我有这个布局的问题。我在 .cpp 文件中编写了这个示例:
#include <QApplication>
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget *window = new QWidget;
window -> setWindowTitle("Enter your age please:");
QSpinBox *spinBox = new QSpinBox;
layout -> addWidget(spinBox);
window -> show();
return app.exec();
}
我用这些命令编译:
qmake -project
qmake
make
我收到此错误:
age.cpp: In function ‘int main(int, char**)’:
age.cpp:13:3: error: ‘layout’ was not declared in this scope
make: *** [age.o] Error 1
我已经搜索过这个错误,但找不到任何解决方案。任何人都可以帮忙吗?