增加样式表

master
feiyangqingyun 2021-03-03 16:37:44 +08:00
parent e7e58c201e
commit e74569008c
6 changed files with 44 additions and 8 deletions

View File

@ -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, "提示", "这里是提示信息!");
}

View File

@ -30,6 +30,9 @@ private slots:
void initOther();
void initStyle();
void initTranslator();
private slots:
void on_btnInfo_clicked();
};
#endif // FRMMAIN_H

View File

@ -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();
//居中显示窗体

View File

@ -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;

View File

@ -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;

View File

@ -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;