QSplashScreen Class ReferenceThe QSplashScreen widget provides a splash screen that can be shown during application startup. More... #include <qsplashscreen.h> Inherits QWidget. Public Members
Public Slots
Signals
Protected Members
Detailed DescriptionThe QSplashScreen widget provides a splash screen that can be shown during application startup.
A splash screen is a widget that is usually displayed when an application is being started. Splash screens are often used for applications that have long start up times (e.g. database or networking applications that take time to establish connections) to provide the user with feedback that the application is loading. The splash screen appears centered on the screen, on top of all other windows. Some X11 window managers do not support the "stays on top" flag. A solution is to set up a timer that periodically calls raise() on the splash screen to simulate the "stays on top" effect. The most common usage is to show a splash screen before the main widget is displayed on the screen. This is illustrated in the following code snippet.
int main( int argc, char **argv ) { QApplication app( argc, argv ); QPixmap pixmap( "splash.png" ); QSplashScreen *splash = new QSplashScreen( pixmap ); splash->show(); QMainWindow *mainWin = new QMainWindow; ... app.setMainWidget( mainWin ); mainWin->show(); splash->finish( mainWin ); delete splash; return app.exec(); } It is sometimes useful to update the splash screen with messages, for example, announcing connections established or modules loaded as the application starts up. QSplashScreen supports this with the message() function. If you wish to do your own drawing you can get a pointer to the pixmap used in the splash screen with pixmap(). Alternatively, you can subclass QSplashScreen and reimplement drawContents(). The user can hide the splash screen by clicking on it with the mouse. Since the splash screen is typically displayed before the event loop has started running, it is necessary to periodically call QApplication::processEvents() to receive the mouse clicks.
QSplashScreen *splash = new QSplashScreen( "splash.png" ); splash->show(); ... // Loading some items splash->message( "Loaded modules" ); qApp->processEvents(); ... // Establishing connections splash->message( "Established connections" ); qApp->processEvents();
See also Miscellaneous Classes. Member Function Documentation
Construct a splash screen that will display the pixmap.
|
Publicité
Best OfActualités les plus luesSemaine
Mois
Année
Le Qt Labs au hasardLa théorie des chaînesLes Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.
CommunautéRessources
Liens utilesContact
Qt dans le magazine |
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 3.2 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com