Bug 424076

Summary: PlasmaComponents3.ComboBox closes popup on click release when editable=true
Product: [Frameworks and Libraries] libplasma Reporter: Chris Holland <zrenfire>
Component: componentsAssignee: Chris Holland <zrenfire>
Status: RESOLVED FIXED    
Severity: normal CC: nate, plasma-bugs
Priority: NOR    
Version: 5.71.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.76

Description Chris Holland 2020-07-10 18:49:36 UTC
https://invent.kde.org/frameworks/plasma-framework/-/blame/master/src/declarativeimports/plasmacomponents3/ComboBox.qml

One solution is to make `contentItem: T.TextField {}` instead of `MouseArea` wrapping the `TextField`. However this breaks press+drag+select.

Note that if you do press+drag, it spams this:
file:///usr/lib/qt/qml/org/kde/plasma/components.3/ComboBox.qml:112: ReferenceError: controlRoot is not defined

IF we make contentItem: T.TextField, it would also fix another bug: PlasmaComponents3.ComboBox autocomplete doesn't work.

See `QQuickComboBoxPrivate::updateEditText()` to where it casts `contentItem` as `QQuickTextInput`.

https://github.com/qt/qtquickcontrols2/blob/dev/src/quicktemplates2/qquickcombobox.cpp#L426

I've personally patched the ComboBox with:
https://gist.github.com/Zren/99ea7a517ea1e1ca028662aa84543ce8

OS: Manjaro
KDE Plasma Version: 5.19.80 (plasma-git)
KDE Frameworks Version: 5.71 (kf5-git)
Qt Version: 5.15
Comment 1 Nate Graham 2020-07-12 14:34:17 UTC
Can you please submit your patch upstream? Thanks!
Comment 2 Bug Janitor Service 2020-07-14 17:06:18 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/36
Comment 3 Bug Janitor Service 2020-08-16 01:43:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/19
Comment 4 Chris Holland 2020-10-08 13:39:24 UTC
Git commit 086a710478592bc4c93b90c28d4ec88e8ae8b86f by Zren (Chris Holland), on behalf of Chris Holland.
Committed on 08/10/2020 at 13:34.
Pushed by cholland into branch 'master'.

ComboBox3.contentItem must be a QQuickTextInput to fix autocomplete

See QQuickComboBoxPrivate::updateEditText()
https://github.com/qt/qtquickcontrols2/blob/dev/src/quicktemplates2/qquickcombobox.cpp#L426

By removing the MouseArea previously in the contentItem, we lose the
ability to press+hold+drag to select a drop down item.

The wheel events still work, as they are captured by the MouseArea in
the background component.

The combobox previously closed the popup when releasing the click to
open the dropdown when editable=true.

M  +45   -103  src/declarativeimports/plasmacomponents3/ComboBox.qml

https://invent.kde.org/frameworks/plasma-framework/commit/086a710478592bc4c93b90c28d4ec88e8ae8b86f