olidem
14th May 2009, 10:50
Hi!
Although this is a often treated problem, I am confused about the thousand possibilities that exist to realise what I want.
I have a slot being connected to a button that shall open a subwindow.
- this subwindow is a subclass of QWidget
- it shall not appear in the taskbar (on Windows)
- it shall have a minimize-, maximize- and close-button
- it shall have a system menu in the upper left corner
- it shall be resizable
- it shall be MODAL, the window containing the button to open the subwindow shall be blocked as long as the subwindow is open.
So far I have the following:
void MainWindow::openSubWindow()
{
SubWindowWidget w(customer);
QDialog diag(0, Qt::Window );
diag.setSizeGripEnabled(true);
QHBoxLayout * lay = new QHBoxLayout;
lay->addWidget(&w);
diag.setLayout(lay);
diag.exec();
}
First problem of this: the destructor of w is called twice!
Can I somehow omit the usage of a QDialog?
Although this is a often treated problem, I am confused about the thousand possibilities that exist to realise what I want.
I have a slot being connected to a button that shall open a subwindow.
- this subwindow is a subclass of QWidget
- it shall not appear in the taskbar (on Windows)
- it shall have a minimize-, maximize- and close-button
- it shall have a system menu in the upper left corner
- it shall be resizable
- it shall be MODAL, the window containing the button to open the subwindow shall be blocked as long as the subwindow is open.
So far I have the following:
void MainWindow::openSubWindow()
{
SubWindowWidget w(customer);
QDialog diag(0, Qt::Window );
diag.setSizeGripEnabled(true);
QHBoxLayout * lay = new QHBoxLayout;
lay->addWidget(&w);
diag.setLayout(lay);
diag.exec();
}
First problem of this: the destructor of w is called twice!
Can I somehow omit the usage of a QDialog?