forked from openkylin/qt5-ukui-platformtheme
tabbar 配置化颜色提取
This commit is contained in:
parent
606e0e5919
commit
c999303b11
|
@ -449,7 +449,7 @@
|
||||||
"WidgetBackgroundBrush" : {"value": "Base_at", "type": "paletterole"},
|
"WidgetBackgroundBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarBackgroundBrush" : {"value": "Window_at", "type": "paletterole"},
|
"TabBarBackgroundBrush" : {"value": "Window_at", "type": "paletterole"},
|
||||||
"TabBarDefaultBrush" : {"value": "Window_at", "type": "paletterole"},
|
"TabBarDefaultBrush" : {"value": "Window_at", "type": "paletterole"},
|
||||||
"TabBarHoverBrush" : { "type": "color"},
|
"TabBarHoverBrush" : {"value": "0, 0, 0, 0.05", "type": "color"},
|
||||||
"TabBarSelectBrush" : {"value": "Base_at", "type": "paletterole"},
|
"TabBarSelectBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarClickBrush" : {"value": "Base_at", "type": "paletterole"},
|
"TabBarClickBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarFocusPen" : {"value": "HighLight_at", "type": "paletterole"}
|
"TabBarFocusPen" : {"value": "HighLight_at", "type": "paletterole"}
|
||||||
|
@ -908,7 +908,7 @@
|
||||||
"WidgetBackgroundBrush" : {"value": "Base_at", "type": "paletterole"},
|
"WidgetBackgroundBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarBackgroundBrush" : {"value": "Window_at", "type": "paletterole"},
|
"TabBarBackgroundBrush" : {"value": "Window_at", "type": "paletterole"},
|
||||||
"TabBarDefaultBrush" : {"value": "Window_at", "type": "paletterole"},
|
"TabBarDefaultBrush" : {"value": "Window_at", "type": "paletterole"},
|
||||||
"TabBarHoverBrush" : { "type": "color"},
|
"TabBarHoverBrush" : {"value": "255, 255, 255, 0.15","type": "color"},
|
||||||
"TabBarSelectBrush" : {"value": "Base_at", "type": "paletterole"},
|
"TabBarSelectBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarClickBrush" : {"value": "Base_at", "type": "paletterole"},
|
"TabBarClickBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarFocusPen" : {"value": "HighLight_at", "type": "paletterole"}
|
"TabBarFocusPen" : {"value": "HighLight_at", "type": "paletterole"}
|
||||||
|
|
|
@ -447,7 +447,7 @@
|
||||||
"WidgetBackgroundBrush" : {"value": "Base_at", "type": "paletterole"},
|
"WidgetBackgroundBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarBackgroundBrush" : {"value": "Window_at", "type": "paletterole"},
|
"TabBarBackgroundBrush" : {"value": "Window_at", "type": "paletterole"},
|
||||||
"TabBarDefaultBrush" : {"value": "Window_at", "type": "paletterole"},
|
"TabBarDefaultBrush" : {"value": "Window_at", "type": "paletterole"},
|
||||||
"TabBarHoverBrush" : { "type": "gradient"},
|
"TabBarHoverBrush" : {"value": "238, 238, 238 ~ 232, 232, 232","type": "gradient"},
|
||||||
"TabBarSelectBrush" : {"value": "Base_at", "type": "paletterole"},
|
"TabBarSelectBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarClickBrush" : {"value": "Base_at", "type": "paletterole"},
|
"TabBarClickBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarFocusPen" : {"value": "HighLight_at", "type": "paletterole"}
|
"TabBarFocusPen" : {"value": "HighLight_at", "type": "paletterole"}
|
||||||
|
@ -904,7 +904,7 @@
|
||||||
"WidgetBackgroundBrush" : {"value": "Base_at", "type": "paletterole"},
|
"WidgetBackgroundBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarBackgroundBrush" : {"value": "Window_at", "type": "paletterole"},
|
"TabBarBackgroundBrush" : {"value": "Window_at", "type": "paletterole"},
|
||||||
"TabBarDefaultBrush" : {"value": "Window_at", "type": "paletterole"},
|
"TabBarDefaultBrush" : {"value": "Window_at", "type": "paletterole"},
|
||||||
"TabBarHoverBrush" : { "type": "gradient"},
|
"TabBarHoverBrush" : {"value": "50, 51, 52 ~ 43, 44, 45", "type": "gradient"},
|
||||||
"TabBarSelectBrush" : {"value": "Base_at", "type": "paletterole"},
|
"TabBarSelectBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarClickBrush" : {"value": "Base_at", "type": "paletterole"},
|
"TabBarClickBrush" : {"value": "Base_at", "type": "paletterole"},
|
||||||
"TabBarFocusPen" : {"value": "HighLight_at", "type": "paletterole"}
|
"TabBarFocusPen" : {"value": "HighLight_at", "type": "paletterole"}
|
||||||
|
|
|
@ -591,14 +591,6 @@ void UKUIConfigStyleParameters::normalButtonColor(bool isDark, QPalette p, QPen
|
||||||
QPen &hoverPen, QBrush &hoverBrush, QPen &clickPen, QBrush &clickBrush,
|
QPen &hoverPen, QBrush &hoverBrush, QPen &clickPen, QBrush &clickBrush,
|
||||||
QPen &disablePen, QBrush &disableBrush)
|
QPen &disablePen, QBrush &disableBrush)
|
||||||
{
|
{
|
||||||
//default
|
|
||||||
if (isDark) {
|
|
||||||
defaultPen = QPen(QBrush(adjustColor(defaultBrush.color(), 0, 0, 8)),
|
|
||||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
||||||
} else
|
|
||||||
defaultPen = QPen(QBrush(adjustColor(defaultBrush.color(), 0, 0, -25)), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
||||||
|
|
||||||
|
|
||||||
//hover
|
//hover
|
||||||
if (isDark) {
|
if (isDark) {
|
||||||
//hightlight->210,72%,71% 210,67%,56%
|
//hightlight->210,72%,71% 210,67%,56%
|
||||||
|
@ -623,13 +615,6 @@ void UKUIConfigStyleParameters::normalButtonColor(bool isDark, QPalette p, QPen
|
||||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
}
|
}
|
||||||
clickBrush = QBrush(highlightClick(isDark, p));
|
clickBrush = QBrush(highlightClick(isDark, p));
|
||||||
|
|
||||||
//disable
|
|
||||||
if (isDark) {
|
|
||||||
disablePen = QPen(QBrush(adjustL(disableBrush.color(), 18)),
|
|
||||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3494,36 +3479,24 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
|
||||||
QBrush tabBarHoverBrush = tabWidgetColorCfg.tabBarHoverBrush;
|
QBrush tabBarHoverBrush = tabWidgetColorCfg.tabBarHoverBrush;
|
||||||
QBrush tabBarSelectBrush = tabWidgetColorCfg.tabBarSelectBrush;
|
QBrush tabBarSelectBrush = tabWidgetColorCfg.tabBarSelectBrush;
|
||||||
QBrush tabBarClickBrush = tabWidgetColorCfg.tabBarClickBrush;
|
QBrush tabBarClickBrush = tabWidgetColorCfg.tabBarClickBrush;
|
||||||
// QPen tabBarHoverPen = QPen(tabWidgetColorCfg.tabBarHoverPen, (tabWidgetColorCfg.tabBarHoverPen == Qt::NoPen || tabWidgetColorCfg.tabBarHoverPen.alpha() == 0) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
QPen tabBarHoverPen = QPen(tabWidgetColorCfg.tabBarHoverPen, (tabWidgetColorCfg.tabBarHoverPen == Qt::NoPen || tabWidgetColorCfg.tabBarHoverPen.alpha() == 0) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
// QPen tabBarClickPen = QPen(tabWidgetColorCfg.tabBarClickPen, (tabWidgetColorCfg.tabBarClickPen == Qt::NoPen || tabWidgetColorCfg.tabBarClickPen.alpha() == 0) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
QPen tabBarClickPen = QPen(tabWidgetColorCfg.tabBarClickPen, (tabWidgetColorCfg.tabBarClickPen == Qt::NoPen || tabWidgetColorCfg.tabBarClickPen.alpha() == 0) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
QPen tabBarPen = QPen(QColor(Qt::NoPen), 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
QPen tabBarDefaultPen = QPen(tabWidgetColorCfg.tabBarDefaultPen, (tabWidgetColorCfg.tabBarDefaultPen == Qt::NoPen || tabWidgetColorCfg.tabBarDefaultPen.alpha() == 0) ? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
QPen tabBarFocusPen = QPen(tabWidgetColorCfg.tabBarFocusPen , (tabWidgetColorCfg.tabBarFocusPen.alpha() == 0 ||
|
QPen tabBarFocusPen = QPen(tabWidgetColorCfg.tabBarFocusPen , (tabWidgetColorCfg.tabBarFocusPen.alpha() == 0 ||
|
||||||
tabWidgetColorCfg.tabBarFocusPen == Qt::NoPen) ? 0 : 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
tabWidgetColorCfg.tabBarFocusPen == Qt::NoPen) ? 0 : 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
|
||||||
|
|
||||||
switch (m_adjustColorRules) {
|
switch (m_adjustColorRules) {
|
||||||
case AdjustColorRules::DefaultRGB:
|
case AdjustColorRules::DefaultRGB:
|
||||||
if (tabWidgetColorCfg.tabBarHoverType == Obj_Color_Type) {
|
if (tabWidgetColorCfg.tabBarHoverType == Obj_Gradient_Type) {
|
||||||
//tabbar hover
|
//tabbar hover
|
||||||
QColor hover_color = option->palette.color(QPalette::Active, QPalette::Window);
|
|
||||||
QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText);
|
|
||||||
tabBarHoverBrush = QBrush(configMixColor(hover_color, mix, 0.1));
|
|
||||||
} else if (tabWidgetColorCfg.tabBarHoverType == Obj_Gradient_Type) {
|
|
||||||
//tabbar hover
|
|
||||||
QColor hover_color = option->palette.color(QPalette::Active, QPalette::Window);
|
|
||||||
QColor mix = option->palette.color(QPalette::Active, QPalette::BrightText);
|
|
||||||
QColor startColor;
|
QColor startColor;
|
||||||
QColor endColor;
|
QColor endColor;
|
||||||
QLinearGradient linearGradient;
|
QLinearGradient linearGradient;
|
||||||
linearGradient.setStart(option->rect.topLeft());
|
linearGradient.setStart(option->rect.topLeft());
|
||||||
linearGradient.setFinalStop(option->rect.bottomLeft());
|
linearGradient.setFinalStop(option->rect.bottomLeft());
|
||||||
if (isDark) {
|
startColor = tabWidgetColorCfg.tabBarHoverGradientList.value(0);
|
||||||
startColor = configMixColor(hover_color, mix, 0.1);
|
endColor = tabWidgetColorCfg.tabBarHoverGradientList.value(1);
|
||||||
endColor = configMixColor(hover_color, mix, 0.05);
|
|
||||||
} else {
|
|
||||||
startColor = configMixColor(hover_color, mix, 0.05);
|
|
||||||
endColor = configMixColor(hover_color, mix, 0.1);
|
|
||||||
}
|
|
||||||
linearGradient.setColorAt(0, startColor);
|
linearGradient.setColorAt(0, startColor);
|
||||||
linearGradient.setColorAt(1, endColor);
|
linearGradient.setColorAt(1, endColor);
|
||||||
tabBarHoverBrush = QBrush(linearGradient);
|
tabBarHoverBrush = QBrush(linearGradient);
|
||||||
|
@ -3538,10 +3511,10 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
|
||||||
tabBarHoverBrush = highlightHover(isDark, option->palette);
|
tabBarHoverBrush = highlightHover(isDark, option->palette);
|
||||||
tabBarClickBrush = highlightClick(isDark, option->palette);
|
tabBarClickBrush = highlightClick(isDark, option->palette);
|
||||||
if (click) {
|
if (click) {
|
||||||
tabBarPen = QPen(QBrush(option->palette.color(QPalette::Active, QPalette::Highlight)),
|
tabBarClickPen = QPen(QBrush(option->palette.color(QPalette::Active, QPalette::Highlight)),
|
||||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
} else if(hover && !selected) {
|
} else if(hover && !selected) {
|
||||||
tabBarPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)),
|
tabBarHoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 0, -5, -15)),
|
||||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3549,11 +3522,11 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
|
||||||
tabBarClickBrush = highlightClick(isDark, option->palette);
|
tabBarClickBrush = highlightClick(isDark, option->palette);
|
||||||
|
|
||||||
if(click){
|
if(click){
|
||||||
tabBarPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 1, -21, 3)),
|
tabBarClickPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 1, -21, 3)),
|
||||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
}
|
}
|
||||||
else if(hover && !selected){
|
else if(hover && !selected){
|
||||||
tabBarPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)),
|
tabBarHoverPen = QPen(QBrush(adjustColor(option->palette.color(QPalette::Active, QPalette::Highlight), 4, -14, 15)),
|
||||||
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3562,9 +3535,9 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((option->state & QStyle::State_HasFocus) && (option->state & QStyle::State_Enabled)){
|
// if((option->state & QStyle::State_HasFocus) && (option->state & QStyle::State_Enabled)){
|
||||||
tabBarPen = tabBarFocusPen;
|
// tabBarPen = tabBarFocusPen;
|
||||||
}
|
// }
|
||||||
|
|
||||||
auto *w = const_cast<QWidget *>(widget);
|
auto *w = const_cast<QWidget *>(widget);
|
||||||
if (w) {
|
if (w) {
|
||||||
|
@ -3575,8 +3548,10 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
|
||||||
w->setProperty("tabBarHoverBrush", tabBarHoverBrush);
|
w->setProperty("tabBarHoverBrush", tabBarHoverBrush);
|
||||||
w->setProperty("tabBarClickBrush", tabBarClickBrush);
|
w->setProperty("tabBarClickBrush", tabBarClickBrush);
|
||||||
w->setProperty("tabBarSelectBrush", tabBarSelectBrush);
|
w->setProperty("tabBarSelectBrush", tabBarSelectBrush);
|
||||||
w->setProperty("tabBarPen", tabBarPen);
|
w->setProperty("tabBarDefaultPen", tabBarDefaultPen);
|
||||||
w->setProperty("tabBarFocusPen", tabBarFocusPen);
|
w->setProperty("tabBarFocusPen", tabBarFocusPen);
|
||||||
|
w->setProperty("tabBarClickPen", tabBarClickPen);
|
||||||
|
w->setProperty("tabBarHoverPen", tabBarHoverPen);
|
||||||
}
|
}
|
||||||
if (widget) {
|
if (widget) {
|
||||||
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
|
if (widget->property("setRadius").isValid() && widget->property("setRadius").canConvert<int>()) {
|
||||||
|
@ -3600,12 +3575,18 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
|
||||||
if (widget->property("setTabBarSelectBrush").isValid() && widget->property("setTabBarSelectBrush").canConvert<QBrush>()) {
|
if (widget->property("setTabBarSelectBrush").isValid() && widget->property("setTabBarSelectBrush").canConvert<QBrush>()) {
|
||||||
tabBarSelectBrush = widget->property("setTabBarSelectBrush").value<QBrush>();
|
tabBarSelectBrush = widget->property("setTabBarSelectBrush").value<QBrush>();
|
||||||
}
|
}
|
||||||
if (widget->property("setTabBarPen").isValid() && widget->property("setTabBarPen").canConvert<QBrush>()) {
|
if (widget->property("setTabBarDefaultPen").isValid() && widget->property("setTabBarDefaultPen").canConvert<QPen>()) {
|
||||||
tabBarPen = widget->property("setTabBarPen").value<QPen>();
|
tabBarDefaultPen = widget->property("setTabBarDefaultPen").value<QPen>();
|
||||||
}
|
}
|
||||||
if (widget->property("setTabBarFocusPen").isValid() && widget->property("setTabBarFocusPen").canConvert<QBrush>()) {
|
if (widget->property("setTabBarFocusPen").isValid() && widget->property("setTabBarFocusPen").canConvert<QPen>()) {
|
||||||
tabBarFocusPen = widget->property("setTabBarFocusPen").value<QPen>();
|
tabBarFocusPen = widget->property("setTabBarFocusPen").value<QPen>();
|
||||||
}
|
}
|
||||||
|
if (widget->property("setTabBarClickPen").isValid() && widget->property("setTabBarClickPen").canConvert<QPen>()) {
|
||||||
|
tabBarFocusPen = widget->property("setTabBarClickPen").value<QPen>();
|
||||||
|
}
|
||||||
|
if (widget->property("setTabBarHoverPen").isValid() && widget->property("setTabBarHoverPen").canConvert<QPen>()) {
|
||||||
|
tabBarFocusPen = widget->property("setTabBarHoverPen").value<QPen>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_TabWidgetParameters.radius = tabradius;
|
m_TabWidgetParameters.radius = tabradius;
|
||||||
|
@ -3615,8 +3596,10 @@ void UKUIConfigStyleParameters::initConfigTabWidgetParameters(bool isDark, const
|
||||||
m_TabWidgetParameters.tabBarHoverBrush = tabBarHoverBrush;
|
m_TabWidgetParameters.tabBarHoverBrush = tabBarHoverBrush;
|
||||||
m_TabWidgetParameters.tabBarClickBrush = tabBarClickBrush;
|
m_TabWidgetParameters.tabBarClickBrush = tabBarClickBrush;
|
||||||
m_TabWidgetParameters.tabBarSelectBrush = tabBarSelectBrush;
|
m_TabWidgetParameters.tabBarSelectBrush = tabBarSelectBrush;
|
||||||
m_TabWidgetParameters.tabBarPen = tabBarPen;
|
m_TabWidgetParameters.tabBarDefaultPen = tabBarDefaultPen;
|
||||||
m_TabWidgetParameters.tabBarFocusPen = tabBarFocusPen;
|
m_TabWidgetParameters.tabBarHoverPen = tabBarHoverPen;
|
||||||
|
m_TabWidgetParameters.tabBarClickPen = tabBarClickPen;
|
||||||
|
m_TabWidgetParameters.tabBarFocusPen = tabBarFocusPen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
|
void UKUIConfigStyleParameters::initConfigMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget)
|
||||||
|
|
|
@ -5141,8 +5141,11 @@ void UKUIConfigStyle::drawControl(QStyle::ControlElement element, const QStyleOp
|
||||||
path.addRect(drawRect);
|
path.addRect(drawRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
int penWidth = sp->m_TabWidgetParameters.tabBarPen.width();
|
int penWidth = (sp->m_TabWidgetParameters.tabBarDefaultPen == Qt::NoPen ||
|
||||||
|
sp->m_TabWidgetParameters.tabBarDefaultPen.color().alpha() == 0) ?
|
||||||
|
0 : sp->m_TabWidgetParameters.tabBarDefaultPen.width();
|
||||||
int radius = sp->m_TabWidgetParameters.radius;
|
int radius = sp->m_TabWidgetParameters.radius;
|
||||||
|
QPen pen = Qt::NoPen;
|
||||||
// drawRect.adjust(0, 0, -1 * penWidth, 0);
|
// drawRect.adjust(0, 0, -1 * penWidth, 0);
|
||||||
// penPath.moveTo(drawRect.left(), drawRect.bottom() - penWidth - radius);
|
// penPath.moveTo(drawRect.left(), drawRect.bottom() - penWidth - radius);
|
||||||
// penPath.lineTo(drawRect.left(), drawRect.top());
|
// penPath.lineTo(drawRect.left(), drawRect.top());
|
||||||
|
@ -5151,23 +5154,33 @@ void UKUIConfigStyle::drawControl(QStyle::ControlElement element, const QStyleOp
|
||||||
// penPath.lineTo(drawRect.left(), drawRect.bottom() - penWidth);
|
// penPath.lineTo(drawRect.left(), drawRect.bottom() - penWidth);
|
||||||
|
|
||||||
if(click) {
|
if(click) {
|
||||||
|
penWidth = sp->m_TabWidgetParameters.tabBarClickPen.width();
|
||||||
painter->setBrush(sp->m_TabWidgetParameters.tabBarClickBrush);
|
painter->setBrush(sp->m_TabWidgetParameters.tabBarClickBrush);
|
||||||
|
pen = sp->m_TabWidgetParameters.tabBarClickPen;
|
||||||
}
|
}
|
||||||
else if (selected) {
|
else if (selected) {
|
||||||
painter->setBrush(sp->m_TabWidgetParameters.tabBarSelectBrush);
|
painter->setBrush(sp->m_TabWidgetParameters.tabBarSelectBrush);
|
||||||
} else if (hover) {
|
} else if (hover) {
|
||||||
|
penWidth = sp->m_TabWidgetParameters.tabBarHoverPen.width();
|
||||||
painter->setBrush(sp->m_TabWidgetParameters.tabBarHoverBrush);
|
painter->setBrush(sp->m_TabWidgetParameters.tabBarHoverBrush);
|
||||||
|
pen = sp->m_TabWidgetParameters.tabBarHoverPen;
|
||||||
} else{
|
} else{
|
||||||
|
penWidth = sp->m_TabWidgetParameters.tabBarDefaultPen.width();
|
||||||
painter->setBrush(sp->m_TabWidgetParameters.tabBarDefaultBrush);
|
painter->setBrush(sp->m_TabWidgetParameters.tabBarDefaultBrush);
|
||||||
|
pen = sp->m_TabWidgetParameters.tabBarDefaultPen;
|
||||||
|
}
|
||||||
|
if((tab->state & State_Enabled) && (tab->state & State_HasFocus)){
|
||||||
|
penWidth = sp->m_TabWidgetParameters.tabBarFocusPen.width();
|
||||||
|
pen = sp->m_TabWidgetParameters.tabBarFocusPen;
|
||||||
}
|
}
|
||||||
painter->drawPath(path);
|
painter->drawPath(path);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setPen(penWidth > 0 ? sp->m_TabWidgetParameters.tabBarPen : Qt::NoPen);
|
painter->setPen(penWidth > 0 ? pen : Qt::NoPen);
|
||||||
painter->setBrush(Qt::NoBrush);
|
painter->setBrush(Qt::NoBrush);
|
||||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||||
if(painter->pen().width() == 1)
|
// if(painter->pen().width() == 1)
|
||||||
painter->translate(0.5, 0.5);
|
// painter->translate(0.5, 0.5);
|
||||||
painter->drawRoundedRect(drawRect.adjusted(penWidth/2, penWidth/2, -1 * penWidth/2, -1 * penWidth), radius, radius);
|
painter->drawRoundedRect(drawRect.adjusted(penWidth/2, penWidth/2, -1 * penWidth/2, -1 * penWidth), radius, radius);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,10 @@ public:
|
||||||
QBrush tabBarHoverBrush;
|
QBrush tabBarHoverBrush;
|
||||||
QBrush tabBarClickBrush;
|
QBrush tabBarClickBrush;
|
||||||
QBrush tabBarSelectBrush;
|
QBrush tabBarSelectBrush;
|
||||||
QPen tabBarPen = Qt::NoPen;
|
QPen tabBarDefaultPen = Qt::NoPen;
|
||||||
QPen tabBarFocusPen = Qt::NoPen;
|
QPen tabBarFocusPen = Qt::NoPen;
|
||||||
|
QPen tabBarClickPen = Qt::NoPen;
|
||||||
|
QPen tabBarHoverPen = Qt::NoPen;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -807,6 +807,7 @@ typedef struct TabWidgetColorStruct
|
||||||
QColor tabBarHoverBrush = QColor(232, 232, 232);
|
QColor tabBarHoverBrush = QColor(232, 232, 232);
|
||||||
QColor tabBarSelectBrush = QColor(255, 255, 255);
|
QColor tabBarSelectBrush = QColor(255, 255, 255);
|
||||||
QColor tabBarClickBrush = QColor(255, 255, 255);
|
QColor tabBarClickBrush = QColor(255, 255, 255);
|
||||||
|
QColor tabBarDefaultPen = QColor(0, 0, 0, 0);
|
||||||
QColor tabBarHoverPen = QColor(0, 0, 0, 0);
|
QColor tabBarHoverPen = QColor(0, 0, 0, 0);
|
||||||
QColor tabBarClickPen = QColor(0, 0, 0, 0);
|
QColor tabBarClickPen = QColor(0, 0, 0, 0);
|
||||||
QColor tabBarFocusPen = QColor(55, 144, 250);
|
QColor tabBarFocusPen = QColor(55, 144, 250);
|
||||||
|
|
Loading…
Reference in New Issue