/
Messus
/
Easy
Обзор
Документация
Войти
/
Messus
/
Easy
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Layout/widget.cpp
45 строк
1 KB
Messus
add another folders
22 мар 2025, 17:31
22 мар 2025, 17:31
31cb4bd
Код
Авторство
О чём код?
#include "widget.h" #include <QHBoxLayout> #include <QVBoxLayout> #include <QLabel> #include <QLineEdit> #include <QPushButton> Widget::Widget(QWidget *parent) : QWidget(parent) { QLineEdit *lLineEdit = new QLineEdit("Text 1"); QLabel *lLabel = new QLabel("Line Edit &1"); lLabel -> setBuddy(lLineEdit); QHBoxLayout *lHBoxLayout = new QHBoxLayout; lHBoxLayout -> addWidget(lLabel); lHBoxLayout -> addWidget(lLineEdit); QLineEdit *lLineEdit2 = new QLineEdit("Text 2"); QLabel *lLabel2 = new QLabel("Line Edit &2"); lLabel -> setBuddy(lLineEdit2); QHBoxLayout *lHBoxLayout2 = new QHBoxLayout; lHBoxLayout2 -> addWidget(lLabel2); lHBoxLayout2 -> addWidget(lLineEdit2); QPushButton *lPushButtonOk = new QPushButton("&Ok"); QPushButton *lPushButtonCancel = new QPushButton("&Cancel"); QHBoxLayout *lHBoxLayout3 = new QHBoxLayout; lHBoxLayout3 -> addStretch(); lHBoxLayout3 -> addWidget(lPushButtonOk); lHBoxLayout3 -> addWidget(lPushButtonCancel); QVBoxLayout *lVBoxLayout = new QVBoxLayout; lVBoxLayout -> addLayout(lHBoxLayout); lVBoxLayout -> addLayout(lHBoxLayout2); lVBoxLayout -> addLayout(lHBoxLayout3); setLayout(lVBoxLayout); } Widget::~Widget() { }