Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
src_gui_kernel_qformlayout.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
6formLayout->addRow(tr("&Name:"), nameLineEdit);
7formLayout->addRow(tr("&Email:"), emailLineEdit);
10
11
14
15nameLabel = new QLabel(tr("&Name:"));
16nameLabel->setBuddy(nameLineEdit);
17
18emailLabel = new QLabel(tr("&Name:"));
19emailLabel->setBuddy(emailLineEdit);
20
21ageLabel = new QLabel(tr("&Name:"));
23
25gridLayout->addWidget(nameLineEdit, 0, 1);
27gridLayout->addWidget(emailLineEdit, 1, 1);
31
32
39
43flay->insertRow(2, "User:", le);
44// later:
45flay->removeRow(2); // le == nullptr at this point
47
49QFormLayout *flay = ...;
51flay->insertRow(2, "User:", le);
52// later:
53flay->removeRow(le); // le == nullptr at this point
55
57QFormLayout *flay = ...;
59flay->insertRow(2, "User:", vbl);
60// later:
61flay->removeRow(layout); // vbl == nullptr at this point
63
65QFormLayout *flay = ...;
67flay->insertRow(2, "User:", le);
68// later:
71
73QFormLayout *flay = ...;
75flay->insertRow(2, "User:", le);
76// later:
79
81QFormLayout *flay = ...;
83flay->insertRow(2, "User:", vbl);
84// later:
The QFormLayout class manages forms of input widgets and their associated labels.
Definition qformlayout.h:18
TakeRowResult takeRow(int row)
void setRowWrapPolicy(RowWrapPolicy policy)
void setFieldGrowthPolicy(FieldGrowthPolicy policy)
void setFormAlignment(Qt::Alignment alignment)
void insertRow(int row, QWidget *label, QWidget *field)
Inserts a new row at position row in this form layout, with the given label and field.
void addRow(QWidget *label, QWidget *field)
Adds a new row to the bottom of this form layout, with the given label and field.
void setLabelAlignment(Qt::Alignment alignment)
void removeRow(int row)
@ FieldsStayAtSizeHint
Definition qformlayout.h:34
The QGridLayout class lays out widgets in a grid.
Definition qgridlayout.h:21
void addWidget(QWidget *w)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qgridlayout.h:64
The QLabel widget provides a text or image display.
Definition qlabel.h:20
The QLineEdit widget is a one-line text editor.
Definition qlineedit.h:28
\inmodule QtCore
Definition qpointer.h:18
The QVBoxLayout class lines up widgets vertically.
Definition qboxlayout.h:91
QOpenGLWidget * widget
[1]
QSpinBox * ageSpinBox
@ AlignTop
Definition qnamespace.h:152
@ AlignHCenter
Definition qnamespace.h:147
@ AlignLeft
Definition qnamespace.h:143
GLuint64EXT * result
[6]
#define tr(X)
QVBoxLayout * layout
QFormLayout * formLayout
[0]
QPointer< QVBoxLayout > vbl
QFormLayout * flay
[2]
QGridLayout * gridLayout
[0]
QPointer< QLineEdit > le
Contains the result of a QFormLayout::takeRow() call.
Definition qformlayout.h:54