QSplashScreen(3qt)

πŸ“¦ version 3.3.8b, in fedora 43, fedora 44

πŸ’– QSplashScreen πŸ’–

okay bestie so like. <qsplashscreen.h> β€” the QSplashScreen widget. it's a splash screen, and you can show it while your app is starting up. she's giving main character energy before the main character even shows up. ✨

(also she inherits QWidget, so she's got all that widget pedigree, periodt.)


🌸 SYNOPSIS 🌸

#include <qsplashscreen.h>

πŸŽ€ Public Members

  • QSplashScreen ( const QPixmap & pixmap = QPixmap ( ), WFlags f = 0 )
  • virtual ~QSplashScreen ()
  • void setPixmap ( const QPixmap & pixmap )
  • QPixmap * pixmap () const
  • void finish ( QWidget * mainWin )
  • void repaint ()

πŸŽ€ Public Slots

  • void message ( const QString & message, int alignment = AlignLeft, const QColor & color = black )
  • void clear ()

πŸŽ€ Signals

  • void messageChanged ( const QString & message )

πŸŽ€ Protected Members

  • virtual void drawContents ( QPainter * painter )

✨ DESCRIPTION ✨

so the QSplashScreen widget gives you a splash screen you can show while your application is starting up. that's the whole vibe. πŸ’…

a splash screen is a widget that usually pops up when an application is being started. splash screens are often used for apps that have long start up times (think database or networking applications that take a hot minute to establish connections) β€” she's there to give the user feedback that the application is loading. no more staring at nothing, bestie. 🫢

the splash screen appears centered on the screen. it may be useful to add the WStyle_StaysOnTop if you desire to keep above all the windows in the GUI. πŸ‘‘

okay but real talk: some X11 window managers do not support the "stays on top" flag. the solution is to set up a timer that periodically calls raise() on the splash screen to simulate the "stays on top" effect. hacky? yes. iconic? also yes. 🧚

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(). your splash, your rules. 🎨

the user can hide the splash screen by clicking on it with the mouse. and because 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. don't forget it or she'll just sit there ignoring everyone, lowkey rude of you honestly 😭

QPixmap pixmap( "splash.png" );
QSplashScreen *splash = new QSplashScreen( pixmap );
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 πŸ’œ

QSplashScreen::QSplashScreen ( const QPixmap & pixmap = QPixmap ( ), WFlags f = 0 )

construct a splash screen that will display the pixmap. πŸ–ΌοΈ

there should be no need to set the widget flags, f, except perhaps WDestructiveClose or WStyle_StaysOnTop. like, you can, but she's fine as she is.

QSplashScreen::~QSplashScreen () [virtual]

destructor. bye bestie πŸ‘‹

void QSplashScreen::clear () [slot]

removes the message being displayed on the splash screen. poof. gone. ✨

See also message().

void QSplashScreen::drawContents ( QPainter * painter ) [virtual protected]

draw the contents of the splash screen using painter painter. the default implementation draws the message passed by message(). reimplement this function if you want to do your own drawing on the splash screen. go off, artiste πŸŽ€

void QSplashScreen::finish ( QWidget * mainWin )

makes the splash screen wait until the widget mainWin is displayed before calling close() on itself. she's patient like that. πŸ’…

void QSplashScreen::message ( const QString & message, int alignment = AlignLeft, const QColor & color = black ) [slot]

draws the message text onto the splash screen with color color and aligns the text according to the flags in alignment.

See also Qt::AlignmentFlags and clear().

void QSplashScreen::messageChanged ( const QString & message ) [signal]

this signal is emitted when the message on the splash screen changes. message is the new message and is a null-string when the message has been removed. 🌈

See also message() and clear().

QPixmap * QSplashScreen::pixmap () const

returns the pixmap that is used in the splash screen. the image does not have any of the text drawn by message() calls. so like, clean pixmap only, no extra toppings. πŸ“

void QSplashScreen::repaint ()

this overrides QWidget::repaint(). it differs from the standard repaint function in that it also calls QApplication::flush() to ensure the updates are displayed, even when there is no event loop present. she's not waiting around for your event loop, she's flushing, periodt. πŸ”₯

void QSplashScreen::setPixmap ( const QPixmap & pixmap )

sets the pixmap that will be used as the splash screen's image to pixmap. glow up achieved. ✨


🌟 SEE ALSO 🌟


Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.


πŸ’« AUTHOR πŸ’«

Generated automatically from the source code. (yes, she was born from a script. still slay.)


πŸ’€ BUGS πŸ’€

if you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. good bug reports help us to help you. thank you. 🫢

the definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. this man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. (iykyk 😭)

if you find errors in this manual page, please report them to qt-bugs@trolltech.com. please include the name of the manual page (qsplashscreen.3qt) and the Qt version (3.3.8). be specific bestie, it helps!! πŸ’–


okay that's the whole thing πŸŽ€ this page came from Trolltech AS, dated 2 February 2007, and it's the QSplashScreen(3qt) manual page for Qt 3.3.8. mwah, go build something cute πŸ’…πŸŒΈ

πŸ“¦ where this page comes from