符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
这篇文章主要讲解了“Qt通用方法及类库是什么”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Qt通用方法及类库是什么”吧!
十年的海州网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都全网营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整海州建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联公司从事“海州网站设计”,“海州网站推广”以来,每个客户项目都认真落实执行。
//设置全局样式 static void setStyle(QUIWidget::Style style); static void setStyle(const QString &qssFile, QString &paletteColor, QString &textColor); static void setStyle(const QString &qssFile, QString &textColor, QString &panelColor, QString &borderColor, QString &normalColorStart, QString &normalColorEnd, QString &darkColorStart, QString &darkColorEnd, QString &highColor); //根据QSS样式获取对应颜色值 static void getQssColor(const QString &qss, QString &textColor, QString &panelColor, QString &borderColor, QString &normalColorStart, QString &normalColorEnd, QString &darkColorStart, QString &darkColorEnd, QString &highColor);
void QUIHelper::setStyle(QUIWidget::Style style) { QString qssFile = ":/qss/lightblue.css"; if (style == QUIWidget::Style_Silvery) { qssFile = ":/qss/silvery.css"; } else if (style == QUIWidget::Style_Blue) { qssFile = ":/qss/blue.css"; } else if (style == QUIWidget::Style_LightBlue) { qssFile = ":/qss/lightblue.css"; } else if (style == QUIWidget::Style_DarkBlue) { qssFile = ":/qss/darkblue.css"; } else if (style == QUIWidget::Style_Gray) { qssFile = ":/qss/gray.css"; } else if (style == QUIWidget::Style_LightGray) { qssFile = ":/qss/lightgray.css"; } else if (style == QUIWidget::Style_DarkGray) { qssFile = ":/qss/darkgray.css"; } else if (style == QUIWidget::Style_Black) { qssFile = ":/qss/black.css"; } else if (style == QUIWidget::Style_LightBlack) { qssFile = ":/qss/lightblack.css"; } else if (style == QUIWidget::Style_DarkBlack) { qssFile = ":/qss/darkblack.css"; } else if (style == QUIWidget::Style_PSBlack) { qssFile = ":/qss/psblack.css"; } else if (style == QUIWidget::Style_FlatBlack) { qssFile = ":/qss/flatblack.css"; } else if (style == QUIWidget::Style_FlatWhite) { qssFile = ":/qss/flatwhite.css"; } else if (style == QUIWidget::Style_Purple) { qssFile = ":/qss/purple.css"; } else if (style == QUIWidget::Style_BlackBlue) { qssFile = ":/qss/blackblue.css"; } else if (style == QUIWidget::Style_BlackVideo) { qssFile = ":/qss/blackvideo.css"; } QFile file(qssFile); if (file.open(QFile::ReadOnly)) { QString qss = QLatin1String(file.readAll()); QString paletteColor = qss.mid(20, 7); getQssColor(qss, QUIConfig::TextColor, QUIConfig::PanelColor, QUIConfig::BorderColor, QUIConfig::NormalColorStart, QUIConfig::NormalColorEnd, QUIConfig::DarkColorStart, QUIConfig::DarkColorEnd, QUIConfig::HighColor); qApp->setPalette(QPalette(QColor(paletteColor))); qApp->setStyleSheet(qss); file.close(); } } void QUIHelper::setStyle(const QString &qssFile, QString &paletteColor, QString &textColor) { QFile file(qssFile); if (file.open(QFile::ReadOnly)) { QString qss = QLatin1String(file.readAll()); paletteColor = qss.mid(20, 7); textColor = qss.mid(49, 7); getQssColor(qss, QUIConfig::TextColor, QUIConfig::PanelColor, QUIConfig::BorderColor, QUIConfig::NormalColorStart, QUIConfig::NormalColorEnd, QUIConfig::DarkColorStart, QUIConfig::DarkColorEnd, QUIConfig::HighColor); qApp->setPalette(QPalette(QColor(paletteColor))); qApp->setStyleSheet(qss); file.close(); } } void QUIHelper::setStyle(const QString &qssFile, QString &textColor, QString &panelColor, QString &borderColor, QString &normalColorStart, QString &normalColorEnd, QString &darkColorStart, QString &darkColorEnd, QString &highColor) { QFile file(qssFile); if (file.open(QFile::ReadOnly)) { QString qss = QLatin1String(file.readAll()); getQssColor(qss, textColor, panelColor, borderColor, normalColorStart, normalColorEnd, darkColorStart, darkColorEnd, highColor); qApp->setPalette(QPalette(QColor(panelColor))); qApp->setStyleSheet(qss); file.close(); } } void QUIHelper::getQssColor(const QString &qss, QString &textColor, QString &panelColor, QString &borderColor, QString &normalColorStart, QString &normalColorEnd, QString &darkColorStart, QString &darkColorEnd, QString &highColor) { QString str = qss; QString flagTextColor = "TextColor:"; int indexTextColor = str.indexOf(flagTextColor); if (indexTextColor >= 0) { textColor = str.mid(indexTextColor + flagTextColor.length(), 7); } QString flagPanelColor = "PanelColor:"; int indexPanelColor = str.indexOf(flagPanelColor); if (indexPanelColor >= 0) { panelColor = str.mid(indexPanelColor + flagPanelColor.length(), 7); } QString flagBorderColor = "BorderColor:"; int indexBorderColor = str.indexOf(flagBorderColor); if (indexBorderColor >= 0) { borderColor = str.mid(indexBorderColor + flagBorderColor.length(), 7); } QString flagNormalColorStart = "NormalColorStart:"; int indexNormalColorStart = str.indexOf(flagNormalColorStart); if (indexNormalColorStart >= 0) { normalColorStart = str.mid(indexNormalColorStart + flagNormalColorStart.length(), 7); } QString flagNormalColorEnd = "NormalColorEnd:"; int indexNormalColorEnd = str.indexOf(flagNormalColorEnd); if (indexNormalColorEnd >= 0) { normalColorEnd = str.mid(indexNormalColorEnd + flagNormalColorEnd.length(), 7); } QString flagDarkColorStart = "DarkColorStart:"; int indexDarkColorStart = str.indexOf(flagDarkColorStart); if (indexDarkColorStart >= 0) { darkColorStart = str.mid(indexDarkColorStart + flagDarkColorStart.length(), 7); } QString flagDarkColorEnd = "DarkColorEnd:"; int indexDarkColorEnd = str.indexOf(flagDarkColorEnd); if (indexDarkColorEnd >= 0) { darkColorEnd = str.mid(indexDarkColorEnd + flagDarkColorEnd.length(), 7); } QString flagHighColor = "HighColor:"; int indexHighColor = str.indexOf(flagHighColor); if (indexHighColor >= 0) { highColor = str.mid(indexHighColor + flagHighColor.length(), 7); } }
感谢各位的阅读,以上就是“Qt通用方法及类库是什么”的内容了,经过本文的学习后,相信大家对Qt通用方法及类库是什么这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!