我尝试在子类上添加框架/小部件子QWizard
类,但向导页面为空白。我添加了QMainWindow
子类,它工作正常。
QuickSetupWizard::QuickSetupWizard(QWidget *parent) :
QWizard(parent),
ui(new Ui::QuickSetupWizard)
{
ui->setupUi(this);
mpMainWindow = new MainWindow(); // QMainWindow subclass
mpSource = new Source(); // Source is QFrame subclass
QWizardPage *page = new QWizardPage;
page->setTitle("Conclusion");
QLabel *label = new QLabel("You are now successfully registered");
label->setWordWrap(true);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(label);
layout->addWidget(mpIrigMainWindow);
page->setLayout(layout);
addPage(page); // here able to add mainWindow as wizard page
QWizardPage *page2 = new QWizardPage;
QVBoxLayout *layout2 = new QVBoxLayout;
layout2->addWidget(new QPushButton("xyz"));
layout2->addWidget(mpSource);
page2->setLayout(layout2);
addPage(page2);
}
第二个向导页面仅显示一个按钮。框架不存在。框架子类我测试过没有问题。