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!


  • Moderators

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



  • @koahnig Hi!

    Yes, indeed, Windows OS in both cases.


  • Moderators

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



  • @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!


  • Moderators

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



  • @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!



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



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



  • @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!?.



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


  • Moderators

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



  • @koahnig

    Unfortunately, it's not easy to replicate :D

    I will try though and post it here!


  • Moderators

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



  • @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!



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.