改进代码

master
feiyangqingyun 2021-09-19 11:44:22 +08:00
parent 62c05a76d7
commit 8b37cfa9bf
16 changed files with 245 additions and 137 deletions

View File

@ -2,6 +2,9 @@
IconHelper *IconHelper::iconFontAliBaBa = 0;
IconHelper *IconHelper::iconFontAwesome = 0;
IconHelper *IconHelper::iconFontWeather = 0;
int IconHelper::iconFontIndex = -1;
void IconHelper::initFont()
{
static bool isInit = false;
@ -13,103 +16,101 @@ void IconHelper::initFont()
if (iconFontAwesome == 0) {
iconFontAwesome = new IconHelper(":/image/fontawesome-webfont.ttf", "FontAwesome");
}
if (iconFontWeather == 0) {
iconFontWeather = new IconHelper(":/image/pe-icon-set-weather.ttf", "pe-icon-set-weather");
}
}
}
QFont IconHelper::getIconFontAliBaBa()
{
initFont();
return iconFontAliBaBa->getIconFont();
}
QFont IconHelper::getIconFontAwesome()
{
initFont();
return iconFontAwesome->getIconFont();
}
QFont IconHelper::getIconFontWeather()
{
initFont();
return iconFontWeather->getIconFont();
}
IconHelper *IconHelper::getIconHelper(int icon)
{
initFont();
//指定了字体索引则取对应索引的字体类
//没指定则自动根据不同的字体的值选择对应的类
//由于部分值范围冲突所以可以指定索引来取
//fontawesome 0xf000-0xf2e0
//iconfont 0xe501-0xe793 0xe8d5-0xea5d
//weather 0xe900-0xe9cf
IconHelper *iconHelper = iconFontAwesome;
if (iconFontIndex < 0) {
if ((icon > 0xe501 && icon < 0xe793) || (icon > 0xe8d5 && icon < 0xea5d)) {
iconHelper = iconFontAliBaBa;
}
} else if (iconFontIndex == 0) {
iconHelper = iconFontAliBaBa;
} else if (iconFontIndex == 1) {
iconHelper = iconFontAwesome;
} else if (iconFontIndex == 2) {
iconHelper = iconFontWeather;
}
return iconHelper;
}
void IconHelper::setIcon(QLabel *lab, int icon, quint32 size)
{
initFont();
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
if (icon > 0xe000 && icon < 0xf000) {
iconFontAliBaBa->setIcon1(lab, icon, size);
} else if (icon > 0xf000) {
iconFontAwesome->setIcon1(lab, icon, size);
}
getIconHelper(icon)->setIcon1(lab, icon, size);
}
void IconHelper::setIcon(QAbstractButton *btn, int icon, quint32 size)
{
initFont();
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
if (icon > 0xe000 && icon < 0xf000) {
iconFontAliBaBa->setIcon1(btn, icon, size);
} else if (icon > 0xf000) {
iconFontAwesome->setIcon1(btn, icon, size);
}
getIconHelper(icon)->setIcon1(btn, icon, size);
}
void IconHelper::setPixmap(QAbstractButton *btn, const QColor &color, int icon, quint32 size,
quint32 width, quint32 height, int flags)
{
initFont();
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
if (icon > 0xe000 && icon < 0xf000) {
iconFontAliBaBa->setPixmap1(btn, color, icon, size, width, height, flags);
} else if (icon > 0xf000) {
iconFontAwesome->setPixmap1(btn, color, icon, size, width, height, flags);
}
getIconHelper(icon)->setPixmap1(btn, color, icon, size, width, height, flags);
}
QPixmap IconHelper::getPixmap(const QColor &color, int icon, quint32 size,
quint32 width, quint32 height, int flags)
{
initFont();
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
QPixmap pix;
if (icon > 0xe000 && icon < 0xf000) {
pix = iconFontAliBaBa->getPixmap1(color, icon, size, width, height, flags);
} else if (icon > 0xf000) {
pix = iconFontAwesome->getPixmap1(color, icon, size, width, height, flags);
}
return pix;
return getIconHelper(icon)->getPixmap1(color, icon, size, width, height, flags);
}
void IconHelper::setStyle(QWidget *widget, QList<QPushButton *> btns,
QList<int> icons, const IconHelper::StyleColor &styleColor)
{
initFont();
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
int icon = icons.first();
if (icon > 0xe000 && icon < 0xf000) {
iconFontAliBaBa->setStyle1(widget, btns, icons, styleColor);
} else if (icon > 0xf000) {
iconFontAwesome->setStyle1(widget, btns, icons, styleColor);
}
getIconHelper(icon)->setStyle1(widget, btns, icons, styleColor);
}
void IconHelper::setStyle(QWidget *widget, QList<QToolButton *> btns,
QList<int> icons, const IconHelper::StyleColor &styleColor)
{
initFont();
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
int icon = icons.first();
if (icon > 0xe000 && icon < 0xf000) {
iconFontAliBaBa->setStyle1(widget, btns, icons, styleColor);
} else if (icon > 0xf000) {
iconFontAwesome->setStyle1(widget, btns, icons, styleColor);
}
getIconHelper(icon)->setStyle1(widget, btns, icons, styleColor);
}
void IconHelper::setStyle(QWidget *widget, QList<QAbstractButton *> btns,
QList<int> icons, const IconHelper::StyleColor &styleColor)
{
initFont();
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
int icon = icons.first();
if (icon > 0xe000 && icon < 0xf000) {
iconFontAliBaBa->setStyle1(widget, btns, icons, styleColor);
} else if (icon > 0xf000) {
iconFontAwesome->setStyle1(widget, btns, icons, styleColor);
}
getIconHelper(icon)->setStyle1(widget, btns, icons, styleColor);
}
IconHelper::IconHelper(const QString &fontFile, const QString &fontName, QObject *parent) : QObject(parent)
{
//判断图形字体是否存在,不存在则加入
@ -122,6 +123,7 @@ IconHelper::IconHelper(const QString &fontFile, const QString &fontName, QObject
}
}
//再次判断是否包含字体名称防止加载失败
if (fontDb.families().contains(fontName)) {
iconFont = QFont(fontName);
#if (QT_VERSION >= QT_VERSION_CHECK(4,8,0))
@ -179,6 +181,11 @@ void IconHelper::toggled(bool checked)
}
}
QFont IconHelper::getIconFont()
{
return this->iconFont;
}
void IconHelper::setIcon1(QLabel *lab, int icon, quint32 size)
{
iconFont.setPixelSize(size);
@ -269,8 +276,9 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
}
//如果图标是左侧显示则需要让没有选中的按钮左侧也有加深的边框,颜色为背景颜色
//如果图标在文字上面而设置的边框是 top bottom 也需要启用加深边框
QStringList qss;
if (styleColor.textBesideIcon) {
if (styleColor.defaultBorder) {
qss << QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:solid;border-radius:0px;%2border-color:%3;color:%4;background:%5;}")
.arg(position).arg(strBorder).arg(styleColor.normalBgColor).arg(styleColor.normalTextColor).arg(styleColor.normalBgColor);
} else {

View File

@ -28,7 +28,7 @@ public:
//样式颜色结构体
struct StyleColor {
QString position; //位置 left right top bottom
bool textBesideIcon; //文字在图标左侧
bool defaultBorder; //默认有边框
quint32 iconSize; //图标字体尺寸
quint32 iconWidth; //图标图片宽度
@ -48,7 +48,7 @@ public:
StyleColor() {
position = "left";
textBesideIcon = false;
defaultBorder = false;
iconSize = 12;
iconWidth = 15;
@ -87,20 +87,38 @@ public:
static IconHelper *iconFontAliBaBa;
//FontAwesome图形字体类
static IconHelper *iconFontAwesome;
//天气图形字体类
static IconHelper *iconFontWeather;
//图形字体索引
static int iconFontIndex;
//初始化图形字体
static void initFont();
//获取图形字体
static QFont getIconFontAliBaBa();
static QFont getIconFontAwesome();
static QFont getIconFontWeather();
//根据值获取图形字体类
static IconHelper *getIconHelper(int icon);
//设置图形字体到标签
static void setIcon(QLabel *lab, int icon, quint32 size = 12);
//设置图形字体到按钮
static void setIcon(QAbstractButton *btn, int icon, quint32 size = 12);
//设置图形字体到图标
static void setPixmap(QAbstractButton *btn, const QColor &color,
int icon, quint32 size = 12,
quint32 width = 15, quint32 height = 15,
int flags = Qt::AlignCenter);
//获取指定图形字体,可以指定文字大小,图片宽高,文字对齐
static QPixmap getPixmap(const QColor &color, int icon, quint32 size = 12,
quint32 width = 15, quint32 height = 15,
int flags = Qt::AlignCenter);
//指定导航面板样式,带图标和效果切换+悬停颜色+按下颜色+选中颜色
static void setStyle(QWidget *widget, QList<QPushButton *> btns, QList<int> icons, const StyleColor &styleColor);
static void setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> icons, const StyleColor &styleColor);
static void setStyle(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const StyleColor &styleColor);
@ -124,6 +142,9 @@ private slots:
void toggled(bool checked);
public:
//获取图形字体
QFont getIconFont();
//设置图形字体到标签
void setIcon1(QLabel *lab, int icon, quint32 size = 12);
//设置图形字体到按钮

View File

@ -3,7 +3,12 @@
#include <QDialog>
#ifdef quc
class Q_DECL_EXPORT FramelessDialog : public QDialog
#else
class FramelessDialog : public QDialog
#endif
{
Q_OBJECT
public:

View File

@ -3,7 +3,12 @@
#include <QMainWindow>
#ifdef quc
class Q_DECL_EXPORT FramelessMainWindow : public QMainWindow
#else
class FramelessMainWindow : public QMainWindow
#endif
{
Q_OBJECT
public:

View File

@ -3,7 +3,12 @@
#include <QWidget>
#ifdef quc
class Q_DECL_EXPORT FramelessWidget : public QWidget
#else
class FramelessWidget : public QWidget
#endif
{
Q_OBJECT
public:

View File

@ -5,6 +5,9 @@
#include "qpushbutton.h"
#include "qcheckbox.h"
#include "framelesswidget2.h"
#include "framelessform/dialog.h"
#include "framelessform/widget.h"
#include "framelessform/mainwindow.h"
frmFramelessWidget::frmFramelessWidget(QWidget *parent) : QWidget(parent), ui(new Ui::frmFramelessWidget)
{
@ -80,3 +83,24 @@ void frmFramelessWidget::stateChanged2(int arg1)
frameless->setResizeEnable(arg1 != 0);
}
}
void frmFramelessWidget::on_btnDialog_clicked()
{
Dialog dialog;
dialog.resize(800, 600);
dialog.exec();
}
void frmFramelessWidget::on_btnWidget_clicked()
{
Widget *widget = new Widget;
widget->resize(800, 600);
widget->show();
}
void frmFramelessWidget::on_btnMainWindow_clicked()
{
MainWindow *window = new MainWindow;
window->resize(800, 600);
window->show();
}

View File

@ -29,6 +29,10 @@ private slots:
void on_pushButton_clicked();
void stateChanged1(int arg1);
void stateChanged2(int arg1);
void on_btnDialog_clicked();
void on_btnWidget_clicked();
void on_btnMainWindow_clicked();
};
#endif // FRMFRAMELESSWIDGET_H

View File

@ -13,18 +13,45 @@
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QPushButton" name="pushButton">
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>92</width>
<height>28</height>
<width>491</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>弹出</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>弹出</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnDialog">
<property name="text">
<string>Dialog</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnWidget">
<property name="text">
<string>Widget</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnMainWindow">
<property name="text">
<string>MainWindow</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>

View File

@ -1,9 +1,6 @@
#pragma execution_character_set("utf-8")
#include "frmframelesswidget.h"
#include "dialog.h"
#include "widget.h"
#include "mainwindow.h"
#include <QApplication>
#include <QTextCodec>
@ -29,11 +26,8 @@ int main(int argc, char *argv[])
QTextCodec::setCodecForLocale(codec);
#endif
frmFramelessWidget w;
//Dialog w;
//Widget w;
//MainWindow w;
w.setWindowTitle("无边框窗体类");
frmFramelessWidget w;
w.setWindowTitle("无边框窗体");
w.resize(800, 600);
w.show();

View File

@ -1,10 +1,6 @@
#pragma execution_character_set("utf-8")
#include "frmmain.h"
#include "frmmain.h"
#include "ui_frmmain.h"
#include "qfile.h"
#include "qtextstream.h"
#include "qtranslator.h"
#include "qdebug.h"
#include "head.h"
frmMain::frmMain(QWidget *parent) : QMainWindow(parent), ui(new Ui::frmMain)
{
@ -31,6 +27,10 @@ void frmMain::initForm()
this->initOther();
this->initStyle();
this->initTranslator();
ui->rbtn1->setChecked(true);
ui->ck2->setChecked(true);
ui->ck3->setCheckState(Qt::PartiallyChecked);
ui->tabWidget->setCurrentIndex(0);
}
@ -133,11 +133,7 @@ void frmMain::initListWidget()
void frmMain::initOther()
{
ui->rbtn1->setChecked(true);
ui->ck2->setChecked(true);
ui->ck3->setCheckState(Qt::PartiallyChecked);
ui->horizontalSlider->setValue(88);
ui->tab9->setStyleSheet("QPushButton{font:20pt;}");
ui->widgetVideo->setStyleSheet("QLabel{font:20pt;}");
@ -156,9 +152,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也行

View File

@ -3,8 +3,7 @@
#include <QMainWindow>
namespace Ui
{
namespace Ui {
class frmMain;
}

View File

@ -1,17 +1,15 @@
#pragma execution_character_set("utf-8")
#include "frmmain.h"
#include <QApplication>
#include <QTextCodec>
#include "frmmain.h"
#include "head.h"
int main(int argc, char *argv[])
{
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Floor);
#endif
QApplication a(argc, argv);
a.setFont(QFont("Microsoft Yahei", 9));
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
#if _MSC_VER
QTextCodec *codec = QTextCodec::codecForName("gbk");
#else

View File

@ -32,7 +32,7 @@ QWidget[nav="top"] QAbstractButton:hover,QWidget[nav="top"] QAbstractButton:pres
border-style:solid;
border-width:0px 0px 2px 0px;
padding:4px 4px 2px 4px;
border-color:#00BB9E;
border-color:#575959;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F6F6F6,stop:1 #F6F6F6);
}
@ -45,7 +45,7 @@ border-style:none;
QWidget[nav="left"] QAbstractButton:hover{
color:#FFFFFF;
background-color:#00BB9E;
background-color:#575959;
}
QWidget[nav="left"] QAbstractButton:checked,QWidget[nav="left"] QAbstractButton:pressed{
@ -53,7 +53,7 @@ color:#57595B;
border-style:solid;
border-width:0px 0px 0px 2px;
padding:4px 4px 4px 2px;
border-color:#00BB9E;
border-color:#575959;
background-color:#FFFFFF;
}
@ -64,7 +64,7 @@ background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #E4E4E4,stop:1
}
QWidget[video="true"] QLabel:focus{
border:1px solid #00BB9E;
border:1px solid #575959;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F6F6F6,stop:1 #F6F6F6);
}
@ -73,7 +73,7 @@ border:1px solid #B6B6B6;
border-radius:3px;
padding:2px;
background:none;
selection-background-color:#00BB9E;
selection-background-color:#575959;
selection-color:#FFFFFF;
}
@ -356,11 +356,11 @@ border-radius:6px;
}
QScrollBar::handle:horizontal:hover{
background:#00BB9E;
background:#575959;
}
QScrollBar::handle:horizontal:pressed{
background:#00BB9E;
background:#575959;
}
QScrollBar::add-page:horizontal{
@ -393,11 +393,11 @@ border-radius:6px;
}
QScrollBar::handle:vertical:hover{
background:#00BB9E;
background:#575959;
}
QScrollBar::handle:vertical:pressed{
background:#00BB9E;
background:#575959;
}
QScrollBar::add-page:vertical{
@ -478,7 +478,7 @@ background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F6F6F6,stop:1
QTabBar::tab:selected,QTabBar::tab:hover{
border-style:solid;
border-color:#00BB9E;
border-color:#575959;
background:#FFFFFF;
}
@ -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{
background:#FFFFFF;
border-color:#E4E4E4;
color:#B6B6B6;
@ -645,4 +654,4 @@ color:#B6B6B6;
/*NormalColorEnd:#E4E4E4*/
/*DarkColorStart:#F6F6F6*/
/*DarkColorEnd:#F6F6F6*/
/*HighColor:#00BB9E*/
/*HighColor:#575959*/

View File

@ -32,7 +32,7 @@ QWidget[nav="top"] QAbstractButton:hover,QWidget[nav="top"] QAbstractButton:pres
border-style:solid;
border-width:0px 0px 2px 0px;
padding:4px 4px 2px 4px;
border-color:#00BB9E;
border-color:#386488;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1 #DAEFFF);
}
@ -45,7 +45,7 @@ border-style:none;
QWidget[nav="left"] QAbstractButton:hover{
color:#FFFFFF;
background-color:#00BB9E;
background-color:#386488;
}
QWidget[nav="left"] QAbstractButton:checked,QWidget[nav="left"] QAbstractButton:pressed{
@ -53,7 +53,7 @@ color:#386487;
border-style:solid;
border-width:0px 0px 0px 2px;
padding:4px 4px 4px 2px;
border-color:#00BB9E;
border-color:#386488;
background-color:#EAF7FF;
}
@ -64,7 +64,7 @@ background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #DEF0FE,stop:1
}
QWidget[video="true"] QLabel:focus{
border:1px solid #00BB9E;
border:1px solid #386488;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1 #DAEFFF);
}
@ -73,7 +73,7 @@ border:1px solid #C0DCF2;
border-radius:3px;
padding:2px;
background:none;
selection-background-color:#00BB9E;
selection-background-color:#386488;
selection-color:#FFFFFF;
}
@ -356,11 +356,11 @@ border-radius:6px;
}
QScrollBar::handle:horizontal:hover{
background:#00BB9E;
background:#386488;
}
QScrollBar::handle:horizontal:pressed{
background:#00BB9E;
background:#386488;
}
QScrollBar::add-page:horizontal{
@ -393,11 +393,11 @@ border-radius:6px;
}
QScrollBar::handle:vertical:hover{
background:#00BB9E;
background:#386488;
}
QScrollBar::handle:vertical:pressed{
background:#00BB9E;
background:#386488;
}
QScrollBar::add-page:vertical{
@ -478,7 +478,7 @@ background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1
QTabBar::tab:selected,QTabBar::tab:hover{
border-style:solid;
border-color:#00BB9E;
border-color:#386488;
background:#EAF7FF;
}
@ -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{
background:#EAF7FF;
border-color:#DEF0FE;
color:#C0DCF2;
@ -645,4 +654,4 @@ color:#C0DCF2;
/*NormalColorEnd:#C0DEF6*/
/*DarkColorStart:#F2F9FF*/
/*DarkColorEnd:#DAEFFF*/
/*HighColor:#00BB9E*/
/*HighColor:#386488*/

View File

@ -32,7 +32,7 @@ QWidget[nav="top"] QAbstractButton:hover,QWidget[nav="top"] QAbstractButton:pres
border-style:solid;
border-width:0px 0px 2px 0px;
padding:4px 4px 2px 4px;
border-color:#00BB9E;
border-color:#AAAAAA;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
}
@ -45,7 +45,7 @@ border-style:none;
QWidget[nav="left"] QAbstractButton:hover{
color:#FFFFFF;
background-color:#00BB9E;
background-color:#AAAAAA;
}
QWidget[nav="left"] QAbstractButton:checked,QWidget[nav="left"] QAbstractButton:pressed{
@ -53,7 +53,7 @@ color:#DCDCDC;
border-style:solid;
border-width:0px 0px 0px 2px;
padding:4px 4px 4px 2px;
border-color:#00BB9E;
border-color:#AAAAAA;
background-color:#444444;
}
@ -64,7 +64,7 @@ background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1
}
QWidget[video="true"] QLabel:focus{
border:1px solid #00BB9E;
border:1px solid #AAAAAA;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
}
@ -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:#AAAAAA;
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{
@ -356,11 +356,11 @@ border-radius:6px;
}
QScrollBar::handle:horizontal:hover{
background:#00BB9E;
background:#AAAAAA;
}
QScrollBar::handle:horizontal:pressed{
background:#00BB9E;
background:#AAAAAA;
}
QScrollBar::add-page:horizontal{
@ -393,11 +393,11 @@ border-radius:6px;
}
QScrollBar::handle:vertical:hover{
background:#00BB9E;
background:#AAAAAA;
}
QScrollBar::handle:vertical:pressed{
background:#00BB9E;
background:#AAAAAA;
}
QScrollBar::add-page:vertical{
@ -478,7 +478,7 @@ background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1
QTabBar::tab:selected,QTabBar::tab:hover{
border-style:solid;
border-color:#00BB9E;
border-color:#AAAAAA;
background:#444444;
}
@ -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{
background:#444444;
border-color:#484848;
color:#242424;
@ -645,4 +654,4 @@ color:#242424;
/*NormalColorEnd:#383838*/
/*DarkColorStart:#646464*/
/*DarkColorEnd:#525252*/
/*HighColor:#00BB9E*/
/*HighColor:#AAAAAA*/

View File

@ -4,13 +4,8 @@ greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
TARGET = styledemo
TEMPLATE = app
MOC_DIR = temp/moc
RCC_DIR = temp/rcc
UI_DIR = temp/ui
OBJECTS_DIR = temp/obj
DESTDIR = $$PWD/../bin
CONFIG += warn_off
SOURCES += main.cpp
HEADERS += head.h
HEADERS += frmmain.h