Results 1 to 8 of 8

Thread: QSplashScreen question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2008
    Location
    Portugal
    Posts
    171
    Thanks
    57
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSplashScreen question

    This was my interpretation also.
    But by the way:
    Qt Code:
    1. #include <QtGui>
    2. int main(int argc, char *argv[])
    3. {
    4. QApplication app(argc, argv);
    5. QPixmap pixmap("f0.png");
    6. QSplashScreen splash(pixmap);
    7. splash.show();
    8. //app.processEvents();
    9. //...
    10. QMainWindow window;
    11. window.show();
    12. //splash.finish(&window);
    13. return app.exec();
    14.  
    15. }
    To copy to clipboard, switch view to plain text mode 

    Commented this 2 lines and both splash and main windows open at the same time. Click closes the splash.
    Thought this was only possible if using app.processEventes(); !

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSplashScreen question

    Quote Originally Posted by graciano View Post
    This was my interpretation also.
    Thought this was only possible if using app.processEventes(); !
    if you read the docs again.. it says that app.processEvents() is used because app.exe() is not called yet. When your mainwindow is shown, app.exe() is called so no need of processEvents().

  3. #3
    Join Date
    Sep 2008
    Location
    Portugal
    Posts
    171
    Thanks
    57
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSplashScreen question

    And in this case:
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "mainwindow.h"
    3. #include <QSplashScreen>
    4. #include <QTimer>
    5.  
    6. int main(int argc, char *argv[])
    7. {
    8. QApplication a(argc, argv);
    9. splash->setPixmap(QPixmap("f0.png"));
    10. splash->show();
    11. splash->showMessage(QObject::trUtf8("A preparar a janela principal ..."), Qt::AlignRight|Qt::AlignTop, Qt::black);
    12. MainWindow w;
    13. QTimer::singleShot(5000, splash, SLOT(close()));
    14. QTimer::singleShot(5000, &w, SLOT(show()));
    15. //delete splash;
    16. return a.exec();
    17. }
    To copy to clipboard, switch view to plain text mode 

    Obviously the commented line could not work ... but where to free the used memory by the splash screen?
    Thanks

Similar Threads

  1. licensing question
    By tommy in forum Installation and Deployment
    Replies: 4
    Last Post: 14th April 2010, 11:54
  2. QSplashScreen Weirdness
    By mclark in forum Qt Programming
    Replies: 11
    Last Post: 19th November 2007, 06:49
  3. Replies: 1
    Last Post: 15th March 2007, 20:45
  4. Question regarding how to paint after zoom.
    By JonathanForQT4 in forum Qt Programming
    Replies: 2
    Last Post: 26th January 2007, 15:34

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
  •  
Qt is a trademark of The Qt Company.