0

In my Qt application, I have the following code under a public slot:

   NewForm* newform = new NewForm(ui->frame_2);
   newform->show();

And it takes about 8 seconds for the form to open after the click() signal is emitted. All I have on the form is some labels, two lineedits, a flat button, and one textedit on the new form. The form relies on some networking backing code... but that shouldn't be relevant to the UI, should it? It calls no additional code on initialization... I'm really stuck. Any ideas how I might fix this? Thanks in advance.

Nickersoft
  • 684
  • 1
  • 12
  • 30
  • 1
    Post your form's code + the code for the slot that creates the form(if what you've posted isn't the full slot). I'm interested in seeing this networking code. – vikki Apr 26 '14 at 04:43
  • It depends on how you have used the networking and where have you put that code. If you you've used blocking methods and you have put the code in constructor, then yes, it's the reason. – Mousa Apr 26 '14 at 04:52
  • add timers to your code and read the elapsed time before the `new`, after the `new` and then again after the `show()`. This will tell you where the bottleneck is. – RobbieE Apr 26 '14 at 07:21
  • You're blocking the event loop for 8 seconds. Don't do that. And yes, show the code. Relevant code. – Kuba hasn't forgotten Monica Apr 28 '14 at 15:14

1 Answers1

0

Managed to fix it by putting the form as a global variable initialized upon in the main form's constructor. Apparently Qt takes forever to construct form widgets. Thanks anyway guys!

Nickersoft
  • 684
  • 1
  • 12
  • 30