Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
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
4#include <QtCore/qpointer.h>
5
8formLayout->addRow(tr("&Name:"), nameLineEdit);
9formLayout->addRow(tr("&Email:"), emailLineEdit);
12
13
16
17nameLabel = new QLabel(tr("&Name:"));
18nameLabel->setBuddy(nameLineEdit);
19
20emailLabel = new QLabel(tr("&Name:"));
21emailLabel->setBuddy(emailLineEdit);
22
23ageLabel = new QLabel(tr("&Name:"));
25
27gridLayout->addWidget(nameLineEdit, 0, 1);
29gridLayout->addWidget(emailLineEdit, 1, 1);
33
34
41
44QPointer<QLineEdit> le = new QLineEdit;
45flay->insertRow(2, "User:", le);
46// later:
47flay->removeRow(2); // le == nullptr at this point
49
51QFormLayout *flay = ...;
52QPointer<QLineEdit> le = new QLineEdit;
53flay->insertRow(2, "User:", le);
54// later:
55flay->removeRow(le); // le == nullptr at this point
57
59QFormLayout *flay = ...;
60QPointer<QVBoxLayout> vbl = new QVBoxLayout;
61flay->insertRow(2, "User:", vbl);
62// later:
63flay->removeRow(layout); // vbl == nullptr at this point
65
67QFormLayout *flay = ...;
68QPointer<QLineEdit> le = new QLineEdit;
69flay->insertRow(2, "User:", le);
70// later:
73
75QFormLayout *flay = ...;
76QPointer<QLineEdit> le = new QLineEdit;
77flay->insertRow(2, "User:", le);
78// later:
81
83QFormLayout *flay = ...;
84QPointer<QVBoxLayout> vbl = new QVBoxLayout;
85flay->insertRow(2, "User:", vbl);
86// 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
The QVBoxLayout class lines up widgets vertically.
Definition qboxlayout.h:91
QOpenGLWidget * widget
[1]
QSpinBox * ageSpinBox
@ AlignTop
Definition qnamespace.h:153
@ AlignHCenter
Definition qnamespace.h:148
@ AlignLeft
Definition qnamespace.h:144
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