Quilting-lw/sharedviews/setcontrolstyle.cpp

1200 lines
35 KiB
C++
Raw Normal View History

2026-01-23 08:37:18 +00:00
#include "setcontrolstyle.h"
//--------------------------------------------------------------------
// 窗体尺寸
const QColor sewcolorYel = QColor(Qt::darkYellow);//黄色
const QColor sewcolorGreen = QColor(0x35,0xC0,0x5C);//绿色
const QColor sewcolorGray = QColor(Qt::lightGray);
const QColor sewcolorblue = QColor(0,128,255);//蓝色
double getFactoryX()
{
double factoryX = 1.0;
switch (g_emResolut)
{
case resolution1910:
factoryX = 1920.0/GLB_SCR_WIGHT;
break;
case resolution1006:
factoryX = 1024.0/GLB_SCR_WIGHT;
break;
case resolution0804:
factoryX = 800.0/GLB_SCR_WIGHT;
break;
default:
break;
}
return factoryX;
}
double getFactoryY()
{
double factoryY = 1.0;
switch (g_emResolut)
{
case resolution1910:
factoryY = 1080.0/GLB_SCR_HEIGHT;
break;
case resolution1006:
factoryY = 600.0/GLB_SCR_HEIGHT;
break;
case resolution0804:
factoryY = 480.0/GLB_SCR_HEIGHT;
break;
default:
break;
}
return factoryY;
}
//--------------------------------------------------------------------
// 圆角
QString borderRadius()
{
int r = 4;
#ifdef Q_OS_WIN
r = 4;
#endif
#ifdef Q_OS_LINUX
r = 4;
#endif
r *= getFactoryY();
QString radius=QString::number(r,10);
return radius;
}
//--------------------------------------------------------------------
// 字体
// 大号字体(标题)
QFont fontSize_L()
{
QFont size(FONTTYPE,g_fontsize + 2, FONTNORMAL);
size.setPointSize(size.pointSize()*getFactoryY());
return size;
}
// 中号字体(正文)
QFont fontSize_M()
{
QFont size(FONTTYPE,g_fontsize, FONTNORMAL);
size.setPointSize(size.pointSize()*getFactoryY());
return size;
}
// 双头组合中号字体(正文)
QFont fontSize_M_DoubleHead()
{
QFont size(FONTTYPE,g_fontsize-1, FONTNORMAL);
size.setPointSize(size.pointSize()*getFactoryY());
return size;
}
// 小号字体(注释)
QFont fontSize_S()
{
QFont size(FONTTYPE,g_fontsize, FONTNORMAL);
size.setPointSize(size.pointSize()*getFactoryY());
return size;
}
//-----------------------------------------------------------
// 字体颜色
// 标题栏文本字体颜色
QString titleTextColour()
{
QString colour = "background-color: rgba(0, 0, 0, 0);color: rgb(255, 255, 255);";
switch (g_emTheme)
{
case theme1:
colour = "background-color: rgba(0, 0, 0, 0);color: rgb(255, 255, 255);";
break;
case theme2:
colour = "background-color: rgba(245, 245, 245, 0);color: rgb(0, 0, 0);";
break;
case theme3:
break;
default:
break;
}
return colour;
}
// 标题栏文本字体颜色 2
QString titleTextColour2()
{
QString colour = "background-color: rgba(138, 210, 208);color: rgb(0, 0, 0);";
return colour;
}
// 主图标文本字体颜色
// 主窗体左侧主按钮
QString mainIconTextColour()
{
QString colour = "background-color: rgba(0, 0, 0, 0);color: rgb(255, 255, 255);";
switch (g_emTheme)
{
case theme1:
colour = "background-color: rgba(0, 0, 0, 0);color: rgb(255, 255, 255);";
break;
case theme2:
colour = "background-color: rgba(245, 245, 245, 0);color: rgb(0, 0, 0);";
break;
break;
case theme3:
break;
default:
break;
}
return colour;
}
// 分类图标文本字体颜色
// 主界面中间分类图标
QString classIconTextColour()
{
QString colour = "";
switch (g_emTheme)
{
case theme1:
colour = "background-color: rgba(0, 0, 0, 0);color: rgb(57, 57, 57);";
break;
case theme2:
colour = "background-color: rgba(245, 245, 245, 0);color: rgb(0, 0, 0);";
break;
case theme3:
break;
default:
break;
}
return colour;
}
// 状态栏文本字体颜色
// 主界面右侧状态栏
QString stateTextColour()
{
QString colour = "";
switch (g_emTheme)
{
case theme1:
colour = "background-color: rgba(0, 0, 0, 0);color: rgb(255, 255, 255);";
break;
case theme2:
colour = "background-color: rgba(245, 245, 245, 0);color: rgb(0, 0, 0);";
break;
case theme3:
break;
default:
break;
}
return colour;
}
// 警示文本字体颜色
QString warnTextColour()
{
QString colour = "background-color: rgba(0, 0, 0, 0);color: rgb(255, 239, 0);";
switch (g_emTheme)
{
case theme1:
colour = "background-color: rgba(0, 0, 0, 0);color: rgb(255, 239, 0);";
break;
case theme2:
//透明背景色,深蓝色前景色
colour = "background-color: rgba(255, 255, 255, 0);color: rgb(57, 95, 140);";
break;
case theme3:
break;
default:
break;
}
return colour;
}
QString numValue()
{
QString colour = "background-color: rgba(0, 0, 0, 0);color: rgb(255, 239, 0);";
switch (g_emTheme)
{
case theme1:
colour = "background-color: rgba(0, 0, 0, 0);color: rgb(255, 239, 0);";
break;
case theme2:
//透明背景色,深蓝色前景色
colour = "background-color: rgba(255, 255, 255, 0);color: rgb(57, 95, 140);border:2px solid;";
break;
case theme3:
break;
default:
break;
}
return colour;
}
// 弹窗标题栏文本字体颜色
QString windowTitleTextColour()
{
QString colour = "background-color: rgba(0, 0, 0, 0);color: rgb(255, 255, 255);";
switch (g_emTheme)
{
case theme1:
colour = "background-color: rgba(0, 0, 0, 0);color: rgb(255, 255, 255);";
break;
case theme2:
break;
case theme3:
break;
default:
break;
}
return colour;
}
// 普通文本 字体颜色
// 参数等界面文字,页码颜色
QString commonTextColour()
{
QString colour = "QLabel {background-color: rgba(0, 0, 0, 0);color: rgb(255, 255, 255);}"
"QLabel:disabled {color: rgb(127, 127, 127);}";//失效时字体颜色
switch (g_emTheme)
{
case theme1:
colour = "QLabel {background-color: rgba(0, 0, 0, 0);color: rgb(255, 255, 255);}"
"QLabel:disabled {color: rgb(127, 127, 127);}";//失效时字体颜色
break;
case theme2:
colour = "QLabel {background-color: rgba(245, 245, 245, 0);color: rgb(0, 0, 0);}"
"QLabel:disabled {color: rgb(127, 127, 127);}";//失效时字体颜色
break;
case theme3:
break;
default:
break;
}
return colour;
}
// 注释文本 字体颜色
// 参数等界面副标题文字
QString noteTextColour()
{
QString colour = "background-color: rgba(0, 0, 0, 0);color: rgb(128, 128, 128);";
switch (g_emTheme)
{
case theme1:
colour = "background-color: rgba(0, 0, 0, 0);color: rgb(128, 128, 128);";
break;
case theme2:
colour = "background-color: rgba(245, 245, 245, 0);color: rgb(0, 0, 0);";
break;
case theme3:
break;
default:
break;
}
return colour;
}
// 传感器信号 指示灯颜色
QString ledTextColour()
{
QString colour = "background-color: rgba(0, 0, 0, 0);color: rgb(63, 193, 216);";
switch (g_emTheme)
{
case theme1:
colour = "background-color: rgba(0, 0, 0, 0);color: rgb(234, 170, 58);";
break;
case theme2:
colour = "background-color: rgba(245, 245, 245, 0);color: rgb(0, 0, 0);";
break;
case theme3:
break;
default:
break;
}
return colour;
}
//-----------------------------------------------------------
// 绘图颜色
// 未缝制跨步颜色
u32 getNoJumpColour()
{
u32 colour = 0;
switch (g_emTheme)
{
case theme1://黄色
colour = qRgb(sewcolorYel.red(),sewcolorYel.green(),sewcolorYel.blue());
break;
case theme2://透明
colour = qRgba(255,255,255,0);
break;
case theme3:
break;
default:
break;
}
return colour;
}
// 缝制后跨步颜色
u32 getJumpedColour()
{
u32 colour{0};
switch (g_emTheme)
{
case theme1://黄色
colour = qRgb(sewcolorYel.red(),sewcolorYel.green(),sewcolorYel.blue());
break;
case theme2:
colour = qRgb(255,255,255);
break;
case theme3:
break;
default:
break;
}
return colour;
}
// 未缝制颜色颜色
u32 getNoSewColour()
{
u32 colour{0};
switch (g_emTheme)
{
case theme1:
colour = qRgb(sewcolorGray.red(),sewcolorGray.green(),sewcolorGray.blue());
break;
case theme2:
colour = qRgba(255,255,255,0);
break;
case theme3:
break;
default:
break;
}
return colour;
}
// 缝制后颜色颜色
u32 getSewedColour()
{
u32 colour{0};
switch (g_emTheme)
{
case theme1://蓝色
colour = qRgb(sewcolorblue.red(),sewcolorblue.green(),sewcolorblue.blue());
break;
case theme2:
colour = qRgba(255,255,255,0);
break;
case theme3:
break;
default:
break;
}
return colour;
}
//-----------------------------------------------------------
// 控件样式
// 文本按钮样式
QString textButtonStyle()
{
QFont size = fontSize_L();
QString pSize = QString::number(size.pointSize() + 5);
QString style = "QPushButton{border-radius:" + borderRadius() + "px;font-size:"+ pSize +"px;font-family:"+FONTTYPE+";}";
switch (g_emTheme)
{
case theme1:
// 银色按钮,黑字
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(255, 255, 255), stop:1 rgb(215, 243, 254));color:rgb(0, 0, 0)}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(217, 222, 224), stop:1 rgb(191,213,223));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(230, 230, 230), stop:1 rgb(182,182,182));}";
break;
case theme2:
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(240, 245, 249), stop:1 rgb(215, 243, 254));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(234, 234, 234), stop:1 rgb(176,176,176));}";
style += "QPushButton:checked{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(186, 226, 227), stop:1 rgb(105,198,194));}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(186, 226, 227), stop:1 rgb(105,198,194));}";
break;
case theme3:
break;
default:
break;
}
return style;
}
// 数字按钮样式
QString numButtonStyle()
{
QFont size = fontSize_L();
QString pSize = QString::number(size.pointSize() + 5);
QString style = "QPushButton{border-radius:" + borderRadius() + "px;font-size:"+ pSize +"px;font-family:"+FONTTYPE+";}";
switch (g_emTheme)
{
case theme1:
// 银色按钮,黑字
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(255, 255, 255), stop:1 rgb(215, 243, 254));color:rgb(57, 57, 57);color:rgb(0, 0, 0)}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(217, 222, 224), stop:1 rgb(191,213,223));color:rgb(57, 57, 57);}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(230, 230, 230), stop:1 rgb(182,182,182));color:rgb(57, 57, 57);}";
break;
case theme2:
style += "QPushButton{background-color:rgba(95, 164, 162);}";
style += "QPushButton:pressed{background-color: rgba(95, 164, 162,100);}";
style += "QPushButton:disabled{background-color: rgba(176,176,176);}";
break;
case theme3:
break;
default:
break;
}
return style;
}
// 机头间距按钮样式
QString headButtonStyle()
{
QFont size = fontSize_L();
QString pSize = QString::number(size.pointSize() + 5);
QString style = "QPushButton{border-radius:" + borderRadius() + "px;font-size:"+ pSize +"px;font-family:"+FONTTYPE+";color: rgb(255, 255, 255);}";
switch (g_emTheme)
{
case theme1:
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(59, 182, 205), stop:1 rgb(59, 182, 205));}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(59, 182, 205), stop:1 rgb(59, 182, 205));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(59, 182, 205), stop:1 rgb(59, 182, 205));}";
break;
case theme2:
break;
case theme3:
break;
default:
break;
}
return style;
}
//弹出窗口背景颜色
QString frameBackStyle()
{
QString style = "background-color: rgba(240, 245, 249);";
return style;
}
// 主图标样式
// 主窗体左侧主按钮
QString mainIconStyle()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;}";
switch (g_emTheme)
{
case theme1:
// 橙色按钮,白字
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(65,197,220), stop:1 rgb(57,176,198));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(234, 234, 234), stop:1 rgb(176,176,176));}";
style += "QPushButton:checked{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(247, 180, 61), stop:1 rgb(222, 162, 55));}";
break;
case theme2:
// 淡蓝色
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(240, 245, 249), stop:1 rgb(215, 243, 254));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(234, 234, 234), stop:1 rgb(176,176,176));}";
style += "QPushButton:checked{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(186, 226, 227), stop:1 rgb(105,198,194));}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(186, 226, 227), stop:1 rgb(105,198,194));}";
break;
case theme3:
break;
default:
break;
}
return style;
}
QString mainIconStyleReversal()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;}";
switch (g_emTheme)
{
case theme1:
// 橙色按钮,白字
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(247, 180, 61), stop:1 rgb(222, 162, 55));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(234, 234, 234), stop:1 rgb(176,176,176));}";
style += "QPushButton:checked{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(65,197,220), stop:1 rgb(57,176,198));}";
break;
case theme2:
// 淡蓝色
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(186, 226, 227), stop:1 rgb(105,198,194));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(234, 234, 234), stop:1 rgb(176,176,176));}";
style += "QPushButton:checked{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(186, 226, 227), stop:1 rgb(105,198,194));}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(240, 245, 249), stop:1 rgb(215, 243, 254));}";
break;
case theme3:
break;
default:
break;
}
return style;
}
QString shortBtnStyle()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;}";
// 橙红色按钮
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(254, 177, 133), stop:1 rgb(215, 107, 62));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(234, 234, 234), stop:1 rgb(176,176,176));}";
style += "QPushButton:checked{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(220,87,40), stop:1 rgb(200, 67, 30));}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(220,87,40), stop:1 rgb(220,117,40));}";
return style;
}
// 分类图标样式
// 主界面中间分类图标
QString classIconStyle()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;}";
switch (g_emTheme)
{
case theme1:
// 橙色按钮,白字
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(247, 180, 61), stop:1 rgb(222, 162, 55));color:rgb(255,255,255);}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(222, 196, 128), stop:1 rgb(213,125,54));color:rgb(255,255,255);}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(227, 227, 227), stop:1 rgb(177,177,177));color:rgb(255,255,255);}";
break;
case theme2:
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(214, 234, 244), stop:1 rgb(197, 233, 244));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(234, 234, 234), stop:1 rgb(176,176,176));}";
style += "QPushButton:checked{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(186, 226, 227), stop:1 rgb(105,198,194));}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(186, 226, 227), stop:1 rgb(105,198,194));}";
break;
case theme3:
break;
default:
break;
}
return style;
}
// 确认图标样式
QString confirmIconStyle()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;}";
switch (g_emTheme)
{
case theme1:
// 橙色按钮,白字
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(247, 180, 61), stop:1 rgb(222, 162, 55));color:rgb(255,255,255);}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(222, 196, 128), stop:1 rgb(213,125,54));color:rgb(255,255,255);}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(227, 227, 227), stop:1 rgb(177,177,177));color:rgb(255,255,255);}";
break;
case theme2:
style += "QPushButton{background-color:rgb(95, 164, 162);}";
style += "QPushButton:pressed{background-color: rgb(95, 164, 162,100);}";
style += "QPushButton:disabled{background-color: rgba(176,176,176);}";
break;
case theme3:
break;
default:
break;
}
return style;
}
// 返回图标样式
// 右上角图标
QString backIconStyle()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;}";
switch (g_emTheme)
{
case theme1:
// 绿色按钮,黑字
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(139, 195, 163), stop:1 rgb(86,172,123));}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(105, 147, 123), stop:1 rgb(84,138,107));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(227, 227, 227), stop:1 rgb(177,177,177));color:rgb(255,255,255);}";
style += "QPushButton:checked{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(105, 147, 100), stop:1 rgb(84,138,90));}";
break;
case theme2:
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(139, 195, 163), stop:1 rgb(86,172,123));}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(105, 147, 123), stop:1 rgb(84,138,107));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(227, 227, 227), stop:1 rgb(177,177,177));color:rgb(255,255,255);}";
style += "QPushButton:checked{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(84,138,90), stop:1 rgb(62,102,67));}";
break;
case theme3:
break;
default:
break;
}
return style;
}
// 标题图标
// 左上角图标
QString titleIconStyle(QString pic)
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;}";
switch (g_emTheme)
{
case theme1:
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(65,197,220), stop:1 rgb(57,176,198));border-image: url(" + pic + ");border:0px;outline: none;}";
break;
case theme2:
//橙色渐变
style += "QPushButton{background-color: rgba(138, 210, 208);border-image: url(" + pic + ");border:0px;outline: none;}";
break;
case theme3:
break;
default:
break;
}
return style;
}
// 选项卡样式
// 主控升级
QString optionsIconStyle()
{
QString style = "QPushButton{border-radius:0px;}";
switch (g_emTheme)
{
case theme1:
style += "QPushButton{border:0px;text-align:left;background-color:rgba(255, 255, 255, 0);color: rgb(255, 255, 255);}";
style += "QPushButton:checked{background-color: rgba(255, 255, 255, 50);}";
break;
case theme2:
style += "QPushButton{border:0px;text-align:left;background-color:rgba(255, 255, 255, 0);color: rgb(0, 0, 0);}";
style += "QPushButton:checked{background-color: rgba(255, 255, 255, 50);}";
break;
case theme3:
break;
default:
break;
}
return style;
}
// 进度条样式
QString progressStyle()
{
QString style = "QProgressBar{border-radius:" + borderRadius() + "px;}";
switch (g_emTheme)
{
case theme1:
style += "QProgressBar{border:0px;}QProgressBar::chunk{background-color: rgb(255, 255, 255);}";
break;
case theme2:
style += "QProgressBar{border:0px;}QProgressBar::chunk{background-color: rgb(255, 255, 255);}";
break;
case theme3:
break;
default:
break;
}
return style;
}
// 透明样式
//透明色、无焦点、无边框
QString transparentStyle()
{
QString style = "";
style += "outline:none;border:0px;background-color: rgba(255, 255, 255, 0);border-radius:" + borderRadius() + "px;";
return style;
}
// 灰白/白蓝 色样式、无焦点、无边框
QString ashenStyle()
{
QString style = "";
switch (g_emTheme)
{
case theme1:
style += "outline:none;border:0px;background-color: rgb(86, 86, 86);border-radius:" + borderRadius() + "px;";
break;
case theme2:
style += "outline:none;border:0px;background-color: rgb(187, 228, 227);border-radius:" + borderRadius() + "px;";
break;
default:
break;
}
return style;
}
//黑色
QString blackStyle()
{
QString style = "outline:none;border:0px;background-color: rgb(60, 60, 60);border-radius:" + borderRadius() + "px;";
return style;
}
// 灰黑/白灰 色样式、无焦点、无边框
QString darkgrayStyle()
{
QString style = "";
switch (g_emTheme)
{
case theme1:
style += "outline:none;border:0px;background-color: rgb(67, 67, 67);border-radius:" + borderRadius() + "px;";
break;
case theme2:
style += "outline:none;border:0px;background-color: rgb(247, 247, 249);border-radius:" + borderRadius() + "px;";
break;
default:
break;
}
return style;
}
//-----------------------------------------------------------
SetStyle::SetStyle(QObject *parent) : QObject(parent)
{
m_uiName.clear();
}
void SetStyle::setUiName(QString uiName)
{
m_uiName = uiName;
}
QString SetStyle::getStyleSheet(QString controlName)
{
//样式表格式 <分辨率><主题><窗体名称><图片名称>
//例如图片路径 :/images/MainWidget/ButtonConnect_logo.png
QString style;
switch (g_emTheme)
{
case theme1:
style = "background-color: rgba(245, 245, 245, 0);color: rgb(255, 255, 255);border:0px;border-image:url(:/images/";
break;
case theme2:
style = "background-color: rgba(245, 245, 245, 0);color: rgb(255, 255, 255);border:0px;border-image:url(:/images2/";
break;
case theme3:
break;
default:
break;
}
style += m_uiName + "/";
style += controlName + "_logo.png);";
return style;
}
QString SetStyle::getStyleSheet1(QString controlName)
{
//样式表格式 <分辨率><主题><窗体名称><图片名称>
//例如图片路径 :/images/1920x1080/theme1/EmbMainWidget/ButtonConnect_logo.png
QString style;
style.clear();
//分辨率
QString str;
str.clear();
switch (g_emTheme)
{
case theme1:
{
style = "background-color: rgba(245, 245, 245, 0);color: rgb(255, 255, 255);border:0px;border-image:url(:/images/";
switch (g_emResolut)
{
case resolution1910:
str = "_1910";
break;
case resolution1006:
str = "_1006";
break;
case resolution0804:
str = "_1006";
break;
default:
break;
}
break;
}
case theme2:
style = "background-color: rgba(245, 245, 245, 0);color: rgb(255, 255, 255);border:0px;border-image:url(:/images2/";
break;
case theme3:
break;
default:
break;
}
style += m_uiName + "/";
style += controlName + str + "_logo.png);";
return style;
}
QString SetStyle::getBorderImageStyleSheet(QString controlName)
{
//样式表格式 <分辨率><主题><窗体名称><图片名称>
//例如图片路径 :/images/1920x1080/theme1/EmbMainWidget/ButtonConnect_logo.png
QString style;
switch (g_emTheme)
{
case theme1:
style = "background-color: rgba(245, 245, 245, 0);color: rgb(255, 255, 255);border:0px;border-image:url(:/images/";
break;
case theme2:
style = "background-color: rgba(245, 245, 245, 0);color: rgb(255, 255, 255);border:0px;border-image:url(:/images2/";
break;
case theme3:
break;
default:
break;
}
//分辨率
QString str;
str.clear();
switch (g_emResolut)
{
case resolution1910:
str = "_1910";
break;
case resolution1006:
str = "_1006";
break;
case resolution0804:
str = "_1006";
break;
default:
break;
}
style += m_uiName + "/";
style += controlName + str + "_logo.png);";
return style;
}
QString SetStyle::getTopStyleSheet(QString controlName)
{
//样式表格式 <分辨率><主题><窗体名称><图片名称>
//例如 :/images/1920x1080/theme1/EmbMainWidget/buttonPatternSet_logo
QString style = "";
switch (g_emTheme)
{
case theme1:
style = ":/images/";
break;
case theme2:
style = ":/images2/";
break;
case theme3:
break;
default:
break;
}
style += m_uiName + "/";
style += controlName + "_logo.png";
return style;
}
QString SetStyle::getBottomStyleSheet(QString parentName)
{
//样式表格式 <分辨率><主题><窗体名称><图片前缀>
//例如 :/images/EmbMainWidget/frameMainFunction
QString style = "";
switch (g_emTheme)
{
case theme1:
style = ":/images/";
break;
case theme2:
style = ":/images2/";
break;
case theme3:
break;
default:
break;
}
style += m_uiName + "/";
style += parentName;
return style;
}
QString SetStyle::getBottomStyleSheet1(QString parentName)
{
//样式表格式 <分辨率><主题><窗体名称><图片前缀>
//例如 :/images/EmbMainWidget/frameMainFunction
QString style = "";
switch (g_emTheme)
{
case theme1:
style = ":/images/";
break;
case theme2:
style = ":/images2/";
break;
case theme3:
break;
default:
break;
}
//分辨率
QString str;
str.clear();
switch (g_emResolut)
{
case resolution1910:
str = "1910_";
break;
case resolution1006:
str = "1006_";
break;
case resolution0804:
str = "1006_";
break;
default:
break;
}
style += m_uiName +"/"+str;
style += parentName;
return style;
}
QString SetStyle::getSharedStyleSheet()
{
//样式表格式 <分辨率><主题><窗体名称><图片名称>
//例如图片路径 :/images/1920x1080/theme1/EmbMainWidget/ButtonConnect_logo.png
QString style;
switch (g_emTheme)
{
case theme1:
style = "background-color: rgba(245, 245, 245, 0);color: rgb(255, 255, 255);border:0px;border-image:url(:/images/";
break;
case theme2:
style += "background-color: rgba(245, 245, 245, 0);color: rgb(255, 255, 255);border:0px;border-image:url(:/images2/";
break;
case theme3:
break;
default:
break;
}
//分辨率
QString str = "_1006";
style += "SharedIcon/WidgetFrameBack"+ str +"_logo.png);";
return style;
}
QString SetStyle::getSharedTopStyleSheet(QString controlName)
{
//样式表格式 <分辨率><主题><窗体名称><图片名称>
//例如 :/images/1920x1080/theme1/EmbMainWidget/buttonPatternSet_logo
QString style = "";
switch (g_emTheme)
{
case theme1:
style = ":/images/";
break;
case theme2:
style = ":/images2/";
break;
case theme3:
break;
default:
break;
}
style += "SharedIcon/";
style += controlName + "_logo.png";
return style;
}
QString SetStyle::getSharedBottomStyleSheet(QString parentName)
{
//样式表格式 <分辨率><主题><窗体名称><图片前缀>
//例如 :/images/1920x1080/theme1/EmbMainWidget/frameMainFunction
QString style = "";
switch (g_emTheme)
{
case theme1:
style = ":/images/";
break;
case theme2:
style = ":/images2/";
break;
case theme3:
break;
default:
break;
}
style += "SharedIcon/";
style += parentName;
return style;
}
/**
* @brief
* @return
*/
QString flippingStyle()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;}";
switch (g_emTheme)
{
case theme1:
// 绿色按钮,黑字
style += "QPushButton{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(139, 195, 163), stop:1 rgb(86,172,123));}";
style += "QPushButton:pressed{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(105, 147, 123), stop:1 rgb(84,138,107));}";
style += "QPushButton:disabled{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(227, 227, 227), stop:1 rgb(177,177,177));color:rgb(255,255,255);}";
style += "QPushButton:checked{background-color: qlineargradient(spread:pad, x1:0.5 y1:0, x2:0.5, y2:1, stop:0 rgb(105, 147, 100), stop:1 rgb(84,138,90));}";
break;
case theme2:
//蓝色渐变带边框
style += "QPushButton{background-color: rgb(38, 172, 221);}";
style += "QPushButton:pressed{background-color: rgb(38, 172, 221,50);}";
style += "QPushButton:disabled{background-color: rgb(200, 200, 200);}";
break;
case theme3:
break;
default:
break;
}
return style;
}
QString knifeStyle2()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;color: rgb(245,245,245);}";
style += "QPushButton{background-color: rgb(128,128,64);}";
style += "QPushButton:pressed{background-color: rgb(108,108,44);}";
style += "QPushButton:disabled{background-color: rgb(140, 140, 140);}";
return style;
}
QString knifeStyle3()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;color: rgb(245,245,245);}";
style += "QPushButton{background-color: rgb(0,0,255);}";
style += "QPushButton:pressed{background-color: rgb(20,20,255);}";
style += "QPushButton:disabled{background-color: rgb(140, 140, 140);}";
return style;
}
QString knifeStyle4()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;color: rgb(0,0,0);}";
style += "QPushButton{background-color: rgb(0, 255, 0);}";
style += "QPushButton:pressed{background-color: rgb(20, 255, 20);}";
style += "QPushButton:disabled{background-color: rgb(140, 140, 140);}";
return style;
}
QString knifeStyle5()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;color: rgb(0,0,0);}";
style += "QPushButton{background-color: rgb(255,0,255);}";
style += "QPushButton:pressed{background-color: rgb(255,20,255);}";
style += "QPushButton:disabled{background-color: rgb(140, 140, 140);}";
return style;
}
QString knifeStyle6()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;color: rgb(0,0,0);}";
style += "QPushButton{background-color: rgb(192,192,192);}";
style += "QPushButton:pressed{background-color: rgb(212,212,212);}";
style += "QPushButton:disabled{background-color: rgb(140, 140, 140);}";
return style;
}
QString knifeStyle7()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;color: rgb(245,245,245);}";
style += "QPushButton{background-color: rgb(0,128,0);}";
style += "QPushButton:pressed{background-color: rrgb(0,148,0);}";
style += "QPushButton:disabled{background-color: rgb(140, 140, 140);}";
return style;
}
QString knifeStyle8()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;color: rgb(0,0,0);}";
style += "QPushButton{background-color: rgb(0,255,255);}";
style += "QPushButton:pressed{background-color: rgb(20,255,255);}";
style += "QPushButton:disabled{background-color: rgb(140, 140, 140);}";
return style;
}
QString knifeStyle9()
{
QString style = "QPushButton{border-radius:" + borderRadius() + "px;color: rgb(0,0,0);}";
style += "QPushButton{background-color: rgb(255,255,0);}";
style += "QPushButton:pressed{background-color: rgb(255,255,20);}";
style += "QPushButton:disabled{background-color: rgb(140, 140, 140);}";
return style;
}