如何在Qt Creator中创建多个UI表单并将它们链接起来? 我想在我的mainwindow.ui中有一个按钮,当它被触发时,我想要显示其他的UI。 我该怎么办?Qt项目中的多个UI
我有两个Qt的表单类:
- 主窗口
- mainwindow2
我在main.cpp中尝试这种代码:
#include "mainwindow.h"
#include "mainwindow2.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
MainWindow2 w2;
w2.show();
return a.exec();
}
,但出现这样的错误:
main.obj:-1: error: LNK2019: unresolved external symbol "public: virtual __thiscall MainWindow2::~MainWindow2(void)" ([email protected]@[email protected]) referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall MainWindow2::MainWindow2(class QWidget *)" ([email protected]@[email protected]@@@Z) referenced in function _main
release\testtest.exe:-1: error: LNK1120: 2 unresolved externals
HTH http://qt-project.org/doc/qt-4.8/designer-using-custom-widgets.html – Tab
你定义构造函数和你的'MainWindow2'类中的析构函数? – thuga