QComboBox with static image



  • Hello,

    The QComboBox will when not in focus show the currently selected item using text and possibly an icon. How can I override this behaviour to show a static image when the ComboBox is not in focus. This is to reduce the space the button takes up. The perfect example is in Windows Explorer, there is a comboBox for View. The ComboBox just contains a simple generic icon but does not say anything about the selected view. Clicking on the button will show the four choices with dot infront of the selected choice.

    How can this be done in Qt?

    Cheers



  • You might want to check out the type of events that Qt can handle. For the given widget you might want to use this one:
    @QEvent::FocusOut 9 Widget loses keyboard focus (QFocusEvent).@
    Then in that event set the value to the one with the icon only to display. Tada, should work
    Greetz


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.