Qt World Summit: Submit your Presentation

QComboBox problem: non-editable combobox losses focus and appears editable

  • I have a QComboBox in a custom widget. If I drop down the combo box then click away from it, it appears "editable" (for lack of a better description, it looks like a LineEdit with an arrow button on the right) until I hover over it again (or actually select something in it), then it is redrawn properly in the Windows 7 style (like one wide button with an arrow on the right).

    Is this a QT bug or did I do something wrong in my code that I can't find?

  • Can you show the pece of code where you use your combo ? Do you reimplement edit method of widget class or something else ?

  • I found a solution but I do think its a bug. When I create the combobox, I immediately call setEditable(false), even though its the default (sometimes I set default values just for readability so I know they are set or whatnot, I never thought this would be an issue). I commented out this call and the problem went away. Seems weird that that made such a big difference but the problem was appearing repeatably every single time I'd pull the box down and then click away and as soon as I removed that line, it stopped happening. I meant to repost that as the "solution" but forgot.

Log in to reply