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)
The very first time a process calls ShowWindow, the show command is ignored and uses the command provided in the STARTUPINFO structure (which should correspond with the nCmdShow parameter in WinMain).
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548%28v=vs.85%29.aspx
This surprising behavior has a tendency to manifest itself in problems like the one you describe. You may be able to resolve it by simply issuing QT's showMaximized call twice if you don't want to use any Win32 API calls directly.