Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-10246

Buttons on QMessageBox not sized correctly if style sheet with min-width is applied.

    XMLWordPrintable

Details

    Description

      The width of QPushButtons on a QMessageBox will not size large enough if a style sheet with 'min-width' is applied. The expectation is that the push buttons will be no smaller than min-width but should be able to expand to a large size.

      See code:

      #include <QtGui/QApplication>
      #include <QMessageBox>

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);
      QMessageBox optionDialog(QMessageBox::Question, "Test Dialog", "Please Select an Option", QMessageBox::NoButton);
      optionDialog.setStyleSheet("QPushButton

      {min-width:50;}

      "); //<-- Dialog will size correctly if this line is commented out
      optionDialog.addButton("Test", QMessageBox::AcceptRole);
      optionDialog.addButton("Test a very longgggg text", QMessageBox::AcceptRole);

      return optionDialog.exec();
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            timthrelkeld Tim Threlkeld
            Votes:
            7 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes