QDialog下的QTabWidget问题
我在一个QDialog下添加了一个tabWidget,在其下添加了一positionTab,给这个positionTab设置了layout,但是运行后发现positionTab下什么东西都没有。。。
QTabWidget *tabWidget = new QTabWidget;QWidget *positionTab = new QWidget();QFormLayout *lightPositionLayout = new QFormLayout();lightPositionLayout->addRow("X:",xpos);lightPositionLayout->addRow("Y:",ypos);lightPositionLayout->addRow("Z:",zpos);positionTab->setLayout(lightPositionLayout);tabWidget->addTab(positionTab,"Position");
QLabel *ambientTab = new QLabel(tr("This is a low"));tabWidget->addTab(ambientTab,tr("Ambient"));
yLabel = new QLabel(formLayoutWidget);
yLabel->setObjectName(QString::fromUtf8("yLabel"));
formLayout->setWidget(1, QFormLayout::LabelRole, yLabel);
yLineEdit = new QLineEdit(formLayoutWidget);
yLineEdit->setObjectName(QString::fromUtf8("yLineEdit"));
formLayout->setWidget(1, QFormLayout::FieldRole, yLineEdit);
zLabel = new QLabel(formLayoutWidget);
zLabel->setObjectName(QString::fromUtf8("zLabel"));
formLayout->setWidget(2, QFormLayout::LabelRole, zLabel);
zLineEdit = new QLineEdit(formLayoutWidget);
zLineEdit->setObjectName(QString::fromUtf8("zLineEdit"));
formLayout->setWidget(2, QFormLayout::FieldRole, zLineEdit);
tabWidget->addTab(tab, QString());
verticalLayout->addWidget(tabWidget);
retranslateUi(Dialog);
tabWidget->setCurrentIndex(0);
QMetaObject::connectSlotsByName(Dialog);
} // setupUi
void retranslateUi(QDialog *Dialog)
{
Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", 0, QApplication::UnicodeUTF8));
xLabel->setText(QApplication::translate("Dialog", "x", 0, QApplication::UnicodeUTF8));
yLabel->setText(QApplication::translate("Dialog", "y", 0, QApplication::UnicodeUTF8));
zLabel->setText(QApplication::translate("Dialog", "z", 0, QApplication::UnicodeUTF8));
tabWidget->setTabText(tabWidget->indexOf(tab), QApplication::translate("Dialog", "Tab 1", 0, QApplication::UnicodeUTF8));
} // retranslateUi
};
namespace Ui {
class Dialog: public Ui_Dialog {};
} // namespace Ui
QT_END_NAMESPACE
#endif // DESIGNERGG6260_H