You may only defer loading the pixmap to after you are sure the widget will already be visible. The latter happens when show() is called and processing returns to the event loop where appropriate events for showing the widget are processed. You can schedule your own event (or make a deferred slot call via QMetaObject::invokeMethod()) to load the image asynchronously. Of course you'll have to move all your code that uses the pixmap from the original function to somewhere after the pixmap is actually loaded.
Bookmarks