February 2019
Beginner
136 pages
3h 7m
English
For those instances when you simply need to place a number of widgets together in a two-column layout, the QFormLayout is useful. You may choose to construct a form using QGridLayout, but for form presentation, QFormLayout is most suited.
Take, for instance, the following code. It illustrates a form that has labels in the first column and the actual control for taking user input in the second column:
#include <QApplication>#include <QFormLayout>#include <QPushButton>#include <QLineEdit>#include <QSpinBox>#include <QComboBox>#include <QStringList>int main(int argc, char *argv[]){ QApplication app(argc, argv); QWidget *window = new QWidget; QLineEdit *firstNameLineEdit= new QLineEdit; QLineEdit *lastNameLineEdit= new QLineEdit; ...Read now
Unlock full access