0

I have a sheet declared in my QML file, which has the id "splashscreen"

When my app performs a computationally intensive task, I emit the working() signal.

I have this code attached to the main element of my QML file:

onCreationCompleted: {
    _encryptedattachment.finished.connect(splashscreen.close);
    _encryptedattachment.working.connect(splashscreen.open);
    console.log("connected");
}

If I open the app through an invoke on a file which needs decrypting, the

    _encryptedattachment.working.connect(splashscreen.open);

does not open the splashscreen, even though the event is being fired (I checked in the debugger that the code

emit working()

is executed.

EDIT:

I changed the onCreated code to this:

onCreationCompleted: {
    splashscreen.open();
    _encryptedattachment.working.connect(showSplash);
    _encryptedattachment.finished.connect(hideSplash);
    console.log("connected");
}
function showSplash() {
    console.log("open splashscreen");
    splashscreen.open();
}
function hideSplash() {
    console.log("close splashscreen");
    splashscreen.close();
}

and both those logs are appearing in the console.

Tom Macdonald
  • 6,433
  • 7
  • 39
  • 59
  • 1
    1. Are you sure that `_encryptedattachment.working.connect(showSplash);` returned true? are you sure that showSplash is not called? If showSplash is called do you call `QApplication::processEvents` after calling show on QSplashScreen instance? – Kamil Klimek Jul 15 '13 at 07:23
  • QApplication::processEvents solved the problem. Thanks. If you add it as an answer I will accept it. – Tom Macdonald Jul 15 '13 at 08:16

1 Answers1

1

After calling QSplashScreen::show() you must call QApplication::processEvents() so eventloop will draw it on screen. Remember to call QApplication::processEvents() after each splash screen update.

Kamil Klimek
  • 12,884
  • 2
  • 43
  • 58