Mulitple Show_()'s
-
I have a QT5 border-less application which has it's fixed Size set to the current monitor's resolution and then is displayed using a normal show()
Since this application is border-less, I have created my own application window bar. When creating my maximizeWindow button I simply thought this would suffice:
this->showMaximized();
However, this would only work once and then would stop doing anything so i then changed the above to this:
this->setWindowState(Qt::WindowMaximized); this->show();
and then added this whenever it was un-maximized:
this->setWindowState(Qt::WindowNoState);
Again, this would only work once at a time...
Any advice on using show_() 's and windowStates would be appreciatedExtra Info:
This is the only override/edit I have done to window stuff:setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
-
@AlexanderAlexander Do I understand you correctly: you maximize the window using showMaximized(), then at some point it is changed to not maximized and if you try to maximize again using showMaximized() it does not maximize?
Did you try showNormal()? -
@jsulm, to provide more info, when I have an event that un-maximizes I have added this line. It does fix the issue but causes a new problem.
One of the main ways the user causes an un-max event is when they drag a maximized window (the window's fixedSize is reduced to a certain ratio). Now, with your suggestion, when I drag the window and it un-maxes, the window is positioned very far down the screen, 100's of pixels south of the cursor that just started to drag it.
-
Instead of dealing with window states, I think I will just set the fixed size to that of the monitor, and then position at 0, 0 to achieve a maximized state. Thanks for the help though