资源简介

Qt带进度条的启动界面

资源截图

代码片段和文件信息

#include “cmysplashscreen.h“
#include 
#include 
CMySplashScreen::CMySplashScreen(QPixmap& pixmapint time) :
    QSplashScreen(pixmap)
    elapseTime(time)
{
    ProgressBar = new QProgressBar(this);
    //设置进度条的位置
    ProgressBar->setGeometry(0pixmap.height()-50pixmap.width()30);
    //设置进度条的样式
    ProgressBar->setstyleSheet(“QProgressBar {color:black;font:30px;text-align:center; }QProgressBar::chunk {background-color: rgb(202 165 14);}“);
    //设置进度条的样式
    ProgressBar->setRange(0 100);
    //设置进度条的当前进度
    ProgressBar->setValue(0);

    generateAscendRandomNumber();
    setProgress();
}

CMySplashScreen::~CMySplashScreen()
{

}

void CMySplashScreen::setProgress()
{
    int tempTime=elapseTime/100;
    for(int i=0;i<100;i++)
    {
       QTimer::singleShot(i*tempTime this SLOT(slotUpdateProgress()));
    }
    QTimer::singleShot(elapseTime this SLOT(close()));

}

void CMySplashScreen::slotUpdateProgress()
{
    static int num=0;
    ProgressBar->setValue(numbersList[num]);
    num++;
}

void CMySplashScreen::generateAscendRandomNumber()
{
    int i;
    qsrand(QTime(000).secsTo(QTime::currentTime()));
    //生成100个大小在[0100]之间的随机数
    for(i=0;i<100;i++)
    {
        numbersList.append(qrand()%101);
    }
    //递增排序
    qSort(numbersList.begin()numbersList.end());
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1478  2016-04-01 14:42  TestSplashscreen\cmysplashscreen.cpp

     文件       1757  2016-04-01 16:01  TestSplashscreen\cmysplashscreen.h

     文件     212689  2016-04-01 16:01  TestSplashscreen\debug\cmysplashscreen.o

     文件     344521  2016-04-01 16:01  TestSplashscreen\debug\main.o

     文件     309491  2016-04-01 15:38  TestSplashscreen\debug\mainwindow.o

     文件       3567  2016-04-01 16:01  TestSplashscreen\debug\moc_cmysplashscreen.cpp

     文件     209117  2016-04-01 16:01  TestSplashscreen\debug\moc_cmysplashscreen.o

     文件       2715  2016-04-01 15:38  TestSplashscreen\debug\moc_mainwindow.cpp

     文件     184600  2016-04-01 15:38  TestSplashscreen\debug\moc_mainwindow.o

     文件     393700  2016-04-01 15:38  TestSplashscreen\debug\qrc_testsplashscreen.cpp

     文件      79817  2016-04-01 15:38  TestSplashscreen\debug\qrc_testsplashscreen.o

     文件    1323229  2016-04-01 16:01  TestSplashscreen\debug\untitled.exe

     文件      75352  2016-04-01 15:25  TestSplashscreen\images\Splashscreen.jpg

     文件        609  2016-04-01 15:38  TestSplashscreen\main.cpp

     文件        235  2016-04-01 15:36  TestSplashscreen\mainwindow.cpp

     文件        315  2016-04-01 15:36  TestSplashscreen\mainwindow.h

     文件        654  2016-04-01 12:08  TestSplashscreen\mainwindow.ui

     文件      25454  2016-04-01 15:36  TestSplashscreen\Makefile

     文件      60082  2016-04-01 15:36  TestSplashscreen\Makefile.Debug

     文件      60203  2016-04-01 15:36  TestSplashscreen\Makefile.Release

     文件        477  2016-04-01 15:33  TestSplashscreen\TestSplashscreen.pro

     文件      23619  2016-04-01 16:01  TestSplashscreen\TestSplashscreen.pro.user

     文件        107  2016-04-01 15:36  TestSplashscreen\testsplashscreen.qrc

     文件       2192  2016-04-01 12:22  TestSplashscreen\ui_mainwindow.h

     目录          0  2016-04-01 16:01  TestSplashscreen\debug

     目录          0  2016-04-01 15:28  TestSplashscreen\images

     目录          0  2016-04-01 12:22  TestSplashscreen\release

     目录          0  2016-04-01 16:01  TestSplashscreen

----------- ---------  ---------- -----  ----

              3315980                    28

............此处省略1个文件信息

评论

共有 条评论