hbox_stretch1.cpp

来自「开发环境 arm+linux. hbox_stretch是演示布局管理中的伸展」· C++ 代码 · 共 30 行

CPP
30
字号
#include <QApplication>#include <QPushButton>#include <QWidget>#include <QHBoxLayout>int main(int argc, char *argv[]){    QApplication app(argc, argv);    QWidget window;    QPushButton *button1 = new QPushButton("One");    QPushButton *button2 = new QPushButton("Two");    QPushButton *button3 = new QPushButton("Three");    QPushButton *button4 = new QPushButton("Four");    QPushButton *button5 = new QPushButton("Five");    QHBoxLayout *layout = new QHBoxLayout;    layout->addWidget(button1, 5);    layout->addWidget(button2, 5);    layout->addWidget(button3, 5);    layout->addWidget(button4, 5);    layout->addWidget(button5, 5);    window.setLayout(layout);    window.show();    return app.exec();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?