|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QSplashScreen
public class QSplashScreen
The 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 in the center of the screen. It may be useful to add the Qt::WindowStaysOnTopHint
to the splash widget's window flags if you want to keep it above all the other windows on the desktop.
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 in which a splash screen is displayed and some initialization tasks are performed before the application's main window is shown:
public static void main(String args[]) { QApplication.initialize(args); QPixmap pixmap = new QPixmap("classpath:splash.png"); QSplashScreen splash = new QSplashScreen(pixmap); splash.show(); QApplication.processEvents(); ... QMainWindow window = new QMainWindow(); window.show(); splash.finish(window); QApplication.exec(); }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. It is sometimes useful to update the splash screen with messages, for example, announcing connections established or modules loaded as the application starts up:
QPixmap pixmap = new QPixmap(":/splash.png"); QSplashScreen splash = new QSplashScreen(pixmap); splash.show(); // Loading some items ... splash.showMessage("Loaded modules"); QApplication.processEvents(); // Establishing connections ... splash.showMessage("Established connections"); QApplication.processEvents();QSplashScreen supports this with the
showMessage()
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()
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget |
---|
QWidget.RenderFlag, QWidget.RenderFlags |
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary | |
---|---|
QSignalEmitter.Signal1 |
messageChanged
This signal takes 1 generic argument(s). |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QSplashScreen()
Construct a splash screen that will display the pixmap. |
|
QSplashScreen(QPixmap pixmap)
Construct a splash screen that will display the pixmap. |
|
QSplashScreen(QPixmap pixmap,
Qt.WindowFlags f)
Construct a splash screen that will display the pixmap. |
|
QSplashScreen(QPixmap pixmap,
Qt.WindowType[] f)
|
|
QSplashScreen(QWidget parent)
This function allows you to specify a parent for your splashscreen. |
|
QSplashScreen(QWidget parent,
QPixmap pixmap)
This function allows you to specify a parent for your splashscreen. |
|
QSplashScreen(QWidget parent,
QPixmap pixmap,
Qt.WindowFlags f)
This function allows you to specify a parent for your splashscreen. |
|
QSplashScreen(QWidget parent,
QPixmap pixmap,
Qt.WindowType[] f)
|
Method Summary | |
---|---|
void |
clearMessage()
Removes the message being displayed on the splash screen |
protected void |
drawContents(QPainter painter)
Draw the contents of the splash screen using painter painter. |
void |
finish(QWidget w)
Makes the splash screen wait until the widget mainWin is displayed before calling close() on itself. |
QPixmap |
pixmap()
Returns the pixmap that is used in the splash screen. |
void |
setPixmap(QPixmap pixmap)
Sets the pixmap that will be used as the splash screen's image to pixmap. |
void |
showMessage(java.lang.String message)
Draws the message text onto the splash screen with color color and aligns the text according to the flags in alignment. |
void |
showMessage(java.lang.String message,
int alignment)
Draws the message text onto the splash screen with color color and aligns the text according to the flags in alignment. |
void |
showMessage(java.lang.String message,
int alignment,
QColor color)
Draws the message text onto the splash screen with color color and aligns the text according to the flags in alignment. |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1 messageChanged
This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.String(named: message)>:
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.
showMessage()
, and clearMessage()
.
Constructor Detail |
---|
public QSplashScreen(QWidget parent, QPixmap pixmap, Qt.WindowType[] f)
public QSplashScreen(QWidget parent, QPixmap pixmap)
public QSplashScreen(QWidget parent)
public QSplashScreen(QWidget parent, QPixmap pixmap, Qt.WindowFlags f)
public QSplashScreen(QPixmap pixmap, Qt.WindowType[] f)
public QSplashScreen(QPixmap pixmap)
There should be no need to set the widget flags, f, except perhaps Qt::WindowStaysOnTopHint
.
public QSplashScreen()
There should be no need to set the widget flags, f, except perhaps Qt::WindowStaysOnTopHint
.
public QSplashScreen(QPixmap pixmap, Qt.WindowFlags f)
There should be no need to set the widget flags, f, except perhaps Qt::WindowStaysOnTopHint
.
Method Detail |
---|
public final void clearMessage()
showMessage()
.
public final void finish(QWidget w)
close()
on itself.
public final QPixmap pixmap()
showMessage()
calls. setPixmap()
.
public final void setPixmap(QPixmap pixmap)
pixmap()
.
public final void showMessage(java.lang.String message, int alignment)
clearMessage()
.
public final void showMessage(java.lang.String message)
clearMessage()
.
public final void showMessage(java.lang.String message, int alignment, QColor color)
clearMessage()
.
protected void drawContents(QPainter painter)
showMessage()
. Reimplement this function if you want to do your own drawing on the splash screen.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |