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.