中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

iis 添加網(wǎng)站 win7種子搜索神器

iis 添加網(wǎng)站 win7,種子搜索神器,哈爾濱市松北區(qū)政府網(wǎng),商丘網(wǎng)絡(luò)營(yíng)銷服務(wù)目錄 QSplashScreen 類介紹 使用方式 項(xiàng)目中使用 THPrinterSplashScreen頭文件 THPrinterSplashScreen實(shí)現(xiàn)代碼 使用代碼 使用效果 QSplashScreen 類介紹 QSplashScreen 是 Qt 中的一個(gè)類,用于顯示啟動(dòng)畫(huà)面。它通常在應(yīng)用程序啟動(dòng)時(shí)顯示,以向用戶顯…

目錄

QSplashScreen 類介紹

?使用方式

項(xiàng)目中使用

THPrinterSplashScreen頭文件

?THPrinterSplashScreen實(shí)現(xiàn)代碼

使用代碼?

使用效果

?


QSplashScreen 類介紹

?????????QSplashScreen?是?Qt?中的一個(gè)類,用于顯示啟動(dòng)畫(huà)面。它通常在應(yīng)用程序啟動(dòng)時(shí)顯示,以向用戶顯示應(yīng)用程序正在啟動(dòng)的狀態(tài)。啟動(dòng)畫(huà)面可以是一個(gè)圖片,也可以是一個(gè)包含了文本、圖片等內(nèi)容的窗口。

QSplashScreen(const QPixmap &pixmap = QPixmap(), Qt::WindowFlags f = Qt::WindowFlags())

QSplashScreen(QWidget *parent, const QPixmap &pixmap = QPixmap(), Qt::WindowFlags f = Qt::WindowFlags())


virtual?~QSplashScreen()


void?finish(QWidget *mainWin)

QString?message() const


const QPixmap?pixmap() const


void?repaint()


void? setPixmap(const QPixmap &pixmap)

//slots
void?clearMessage()
void?showMessage(const QString &message, int alignment = Qt::AlignLeft, const QColor &color = Qt::black)

//protected 可以繼承自繪
virtual void?drawContents(QPainter *painter)
?

?使用方式

????????以下是Qt官方文檔給出的兩種使用場(chǎng)景。

? 作為主窗口啟動(dòng)前的啟動(dòng)動(dòng)畫(huà)

  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(&window);return app.exec();}

主窗口啟動(dòng)前軟件啟動(dòng)提示信息

  QPixmap pixmap(":/splash.png");QSplashScreen *splash = new QSplashScreen(pixmap);splash->show();... // Loading some itemssplash->showMessage("Loaded modules");qApp->processEvents();... // Establishing connectionssplash->showMessage("Established connections");qApp->processEvents();

項(xiàng)目中使用

? ? ? ? 實(shí)際項(xiàng)目中如果軟件啟動(dòng)比較耗時(shí),一般需要根據(jù)軟件的樣式風(fēng)格和互動(dòng)需求自定義啟動(dòng)動(dòng)畫(huà)效果,此時(shí)virtual void?drawContents(QPainter *painter) 和?repaint()就顯得尤為重要。

????????以下是根據(jù)自身項(xiàng)目,加載啟動(dòng)動(dòng)畫(huà)時(shí)顯示軟件版本信息和啟動(dòng)進(jìn)度等信息,主要繼承drawContents進(jìn)行重繪。

THPrinterSplashScreen頭文件

#ifndef THPrinterSplashScreenT_H
#define THPrinterSplashScreenT_H#include <QSplashScreen>
#include "Common.h"#define g_pSplashScreen Singleton<THPrinterSplashScreen>::getInstance()class THPrinterSplashScreen : public QSplashScreen
{Q_OBJECTfriend Singleton<THPrinterSplashScreen>;
public://關(guān)閉自身前可以再次操作void finish(QWidget *w);//設(shè)置啟動(dòng)進(jìn)度0-100void setProgressValue(int value);//設(shè)置啟動(dòng)提示信息 如庫(kù)加載信息、數(shù)據(jù)庫(kù)啟動(dòng)...void setTipStr(const QString&tipStr);protected://重寫(xiě)此函數(shù) 自定義繪制啟動(dòng)動(dòng)畫(huà)void drawContents(QPainter *painter) override;
private:THPrinterSplashScreen();~THPrinterSplashScreen() = default;QPixmap m_pixIcon;QPixmap m_picBackground;int     m_nProgressValue = 0;QString m_strTip;
};#endif // THPrinterSplashScreenT_H

?THPrinterSplashScreen實(shí)現(xiàn)代碼


#pragma execution_character_set("utf-8")THPrinterSplashScreen::THPrinterSplashScreen()	
{m_picBackground.load(":/images/icon/background.png");m_pixIcon.load(":/images/icon/logo.png");setPixmap(m_picBackground);setWindowFlag(Qt::WindowStaysOnTopHint);
}void THPrinterSplashScreen::finish(QWidget *w)
{setProgressValue(100);setTipStr("程序加載完成!");QSplashScreen::finish(w);
}void THPrinterSplashScreen::setProgressValue(int value)
{if (isVisible() && value >= 0 && m_nProgressValue < value) {value = qBound(0, value,100);m_nProgressValue = value;repaint();}
}void THPrinterSplashScreen::setTipStr(const QString&tipStr)
{if (isVisible() && !tipStr.isEmpty() && m_strTip != tipStr) {m_strTip = tipStr;repaint();}
}void THPrinterSplashScreen::drawContents(QPainter *painter)
{QSplashScreen::drawContents(painter);int bg_w = m_picBackground.width();int bg_h = m_picBackground.height();int icon_w = m_pixIcon.width();int icon_h = m_pixIcon.height();//默認(rèn)垂直方向dpi為96 防止不同設(shè)備分辨率不同字體差異過(guò)大float fFactor = logicalDpiY() / 96.0f; int smallFontSize = qRound(10 * fFactor);int midFontSize = qRound(15 * fFactor);int bigFontSize = qRound(20 * fFactor);int fontGapSize = 6;int magrinGapSize = 10;int offset = -20;int icon_x = (bg_w - icon_w) / 2;int icon_y = (bg_h - icon_h) / 2  + offset;int text_name_y = (bg_h + icon_h) / 2 + magrinGapSize + offset;int text_TipStr_y = text_name_y + bigFontSize + fontGapSize;int text_version_y = bg_h - fontGapSize - midFontSize;QRect rect_Icon(icon_x, icon_y, icon_w, icon_h);//相對(duì)于parent 左上角坐標(biāo) 長(zhǎng)寬QRect rect_Name_Text(0, text_name_y, bg_w, bigFontSize + fontGapSize);QRect rect_TipStr_Text(0, text_TipStr_y, bg_w, smallFontSize + fontGapSize);QRect rect_Version_Text(0, text_version_y, bg_w, midFontSize + fontGapSize);// 繪制啟動(dòng)動(dòng)畫(huà)logopainter->drawPixmap(rect_Icon, m_pixIcon);//繪制軟件名稱auto font = painter->font();font.setBold(true);font.setPointSize(bigFontSize);painter->setFont(font);auto pen = painter->pen();pen.setColor(Qt::white);painter->setPen(pen);painter->drawText(rect_Name_Text, Qt::AlignCenter, tr("設(shè)備指紋燒錄工具"));//繪制啟動(dòng)中提示信息font = painter->font();font.setBold(false);font.setPointSize(smallFontSize);painter->setFont(font);if (!m_strTip.isEmpty()){painter->drawText(rect_TipStr_Text, Qt::AlignCenter, m_strTip);}//繪制軟件版本信息font = painter->font();font.setPointSize(midFontSize);painter->setFont(font);auto &strVersion = PmsUpDater::getVersion();if (!strVersion.isEmpty()) {painter->drawText(rect_Version_Text, Qt::AlignCenter, strVersion);}//在rect_Version_Text最右側(cè)繪制軟件啟動(dòng)進(jìn)度if (m_nProgressValue >= 0) {rect_Version_Text.adjust(0, 0, -midFontSize, 0);painter->drawText(rect_Version_Text,Qt::AlignVCenter | Qt::AlignRight,QString("%1%").arg(m_nProgressValue));}
}

使用代碼?

main函數(shù)中嵌入到軟件主界面啟動(dòng)前后。

	int main(int argc, char *argv[]){//...g_pSplashScreen->setProgressValue(0);g_pSplashScreen->show();PmsUpDater w;w.show();g_pSplashScreen->finish(&w);//...return a.exec();}

????????在程序啟動(dòng)比較耗時(shí)的地方添加進(jìn)度信息和提示信息,便于判斷程序啟動(dòng)的狀態(tài),若程序啟動(dòng)失敗也可作為定位失敗位置的信息。

int THPrinter::Initial(){//...//初始化SDKInitialSdk();g_pSplashScreen->setTipStr("SDK初始化成功!");g_pSplashScreen->setProgressValue(53);//...//數(shù)據(jù)庫(kù)連接開(kāi)始g_pSplashScreen->setTipStr("數(shù)據(jù)庫(kù)連接中...");g_pSplashScreen->setProgressValue(56);//...//連接完成g_pSplashScreen->setTipStr("數(shù)據(jù)庫(kù)連完成");g_pSplashScreen->setProgressValue(57);//...}

使用效果

http://www.risenshineclean.com/news/47532.html

相關(guān)文章:

  • 怎么做網(wǎng)站點(diǎn)擊率監(jiān)控工具國(guó)內(nèi)seo做最好的公司
  • 大安網(wǎng)站建設(shè)網(wǎng)站制作公司有哪些
  • 如何尋找一批做網(wǎng)站的公司查看今日頭條
  • 開(kāi)發(fā)網(wǎng)站比較好的公司公司網(wǎng)絡(luò)搭建
  • 滄州網(wǎng)站建沒(méi)搜狗營(yíng)銷
  • 做網(wǎng)站 科目今天發(fā)生的新聞
  • 本地房產(chǎn)交易信息網(wǎng)人員優(yōu)化方案
  • 濰坊??茖W(xué)校深圳seo排名
  • 諸城網(wǎng)站建設(shè)電子商務(wù)網(wǎng)店運(yùn)營(yíng)推廣
  • 開(kāi)個(gè)網(wǎng)站需要什么條件福建省人民政府
  • 東營(yíng)定制網(wǎng)站建設(shè)服務(wù)成人編程培訓(xùn)機(jī)構(gòu)排名前十
  • 免費(fèi)主機(jī)空間網(wǎng)絡(luò)營(yíng)銷優(yōu)化培訓(xùn)
  • 在線注冊(cè)個(gè)體工商戶企業(yè)seo關(guān)鍵詞優(yōu)化
  • 免費(fèi)行情網(wǎng)站北京sem
  • 西寧微信網(wǎng)站建設(shè)需要多少錢網(wǎng)店運(yùn)營(yíng)與推廣
  • dede建設(shè)網(wǎng)站教程sem推廣
  • 商務(wù)部網(wǎng)站建設(shè)情況匯報(bào)公司seo排名優(yōu)化
  • 如何制作一個(gè)自己的網(wǎng)站中國(guó)十大經(jīng)典廣告
  • 做網(wǎng)絡(luò)銷售都做什么網(wǎng)站饑餓營(yíng)銷的十大案例
  • 佛山專業(yè)網(wǎng)站營(yíng)銷seo是什么意思網(wǎng)絡(luò)用語(yǔ)
  • 平面設(shè)計(jì)類網(wǎng)站app開(kāi)發(fā)公司排行榜
  • 湖南建設(shè)廳網(wǎng)站不良記錄數(shù)據(jù)分析師資格證書(shū)怎么考
  • 門戶網(wǎng)站意思種子搜索引擎在線
  • 做網(wǎng)站業(yè)務(wù)員提成幾個(gè)點(diǎn)網(wǎng)絡(luò)營(yíng)銷的渠道有哪些
  • 建設(shè)網(wǎng)站的目的服裝類鎮(zhèn)江網(wǎng)站定制
  • 蕪湖做網(wǎng)站的鄧健照片企業(yè)培訓(xùn)
  • 做網(wǎng)站的費(fèi)用 可以抵扣嗎網(wǎng)絡(luò)整合營(yíng)銷4i原則
  • 下載app軟件安裝搜索引擎優(yōu)化公司排行
  • 網(wǎng)站開(kāi)發(fā)連接形式合肥網(wǎng)站優(yōu)化推廣方案
  • 刪除wordpress站高端營(yíng)銷型網(wǎng)站