Results 1 to 10 of 10

Thread: splash screen problem

  1. #1
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Symbian S60

    Exclamation splash screen problem

    Hi All,

    I have created an application with a splash screen as it should be. The problem is that whenever I tap on the splash screen on my device (tested on N8 and E7), the application disappears and the background i.e. the phone menu is displayed. The application still runs in the background.
    This application makes use of the internet and so it does its initial network lookup while the splash screen is on.

    This issue does not occur with other applications which does not deal with initial network lookup.


    The code for splash screen is as follows:

    Qt Code:
    1. QPixmap splashPix(":/Images/splash_new.png");
    2.  
    3.  
    4. splash->setPixmap(splashPix);
    5. splash->showFullScreen();
    6.  
    7. splash->raise();
    8.  
    9. Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
    10. splash->showMessage(QObject::tr("Checking connectivity"),
    11. Qt::AlignJustify, Qt::white);
    12. Utils::sleep(1);
    13. splash->showMessage(QObject::tr("Checking connectivity."),
    14. Qt::AlignJustify, Qt::white);
    15. Utils::sleep(1);
    16. splash->showMessage(QObject::tr("Checking connectivity.."),
    17. Qt::AlignJustify, Qt::white);
    18.  
    19. Utils::sleep(1);
    20. splash->showMessage(QObject::tr("Checking connectivity..."),
    21. Qt::AlignJustify, Qt::white);
    22. splash->clearMessage();
    23.  
    24. net = isConnectedToNetwork(); // connection status call
    25.  
    26. if(net)
    27. {
    28. //Found an interface. Show status & proceed normally.
    29. splash->showMessage(QObject::tr("Connection Found !!"),
    30. Qt::AlignJustify, Qt::green);
    31. qWarning("Connection found....");
    32. Utils::sleep(2);
    33. splash->showMessage(QObject::tr("Launching application"),
    34. Qt::AlignJustify, Qt::green);
    35. Utils::sleep(1);
    36. splash->showMessage(QObject::tr("Launching application."),
    37. Qt::AlignJustify, Qt::green);
    38. Utils::sleep(1);
    39. splash->showMessage(QObject::tr("Launching application.."),
    40. Qt::AlignJustify, Qt::green);
    41. Utils::sleep(1);
    42. splash->showMessage(QObject::tr("Launching application..."),
    43. Qt::AlignJustify, Qt::green);
    44. Utils::sleep(1);
    45. }
    46. else
    47. {
    48. qWarning("Comes here");
    49. splash->showMessage(QObject::tr("No Internet Connection !!\nPlease check the network settings.\nTrackIt will now exit..."),
    50. Qt::AlignJustify, Qt::red);
    51. Utils::sleep(5);
    52.  
    53. return -1;
    54. }
    55.  
    56. Utils::sleep(5);
    57.  
    58. splash->clearMessage();
    59. splash->finish(w);
    60.  
    61. w->showFullScreen();
    62. delete splash;
    63. splash = NULL;
    To copy to clipboard, switch view to plain text mode 

    Can anyone please help me with this issue?

    Thanks and Regards.
    Last edited by high_flyer; 14th January 2011 at 08:48. Reason: code tags

  2. #2
    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: splash screen problem

    What's the point of using sleep()? This blocks your application.
    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.


  3. #3
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: splash screen problem

    and is causing it to ignore messages from the OS, which might decide to remove you from the foreground as a result.

  4. #4
    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: splash screen problem

    Maybe 'Utils' is a thread? then it is ok.
    ==========================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.

  5. #5
    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: splash screen problem

    Quote Originally Posted by high_flyer View Post
    Maybe 'Utils' is a thread? then it is ok.
    Then he's accessing widgets from a non-gui thread. So it's still no ok.
    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.


  6. #6
    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: splash screen problem

    Then he's accessing widgets from a non-gui thread. So it's still no ok.
    how do you come to that conclusion?
    He could be very well in the Gui thread calling the non gui thread's sleep... (provided if overriden it to be public)
    Or am I missing something?

    To original poster:
    You should explain a bit what you are doing, we can't just guess!
    ==========================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.

  7. #7
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: splash screen problem

    Could be, but I don't see why you'd call a sleep function on a different thread. Surely the point of the call is to delay the execution of the current thread so that the splash screen stays up longer, and if he's doing that, he can't be processing messages too.

  8. #8
    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: splash screen problem

    Quote Originally Posted by high_flyer View Post
    how do you come to that conclusion?
    He could be very well in the Gui thread calling the non gui thread's sleep... (provided if overriden it to be public)
    Or am I missing something?
    Several reasons. First of all I don't think you can put thread A to sleep from thread B. Second of all Utils::sleep() is a static call so unless Utils is a singleton class, it is likely that its behaviour is similar to QThread::sleep() which puts the current thread to sleep. Furthermore if it was the case that this call puts another thread to sleep then calling sleep() several times in a row wouldn't make any sense as the thread would already be sleeping after the first call.
    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.


  9. #9
    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: splash screen problem

    First of all I don't think you can put thread A to sleep from thread B.
    You could if you exposed sleep() and internally make the thead call its own sleep. (I wouldn't, you niether, but who knows? I have seen stranger things!)
    Second of all Utils::sleep() is a static call so unless Utils is a singleton class, it is likely that its behaviour is similar to QThread::sleep() which puts the current thread to sleep.
    That is a good point, which wraps it for me.
    If Utils is a mother class, than he is putting him self to sleep.
    If not, then its something like what I just wrote above, which is probably even worse.
    Furthermore if it was the case that this call puts another thread to sleep then calling sleep() several times in a row wouldn't make any sense as the thread would already be sleeping after the first call.
    Ah... how many times have we seen here stuff that doesn't make any sense?
    ==========================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.

  10. #10
    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: splash screen problem

    Quote Originally Posted by high_flyer View Post
    You could if you exposed sleep() and internally make the thead call its own sleep. (I wouldn't, you niether, but who knows? I have seen stranger things!)
    You mean like "schedule a sleep"? Maybe... But I don't think that's the case here

    Ah... how many times have we seen here stuff that doesn't make any sense?
    I tend to assume that something someone did does make some sense until I have enough evidence or intuition to say otherwise.

    Anyway, the solution is to use a timer instead of the sleep calls. And signals and slots, of course.
    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 with Splash Screen ?
    By vinod in forum Qt Programming
    Replies: 13
    Last Post: 11th April 2020, 17:15
  2. How to Keep Splash Screen and App on Same Display
    By ajb_advance in forum Qt Programming
    Replies: 2
    Last Post: 4th March 2009, 11:49
  3. Splash screen showing for two seconds
    By Koas in forum Qt Programming
    Replies: 5
    Last Post: 17th October 2008, 19:40
  4. Splash Screen
    By Salazaar in forum Newbie
    Replies: 27
    Last Post: 4th June 2007, 17:31
  5. QTimer based Splash Screen
    By bpetty in forum Newbie
    Replies: 6
    Last Post: 15th December 2006, 00:51

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.