@SPlatten said in setGeometry Unable to set geometry:
@Cobra91151 If the MainWindow is the at the top level of the application, there isn't a parent is there?
If you mean something like this:
Code:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Dialog w;
w.show();
return a.exec();
}
Then no parent is needed. But, if you have some object class in which you check what dialog to display as the top level, then I would suggest setParent to the app object:
Code:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MyStartup obj;
obj.setParent(&a);
return a.exec();
}
But I do not think it will fix your issue. Have you tried for example: setFixedSize method to check if this issue still exists? Also, you can set setWindowFlags method: Qt::MSWindowsFixedSizeDialogHint to make window not resizable on Windows just for a test.
Additionally, you can try to find what causes it using the code below in your main method (main.cpp):
#ifdef QT_DEBUG
qputenv("QT_FATAL_WARNINGS", "1");
qputenv("QT_MESSAGE_PATTERN",
"Type: %{type}\nProduct Name: %{appname}\nFile: %{file}\nLine: %{line}\nMethod: %{function}\nThreadID: %{threadid}\nThreadPtr: %{qthreadptr}\nMessage: %{message}");
#endif
It will work only in Debug mode and should display more details about your issue. Without any code it is hard to find the root of your issue.