Ciurica
29th August 2012, 07:32
Hello guys,
I have a
class MyWidget : public QWidget
{
Q_OBJECT;
[...]
};
and I want to use this widget modal in one dialog and embedded in another bigger widget in the same time.
When I add this widget in another dialog everything is fine and looks great, but to display it as a popup in an single dialog I do:
MyWidget *myWidgetDlg = new MyWidget ();
addCompanyDlg->setWindowModality (Qt::WindowModal);
QDialog mainDialog;
mainDialog.setLayoutDirection (Qt::LayoutDirection::LeftToRight);
QBoxLayout mainDialogLayout(QBoxLayout::LeftToRight);
mainDialogLayout.addWidget(myWidgetDlg );
mainDialogLayout.setMargin (0);
mainDialog.setLayout(&mainDialogLayout);
mainDialog.setWindowState(mainDialog.windowState() | Qt::WindowMaximized);
mainDialog.setWindowFlags (Qt::Dialog);
mainDialog.exec();
This works on my computer on Linux (Ubuntu 12.4 x64), but on Windows (x64) and on my tester computer (Ubuntu 12.4 x86), the dialog is shown without borders and title bar is like an splash screen, not minimize and maximize buttons.
What is wrong in my dynamical QDialog creation?
Thanks in advance.
I have a
class MyWidget : public QWidget
{
Q_OBJECT;
[...]
};
and I want to use this widget modal in one dialog and embedded in another bigger widget in the same time.
When I add this widget in another dialog everything is fine and looks great, but to display it as a popup in an single dialog I do:
MyWidget *myWidgetDlg = new MyWidget ();
addCompanyDlg->setWindowModality (Qt::WindowModal);
QDialog mainDialog;
mainDialog.setLayoutDirection (Qt::LayoutDirection::LeftToRight);
QBoxLayout mainDialogLayout(QBoxLayout::LeftToRight);
mainDialogLayout.addWidget(myWidgetDlg );
mainDialogLayout.setMargin (0);
mainDialog.setLayout(&mainDialogLayout);
mainDialog.setWindowState(mainDialog.windowState() | Qt::WindowMaximized);
mainDialog.setWindowFlags (Qt::Dialog);
mainDialog.exec();
This works on my computer on Linux (Ubuntu 12.4 x64), but on Windows (x64) and on my tester computer (Ubuntu 12.4 x86), the dialog is shown without borders and title bar is like an splash screen, not minimize and maximize buttons.
What is wrong in my dynamical QDialog creation?
Thanks in advance.