Unsolved QDialogButtonBox - push buttons' size bug
-
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!
-
Hi and welcome to devnet forum
Both dialogs are shown through apps on the same OS?
Otherwise please indicate the respective OS used.
-
@koahnig Hi!
Yes, indeed, Windows OS in both cases.
-
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?
-
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!
-
@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.
-
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.0Thanks for reaching out!
-
@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.
-
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):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):
-
@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!?. -
Unfortunately, it doesn't :)
This is the actual look of the
PointDialog
object:Vertical layout is applied to the
QDialog
object. I've tried other layouts, too.The end result:
-
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. -
-
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?
-
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 withQMessageBox
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
orQDialogButtonBox
objects... mainly background colors forQMenu
objects and similar...If I figure out what was the issue, I'll be sure to post it here!
- Replacing
-
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.
-
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; }