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

QFormLayout does not calculate width of rows without label properly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Fixed
    • Affects Version/s: 5.8.0
    • Fix Version/s: 5.13.0 Alpha 1
    • Component/s: Widgets: Layout
    • Labels:
      None
    • Platform/s:
      All
    • Commits:
      8c38b08343b226883ef368d31a085b0a620f7995

      Description

      Take a look at the code below:

       

      #include <QtWidgets>
      
      int main(int argc, char** argv)
      {
        QApplication app(argc, argv);
        QWidget w;
        QFormLayout* ll = new QFormLayout(&w);
        ll->setWidget(0, QFormLayout::LabelRole, new QLabel("123245689"));
        ll->setWidget(0, QFormLayout::FieldRole, new QSpinBox);
        ll->setWidget(1, QFormLayout::FieldRole, new QCheckBox("some other text"));
        w.show();
        app.exec();
      }
      

       

      Here is how it looks:

      A simple change in code

      ll->setWidget(0, QFormLayout::LabelRole, new QLabel("123245689"));
      ll->setWidget(0, QFormLayout::FieldRole, new QSpinBox);
      ll->setWidget(1, QFormLayout::LabelRole, new QLabel("123245689"));
      ll->setWidget(1, QFormLayout::FieldRole, new QCheckBox("some other text"));

      will fix it:

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              chehrlic Christian Ehrlicher
              Reporter:
              kicer Michał Walenciak
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes