是这样的,我定义了一个类MainWindow,有三个相关文件 mainwindow.ui, mainwindow.h, mainwindow.cpp
然后在mainwindow.ui框架里面有个QTabWidget,那么里面的每一页都是QWidget,我想放个自己定义的另一个QWidget在其中一页里面,那应该怎样做?
我先添加个
QLabel的话,在mainwindow.cpp里面的构造函数内是这样的:
QVBoxLayout *layout = new QVBoxLayout;
QLabel *label= new QLabel("Hello!");
layout -> addWidget(label);
this->heartRateTab->setLayout(layout);//heartRateTab是那个QTabWidget里面的某一页
setupUi(this);
createActions();
为什么运行时直接退出。
D:\Qt Projects\Client-build-desktop\debug\Client.exe 启动中...
无法获取调试输出!D:\Qt Projects\Client-build-desktop\debug\Client.exe 退出, 代码: -1073741819
——————————————————————————————————————————
发现解决了,把setupUi(this);调到最前面就行了~
[ 此帖被sapphirezzz在2011-05-02 14:02重新编辑 ]