PDA

View Full Version : Display the GUI after that it has been completely initialized



haribo
19th December 2010, 18:48
Hi,

When my application starts up I resize it to a smaller size based on the user's system preferences. Here is the code (created with Qt-Creator):



GUI::GUI(QWidget *parent) : QMainWindow(parent), ui(new Ui::GUI) {
ui->setupUi(this);
// create menu bar, fill comboboxes, ...
this->initGUIStuff();
// resize the GUI according to the users system preferences
this->resize(this->sizeHint());
...
}


This works fine, when the application starts up on Windows, Linux or Mac OS X it is resized to a smaller size that is more appropriate. Unfortunately one can see the resize action on Mac OS X, the GUI starts up and once it is rendered to the screen it is resized.

Is there a possibility to hide the GUI until it has been set up and only then show it to the user? If tried this->setVisible(false), ..., this->setVisible(true) but that did not work.

Thanks!

tbscope
19th December 2010, 19:08
I guess you call show() in the main.cpp or somewhere else.
Don't do that and let the GUI class either show itself or send a signal it is ready to show.