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?

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 1 Aug 2019, 23:23 last edited by davecotter 8 Jan 2019, 23:27
    #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

    J P 2 Replies Last reply 2 Aug 2019, 04:21
    0
    • P Pl45m4
      3 Aug 2019, 00:22

      @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 7 Aug 2019, 23:02 last edited by
      #6

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

      1 Reply Last reply
      0
      • D davecotter
        1 Aug 2019, 23:23

        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

        J Online
        J Online
        jsulm
        Lifetime Qt Champion
        wrote on 2 Aug 2019, 04:21 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
          1 Aug 2019, 23:23

          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

          P Online
          P Online
          Pl45m4
          wrote on 2 Aug 2019, 07:33 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 2 Aug 2019, 22:38 last edited by davecotter 8 Feb 2019, 22:40
            #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?

            P 1 Reply Last reply 3 Aug 2019, 00:22
            0
            • D davecotter
              2 Aug 2019, 22:38

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

              P Online
              P Online
              Pl45m4
              wrote on 3 Aug 2019, 00:22 last edited by Pl45m4 8 Mar 2019, 00:53
              #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 7 Aug 2019, 23:02
              4
              • P Pl45m4
                3 Aug 2019, 00:22

                @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 7 Aug 2019, 23:02 last edited by
                #6

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

                1 Reply Last reply
                0

                6/6

                7 Aug 2019, 23:02

                • Login

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