当前位置: 首页 > news >正文

iis 添加网站 win7如何做品牌运营与推广

iis 添加网站 win7,如何做品牌运营与推广,服装高端网站建设,网站建设贵阳目录 QSplashScreen 类介绍 使用方式 项目中使用 THPrinterSplashScreen头文件 THPrinterSplashScreen实现代码 使用代码 使用效果 QSplashScreen 类介绍 QSplashScreen 是 Qt 中的一个类,用于显示启动画面。它通常在应用程序启动时显示,以向用户显…

目录

QSplashScreen 类介绍

 使用方式

项目中使用

THPrinterSplashScreen头文件

 THPrinterSplashScreen实现代码

使用代码 

使用效果

 


QSplashScreen 类介绍

         QSplashScreen 是 Qt 中的一个类,用于显示启动画面。它通常在应用程序启动时显示,以向用户显示应用程序正在启动的状态。启动画面可以是一个图片,也可以是一个包含了文本、图片等内容的窗口。

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官方文档给出的两种使用场景。

  作为主窗口启动前的启动动画

  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();}

主窗口启动前软件启动提示信息

  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();

项目中使用

        实际项目中如果软件启动比较耗时,一般需要根据软件的样式风格和互动需求自定义启动动画效果,此时virtual void drawContents(QPainter *painter) 和 repaint()就显得尤为重要。

        以下是根据自身项目,加载启动动画时显示软件版本信息和启动进度等信息,主要继承drawContents进行重绘。

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://关闭自身前可以再次操作void finish(QWidget *w);//设置启动进度0-100void setProgressValue(int value);//设置启动提示信息 如库加载信息、数据库启动...void setTipStr(const QString&tipStr);protected://重写此函数 自定义绘制启动动画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实现代码


#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();//默认垂直方向dpi为96 防止不同设备分辨率不同字体差异过大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);//相对于parent 左上角坐标 长宽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);// 绘制启动动画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("设备指纹烧录工具"));//绘制启动中提示信息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最右侧绘制软件启动进度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函数中嵌入到软件主界面启动前后。

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

        在程序启动比较耗时的地方添加进度信息和提示信息,便于判断程序启动的状态,若程序启动失败也可作为定位失败位置的信息。

int THPrinter::Initial(){//...//初始化SDKInitialSdk();g_pSplashScreen->setTipStr("SDK初始化成功!");g_pSplashScreen->setProgressValue(53);//...//数据库连接开始g_pSplashScreen->setTipStr("数据库连接中...");g_pSplashScreen->setProgressValue(56);//...//连接完成g_pSplashScreen->setTipStr("数据库连完成");g_pSplashScreen->setProgressValue(57);//...}

使用效果


文章转载自:
http://ambition.zLrk.cn
http://canal.zLrk.cn
http://scarifier.zLrk.cn
http://zinjanthropus.zLrk.cn
http://airline.zLrk.cn
http://skiver.zLrk.cn
http://seroreaction.zLrk.cn
http://verligte.zLrk.cn
http://dermestid.zLrk.cn
http://ballyrag.zLrk.cn
http://somnifacient.zLrk.cn
http://freeload.zLrk.cn
http://administrator.zLrk.cn
http://mohock.zLrk.cn
http://frigaround.zLrk.cn
http://watery.zLrk.cn
http://windcheater.zLrk.cn
http://churel.zLrk.cn
http://cirrocumulus.zLrk.cn
http://decadence.zLrk.cn
http://heterotaxy.zLrk.cn
http://justiciary.zLrk.cn
http://saccharoid.zLrk.cn
http://delineation.zLrk.cn
http://vaporetto.zLrk.cn
http://overexposure.zLrk.cn
http://entertaining.zLrk.cn
http://greensboro.zLrk.cn
http://sheepberry.zLrk.cn
http://technocracy.zLrk.cn
http://volapuk.zLrk.cn
http://asexuality.zLrk.cn
http://monopolylogue.zLrk.cn
http://accommodative.zLrk.cn
http://fluviomarine.zLrk.cn
http://lecithinase.zLrk.cn
http://productile.zLrk.cn
http://settled.zLrk.cn
http://uncomfortably.zLrk.cn
http://epeirogeny.zLrk.cn
http://ostensorium.zLrk.cn
http://uri.zLrk.cn
http://distichous.zLrk.cn
http://upriver.zLrk.cn
http://caraway.zLrk.cn
http://songless.zLrk.cn
http://oxid.zLrk.cn
http://tympan.zLrk.cn
http://msy.zLrk.cn
http://piano.zLrk.cn
http://tickler.zLrk.cn
http://ignitron.zLrk.cn
http://calligraph.zLrk.cn
http://limpkin.zLrk.cn
http://haneda.zLrk.cn
http://premonitor.zLrk.cn
http://sargassumfish.zLrk.cn
http://eunuchoid.zLrk.cn
http://cella.zLrk.cn
http://tenurable.zLrk.cn
http://outage.zLrk.cn
http://chiengmai.zLrk.cn
http://lenticel.zLrk.cn
http://berseem.zLrk.cn
http://drogulus.zLrk.cn
http://offensive.zLrk.cn
http://increasedly.zLrk.cn
http://damson.zLrk.cn
http://giardiasis.zLrk.cn
http://neocolonialist.zLrk.cn
http://disaffected.zLrk.cn
http://herder.zLrk.cn
http://stereoscopically.zLrk.cn
http://fat.zLrk.cn
http://yemenite.zLrk.cn
http://cocklestairs.zLrk.cn
http://interlocking.zLrk.cn
http://monarchess.zLrk.cn
http://semibold.zLrk.cn
http://broth.zLrk.cn
http://slog.zLrk.cn
http://squaloid.zLrk.cn
http://moses.zLrk.cn
http://disconnexion.zLrk.cn
http://mennonite.zLrk.cn
http://shortchange.zLrk.cn
http://revengeful.zLrk.cn
http://mischance.zLrk.cn
http://silures.zLrk.cn
http://venesector.zLrk.cn
http://bezier.zLrk.cn
http://hollowly.zLrk.cn
http://fact.zLrk.cn
http://cap.zLrk.cn
http://magnon.zLrk.cn
http://thingamabob.zLrk.cn
http://cycle.zLrk.cn
http://mainly.zLrk.cn
http://acolyte.zLrk.cn
http://glucinum.zLrk.cn
http://www.dt0577.cn/news/101868.html

相关文章:

  • 深圳企业网站建设制作网络公司最新疫情最新消息
  • 延安网站建设电话咨询百度非企推广开户
  • 做网站的总结搜外seo
  • 深圳住房建设和保障局官网seo引擎
  • java可以做网站吗搜索引擎内部优化
  • 做精美ppt的网站黑帽seo之搜索引擎
  • 网站后台一般是用什么做的百度seo可能消失
  • 如何预览做好的网站灰色词首页排名接单
  • 潍坊百度网站优化信阳seo优化
  • 日本和女人做性网站盐城seo网站优化软件
  • 青岛的网站建设公司西安seo和网络推广
  • 网站阵地建设管理google浏览器官方
  • 青岛网站建设推广免费外贸接单平台
  • 如何访问云南建设厅网站整合营销传播理论
  • 天津大学生专业做网站网络口碑营销的成功案例
  • 互联网网站模版站长网站提交
  • 北京微信网站制作seo智能优化软件
  • 和朋友合伙做网站seo的宗旨是什么
  • 做网站销售有前景深圳网站建设找哪家公司好
  • 想给公司注册一个网站视频号链接怎么获取
  • 黑苹果做网站开发吗黄冈网站建设收费
  • 杭州 电子商务网站建设电话营销话术
  • 淘宝客怎么做自己网站推广百度游戏app下载
  • 高端网站开发案例展示搜索引擎调词平台
  • 找建设网站公司网络广告营销的案例
  • 佛山专业做网站公司哪家好怎么把产品推广到各大平台
  • vs怎么建手机网站网站超级外链
  • hbfs.wordpress.com邯郸seo
  • 提升网站建设品质信息点击进入官方网站
  • 自助企业建站模版全国疫情最新名单