QDialogButtonBox - push buttons' size bug
- 
wrote on 2 Aug 2017, 09:10 last edited by
In a dialog I use, a
QDialogButtonBoxclass 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
QDialogButtonBoxclass objects.Same thing happens when I use
QMessageBox::questionfunction 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!
 - 
In a dialog I use, a
QDialogButtonBoxclass 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
QDialogButtonBoxclass objects.Same thing happens when I use
QMessageBox::questionfunction 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!
wrote on 2 Aug 2017, 09:52 last edited byHi and welcome to devnet forum
Both dialogs are shown through apps on the same OS?
Otherwise please indicate the respective OS used.
 - 
Hi and welcome to devnet forum
Both dialogs are shown through apps on the same OS?
Otherwise please indicate the respective OS used.
wrote on 2 Aug 2017, 11:35 last edited by@koahnig Hi!
Yes, indeed, Windows OS in both cases.
 - 
@koahnig Hi!
Yes, indeed, Windows OS in both cases.
wrote on 2 Aug 2017, 13:11 last edited byAssuming 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
QDialogButtonBoxclass 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?
 - 
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
QDialogButtonBoxclass 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?
wrote on 2 Aug 2017, 14:52 last edited byI 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::questionhas the same issue, and in this case, there's no Qt Designer Mode usage, of course.Thanks!
 - 
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::questionhas the same issue, and in this case, there's no Qt Designer Mode usage, of course.Thanks!
wrote on 2 Aug 2017, 16:30 last edited by koahnig 8 Feb 2017, 16:31@marko.lainovic said in QDialogButtonBox - push buttons' size bug:
Putting button boxes in/out of layouts doesn't help.
Also, usage of
QMessageBox::questionhas 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.
 - 
@marko.lainovic said in QDialogButtonBox - push buttons' size bug:
Putting button boxes in/out of layouts doesn't help.
Also, usage of
QMessageBox::questionhas 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.
wrote on 3 Aug 2017, 09:03 last edited by marko.lainovic 8 Mar 2017, 09:04Here you go:
Windows 10 Home 64bit
Version: 1607
OS Build: 14393.1480
Qt version 5.7.1 (MSVC 2015, 32bit)
Qt Creator 4.2.0Thanks for reaching out!
 - 
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::questionhas the same issue, and in this case, there's no Qt Designer Mode usage, of course.Thanks!
@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.
 - 
@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.
wrote on 3 Aug 2017, 09:35 last edited by marko.lainovic 8 Mar 2017, 09:36Thanks very much, but I'm not getting it...
I haven't specified anything. This is what Qt designer shows for the
QDialogButtonBoxobject (image below):As you can see, I made it on purpose to be like this; I dragged it out, there is no layout for the
QDialogButtonBoxobject, etc...However, the "bug" is still there (image below):
 - 
Thanks very much, but I'm not getting it...
I haven't specified anything. This is what Qt designer shows for the
QDialogButtonBoxobject (image below):
As you can see, I made it on purpose to be like this; I dragged it out, there is no layout for the
QDialogButtonBoxobject, etc...However, the "bug" is still there (image below):

@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
pointDialoga Layout maybe that will give it a change!?. - 
@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
pointDialoga Layout maybe that will give it a change!?.wrote on 3 Aug 2017, 09:55 last edited by marko.lainovic 8 Mar 2017, 09:55Unfortunately, it doesn't :)
This is the actual look of the
PointDialogobject:Vertical layout is applied to the
QDialogobject. I've tried other layouts, too.The end result:
 - 
Unfortunately, it doesn't :)
This is the actual look of the
PointDialogobject:
Vertical layout is applied to the
QDialogobject. I've tried other layouts, too.The end result:
wrote on 3 Aug 2017, 16:06 last edited byCan 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. - 
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.wrote on 4 Aug 2017, 09:45 last edited by - 
wrote on 4 Aug 2017, 10:11 last edited by
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?
 - 
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?
wrote on 8 Aug 2017, 12:22 last edited by marko.lainovic 8 Aug 2017, 12:33Hi!
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::questioncall withQMessageBoxobject on stack.. - Setting minumum size for the buttons in the 
QDialogButtonBoxobject in the code. 
I've been setting stylesheets just a couple of times in the code, but it has nothing to do with
QPushButtonorQDialogButtonBoxobjects... mainly background colors forQMenuobjects and similar...If I figure out what was the issue, I'll be sure to post it here!
 - Replacing 
 - 
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::questioncall withQMessageBoxobject on stack.. - Setting minumum size for the buttons in the 
QDialogButtonBoxobject in the code. 
I've been setting stylesheets just a couple of times in the code, but it has nothing to do with
QPushButtonorQDialogButtonBoxobjects... mainly background colors forQMenuobjects and similar...If I figure out what was the issue, I'll be sure to post it here!
wrote on 25 May 2018, 17:54 last edited byHi,
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.
 - Replacing 
 - 
wrote on 18 Jun 2021, 09:54 last edited by
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; }