How to make QComboBox appear as a popup and not a ... combo box?
-
can we make it look like this on windows?
currently looks like this:
which i don't think looks as pretty
-
@davecotter said in How to make QComboBox appear as a popup and not a ... combo box?:
which i don't think looks as pretty
But this is how combo boxes look like on Windows. Changing this would let your application go against Windows design.
-
You could replace your comboBox with a custom Widget (Button subclass?), which opens some sort of QMenu (e.g. Context Menu). Your items inside are going to be (checkable) QActions then
-
@Pl45m4 i want to be able to use UI Designer in my dialogs to create these widgets. the only available widget is QComboBox, and there's no style flag to say "make it look like a popup". how could i accomplish this?
@jsulm i WANT to use a popup, which is ALSO used on windows and looks much better than a combo box (see my first screen shot). but there is no popup widget in UI Designer, that i can find?
-
@davecotter said in How to make QComboBox appear as a popup and not a ... combo box?:
there's no style flag to say "make it look like a popup"
Yes, that's correct :)
In Designer (with Designer only) it's not possible. But you can create a custom Widget with that behavior and promote it to Qt Designer.
@davecotter said in How to make QComboBox appear as a popup and not a ... combo box?:
but there is no popup widget in UI Designer, that i can find?
Your "popup"-Widget from your first picture looks like a QContextMenu-Popup, which is shown (if enabled), when you right-click something.
I would give it a try.
Edit:
Once you've finished the custom widget, you can use it everywhere (as promoted widget, presented by some standard class in Qt Designer).How to create a new plugin for your Designer, is explained here: Build Custom Widget Plugin
Then you dont have to promote it anymore.