Redraw the PushButtonLabel in the way of DT
This commit is contained in:
parent
e4eb5828a7
commit
b262db2b96
|
@ -965,7 +965,14 @@ void UKUIConfigStyleParameters::initConfigPushButtonLabelParameters(bool isDark,
|
|||
bool isWindowColoseButton = false;
|
||||
bool needTranslucent = false;
|
||||
|
||||
UKUIColorTheme::ButtonColorCfg buttonColorCfg = readCfg()->buttonColorCfg(palette);
|
||||
QBrush defaultBrush ;
|
||||
QBrush disableBrush ;
|
||||
QBrush clickBrush ;
|
||||
QBrush hoverBrush ;
|
||||
QPen defaultPen ;
|
||||
QPen hoverPen ;
|
||||
QPen clickPen ;
|
||||
QPen disablePen ;
|
||||
|
||||
if (widget) {
|
||||
if (widget->property("isWindowButton").isValid()) {
|
||||
|
@ -988,21 +995,90 @@ void UKUIConfigStyleParameters::initConfigPushButtonLabelParameters(bool isDark,
|
|||
needTranslucent = widget->property("needTranslucent").toBool();
|
||||
}
|
||||
}
|
||||
if (isWindowColoseButton)
|
||||
buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_WindowCloseButton);
|
||||
if (isWindowButton)
|
||||
buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_WindowButton);
|
||||
if (useButtonPalette || isWindowButton) {
|
||||
if (needTranslucent)
|
||||
buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_TranslucentButton);
|
||||
else
|
||||
buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_UseButtonPalette);
|
||||
if (isWindowColoseButton){
|
||||
defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kGrayAlpha0());
|
||||
hoverBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kErrorHover());
|
||||
clickBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kErrorClick());
|
||||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kGrayAlpha0());
|
||||
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
if (isWindowButton){
|
||||
defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kGrayAlpha0());
|
||||
hoverBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaHover());
|
||||
clickBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaClick());
|
||||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kGrayAlpha0());
|
||||
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
if (useButtonPalette || isWindowButton) {
|
||||
if (needTranslucent){
|
||||
defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaNormal());
|
||||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaDisable());
|
||||
hoverBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaHover());
|
||||
clickBrush= parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentAlphaClick());
|
||||
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
} else {
|
||||
defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->buttonActive());
|
||||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->buttonDisable());
|
||||
clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentClick());
|
||||
hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kComponentHover());
|
||||
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineComponentDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
}
|
||||
if (isImportant){
|
||||
defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightActive());
|
||||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightDisable());
|
||||
hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kBrandHover());
|
||||
clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kBrandClick());
|
||||
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen= QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
if (isImportant)
|
||||
buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_ImportButton);
|
||||
|
||||
if(option && option->state & QStyle::State_On && option->state & QStyle::State_Enabled){
|
||||
buttonColorCfg = readCfg()->buttonColorCfg(palette, C_Button_ImportButton);
|
||||
defaultBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightActive());
|
||||
disableBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->highLightDisable());
|
||||
hoverBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kBrandHover());
|
||||
clickBrush = parseDTColor(option ? option->rect : QRect(), m_dtconfig->kBrandClick());
|
||||
defaultPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandNormal()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
hoverPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandHover()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
clickPen = QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandClick()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
disablePen= QPen(parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()), (parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()).color() == Qt::NoPen || parseDTColor(option ? option->rect : QRect(), m_dtconfig->kLineBrandDisable()).color().alpha() == 0)
|
||||
? 0 : 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
}
|
||||
|
||||
QColor textDefaultColor = parseDTColor(option ? option->rect : QRect(), m_dtconfig->buttonTextActive()).color();
|
||||
|
|
Loading…
Reference in New Issue