Qt:Документация 4.3.2/qsplashscreen

Материал из Wiki.crossplatform.ru

Версия от 11:27, 12 января 2009; Root (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] QSplashScreen Class Reference
[модуль QtGui ]

The QSplashScreen widget provides a splash screen that can be shown during application startup. Далее...

 #include <QSplashScreen>

Наследует QWidget.

[править] Открытые функции

  • 201 свойство, унаследованное от QWidget
  • 29 открытых функций, унаследованных от QObject
  • 12 открытых функций, унаследованных от QPaintDevice

[править] Открытые слоты

  • void clearMessage ()
  • void showMessage ( const QString & message, int alignment = Qt::AlignLeft, const QColor & color = Qt::black )
  • 19 открытых слотов, унаследованных от QWidget
  • 1 открытый слот, унаследованный от QObject

[править] Сигналы

  • 1 сигнал, унаследованный от QWidget
  • 1 сигнал, унаследованный от QObject

[править] Защищенные функции

  • 38 защищенных функций, унаследованных от QWidget
  • 7 защищенных функций, унаследованных от QObject
  • 1 защищенная функция, унаследованных от QPaintDevice

[править] Дополнительные унаследованные члены

  • 56 свойств, унаследованных от QWidget
  • 1 свойство, унаследованное от QObject
  • 4 статических открытых члена, унаследованных от QWidget
  • 5 статических открытых членов, унаследованных от QObject
  • 1 защищенный слот, унаследованый от QWidget

[править] Подробное описание

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:

 int main(int argc, char *argv[])
 {
     QApplication app(argc, argv);
     QPixmap pixmap(":/splash.png");
     QSplashScreen splash(pixmap);
     splash.show();
     app.processEvents();
     ...
     QMainWindow window;
     window.show();
     splash.finish(&amp;window);
     return app.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(":/splash.png");
 QSplashScreen *splash = new QSplashScreen(pixmap);
 splash->show();
 
 ... // Loading some items
 splash->showMessage("Loaded modules");
 
 qApp->processEvents();
 
 ... // Establishing connections
 splash->showMessage("Established connections");
 
 qApp->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().


[править] Описание функций-членов

[править]
QSplashScreen::QSplashScreen ( const QPixmap & pixmap = QPixmap(), Qt::WindowFlags f = 0 )

Construct a splash screen that will display the pixmap.

There should be no need to set the widget flags, f, except perhaps Qt::WindowStaysOnTopHint.

[править]
QSplashScreen::QSplashScreen ( QWidget * parent, const QPixmap & pixmap = QPixmap(), Qt::WindowFlags f = 0 )

This function allows you to specify a parent for your splashscreen. The typical use for this constructor is if you have a multiple screens and prefer to have the splash screen on a different screen than your primary one. In that case pass the proper desktop() as the parent.

[править]
QSplashScreen::~QSplashScreen () [virtual]

Деструктор.

[править]
void QSplashScreen::clearMessage () [slot]

Removes the message being displayed on the splash screen

See also showMessage().

[править]
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 showMessage(). Reimplement this function if you want to do your own drawing on the splash screen.

[править]
void QSplashScreen::finish ( QWidget * mainWin )

Makes the splash screen wait until the widget mainWin is displayed before calling close() on itself.

[править]
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 showMessage() and clearMessage().

[править]
const 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 showMessage() calls.

Смотрите также setPixmap().

[править]
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.

[править]
void QSplashScreen::setPixmap ( const QPixmap & pixmap )

Sets the pixmap that will be used as the splash screen's image to pixmap.

Смотрите также pixmap().

[править]
void QSplashScreen::showMessage ( const QString & message, int alignment = Qt::AlignLeft, const QColor & color = Qt::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::Alignment and clearMessage().



Copyright © 2007 Trolltech Trademarks
Qt 4.3.2