zoukankan      html  css  js  c++  java
  • Splash Screens

    Splash Screens

    如何为QT创建一个闪屏

    Many applications present a splash screen at startup, such as the one shown in Figure 3.18. Some developers use a splash screen to disguise a slow startup, while others do it to satisfy their marketing departments. Adding a splash screen to Qt applications is very easy using the QSplashScreen class.

    The QSplashScreen class shows an image before the main window appears. It can also write messages on the image to inform the user about the progress of the application's initialization process. Typically, the splash screen code is located in main(), before the call to QApplication::exec().

    Next 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;
        splash->setPixmap(QPixmap(":/images/splash.png"));
        splash->show();
    
        Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
        splash->showMessage(QObject::tr("Setting up the main window..."),
                               topRight, Qt::white);
        MainWindow mainWin;
    
        splash->showMessage(QObject::tr("Loading modules..."),
                               topRight, Qt::white);
        loadModules();
    
        splash->showMessage(QObject::tr("Establishing connections..."),
                               topRight, Qt::white);
        establishConnections();
    
        mainWin.show();
        splash->finish(&mainWin);
        delete splash;
    
        return app.exec();
    }

    We have now completed the Spreadsheet application's user interface. In the next chapter, we will complete the application by implementing the core spreadsheet functionality.

    THE END!

    2012年12月30日

  • 相关阅读:
    3D 服务器端以向量计算为主的角色位置的算法
    宇宙中可见物质为 4%,暗物质和暗能量占 96% 是怎么算出来的?
    量子纠缠
    “人的第一感觉(直觉)其实非常准”
    有哪些看似荒谬,其实很科学的理论@知乎、@量子力学
    CPU/寄存器/内存
    原子操作
    简单的介绍下WPF中的MVVM框架
    IOS开发中,TextField和TextView有何区别
    年后小结
  • 原文地址:https://www.cnblogs.com/xingchen/p/2839564.html
Copyright © 2011-2022 走看看