WindowSystemMenuHint strange bug
-
Hi everybody. I just added new fresh .ui file with class which inherits QDialog for extra window of my main project. Add in ui some layout and labels, it looks as it should, everything ok on the following screenshot:
But when i try to remove that unnecessary MenuHint(question mark) like that:
myNewDialog->setWindowFlags(Qt::WindowSystemMenuHint);
Or. By adding such thing in to constructor of that child dialog:
this->setWindowFlags(Qt::WindowSystemMenuHint);
The window will start looking, i would say, strange:
The code in constructor of my main class:
myNewDialog = new FinalResult(this); //class of child window myNewDialog->show();
-
@Engelard isn't that ...HelpButtonHint?
which type of widget is your dialog? it may be the platform defaiult to show it.
-
Hi
The reason for the odd look is due to you remove all its flags
setWindowFlags(Qt::WindowSystemMenuHint);
Now ONLY WindowSystemMenuHint is set. not Dialog and all the others it needs.
You need to do
setWindowFlags(windowFlags() & ~Qt::WindowSystemMenuHint);
which takes the current flags and bitwise disable only hint. -
Hi
The reason for the odd look is due to you remove all its flags
setWindowFlags(Qt::WindowSystemMenuHint);
Now ONLY WindowSystemMenuHint is set. not Dialog and all the others it needs.
You need to do
setWindowFlags(windowFlags() & ~Qt::WindowSystemMenuHint);
which takes the current flags and bitwise disable only hint.Very good stuff. But.
- as i understand, it set it from windowFlags() which comes from parent, it do totally no effect if i would try set it up from it's own flags:
myNewDialog->windowFlags()
- As it appliable only from parent(QMainWindow), it adds maximize and minimize hints, maximize is unnecessary, so i tried to remove it, but it only disable it, not hide:
myNewDialog->setWindowFlags(windowFlags() & (~Qt::WindowSystemMenuHint & ~Qt::WindowMaximizeButtonHint));
-
Very good stuff. But.
- as i understand, it set it from windowFlags() which comes from parent, it do totally no effect if i would try set it up from it's own flags:
myNewDialog->windowFlags()
- As it appliable only from parent(QMainWindow), it adds maximize and minimize hints, maximize is unnecessary, so i tried to remove it, but it only disable it, not hide:
myNewDialog->setWindowFlags(windowFlags() & (~Qt::WindowSystemMenuHint & ~Qt::WindowMaximizeButtonHint));
-
Not all combinations works all types of windows.
-
@Engelard
Oh, must be from dialog :)myNewDialog->setWindowFlags(myNewDialog->windowFlags() & (~Qt::WindowSystemMenuHint & ~Qt::WindowMaximizeButtonHint));
-
Hi
I triedCustomDialog::CustomDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CustomDialog) { ui->setupUi(this); setWindowFlags(Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); }
-
Lol i figure it out, with little help of Qt documentation and imagination:
resultsWindow = new FinalResult(this); Qt::WindowFlags flags = 0; flags = Qt::Dialog; resultsWindow->setWindowFlags(flags |= Qt::WindowSystemMenuHint); // question mark removed, but close button now disabled resultsWindow->setWindowFlag(Qt::WindowCloseButtonHint, true);
-
Hi
I triedCustomDialog::CustomDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CustomDialog) { ui->setupUi(this); setWindowFlags(Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); }
-
@mrjj said in WindowSystemMenuHint strange bug:
Hi
I triedI try that stuff long ago, no efforts of doing that attempts from the constructor of child QDialog were paid...