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. QDialogButtonBox - push buttons' size bug
Servers for Qt installer are currently down

QDialogButtonBox - push buttons' size bug

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 5 Posters 6.3k Views 2 Watching
  • 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.
  • M Offline
    M Offline
    marko.lainovic
    wrote on 2 Aug 2017, 09:10 last edited by
    #1

    In a dialog I use, a QDialogButtonBox class object has its buttons' sizes minimized, as in image below:

    While in other dialogues, it looks normal, as in image below:

    Both dialogues were made through Qt Designer Mode, with no additional code from my part concerning these QDialogButtonBox class objects.

    Same thing happens when I use QMessageBox::question function to create the dialogue, just like the first image.

    I want my buttons to be normal size, not so tiny like in the first image.
    Any ideas?

    Thanks!

    K 1 Reply Last reply 2 Aug 2017, 09:52
    0
    • M marko.lainovic
      2 Aug 2017, 09:10

      In a dialog I use, a QDialogButtonBox class object has its buttons' sizes minimized, as in image below:

      While in other dialogues, it looks normal, as in image below:

      Both dialogues were made through Qt Designer Mode, with no additional code from my part concerning these QDialogButtonBox class objects.

      Same thing happens when I use QMessageBox::question function to create the dialogue, just like the first image.

      I want my buttons to be normal size, not so tiny like in the first image.
      Any ideas?

      Thanks!

      K Offline
      K Offline
      koahnig
      wrote on 2 Aug 2017, 09:52 last edited by
      #2

      @marko.lainovic

      Hi and welcome to devnet forum

      Both dialogs are shown through apps on the same OS?

      Otherwise please indicate the respective OS used.

      Vote the answer(s) that helped you to solve your issue(s)

      M 1 Reply Last reply 2 Aug 2017, 11:35
      1
      • K koahnig
        2 Aug 2017, 09:52

        @marko.lainovic

        Hi and welcome to devnet forum

        Both dialogs are shown through apps on the same OS?

        Otherwise please indicate the respective OS used.

        M Offline
        M Offline
        marko.lainovic
        wrote on 2 Aug 2017, 11:35 last edited by
        #3

        @koahnig Hi!

        Yes, indeed, Windows OS in both cases.

        K 1 Reply Last reply 2 Aug 2017, 13:11
        0
        • M marko.lainovic
          2 Aug 2017, 11:35

          @koahnig Hi!

          Yes, indeed, Windows OS in both cases.

          K Offline
          K Offline
          koahnig
          wrote on 2 Aug 2017, 13:11 last edited by
          #4

          @marko.lainovic

          Assuming that you create those behaviours on the very same machine, what do you mean with:

          @marko.lainovic said in QDialogButtonBox - push buttons' size bug:

          In a dialog I use, a QDialogButtonBox class object has its buttons' sizes minimized, as in image below:

          Did you change the default settings through qt craetor's design mode or somewhere else?

          Vote the answer(s) that helped you to solve your issue(s)

          M 1 Reply Last reply 2 Aug 2017, 14:52
          0
          • K koahnig
            2 Aug 2017, 13:11

            @marko.lainovic

            Assuming that you create those behaviours on the very same machine, what do you mean with:

            @marko.lainovic said in QDialogButtonBox - push buttons' size bug:

            In a dialog I use, a QDialogButtonBox class object has its buttons' sizes minimized, as in image below:

            Did you change the default settings through qt craetor's design mode or somewhere else?

            M Offline
            M Offline
            marko.lainovic
            wrote on 2 Aug 2017, 14:52 last edited by
            #5

            @koahnig

            I haven't changed anything regarding the QDialogButtonBox' objects. There's a code in these dialogs' classes, for sure, but nothing related to those button boxes, and I haven't been changing settings is the Qt Designer Mode; I just used it for inserting widgets.

            Putting button boxes in/out of layouts doesn't help.

            Also, usage of QMessageBox::question has the same issue, and in this case, there's no Qt Designer Mode usage, of course.

            Thanks!

            K J 2 Replies Last reply 2 Aug 2017, 16:30
            0
            • M marko.lainovic
              2 Aug 2017, 14:52

              @koahnig

              I haven't changed anything regarding the QDialogButtonBox' objects. There's a code in these dialogs' classes, for sure, but nothing related to those button boxes, and I haven't been changing settings is the Qt Designer Mode; I just used it for inserting widgets.

              Putting button boxes in/out of layouts doesn't help.

              Also, usage of QMessageBox::question has the same issue, and in this case, there's no Qt Designer Mode usage, of course.

              Thanks!

              K Offline
              K Offline
              koahnig
              wrote on 2 Aug 2017, 16:30 last edited by koahnig 8 Feb 2017, 16:31
              #6

              @marko.lainovic said in QDialogButtonBox - push buttons' size bug:

              Putting button boxes in/out of layouts doesn't help.

              Also, usage of QMessageBox::question has the same issue, and in this case, there's no Qt Designer Mode usage, of course.

              Sounds really strange.

              Please give your actual windows version, the version of Qt libs and your tool chain.

              Vote the answer(s) that helped you to solve your issue(s)

              M 1 Reply Last reply 3 Aug 2017, 09:03
              0
              • K koahnig
                2 Aug 2017, 16:30

                @marko.lainovic said in QDialogButtonBox - push buttons' size bug:

                Putting button boxes in/out of layouts doesn't help.

                Also, usage of QMessageBox::question has the same issue, and in this case, there's no Qt Designer Mode usage, of course.

                Sounds really strange.

                Please give your actual windows version, the version of Qt libs and your tool chain.

                M Offline
                M Offline
                marko.lainovic
                wrote on 3 Aug 2017, 09:03 last edited by marko.lainovic 8 Mar 2017, 09:04
                #7

                @koahnig

                Here you go:

                Windows 10 Home 64bit
                Version: 1607
                OS Build: 14393.1480
                Qt version 5.7.1 (MSVC 2015, 32bit)
                Qt Creator 4.2.0

                Thanks for reaching out!

                1 Reply Last reply
                0
                • M marko.lainovic
                  2 Aug 2017, 14:52

                  @koahnig

                  I haven't changed anything regarding the QDialogButtonBox' objects. There's a code in these dialogs' classes, for sure, but nothing related to those button boxes, and I haven't been changing settings is the Qt Designer Mode; I just used it for inserting widgets.

                  Putting button boxes in/out of layouts doesn't help.

                  Also, usage of QMessageBox::question has the same issue, and in this case, there's no Qt Designer Mode usage, of course.

                  Thanks!

                  J Offline
                  J Offline
                  J.Hilk
                  Moderators
                  wrote on 3 Aug 2017, 09:15 last edited by
                  #8

                  @marko.lainovic seems like normal layout behaviour for me. Do you specify the size of your DialogButtonBox? To be, for example, as small as possible.

                  Try to make the box bigger by using your mouse and 'dragging' the border further appart, the buttons should become bigger than.


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  M 1 Reply Last reply 3 Aug 2017, 09:35
                  0
                  • J J.Hilk
                    3 Aug 2017, 09:15

                    @marko.lainovic seems like normal layout behaviour for me. Do you specify the size of your DialogButtonBox? To be, for example, as small as possible.

                    Try to make the box bigger by using your mouse and 'dragging' the border further appart, the buttons should become bigger than.

                    M Offline
                    M Offline
                    marko.lainovic
                    wrote on 3 Aug 2017, 09:35 last edited by marko.lainovic 8 Mar 2017, 09:36
                    #9

                    @J.Hilk

                    Thanks very much, but I'm not getting it...

                    I haven't specified anything. This is what Qt designer shows for the QDialogButtonBox object (image below):

                    alt text

                    As you can see, I made it on purpose to be like this; I dragged it out, there is no layout for the QDialogButtonBox object, etc...

                    However, the "bug" is still there (image below):

                    alt text

                    J 1 Reply Last reply 3 Aug 2017, 09:42
                    0
                    • M marko.lainovic
                      3 Aug 2017, 09:35

                      @J.Hilk

                      Thanks very much, but I'm not getting it...

                      I haven't specified anything. This is what Qt designer shows for the QDialogButtonBox object (image below):

                      alt text

                      As you can see, I made it on purpose to be like this; I dragged it out, there is no layout for the QDialogButtonBox object, etc...

                      However, the "bug" is still there (image below):

                      alt text

                      J Offline
                      J Offline
                      J.Hilk
                      Moderators
                      wrote on 3 Aug 2017, 09:42 last edited by
                      #10

                      @marko.lainovic
                      ah, now we're a bit closer :-)
                      The DialogButtonBox is bigger than what is drawn in your widget.

                      HOwever, try to give your central widget pointDialog a Layout maybe that will give it a change!?.


                      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                      Q: What's that?
                      A: It's blue light.
                      Q: What does it do?
                      A: It turns blue.

                      M 1 Reply Last reply 3 Aug 2017, 09:55
                      0
                      • J J.Hilk
                        3 Aug 2017, 09:42

                        @marko.lainovic
                        ah, now we're a bit closer :-)
                        The DialogButtonBox is bigger than what is drawn in your widget.

                        HOwever, try to give your central widget pointDialog a Layout maybe that will give it a change!?.

                        M Offline
                        M Offline
                        marko.lainovic
                        wrote on 3 Aug 2017, 09:55 last edited by marko.lainovic 8 Mar 2017, 09:55
                        #11

                        @J.Hilk

                        Unfortunately, it doesn't :)

                        This is the actual look of the PointDialog object:

                        alt text

                        Vertical layout is applied to the QDialog object. I've tried other layouts, too.

                        The end result:

                        alt text

                        K 1 Reply Last reply 3 Aug 2017, 16:06
                        0
                        • M marko.lainovic
                          3 Aug 2017, 09:55

                          @J.Hilk

                          Unfortunately, it doesn't :)

                          This is the actual look of the PointDialog object:

                          alt text

                          Vertical layout is applied to the QDialog object. I've tried other layouts, too.

                          The end result:

                          alt text

                          K Offline
                          K Offline
                          koahnig
                          wrote on 3 Aug 2017, 16:06 last edited by
                          #12

                          @marko.lainovic

                          Can you create a small app showing this?
                          I would suggest a simple application created by creator and add a dialog and check, if it is showing the problem on your machine.
                          Others can cross-check the source on their machine with their installations.

                          Vote the answer(s) that helped you to solve your issue(s)

                          M 1 Reply Last reply 4 Aug 2017, 09:45
                          0
                          • K koahnig
                            3 Aug 2017, 16:06

                            @marko.lainovic

                            Can you create a small app showing this?
                            I would suggest a simple application created by creator and add a dialog and check, if it is showing the problem on your machine.
                            Others can cross-check the source on their machine with their installations.

                            M Offline
                            M Offline
                            marko.lainovic
                            wrote on 4 Aug 2017, 09:45 last edited by
                            #13

                            @koahnig

                            Unfortunately, it's not easy to replicate :D

                            I will try though and post it here!

                            K 1 Reply Last reply 4 Aug 2017, 10:11
                            0
                            • M marko.lainovic
                              4 Aug 2017, 09:45

                              @koahnig

                              Unfortunately, it's not easy to replicate :D

                              I will try though and post it here!

                              K Offline
                              K Offline
                              koahnig
                              wrote on 4 Aug 2017, 10:11 last edited by
                              #14

                              @marko.lainovic

                              When you cannot replicate in another, it is obviously nothing with your installation of Qt.

                              Since you nothing special in design mode of Qt creator and you observe the same behaviour in Qt standard dialogs such as QMessage, the problem is with your application.

                              Did you play around with stylesheets in your application?

                              Vote the answer(s) that helped you to solve your issue(s)

                              M 1 Reply Last reply 8 Aug 2017, 12:22
                              0
                              • K koahnig
                                4 Aug 2017, 10:11

                                @marko.lainovic

                                When you cannot replicate in another, it is obviously nothing with your installation of Qt.

                                Since you nothing special in design mode of Qt creator and you observe the same behaviour in Qt standard dialogs such as QMessage, the problem is with your application.

                                Did you play around with stylesheets in your application?

                                M Offline
                                M Offline
                                marko.lainovic
                                wrote on 8 Aug 2017, 12:22 last edited by marko.lainovic 8 Aug 2017, 12:33
                                #15

                                @koahnig

                                Hi!

                                I tend to agree with you that something is amiss in the application, but I cannot figure out why...

                                I solved this problem by:

                                • Replacing QMessageBox::question call with QMessageBox object on stack..
                                • Setting minumum size for the buttons in the QDialogButtonBox object in the code.

                                I've been setting stylesheets just a couple of times in the code, but it has nothing to do with QPushButton or QDialogButtonBox objects... mainly background colors for QMenu objects and similar...

                                If I figure out what was the issue, I'll be sure to post it here!

                                R 1 Reply Last reply 25 May 2018, 17:54
                                1
                                • M marko.lainovic
                                  8 Aug 2017, 12:22

                                  @koahnig

                                  Hi!

                                  I tend to agree with you that something is amiss in the application, but I cannot figure out why...

                                  I solved this problem by:

                                  • Replacing QMessageBox::question call with QMessageBox object on stack..
                                  • Setting minumum size for the buttons in the QDialogButtonBox object in the code.

                                  I've been setting stylesheets just a couple of times in the code, but it has nothing to do with QPushButton or QDialogButtonBox objects... mainly background colors for QMenu objects and similar...

                                  If I figure out what was the issue, I'll be sure to post it here!

                                  R Offline
                                  R Offline
                                  robertjjoynt
                                  wrote on 25 May 2018, 17:54 last edited by
                                  #16

                                  @marko.lainovic

                                  Hi,

                                  I have a suggestion for this issue. Perhaps the QDialogButtonBox has the following properties set (not at default values) which is causing the bad display: sizePolicy ( 4 properties), minimumSize (2 properties) and maximumSize (2 properties).

                                  These properties will affect the expanding/shrinking of the buttonbox which may be causing the small buttons. These properties can be adjusted in QtDesigner. If they are set (marked in bold) then you could try unsetting them to see if it solves the problem.

                                  1 Reply Last reply
                                  0
                                  • T Offline
                                    T Offline
                                    theworldlock
                                    wrote on 18 Jun 2021, 09:54 last edited by
                                    #17

                                    try using CSS, change attributes according to your need

                                    QDialogButtonBox QPushButton{
                                      color:rgb(0,0,0);
                                      height:80px;
                                      font-size:20px;
                                      padding:10px;
                                      width:100px;
                                      font-weight:bold;
                                      background-color: rgb(237, 212, 0);
                                      border-radius: 8px;
                                    }
                                    
                                    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