Thanks guys.
I have ran into an issue though. I am creating my layouts and what not with Qt Designer. My .ui creates the following layout code:
// taken from an auto generated ui_*.h file.
...
Layout1 = new QWidget(ConfigWidget
);
Layout1
->setObjectName
(QString::fromUtf8("Layout1"));
Layout1
->setGeometry
(QRect(30,
150,
303,
31));
hboxLayout1->setSpacing(6);
hboxLayout1->setMargin(0);
hboxLayout1
->setObjectName
(QString::fromUtf8("hboxLayout1"));
lblDocType_grp1
= new QLabel(Layout1
);
lblDocType_grp1
->setObjectName
(QString::fromUtf8("lblDocType_grp1"));
hboxLayout1->addWidget(lblDocType_grp1);
cmbIndexes_grp1
->setObjectName
(QString::fromUtf8("cmbIndexes_grp1"));
QSizePolicy sizePolicy
(static_cast<QSizePolicy
::Policy>
(7), static_cast<QSizePolicy
::Policy>
(0));
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(cmbIndexes_grp1->sizePolicy().hasHeightForWidth());
cmbIndexes_grp1->setSizePolicy(sizePolicy);
cmbIndexes_grp1->setEditable(true);
hboxLayout1->addWidget(cmbIndexes_grp1);
// taken from an auto generated ui_*.h file.
QWidget *Layout1;
QHBoxLayout *hboxLayout1;
QLabel *lblDocType_grp1;
QComboBox *cmbIndexes_grp1;
...
Layout1 = new QWidget(ConfigWidget);
Layout1->setObjectName(QString::fromUtf8("Layout1"));
Layout1->setGeometry(QRect(30, 150, 303, 31));
hboxLayout1 = new QHBoxLayout(Layout1);
hboxLayout1->setSpacing(6);
hboxLayout1->setMargin(0);
hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
lblDocType_grp1 = new QLabel(Layout1);
lblDocType_grp1->setObjectName(QString::fromUtf8("lblDocType_grp1"));
hboxLayout1->addWidget(lblDocType_grp1);
cmbIndexes_grp1 = new QComboBox(Layout1);
cmbIndexes_grp1->setObjectName(QString::fromUtf8("cmbIndexes_grp1"));
QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(0));
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(cmbIndexes_grp1->sizePolicy().hasHeightForWidth());
cmbIndexes_grp1->setSizePolicy(sizePolicy);
cmbIndexes_grp1->setEditable(true);
hboxLayout1->addWidget(cmbIndexes_grp1);
To copy to clipboard, switch view to plain text mode
Sooo.. Layout1 is my QWidget that I want to insert right?
When I create a stacked object like so:
void CConfigWidget::InitStack()
{
// Add Layout Widgets to QStackerWidget
pStacker->insertWidget(0, ui.Layout1);
pStacker->insertWidget(1, ui.Layout2);
pStacker->insertWidget(2, ui.Layout3);
}
void CConfigWidget::InitStack()
{
// Add Layout Widgets to QStackerWidget
pStacker = new QStackedWidget;
pStacker->insertWidget(0, ui.Layout1);
pStacker->insertWidget(1, ui.Layout2);
pStacker->insertWidget(2, ui.Layout3);
}
To copy to clipboard, switch view to plain text mode
and connect it to my radio buttons like so:
void CConfigWidget::InitConnections()
{
connect(ui.rbRadio1, SIGNAL(toggled(bool)), this, SLOT(Radio1Click(bool)));
connect(ui.rbRadio2, SIGNAL(toggled(bool)), this, SLOT(Radio2Click(bool)));
connect(ui.rbRadio3, SIGNAL(toggled(bool)), this, SLOT(Radio3Click(bool)));
}
void CConfigWidget::Radio1Click(bool bVisible)
{
if (bVisible) pStacker->setCurrentIndex(0);
}
void CConfigWidget::InitConnections()
{
connect(ui.rbRadio1, SIGNAL(toggled(bool)), this, SLOT(Radio1Click(bool)));
connect(ui.rbRadio2, SIGNAL(toggled(bool)), this, SLOT(Radio2Click(bool)));
connect(ui.rbRadio3, SIGNAL(toggled(bool)), this, SLOT(Radio3Click(bool)));
}
void CConfigWidget::Radio1Click(bool bVisible)
{
if (bVisible) pStacker->setCurrentIndex(0);
}
To copy to clipboard, switch view to plain text mode
... nothing shows up. setCurrentIndex(int) is getting called... but nothing is displayed.
Am I still missing something?
Bookmarks