Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt: showMaximized() not working in Windows

I am opening a file in my application (in Windows) by double-clicking it. I am passing the file name as received through argument to my open logic. There I am calling showMaximized(), but it is not getting picked up. The window that opens up is not maximized and defaultly located at the top-left corner of the screen.

Note that all this logic flow is through main() and hence showMaximized() is probably getting called before the event loop starts. Is this stopping the showMaximized() to work properly? If yes, how to solve this?

I also tried using QTimer::singleShot(0,...,...) (so as to let the event loop start) but this has even stopped the launching of the non-maximized screen.

PS: In Mac the screen is getting maximized as there it happens through event (QEvent::FileOpen)

like image 782
user2653062 Avatar asked Nov 26 '14 19:11

user2653062


1 Answers

Simplest workaround is use resize(800,600) before using showMaximized(). I have similar error in Qt 5.7.0 on Windows 8.1.

like image 143
Vasilyev Eugene Avatar answered Sep 17 '22 09:09

Vasilyev Eugene