Results 1 to 2 of 2

Thread: QDialogButtonBox buttons size

  1. #1
    Join Date
    Nov 2009
    Qt products

    Default QDialogButtonBox buttons size

    In my program i am dinamically inserting buttons into a QDialogButtonBox, but i want them to be really big.
    No matter what i try to do, they are always standard size.
    can someone point me to a correct stylesheet or anything to achive that?

    right now i'm inserting new buttons like that:
    Qt Code:
    1. ui->buttonBox->addButton("OK", QDialogButtonBox::AcceptRole);
    2. ui->buttonBox->addButton("Yes", QDialogButtonBox::YesRole);
    3. ui->buttonBox->addButton("No", QDialogButtonBox::NoRole);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2011
    Hyderabad, India
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    MacOS X Unix/X11 Windows
    Wiki edits

    Default Re: QDialogButtonBox buttons size

    Think again why you want to use QDialogButtonBox, QDialogButtonBox is generally used for platform specific look and feel, if you change the buttons layout / sizes, the basic purpose of platform specific is lost. I would recommend to have you own custom QDialog, and add buttons to it.

    Ok, as far as QDialogButtonBox is concerned, it has its own size constrains (as is a QWidget by itself). So you need to set the size of ButtonBox first and then set size all the child buttons in it, something like this

    Qt Code:
    1. buttonBox->setMinimumHeight(100);
    2. QList<QAbstractButton *> buttons = buttonBox->buttons();
    3. while(buttons.size())
    4. buttons.takeFirst()->setMinimumHeight(buttonBox->minimumHeight());
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QDialogButtonBox ResetRole
    By mero in forum Qt Programming
    Replies: 5
    Last Post: 10th May 2011, 10:58
  2. QSpinBox buttons size
    By bcastalia in forum Qt Programming
    Replies: 0
    Last Post: 24th March 2011, 04:49
  3. Replies: 1
    Last Post: 8th January 2010, 11:45
  4. Increase the size of radio buttons
    By arunvv in forum Qt Programming
    Replies: 7
    Last Post: 24th January 2009, 00:09
  5. a QDialogButtonBox question
    By bnilsson in forum Qt Programming
    Replies: 3
    Last Post: 16th July 2008, 22:42


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.