[RESOLVED] Qt modeless dialog problem
-
Hello I have a problem:
I want ot ad costume window flags to dialog, so I use this code:
@ ui->setupUi(this);
Qt::WindowFlags flags = 0;
flags |= Qt::WindowMaximizeButtonHint;
flags |= Qt::WindowCloseButtonHint;
setWindowFlags( flags );@Proble is that I can open dialog just using it as model, if I open dialog as modeless, dialog opens but it shows up inside Mainwindow, I mean Dialog components are displayed on top of main window components ant acts like oen window. It's realy strange.
If I use it like model everything works ok Dialog opens and flags are being displayed.
But I need it to be modeless.@
// Modeless not working properly:
Dialog *Dia;
Dia = new PirkejoLangas(this);
Dia->setWindowFlags(Qt::WindowMaximizeButtonHint);
Dia->show();// Model working ok:
Dialog Dia;
Dia.setModal(true);
Dia.exec();
@Why it is happening ?
Sory for my english.
-
Ok I got it !
If enyone have the same problem, all you have to do is to add Qt::Dialog in your code:
@Qt::WindowFlags flags = 0;
flags |= Qt::Dialog;
flags |= Qt::WindowMaximizeButtonHint;
flags |= Qt::WindowCloseButtonHint;
setWindowFlags( flags );@Or just:
@setWindowFlags( Qt::Dialog | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);@
Now the dialog opens separately from Main window.