Results 1 to 4 of 4

Thread: Automatic start routine after GUI started

  1. #1
    Join Date
    Aug 2009
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Automatic start routine after GUI started

    My program has a lengthy initialization routine. If I call the routine before the app.exec() there is a long wait before the main window appears which I would like to avoid.

    How can I get the window showing first and then the initialization routine started without user involvement?

    I may have to intercept QEvent::ApplicationActivate or something event like that ???

    Appreciate any help
    Enno

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Automatic start routine after GUI started

    A single shot timer set to a low value in your constructor.
    When the timer is finished, start your initialisation.

    At least that's how it's done in KDE if I remember it correctly, but it has been a while.

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Automatic start routine after GUI started

    it depends.
    If your main window needs data initialized before then either show it, and update the data when it is initialized or, the more "standard" way, is to show a splash screen, and some sort of information about the initialization process, so that the user knows he has to wait a bit. (See GIMP as one example).
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Automatic start routine after GUI started

    Use QMetaObject::invokeMethod() with Qt::QueuedConnection.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Problem calling a routine with dynamicCall
    By franco.amato in forum Qt Programming
    Replies: 10
    Last Post: 10th May 2010, 17:59
  2. Problems with ACtiveQT in calling a routine
    By franco.amato in forum Qt Programming
    Replies: 0
    Last Post: 15th April 2010, 01:00
  3. Wierd behaviour in a slot routine
    By koenig in forum Newbie
    Replies: 7
    Last Post: 29th January 2010, 07:27
  4. emit a signal from inside a callback routine
    By franco.amato in forum Qt Programming
    Replies: 20
    Last Post: 21st January 2010, 18:05
  5. Replies: 5
    Last Post: 19th September 2008, 15:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.