CopperSpice API  1.9.2
QFormLayout Class Reference

The QFormLayout class manages forms of input widgets and their associated labels. More...

Inheritance diagram for QFormLayout:
QLayout QObject QLayoutItem

Public Types

enum  FieldGrowthPolicy
 
enum  ItemRole
 
enum  RowWrapPolicy
 
- Public Types inherited from QLayout
enum  SizeConstraint
 

Public Methods

 QFormLayout (QWidget *parent=nullptr)
 
 ~QFormLayout ()
 
void addItem (QLayoutItem *item) override
 
void addRow (const QString &labelText, QLayout *field)
 
void addRow (const QString &labelText, QWidget *field)
 
void addRow (QLayout *layout)
 
void addRow (QWidget *label, QLayout *field)
 
void addRow (QWidget *label, QWidget *field)
 
void addRow (QWidget *widget)
 
int count () const override
 
Qt::Orientations expandingDirections () const override
 
FieldGrowthPolicy fieldGrowthPolicy () const
 
Qt::Alignment formAlignment () const
 
void getItemPosition (int index, int *rowPtr, ItemRole *rolePtr) const
 
void getLayoutPosition (QLayout *layout, int *rowPtr, ItemRole *rolePtr) const
 
void getWidgetPosition (QWidget *widget, int *rowPtr, ItemRole *rolePtr) const
 
bool hasHeightForWidth () const override
 
int heightForWidth (int width) const override
 
int horizontalSpacing () const
 
void insertRow (int row, const QString &labelText, QLayout *field)
 
void insertRow (int row, const QString &labelText, QWidget *field)
 
void insertRow (int row, QLayout *layout)
 
void insertRow (int row, QWidget *label, QLayout *field)
 
void insertRow (int row, QWidget *label, QWidget *field)
 
void insertRow (int row, QWidget *widget)
 
void invalidate () override
 
QLayoutItemitemAt (int index) const override
 
QLayoutItemitemAt (int row, ItemRole role) const
 
Qt::Alignment labelAlignment () const
 
QWidgetlabelForField (QLayout *field) const
 
QWidgetlabelForField (QWidget *field) const
 
QSize minimumSize () const override
 
int rowCount () const
 
RowWrapPolicy rowWrapPolicy () const
 
void setFieldGrowthPolicy (FieldGrowthPolicy policy)
 
void setFormAlignment (Qt::Alignment alignment)
 
void setGeometry (const QRect &rect) override
 
void setHorizontalSpacing (int spacing)
 
void setItem (int row, ItemRole role, QLayoutItem *item)
 
void setLabelAlignment (Qt::Alignment alignment)
 
void setLayout (int row, ItemRole role, QLayout *layout)
 
void setRowWrapPolicy (RowWrapPolicy policy)
 
void setSpacing (int spacing)
 
void setVerticalSpacing (int spacing)
 
void setWidget (int row, ItemRole role, QWidget *widget)
 
QSize sizeHint () const override
 
int spacing () const
 
QLayoutItemtakeAt (int index) override
 
int verticalSpacing () const
 
- Public Methods inherited from QLayout
 QLayout ()
 
 QLayout (QWidget *parent)
 
bool activate ()
 
void addWidget (QWidget *w)
 
QMargins contentsMargins () const
 
QRect contentsRect () const
 
QSizePolicy::ControlTypes controlTypes () const override
 
Qt::Orientations expandingDirections () const override
 
QRect geometry () const override
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 
virtual int indexOf (QWidget *widget) const
 
void invalidate () override
 
bool isEmpty () const override
 
bool isEnabled () const
 
QLayout * layout () override
 
int margin () const
 
QSize maximumSize () const override
 
QWidgetmenuBar () const
 
QSize minimumSize () const override
 
QWidgetparentWidget () const
 
void removeItem (QLayoutItem *item)
 
void removeWidget (QWidget *widget)
 
virtual QLayoutItemreplaceWidget (QWidget *from, QWidget *to, Qt::FindChildOptions options=Qt::FindChildrenRecursively)
 
bool setAlignment (QLayout *layout, Qt::Alignment alignment)
 
void setAlignment (Qt::Alignment alignment)
 
bool setAlignment (QWidget *widget, Qt::Alignment alignment)
 
void setContentsMargins (const QMargins &margins)
 
void setContentsMargins (int left, int top, int right, int bottom)
 
void setEnabled (bool enable)
 
void setGeometry (const QRect &rect) override
 
void setMargin (int margin)
 
void setMenuBar (QWidget *widget)
 
void setSizeConstraint (SizeConstraint constraint)
 
void setSpacing (int spacing)
 
SizeConstraint sizeConstraint () const
 
int spacing () const
 
void update ()
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 
- Public Methods inherited from QLayoutItem
 QLayoutItem (Qt::Alignment alignment=Qt::Alignment ())
 
virtual ~QLayoutItem ()
 
Qt::Alignment alignment () const
 
virtual int minimumHeightForWidth (int width) const
 
void setAlignment (Qt::Alignment alignment)
 
virtual QSpacerItemspacerItem ()
 
virtual QWidgetwidget ()
 

Properties

 fieldGrowthPolicy
 
 formAlignment
 
 horizontalSpacing
 
 labelAlignment
 
 rowWrapPolicy
 
 verticalSpacing
 
- Properties inherited from QLayout
 margin
 
 sizeConstraint
 
 spacing
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 
- Public Slots inherited from QObject
void deleteLater ()
 
- Static Public Methods inherited from QLayout
static QSize closestAcceptableSize (const QWidget *widget, const QSize &size)
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Protected Methods inherited from QLayout
void addChildLayout (QLayout *layout)
 
void addChildWidget (QWidget *widget)
 
QRect alignmentRect (const QRect &rect) const
 
void childEvent (QChildEvent *event) override
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

The QFormLayout class manages two column forms of input widgets and their associated labels. The left column is usually the label control and the right column is a widget like a text line editor, spin box or combo box.

Using a QFormLayout has the following advantages over using a QGridLayout.

  • Uses the platform look and feel. For example, Mac OS X and KDE guidelines specify the labels should be right aligned. While Windows and GNOME applications normally use left alignment.
  • For devices with small displays, QFormLayout can be set to wrap long rows or even to wrap all rows.
  • Convenient API for creating label field pairs.

Appearance

The table below shows the default appearance in different styles.

QCommonStyle Derived StylesQMacStyleQFusionStyleExtended Styles
Traditional style used for Windows, GNOME, and earlier versions of KDE. Labels are left aligned, and expanding fields grow to fill the available space.Style based on the Mac OS X Aqua guidelines. Labels are right-aligned, the fields do not grow beyond their size hint, and the form is horizontally centered.Recommended style for KDE applications. Similar to MacStyle, except that the form is left-aligned and all fields grow to fill the available space.Default style for CopperSpice Extended styles. Labels are right-aligned, expanding fields grow to fill the available space, and row wrapping is enabled for long lines.

The styles can be overridden by calling setLabelAlignment(), setFormAlignment(), setFieldGrowthPolicy(), and setRowWrapPolicy(). For example, to simulate the form layout appearance of QMacStyle use the following code.

formLayout->setRowWrapPolicy(QFormLayout::DontWrapRows);
formLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
formLayout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
formLayout->setLabelAlignment(Qt::AlignRight);

Example

Here is an example using QGridLayout.

// nameLineEdit, mailLineEdit, ageSpinBox widgets already constructed
nameLabel = new QLabel(tr("&Name:"));
nameLabel->setBuddy(nameLineEdit);
emailLabel = new QLabel(tr("&Email address:"));
emailLabel->setBuddy(emailLineEdit);
ageLabel = new QLabel(tr("&Age:"));
ageLabel->setBuddy(ageSpinBox);
QGridLayout *gridLayout = new QGridLayout;
gridLayout->addWidget(nameLabel, 0, 0);
gridLayout->addWidget(nameLineEdit, 0, 1);
gridLayout->addWidget(emailLabel, 1, 0);
gridLayout->addWidget(emailLineEdit, 1, 1);
gridLayout->addWidget(ageLabel, 2, 0);
gridLayout->addWidget(ageSpinBox, 2, 1);
setLayout(gridLayout);

The following code uses QGridLayout and will produce a very similar output.

// nameLineEdit, mailLineEdit, ageSpinBox widgets already constructed
QFormLayout *formLayout = new QFormLayout;
formLayout->addRow(tr("&Name:"), nameLineEdit);
formLayout->addRow(tr("&Email address:"), emailLineEdit);
formLayout->addRow(tr("&Age:"), ageSpinBox);
setLayout(formLayout);
See also
QGridLayout, QBoxLayout, QStackedLayout

Member Enumeration Documentation

This enum specifies the different policies that can be used to control the way in which the form's fields grow.

ConstantValueDescription
QFormLayout::FieldsStayAtSizeHint 0 The fields never grow beyond their effective size hint. This is the default for QMacStyle.
QFormLayout::ExpandingFieldsGrow 1 Fields with an horizontal size policy of Expanding or MinimumExpanding will grow to fill the available space. The other fields will not grow beyond their effective size hint. This is the default policy for Fusion.
QFormLayout::AllNonFixedFieldsGrow2 All fields with a size policy that allows them to grow will grow to fill the available space. This is the default policy for most styles.
See also
fieldGrowthPolicy

This enum specifies the types of widgets (or other layout items) that may appear in a row.

ConstantValueDescription
QFormLayout::LabelRole0 Label widget.
QFormLayout::FieldRole1 Field widget.
QFormLayout::SpanningRole2 Widget that spans label and field columns.
See also
itemAt(), getItemPosition()

This enum specifies the different policies that can be used to control the way in which the form's rows wrap.

ConstantValueDescription
QFormLayout::DontWrapRows0 Fields are always laid out next to their label. This is the default policy for all styles except Extended styles.
QFormLayout::WrapLongRows1 Labels are given enough horizontal space to fit the widest label, and the rest of the space is given to the fields. If the minimum size of a field pair is wider than the available space, the field is wrapped to the next line. This is the default policy for Extended styles.
QFormLayout::WrapAllRows2 Fields are always laid out below their label.
See also
rowWrapPolicy

Constructor & Destructor Documentation

QFormLayout::QFormLayout ( QWidget parent = nullptr)
explicit

Constructs a new form layout with the given parent widget.

See also
QWidget::setLayout()
QFormLayout::~QFormLayout ( )

Destroys the form layout.

Method Documentation

void QFormLayout::addItem ( QLayoutItem item)
overridevirtual

Implements QLayout::addItem()

void QFormLayout::addRow ( const QString labelText,
QLayout field 
)

Creates a QLabel with labelText as the text.

void QFormLayout::addRow ( const QString labelText,
QWidget field 
)

Creates a QLabel with labelText as the text. The field is set as the new QLabel's buddy.

void QFormLayout::addRow ( QLayout layout)

Adds the specified layout at the end of this form layout. The layout spans both columns.

void QFormLayout::addRow ( QWidget label,
QLayout field 
)

Adds a row using the given label as the label. The field is set as the new QLabel's buddy.

void QFormLayout::addRow ( QWidget label,
QWidget field 
)

Adds a new row to the bottom of this form layout with the given label. The field is set as the new QLabel's buddy.

See also
insertRow()
void QFormLayout::addRow ( QWidget widget)

Adds the specified widget at the end of this form layout. The widget spans both columns.

int QFormLayout::count ( ) const
overridevirtual

Implements QLayout::count()

Qt::Orientations QFormLayout::expandingDirections ( ) const
overridevirtual
FieldGrowthPolicy QFormLayout::fieldGrowthPolicy ( ) const

Returns the value of the property.

Qt::Alignment QFormLayout::formAlignment ( ) const

Returns the value of the property.

void QFormLayout::getItemPosition ( int  index,
int *  rowPtr,
ItemRole rolePtr 
) const

Retrieves the row and role (column) of the item at the specified index. If index is out of bounds rowPtr is set to -1, otherwise the row is stored in rowPtr and the role is stored in rolePtr.

See also
itemAt(), count(), getLayoutPosition(), getWidgetPosition()
void QFormLayout::getLayoutPosition ( QLayout layout,
int *  rowPtr,
ItemRole rolePtr 
) const

Retrieves the row and role (column) of the specified child layout. If layout is not in the form layout rowPtr is set to -1, otherwise the row is stored in rowPtr and the role is stored in rolePtr.

void QFormLayout::getWidgetPosition ( QWidget widget,
int *  rowPtr,
ItemRole rolePtr 
) const

Retrieves the row and role (column) of the specified widget in the layout. If widget is not in the layout rowPtr is set to -1, otherwise the row is stored in rowPtr and the role is stored in rolePtr.

See also
getItemPosition(), itemAt()
bool QFormLayout::hasHeightForWidth ( ) const
overridevirtual
int QFormLayout::heightForWidth ( int  width) const
overridevirtual

Reimplemented from QLayoutItem::heightForWidth()

int QFormLayout::horizontalSpacing ( ) const

Returns the value of the property.

void QFormLayout::insertRow ( int  row,
const QString labelText,
QLayout field 
)

Creates a QLabel with labelText as its text.

void QFormLayout::insertRow ( int  row,
const QString labelText,
QWidget field 
)

Creates a QLabel with labelText as its text. The field is set as the new QLabel's buddy.

void QFormLayout::insertRow ( int  row,
QLayout layout 
)

Inserts the specified layout at position row in this form layout. The layout spans both columns. If row is out of bounds, the widget is added at the end.

void QFormLayout::insertRow ( int  row,
QWidget label,
QLayout field 
)

Inserts a new row at position row using label as the label. The field is set as the label's buddy.

void QFormLayout::insertRow ( int  row,
QWidget label,
QWidget field 
)

Inserts a new row at position row in this form layout, with the given label and field. If row is out of bounds, the new row is added at the end.

See also
addRow()
void QFormLayout::insertRow ( int  row,
QWidget widget 
)

Inserts the specified widget at position row in this form layout. The widget spans both columns. If row is out of bounds, the widget is added at the end.

void QFormLayout::invalidate ( )
overridevirtual

Reimplemented from QLayoutItem::invalidate()

QLayoutItem * QFormLayout::itemAt ( int  index) const
overridevirtual

Implements QLayout::itemAt()

QLayoutItem * QFormLayout::itemAt ( int  row,
ItemRole  role 
) const

Returns the layout item in the given row with the specified role (column). Returns nullptr if there is no such item.

See also
QLayout::itemAt(), setItem()
Qt::Alignment QFormLayout::labelAlignment ( ) const

Returns the value of the property.

QWidget * QFormLayout::labelForField ( QLayout field) const

Returns the label associated with the given field.

QWidget * QFormLayout::labelForField ( QWidget field) const

Returns the label associated with the given field.

See also
itemAt()
QSize QFormLayout::minimumSize ( ) const
overridevirtual
int QFormLayout::rowCount ( ) const

Returns the number of rows in the form.

See also
QLayout::count()
RowWrapPolicy QFormLayout::rowWrapPolicy ( ) const

Returns the value of the property.

void QFormLayout::setFieldGrowthPolicy ( FieldGrowthPolicy  policy)

Sets the value of the property to policy.

void QFormLayout::setFormAlignment ( Qt::Alignment  alignment)

Sets the value of the property to alignment.

void QFormLayout::setGeometry ( const QRect rect)
overridevirtual
void QFormLayout::setHorizontalSpacing ( int  spacing)

Sets the value of the property to spacing.

void QFormLayout::setItem ( int  row,
ItemRole  role,
QLayoutItem item 
)

Sets the item in the given row for the given role to item, extending the layout with empty rows if necessary. If the cell is already occupied, the item is not inserted and an error message is sent to the console. The item spans both columns.

Warning
Do not use this method to add child layouts or child widget items. Use setLayout() or setWidget() instead.
See also
setLayout()
void QFormLayout::setLabelAlignment ( Qt::Alignment  alignment)

Sets the value of the property to alignment.

void QFormLayout::setLayout ( int  row,
ItemRole  role,
QLayout layout 
)

Sets the sub-layout in the given row for the given role to layout, extending the form layout with empty rows if necessary. If the cell is already occupied, the layout is not inserted and an error message is sent to the console.

Note
For most applications, addRow() or insertRow() should be used instead of setLayout().
See also
setWidget()
void QFormLayout::setRowWrapPolicy ( RowWrapPolicy  policy)

Sets the value of the property to policy.

void QFormLayout::setSpacing ( int  spacing)

This method sets both the vertical and horizontal spacing to spacing.

See also
spacing(), setVerticalSpacing(), setHorizontalSpacing()
void QFormLayout::setVerticalSpacing ( int  spacing)

Sets the value of the property to spacing.

void QFormLayout::setWidget ( int  row,
ItemRole  role,
QWidget widget 
)

Sets the widget in the given row for the given role to widget, extending the layout with empty rows if necessary. If the cell is already occupied, the widget is not inserted and an error message is sent to the console.

Note
For most applications, addRow() or insertRow() should be used instead of setWidget().
See also
setLayout()
QSize QFormLayout::sizeHint ( ) const
overridevirtual
int QFormLayout::spacing ( ) const

If the vertical spacing is equal to the horizontal spacing, this method returns the value, otherwise it returns -1.

See also
setSpacing(), verticalSpacing(), horizontalSpacing()
QLayoutItem * QFormLayout::takeAt ( int  index)
overridevirtual

Implements QLayout::takeAt()

int QFormLayout::verticalSpacing ( ) const

Returns the value of the property.

Property Documentation

QFormLayout::fieldGrowthPolicy

This property holds the way in which the form's fields grow.

The default value depends on the widget or application style. For QMacStyle, the default is FieldsStayAtSizeHint; for QCommonStyle derived styles (like Fusion and Windows), the default is ExpandingFieldsGrow; for CopperSpice Extended styles, the default is AllNonFixedFieldsGrow.

If none of the fields can grow and the form is resized, extra space is distributed according to the current form alignment.

See also
formAlignment, rowWrapPolicy
PropertiesClass Methods
read fieldGrowthPolicy
write setFieldGrowthPolicy
reset resetFieldGrowthPolicy
QFormLayout::formAlignment

This property holds the alignment of the form layout's contents within the layout's geometry. The default value depends on the widget or application style. For QMacStyle, the default is Qt::AlignHCenter | Qt::AlignTop, for the other styles the default is Qt::AlignLeft | Qt::AlignTop.

See also
labelAlignment, rowWrapPolicy
PropertiesClass Methods
read formAlignment
write setFormAlignment
reset resetFormAlignment
QFormLayout::horizontalSpacing

This property holds the spacing between widgets that are laid out side by side. By default, if no value is explicitly set, the layout's horizontal spacing is inherited from the parent layout, or from the style settings for the parent widget.

See also
verticalSpacing, QStyle::pixelMetric(), PM_LayoutHorizontalSpacing
PropertiesClass Methods
read horizontalSpacing
write setHorizontalSpacing
QFormLayout::labelAlignment

This property holds the horizontal alignment of the labels. The default value depends on the widget or application style. For QCommonStyle derived styles, except for QFusionStyle, the default is Qt::AlignLeft; for the other styles, the default is Qt::AlignRight.

See also
formAlignment
PropertiesClass Methods
read labelAlignment
write setLabelAlignment
reset resetLabelAlignment
QFormLayout::rowWrapPolicy

This property holds the way in which the form's rows wrap.

The default value depends on the widget or application style. For Extended styles the default is WrapLongRows. For the other styles the default is DontWrapRows. If you want to display each label above its associated field (instead of next to it), set this property to WrapAllRows.

See also
fieldGrowthPolicy
PropertiesClass Methods
read rowWrapPolicy
write setRowWrapPolicy
reset resetRowWrapPolicy
QFormLayout::verticalSpacing

This property holds the spacing between widgets that are laid out vertically. By default, if no value is explicitly set, the layout's vertical spacing is inherited from the parent layout, or from the style settings for the parent widget.

See also
horizontalSpacing, QStyle::pixelMetric(), PM_LayoutHorizontalSpacing
PropertiesClass Methods
read verticalSpacing
write setVerticalSpacing