Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved How to make QComboBox appear as a popup and not a ... combo box?

    General and Desktop
    3
    6
    1462
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      davecotter last edited by davecotter

      can we make it look like this on windows?

      0_1564701823665_Screen Shot 2019-08-01 at 4.22.53 PM.png

      currently looks like this:

      0_1564701990317_Screen Shot 2019-08-01 at 4.26.00 PM.png

      which i don't think looks as pretty

      jsulm Pl45m4 2 Replies Last reply Reply Quote 0
      • D
        davecotter @Pl45m4 last edited by

        @pl45m4 i think you got the right answer, thanks so much!

        1 Reply Last reply Reply Quote 0
        • jsulm
          jsulm Lifetime Qt Champion @davecotter last edited by

          @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.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply Reply Quote 3
          • Pl45m4
            Pl45m4 @davecotter last edited by

            @davecotter

            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


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            1 Reply Last reply Reply Quote 0
            • D
              davecotter last edited by davecotter

              @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?

              Pl45m4 1 Reply Last reply Reply Quote 0
              • Pl45m4
                Pl45m4 @davecotter last edited by Pl45m4

                @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).

                Promote Custom Widgets

                How to create a new plugin for your Designer, is explained here: Build Custom Widget Plugin
                Then you dont have to promote it anymore.


                If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                ~E. W. Dijkstra

                D 1 Reply Last reply Reply Quote 4
                • D
                  davecotter @Pl45m4 last edited by

                  @pl45m4 i think you got the right answer, thanks so much!

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post