Results 1 to 11 of 11

Thread: QSplash screen at the baskground

  1. #1
    Join Date
    Feb 2007
    Posts
    63
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default QSplash screen at the baskground

    Hi i have an application in which i am displaying a splash screen on clicking a button.
    but the splash screen is displayed at the background of the form.

    Where can be the problem??????????

    Regards

    Raghvendra

  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: QSplash screen at the baskground

    In the code you use

    And seriously, can you paste some of it?

  3. #3
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Lightbulb Re: QSplash screen at the baskground

    Qt Code:
    1. #include <QApplication>
    2.  
    3. #include <QSplashScreen>
    4.  
    5. #include <QWidget>
    6.  
    7.  
    8.  
    9. int main(int argc, char *argv[])
    10.  
    11. {
    12.  
    13. QApplication app(argc, argv);
    14.  
    15.  
    16.  
    17. QPixmap pixmap;
    18.  
    19. pixmap.load(":/images/splash.png");
    20.  
    21. QSplashScreen *splash=new QSplashScreen(pixmap);
    22.  
    23. splash->show();
    24.  
    25.  
    26.  
    27. app.processEvents();
    28.  
    29. w.show();
    30.  
    31.  
    32. splash->finish(&w);
    33.  
    34. delete splash;
    35.  
    36. return app.exec();
    37.  
    38. }
    To copy to clipboard, switch view to plain text mode 

    hope its help.
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

  4. #4
    Join Date
    Jan 2008
    Location
    Warsaw, Poland
    Posts
    26
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default Re: QSplash screen at the baskground

    Using QSplashScreen usually involves setting Qt::WindowFlags, namely Qt::WindowStaysOnTopHint to get desired result.

    I'd changed fragment of your code as follows:
    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication app(argc, argv);
    4. QPixmap pixmap(":/images/splash.png");
    5. QSplashScreen splash(pixmap, Qt::WindowStaysOnTopHint);
    6. splash.show();
    7. app.processEvents();
    8. // (...)
    9. splash.finish(&w);
    10. return app.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Jan 2008
    Location
    Warsaw, Poland
    Posts
    26
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default Re: QSplash screen at the baskground

    Sorry, I didn't spot earlier, that this topic is related to Qt3. In this case, you probably should use Qt::WStyle_StaysOnTop. There is also Qt::WStyle_Splash, maybe it'll be sufficient for you.

  6. #6
    Join Date
    Feb 2007
    Posts
    63
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: QSplash screen at the baskground

    Hi ,
    I tried with the "WStyle_StaysOnTop" flag but still my flash screen is in the back ground.

    I am pasting a piece of my code.
    In my application when i am clicking the ok button the function below is called and shall display Splash Screen on top.

    Qt Code:
    1. void Form2::onOk()
    2. {
    3.  
    4. QPixmap pixmap("splash.png");
    5.  
    6. QSplashScreen *splash = new QSplashScreen(pixmap,Qt::WStyle_StaysOnTop);
    7. splash->show();
    8.  
    9. splash->message(QObject::tr("Setting up the main window..."),
    10. Qt::AlignRight | Qt::AlignTop, Qt::white);
    11.  
    12. delete splash;
    13.  
    14. }
    To copy to clipboard, switch view to plain text mode 

    Plz tell me how to solve the problem.

    Regards
    Raghvendra
    Last edited by jpn; 8th February 2008 at 08:47. Reason: missing [code] tags

  7. #7
    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: QSplash screen at the baskground

    Are you deleting the splash screen right after creating it?

  8. #8
    Join Date
    Feb 2007
    Posts
    63
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: QSplash screen at the baskground

    Actually i am creating bthe Splash screen , writting the message to it and then deleting the splash.
    The splash screen comes and displays the message also but it comes at the background of the widget from where i am calling it.

    So to see that i have to minimize my widget every time i call it.
    hope i am clear with the problem................

  9. #9
    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: QSplash screen at the baskground

    Here is my working code for a splashscreen:
    Qt Code:
    1. QPixmap splashpixmap(settings.appPath() + "/icons/splashskrin.png");
    2. QSplashScreen *splash = new QSplashScreen( splashpixmap );
    3. splash->show();
    4. splash->message( QObject::tr("Loading bitmaps..."), Qt::AlignHCenter|Qt::AlignVCenter );
    5. a.processEvents();
    6. createMimeFactory();
    7. editor *mw= new editor();
    8. splash->message( QObject::tr("Loading plugins..."), Qt::AlignHCenter|Qt::AlignVCenter );
    9. a.processEvents();
    10. QString plugspath(settings.appPath()+"/plugins/");
    11. plugins.load(plugspath);
    12. plugins.addIOFormat((void*)newSTL, "STL");
    13. splash->message( QObject::tr("Setting application..."), Qt::AlignHCenter|Qt::AlignVCenter );
    14. a.processEvents();
    15. splash->finish(mw);
    16. splash->deleteLater();
    To copy to clipboard, switch view to plain text mode 

  10. #10
    Join Date
    Jan 2008
    Location
    Warsaw, Poland
    Posts
    26
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default Re: QSplash screen at the baskground

    Quote Originally Posted by raghvendramisra View Post
    Hi ,
    I tried with the "WStyle_StaysOnTop" flag but still my flash screen is in the back ground.
    If changing line with deleting splash immediately after creating don't help you, you can try adding flag WX11BypassWM as documentation suggests, necessity of putting this flag depends on WM you use, so I presume it is better to always have it.
    Did you try also Qt::WStyle_Splash? If your WM doesn't support NETWM, than mentioned earlier WX11BypassWM flag is used.

  11. #11
    Join Date
    Feb 2007
    Posts
    63
    Qt products
    Qt3
    Platforms
    Unix/X11

    Smile Re: QSplash screen at the baskground

    HI,
    thanx everyone my problem is solved now.
    i have used raise() to bring it to the top and it is working now..........

    Regards

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.