Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to make QComboBox appear as a popup and not a ... combo box?
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.9k Views
  • 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 Offline
    D Offline
    davecotter
    wrote on last edited by davecotter
    #1

    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

    jsulmJ Pl45m4P 2 Replies Last reply
    0
    • Pl45m4P 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.

      D Offline
      D Offline
      davecotter
      wrote on last edited by
      #6

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

      1 Reply Last reply
      0
      • D 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

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @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
        3
        • D 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

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #3

          @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
          0
          • D Offline
            D Offline
            davecotter
            wrote on last edited by davecotter
            #4

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

            Pl45m4P 1 Reply Last reply
            0
            • D 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?

              Pl45m4P Offline
              Pl45m4P Offline
              Pl45m4
              wrote on last edited by Pl45m4
              #5

              @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
              4
              • Pl45m4P 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.

                D Offline
                D Offline
                davecotter
                wrote on last edited by
                #6

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

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved