Splash Screens
Many applications present a splash screen at startup. Some developers use a splash screen to disguise a slow startup, while others do it to
The
QSplashScreen
class shows an image before the application proper has started. It can also draw a message on the image, to
Below is an example main() function that uses QSplashScreen to present a splash screen in an application that loads modules and establishes network connections at startup.
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QSplashScreen *splash =
new QSplashScreen(QPixmap::fromMimeSource("splash.png"));
splash->show();
splash->message(QObject::tr("Setting up the main window..."),
Qt::AlignRight Qt::AlignTop, Qt::white);
MainWindow mainWin;
app.setMainWidget(&mainWin);
splash->message(QObject::tr("Loading modules..."),
Qt::AlignRight Qt::AlignTop, Qt::white);
loadModules();
splash->message(QObject::tr("Establishing connections..."),
Qt::AlignRight Qt::AlignTop, Qt::white);
establishConnections();
mainWin.show();
splash->finish(&mainWin);
delete splash;
return app.exec();
}
Figure 3.18. A QSplashScreen widget
We have now completed the Spreadsheet application's user interface. In the
|
Chapter 4. Implementing Application Functionality
In the previous two chapters, we explained how to create the Spreadsheet application's
|
The Central WidgetThe central area of a QMainWindow can be occupied by any kind of widget. Here's an overview of the possibilities:
Layouts, splitters, and MDI workspaces can be used in combination with standard Qt widgets or with custom widgets. Chapter 6 covers these classes in depth. For the Spreadsheet application, a QTable subclass is used as the central widget. The QTable class already provides most of the spreadsheet capability we need, but it doesn't understand spreadsheet formulas like "=A1+A2+A3", and it doesn't support clipboard operations. We will implement this missing functionality in the Spreadsheet class, which inherits from QTable . |

GCC: The Complete Reference

C++ GUI Programming with Qt 4 (2nd Edition) (Prentice Hall Open Source Software Development Series)

Advanced Qt Programming: Creating Great Software with C++ and Qt 4 (Prentice Hall Open Source Software Development)

Partial Differential Equations for Scientists and Engineers (Dover Books on Mathematics)