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

The push button breaks form layout on MacOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 5.3.0, 5.12.0 Beta 4
    • None
    • IDE:
      Qt Creator 3.1.1 (opensource)
      Based on Qt 5.2.1 (Clang 5.0 (Apple), 64 bit)

      OS: MacOs X 10.9 and 10.10

    Description

      If to create form with custom panel with button, the spacing between rows becomes broken (see code below). To fix this I found, that need to set attribute WA_LayoutUsesWidgetRect for problem widget (QTBUG-2699). But this solution don't have effect. Form stays broken.

      Here the sample code:

          QFormLayout* formLayout = new QFormLayout;
          formLayout->setFieldGrowthPolicy( QFormLayout::AllNonFixedFieldsGrow );
          setLayout( formLayout );
      
          QWidget* panel = new QWidget;
          QHBoxLayout* hl = new QHBoxLayout;
          QPushButton* btn = new QPushButton( "test" );
          btn->setAttribute( Qt::WA_LayoutUsesWidgetRect );
      
          hl->addWidget( new QLineEdit );
          hl->addWidget( btn );
      
          hl->setContentsMargins( 0, 0, 0, 0 );
          panel->setContentsMargins( 0, 0, 0, 0 );
          panel->setLayout( hl );
      
          formLayout->insertRow( 0, "L1", new QLineEdit  );
          formLayout->insertRow( 1, "L2", panel  );
          formLayout->insertRow( 2, "L3", new QLineEdit  );
          formLayout->insertRow( 2, "L4", new QLineEdit  );
      

      The snapshot of the form is attached.

      Attachments

        1. qt_form_512.png
          qt_form_512.png
          25 kB
        2. qt_form.png
          qt_form.png
          20 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpochep Timur Pocheptsov
            yura-vel Yuriy
            Votes:
            6 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes