Mrdata
3rd February 2007, 12:03
I've been trying QT4 for the past few days and i'm having problems understanding how the implement this in my application:
What i want to achieve:
1) Main window with buttons -OK
2) User press one of the buttons a Tab widget will appear -OK
3) Tab Widget have button -OK
4) User press button on tab widget and a new window must appear on top of the tab widget
The 4) never works for me, unless i use a QmessageBox, but i really need more "control" over the message window in question.
I created things like this:
//Create the tab widget
Stuff_tab::Stuff_tab(QWidget *parent) : QDialog(parent)
{
tabWidget = new QTabWidget;
tabWidget->addTab(new Tab1, tr("Tab 1"));
tabWidget->addTab(new Tab2, tr("Tab 2"));
.......
mainLayout = new QVBoxLayout;//(this);
mainLayout->setSizeConstraint( QLayout::SetFixedSize );
tabWidget->setFixedSize(400, 768);
mainLayout->addWidget(tabWidget);
setLayout(mainLayout);
setWindowTitle(tr("Tab"));
}
void Stuff_tab::infoMessage() //called from a button on the tab widget
{
QDialogButtonBox *buttonBox; // i also tried with different widget types
buttonBox = new QDialogButtonBox(QDialogButtonBox::Open
| QDialogButtonBox::Cancel
| QDialogButtonBox::Help);
QVBoxLayout *mainLayout2 = new QVBoxLayout( this );
mainLayout2->setSizeConstraint( QLayout::SetFixedSize );
buttonBox->setFixedSize(200, 200);
mainLayout2->addWidget(buttonBox);
setLayout(mainLayout2); // use this?
}
//this part never show up on screen
I can't have nested layouts? Am i doing things the wrong way? Any help will be really appreciated. Thanks in advance.
What i want to achieve:
1) Main window with buttons -OK
2) User press one of the buttons a Tab widget will appear -OK
3) Tab Widget have button -OK
4) User press button on tab widget and a new window must appear on top of the tab widget
The 4) never works for me, unless i use a QmessageBox, but i really need more "control" over the message window in question.
I created things like this:
//Create the tab widget
Stuff_tab::Stuff_tab(QWidget *parent) : QDialog(parent)
{
tabWidget = new QTabWidget;
tabWidget->addTab(new Tab1, tr("Tab 1"));
tabWidget->addTab(new Tab2, tr("Tab 2"));
.......
mainLayout = new QVBoxLayout;//(this);
mainLayout->setSizeConstraint( QLayout::SetFixedSize );
tabWidget->setFixedSize(400, 768);
mainLayout->addWidget(tabWidget);
setLayout(mainLayout);
setWindowTitle(tr("Tab"));
}
void Stuff_tab::infoMessage() //called from a button on the tab widget
{
QDialogButtonBox *buttonBox; // i also tried with different widget types
buttonBox = new QDialogButtonBox(QDialogButtonBox::Open
| QDialogButtonBox::Cancel
| QDialogButtonBox::Help);
QVBoxLayout *mainLayout2 = new QVBoxLayout( this );
mainLayout2->setSizeConstraint( QLayout::SetFixedSize );
buttonBox->setFixedSize(200, 200);
mainLayout2->addWidget(buttonBox);
setLayout(mainLayout2); // use this?
}
//this part never show up on screen
I can't have nested layouts? Am i doing things the wrong way? Any help will be really appreciated. Thanks in advance.