From 91dcb825164daf9081284e463e25dde6f4397b4b Mon Sep 17 00:00:00 2001 From: feiyangqingyun Date: Tue, 27 Apr 2021 09:52:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=A0=B7=E5=BC=8F=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styledemo/frmmain.cpp | 12 +++------ styledemo/frmmain.h | 3 --- styledemo/frmmain.ui | 43 +++++++++++++++++++++++++++---- styledemo/main.cpp | 5 ++-- styledemo/other/qss/flatwhite.css | 11 +------- styledemo/other/qss/lightblue.css | 11 +------- styledemo/other/qss/psblack.css | 15 +++-------- 7 files changed, 49 insertions(+), 51 deletions(-) diff --git a/styledemo/frmmain.cpp b/styledemo/frmmain.cpp index cfa363d..453a128 100644 --- a/styledemo/frmmain.cpp +++ b/styledemo/frmmain.cpp @@ -5,7 +5,6 @@ #include "qtextstream.h" #include "qtranslator.h" #include "qdesktopwidget.h" -#include "qmessagebox.h" #include "qdebug.h" frmMain::frmMain(QWidget *parent) : QMainWindow(parent), ui(new Ui::frmMain) @@ -158,9 +157,9 @@ void frmMain::initStyle() { //加载样式表 QString qss; - QFile file(":/qss/psblack.css"); + //QFile file(":/qss/psblack.css"); //QFile file(":/qss/flatwhite.css"); - //QFile file(":/qss/lightblue.css"); + QFile file(":/qss/lightblue.css"); if (file.open(QFile::ReadOnly)) { #if 1 //用QTextStream读取样式文件不用区分文件编码 带bom也行 @@ -179,7 +178,7 @@ void frmMain::initStyle() qss = QLatin1String(file.readAll()); #endif QString paletteColor = qss.mid(20, 7); - qApp->setPalette(QPalette(QColor(paletteColor))); + qApp->setPalette(QPalette(paletteColor)); qApp->setStyleSheet(qss); file.close(); } @@ -197,8 +196,3 @@ void frmMain::initTranslator() translator2->load(":/image/widgets.qm"); qApp->installTranslator(translator2); } - -void frmMain::on_btnInfo_clicked() -{ - QMessageBox::information(this, "提示", "这里是提示信息!"); -} diff --git a/styledemo/frmmain.h b/styledemo/frmmain.h index adefa61..3fa765b 100644 --- a/styledemo/frmmain.h +++ b/styledemo/frmmain.h @@ -30,9 +30,6 @@ private slots: void initOther(); void initStyle(); void initTranslator(); - -private slots: - void on_btnInfo_clicked(); }; #endif // FRMMAIN_H diff --git a/styledemo/frmmain.ui b/styledemo/frmmain.ui index 8f6ff8f..a351c06 100644 --- a/styledemo/frmmain.ui +++ b/styledemo/frmmain.ui @@ -6,8 +6,8 @@ 0 0 - 850 - 626 + 978 + 723 @@ -1218,8 +1218,8 @@ 0 0 - 850 - 23 + 978 + 26 @@ -1310,5 +1310,38 @@ - + + + horizontalSlider + valueChanged(int) + progressBar1 + setValue(int) + + + 422 + 600 + + + 423 + 627 + + + + + verticalSlider + valueChanged(int) + progressBar2 + setValue(int) + + + 885 + 589 + + + 902 + 589 + + + + diff --git a/styledemo/main.cpp b/styledemo/main.cpp index af0ce3f..a7b00a3 100644 --- a/styledemo/main.cpp +++ b/styledemo/main.cpp @@ -1,4 +1,5 @@ -#include "frmmain.h" +#pragma execution_character_set("utf-8") +#include "frmmain.h" #include #include #include @@ -23,7 +24,7 @@ int main(int argc, char *argv[]) #endif frmMain w; - w.setWindowTitle("styledemo Author: feiyangqingyun@163.com QQ: 517216493"); + w.setWindowTitle("样式表示例 (QQ: 517216493 WX: feiyangqingyun)"); w.show(); //居中显示窗体 diff --git a/styledemo/other/qss/flatwhite.css b/styledemo/other/qss/flatwhite.css index 3375011..4953c4d 100644 --- a/styledemo/other/qss/flatwhite.css +++ b/styledemo/other/qss/flatwhite.css @@ -632,16 +632,7 @@ QTabWidget::pane:bottom{bottom:-1px;} QTabWidget::pane:left{right:-1px;} QTabWidget::pane:right{left:-1px;} -QDialog { -background-color:#FFFFFF; -color:#57595B; -} - -QDialogButtonBox > QPushButton { -min-width:50px; -} - -*:disabled,QMenu::item:disabled,QTabBar::tab:disabled{ +*:disabled{ background:#FFFFFF; border-color:#E4E4E4; color:#B6B6B6; diff --git a/styledemo/other/qss/lightblue.css b/styledemo/other/qss/lightblue.css index e6809ba..4b900af 100644 --- a/styledemo/other/qss/lightblue.css +++ b/styledemo/other/qss/lightblue.css @@ -632,16 +632,7 @@ QTabWidget::pane:bottom{bottom:-1px;} QTabWidget::pane:left{right:-1px;} QTabWidget::pane:right{left:-1px;} -QDialog { -background-color:#EAF7FF; -color:#386487; -} - -QDialogButtonBox > QPushButton { -min-width:50px; -} - -*:disabled,QMenu::item:disabled,QTabBar::tab:disabled{ +*:disabled{ background:#EAF7FF; border-color:#DEF0FE; color:#C0DCF2; diff --git a/styledemo/other/qss/psblack.css b/styledemo/other/qss/psblack.css index 79bd3be..b61436d 100644 --- a/styledemo/other/qss/psblack.css +++ b/styledemo/other/qss/psblack.css @@ -73,8 +73,8 @@ border:1px solid #242424; border-radius:3px; padding:2px; background:none; -selection-background-color:#00BB9E; -selection-color:#FFFFFF; +selection-background-color:#484848; +selection-color:#DCDCDC; } QLineEdit:focus,QTextEdit:focus,QPlainTextEdit:focus,QSpinBox:focus,QDoubleSpinBox:focus,QComboBox:focus,QDateEdit:focus,QTimeEdit:focus,QDateTimeEdit:focus,QLineEdit:hover,QTextEdit:hover,QPlainTextEdit:hover,QSpinBox:hover,QDoubleSpinBox:hover,QComboBox:hover,QDateEdit:hover,QTimeEdit:hover,QDateTimeEdit:hover{ @@ -632,16 +632,7 @@ QTabWidget::pane:bottom{bottom:-1px;} QTabWidget::pane:left{right:-1px;} QTabWidget::pane:right{left:-1px;} -QDialog { -background-color:#444444; -color:#DCDCDC; -} - -QDialogButtonBox > QPushButton { -min-width:50px; -} - -*:disabled,QMenu::item:disabled,QTabBar::tab:disabled{ +*:disabled{ background:#444444; border-color:#484848; color:#242424;