forked from openkylin/qt5-ukui-platformtheme
checkable状态下按钮响应高亮色变化
This commit is contained in:
parent
5cbd96d9be
commit
20755b995f
|
@ -741,6 +741,23 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark,
|
||||||
disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen || buttonColorCfg.disablePen.alpha() == 0)
|
disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen || buttonColorCfg.disablePen.alpha() == 0)
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
|
||||||
|
auto checkableColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_ImportButton);
|
||||||
|
{
|
||||||
|
checkPen = QPen(QBrush(checkableColorCfg.defaultPen), (checkableColorCfg.defaultPen == Qt::NoPen || checkableColorCfg.defaultPen.alpha() == 0)
|
||||||
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
checkHoverPen = QPen(QBrush(checkableColorCfg.hoverPen), (checkableColorCfg.hoverPen == Qt::NoPen || checkableColorCfg.hoverPen.alpha() == 0)
|
||||||
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
checkClickPen = QPen(QBrush(checkableColorCfg.clickPen), (checkableColorCfg.clickPen == Qt::NoPen || checkableColorCfg.clickPen.alpha() == 0)
|
||||||
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
checkDisablePen = QPen(QBrush(checkableColorCfg.disablePen), (checkableColorCfg.disablePen == Qt::NoPen || checkableColorCfg.disablePen.alpha() == 0)
|
||||||
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
|
||||||
|
checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight);
|
||||||
|
checkHoverBrush = checkableColorCfg.hoverBrush;
|
||||||
|
checkClickBrush = checkableColorCfg.clickBrush;
|
||||||
|
checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
|
||||||
|
}
|
||||||
|
|
||||||
if (isWindowColoseButton) {
|
if (isWindowColoseButton) {
|
||||||
if (buttonColorCfg.hoverType == Obj_Gradient_Type){
|
if (buttonColorCfg.hoverType == Obj_Gradient_Type){
|
||||||
linearGradient.setColorAt(0, buttonColorCfg.hoverGradientList.value(0));
|
linearGradient.setColorAt(0, buttonColorCfg.hoverGradientList.value(0));
|
||||||
|
@ -780,6 +797,8 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark,
|
||||||
clickBrush = QBrush(configMixColor(highlight, mix, 0.2));
|
clickBrush = QBrush(configMixColor(highlight, mix, 0.2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
checkHoverBrush = hoverBrush;
|
||||||
|
checkClickBrush = clickBrush;
|
||||||
|
|
||||||
if (isWindowButton && useTransparentButtonList().contains(qAppName())) {//特殊三联应用
|
if (isWindowButton && useTransparentButtonList().contains(qAppName())) {//特殊三联应用
|
||||||
if (isDark) {
|
if (isDark) {
|
||||||
|
@ -842,6 +861,9 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark,
|
||||||
disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen || buttonColorCfg.disablePen.alpha() == 0)
|
disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen || buttonColorCfg.disablePen.alpha() == 0)
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
|
||||||
|
checkHoverBrush = hoverBrush;
|
||||||
|
checkClickBrush = clickBrush;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
clickBrush = QBrush(buttonColorCfg.clickBrush);
|
clickBrush = QBrush(buttonColorCfg.clickBrush);
|
||||||
hoverBrush = QBrush(buttonColorCfg.hoverBrush);
|
hoverBrush = QBrush(buttonColorCfg.hoverBrush);
|
||||||
|
@ -852,24 +874,6 @@ void UKUIConfigStyleParameters::initConfigPushButtonBevelParameters(bool isDark,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto checkableColorCfg = readCfg()->buttonColorCfg(option->palette, C_Button_ImportButton);
|
|
||||||
{
|
|
||||||
checkPen = QPen(QBrush(checkableColorCfg.defaultPen), (checkableColorCfg.defaultPen == Qt::NoPen || checkableColorCfg.defaultPen.alpha() == 0)
|
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
||||||
checkHoverPen = QPen(QBrush(checkableColorCfg.hoverPen), (checkableColorCfg.hoverPen == Qt::NoPen || checkableColorCfg.hoverPen.alpha() == 0)
|
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
||||||
checkClickPen = QPen(QBrush(checkableColorCfg.clickPen), (checkableColorCfg.clickPen == Qt::NoPen || checkableColorCfg.clickPen.alpha() == 0)
|
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
||||||
checkDisablePen = QPen(QBrush(checkableColorCfg.disablePen), (checkableColorCfg.disablePen == Qt::NoPen || checkableColorCfg.disablePen.alpha() == 0)
|
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
||||||
|
|
||||||
checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight);
|
|
||||||
checkHoverBrush = checkableColorCfg.hoverBrush;
|
|
||||||
checkClickBrush = checkableColorCfg.clickBrush;
|
|
||||||
checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
auto *w = const_cast<QWidget *>(widget);
|
auto *w = const_cast<QWidget *>(widget);
|
||||||
|
|
||||||
if (w) {
|
if (w) {
|
||||||
|
@ -1156,6 +1160,23 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark,
|
||||||
disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen) ?
|
disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen) ?
|
||||||
0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
|
||||||
|
auto checkableColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_ImportButton);
|
||||||
|
|
||||||
|
{
|
||||||
|
checkPen = QPen(QBrush(checkableColorCfg.defaultPen), (checkableColorCfg.defaultPen == Qt::NoPen || checkableColorCfg.defaultPen.alpha() == 0)
|
||||||
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
checkHoverPen = QPen(QBrush(checkableColorCfg.hoverPen), (checkableColorCfg.hoverPen == Qt::NoPen || checkableColorCfg.hoverPen.alpha() == 0)
|
||||||
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
checkClickPen = QPen(QBrush(checkableColorCfg.clickPen), (checkableColorCfg.clickPen == Qt::NoPen || checkableColorCfg.clickPen.alpha() == 0)
|
||||||
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
checkDisablePen = QPen(QBrush(checkableColorCfg.disablePen), (checkableColorCfg.disablePen == Qt::NoPen || checkableColorCfg.disablePen.alpha() == 0)
|
||||||
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
|
||||||
|
checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight);
|
||||||
|
checkHoverBrush = checkableColorCfg.hoverBrush;
|
||||||
|
checkClickBrush = checkableColorCfg.clickBrush;
|
||||||
|
checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
|
||||||
|
}
|
||||||
if (isWindowColoseButton){
|
if (isWindowColoseButton){
|
||||||
if (buttonColorCfg.hoverType == Obj_Gradient_Type) {
|
if (buttonColorCfg.hoverType == Obj_Gradient_Type) {
|
||||||
linearGradient.setColorAt(0, buttonColorCfg.hoverGradientList.value(0));
|
linearGradient.setColorAt(0, buttonColorCfg.hoverGradientList.value(0));
|
||||||
|
@ -1195,6 +1216,9 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkHoverBrush = hoverBrush;
|
||||||
|
checkClickBrush = clickBrush;
|
||||||
|
|
||||||
if (isWindowButton && useTransparentButtonList().contains(qAppName())) {//特殊三联应用
|
if (isWindowButton && useTransparentButtonList().contains(qAppName())) {//特殊三联应用
|
||||||
if (isDark) {
|
if (isDark) {
|
||||||
mix.setAlphaF(0.28);
|
mix.setAlphaF(0.28);
|
||||||
|
@ -1256,6 +1280,10 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark,
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen || buttonColorCfg.disablePen.alpha() == 0)
|
disablePen = QPen(QBrush(buttonColorCfg.disablePen), (buttonColorCfg.disablePen == Qt::NoPen || buttonColorCfg.disablePen.alpha() == 0)
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
|
||||||
|
checkHoverBrush = hoverBrush;
|
||||||
|
checkClickBrush = clickBrush;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
clickBrush = QBrush(buttonColorCfg.clickBrush);
|
clickBrush = QBrush(buttonColorCfg.clickBrush);
|
||||||
hoverBrush = QBrush(buttonColorCfg.hoverBrush);
|
hoverBrush = QBrush(buttonColorCfg.hoverBrush);
|
||||||
|
@ -1266,24 +1294,6 @@ void UKUIConfigStyleParameters::initConfigToolButtonPanelParameters(bool isDark,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto checkableColorCfg = readCfg()->toolButtonColorCfg(option->palette, C_Button_ImportButton);
|
|
||||||
|
|
||||||
{
|
|
||||||
checkPen = QPen(QBrush(checkableColorCfg.defaultPen), (checkableColorCfg.defaultPen == Qt::NoPen || checkableColorCfg.defaultPen.alpha() == 0)
|
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
||||||
checkHoverPen = QPen(QBrush(checkableColorCfg.hoverPen), (checkableColorCfg.hoverPen == Qt::NoPen || checkableColorCfg.hoverPen.alpha() == 0)
|
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
||||||
checkClickPen = QPen(QBrush(checkableColorCfg.clickPen), (checkableColorCfg.clickPen == Qt::NoPen || checkableColorCfg.clickPen.alpha() == 0)
|
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
||||||
checkDisablePen = QPen(QBrush(checkableColorCfg.disablePen), (checkableColorCfg.disablePen == Qt::NoPen || checkableColorCfg.disablePen.alpha() == 0)
|
|
||||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
|
||||||
|
|
||||||
checkBrush = option->palette.color(QPalette::Active, QPalette::Highlight);
|
|
||||||
checkHoverBrush = checkableColorCfg.hoverBrush;
|
|
||||||
checkClickBrush = checkableColorCfg.clickBrush;
|
|
||||||
checkDisableBrush = option->palette.brush(QPalette::Disabled, QPalette::NoRole);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto *w = const_cast<QWidget *>(widget);
|
auto *w = const_cast<QWidget *>(widget);
|
||||||
if (w) {
|
if (w) {
|
||||||
w->setProperty("radius", radius);
|
w->setProperty("radius", radius);
|
||||||
|
|
Loading…
Reference in New Issue