QComboBox
-
Hi,
I am using a QComboBox and when the current index is -1 and it's editable, the popup / dropdown works normally : when I open it, it remains open until an item is selected or it loses focus. But when an item is selected (index ≠ -1) and the combo is not editable, the popup / dropdown remains open only if I hold the mouse button.
Does anybody know how to change that ?
-
Hi,
I am using a QComboBox and when the current index is -1 and it's editable, the popup / dropdown works normally : when I open it, it remains open until an item is selected or it loses focus. But when an item is selected (index ≠ -1) and the combo is not editable, the popup / dropdown remains open only if I hold the mouse button.
Does anybody know how to change that ?
-
@jsulm
I want the popup to close only after an item is selected (clicked).
Currently, when the index ≠ -1 and I open the popup, it closes when I release the mouse button (and haven't selected an item yet) -
-
@jsulm I use Qt 6 on Ubuntu / Linux.
There are a lot of items in my combo and I use it via subclassing. I also modified its original behavior by connecting its signal currentIndexChanged to a slot that sets the index to -1 if the currentIndex is 0. -
@jsulm
I think I understood what's happening.
As I said, my QComboBox has a lot of items and because of this, the popup position is shifted when I click on the field to open it and the mouse cursor falls within the area of the popup and when I release the mouse button, Qt thinks I selected an item and closes the popup.
-