From b6e1ecac97d0603a251d5376d36e213bee7e9c9b Mon Sep 17 00:00:00 2001 From: feiyangqingyun Date: Wed, 3 Mar 2021 16:38:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A0=B7=E5=BC=8F=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styledemo/frmmain.cpp | 10 ++++++++-- styledemo/frmmain.h | 3 +++ styledemo/main.cpp | 2 +- styledemo/other/qss/flatwhite.css | 11 ++++++++++- styledemo/other/qss/lightblue.css | 11 ++++++++++- styledemo/other/qss/psblack.css | 15 ++++++++++++--- 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/styledemo/frmmain.cpp b/styledemo/frmmain.cpp index 8f76cd2..cfa363d 100644 --- a/styledemo/frmmain.cpp +++ b/styledemo/frmmain.cpp @@ -5,6 +5,7 @@ #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) @@ -157,9 +158,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也行 @@ -196,3 +197,8 @@ 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 3fa765b..adefa61 100644 --- a/styledemo/frmmain.h +++ b/styledemo/frmmain.h @@ -30,6 +30,9 @@ private slots: void initOther(); void initStyle(); void initTranslator(); + +private slots: + void on_btnInfo_clicked(); }; #endif // FRMMAIN_H diff --git a/styledemo/main.cpp b/styledemo/main.cpp index 10d4d2a..af0ce3f 100644 --- a/styledemo/main.cpp +++ b/styledemo/main.cpp @@ -23,7 +23,7 @@ int main(int argc, char *argv[]) #endif frmMain w; - w.setWindowTitle("styledemo Author: feiyangqingyun@163.com QQ: 517216493"); + w.setWindowTitle("styledemo Author: feiyangqingyun@163.com QQ: 517216493"); w.show(); //居中显示窗体 diff --git a/styledemo/other/qss/flatwhite.css b/styledemo/other/qss/flatwhite.css index 4953c4d..3375011 100644 --- a/styledemo/other/qss/flatwhite.css +++ b/styledemo/other/qss/flatwhite.css @@ -632,7 +632,16 @@ QTabWidget::pane:bottom{bottom:-1px;} QTabWidget::pane:left{right:-1px;} QTabWidget::pane:right{left:-1px;} -*:disabled{ +QDialog { +background-color:#FFFFFF; +color:#57595B; +} + +QDialogButtonBox > QPushButton { +min-width:50px; +} + +*:disabled,QMenu::item:disabled,QTabBar::tab:disabled{ background:#FFFFFF; border-color:#E4E4E4; color:#B6B6B6; diff --git a/styledemo/other/qss/lightblue.css b/styledemo/other/qss/lightblue.css index 4b900af..e6809ba 100644 --- a/styledemo/other/qss/lightblue.css +++ b/styledemo/other/qss/lightblue.css @@ -632,7 +632,16 @@ QTabWidget::pane:bottom{bottom:-1px;} QTabWidget::pane:left{right:-1px;} QTabWidget::pane:right{left:-1px;} -*:disabled{ +QDialog { +background-color:#EAF7FF; +color:#386487; +} + +QDialogButtonBox > QPushButton { +min-width:50px; +} + +*:disabled,QMenu::item:disabled,QTabBar::tab:disabled{ background:#EAF7FF; border-color:#DEF0FE; color:#C0DCF2; diff --git a/styledemo/other/qss/psblack.css b/styledemo/other/qss/psblack.css index b61436d..79bd3be 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:#484848; -selection-color:#DCDCDC; +selection-background-color:#00BB9E; +selection-color:#FFFFFF; } 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,7 +632,16 @@ QTabWidget::pane:bottom{bottom:-1px;} QTabWidget::pane:left{right:-1px;} QTabWidget::pane:right{left:-1px;} -*:disabled{ +QDialog { +background-color:#444444; +color:#DCDCDC; +} + +QDialogButtonBox > QPushButton { +min-width:50px; +} + +*:disabled,QMenu::item:disabled,QTabBar::tab:disabled{ background:#444444; border-color:#484848; color:#242424;