feat(decoration): resize window buttons

main
kate 3 years ago
parent b5198d1588
commit 20f907f623

@ -74,10 +74,14 @@ void Button::paint(QPainter *painter, const QRect &repaintRegion)
painter->setRenderHint(QPainter::SmoothPixmapTransform, false);
painter->setRenderHints(QPainter::Antialiasing, true);
QRect btnRect(0, 0, 28 * decoration->devicePixelRatio(),
28 * decoration->devicePixelRatio());
QRect btnRect(0, 0, 26 * decoration->devicePixelRatio(),
26 * decoration->devicePixelRatio());
btnRect.moveCenter(rect.center());
QRect imgRect(0, 0, 24 * decoration->devicePixelRatio(),
24 * decoration->devicePixelRatio());
imgRect.moveCenter(rect.center());
if (isHovered() || isPressed()) {
painter->setPen(Qt::NoPen);
painter->setBrush(isDarkMode ? isPressed() ? QColor(255, 255, 255, 255 * 0.1) : QColor(255, 255, 255, 255 * 0.15)
@ -94,18 +98,18 @@ void Button::paint(QPainter *painter, const QRect &repaintRegion)
break;
}
case KDecoration2::DecorationButtonType::Minimize: {
painter->drawPixmap(btnRect, decoration->minimizeBtnPixmap());
painter->drawPixmap(imgRect, decoration->minimizeBtnPixmap());
break;
}
case KDecoration2::DecorationButtonType::Maximize: {
if (isChecked())
painter->drawPixmap(btnRect, decoration->restoreBtnPixmap());
painter->drawPixmap(imgRect, decoration->restoreBtnPixmap());
else
painter->drawPixmap(btnRect, decoration->maximizeBtnPixmap());
painter->drawPixmap(imgRect, decoration->maximizeBtnPixmap());
break;
}
case KDecoration2::DecorationButtonType::Close: {
painter->drawPixmap(btnRect, decoration->closeBtnPixmap());
painter->drawPixmap(imgRect, decoration->closeBtnPixmap());
break;
}
default:

@ -329,7 +329,7 @@ void Decoration::updateShadow()
void Decoration::updateBtnPixmap()
{
int size = 28;
int size = 24;
QString dirName = darkMode() ? "dark" : "light";
m_closeBtnPixmap = fromSvgToPixmap(QString(":/images/%1/close_normal.svg").arg(dirName), QSize(size, size));

@ -46,6 +46,7 @@ static QStringList allowList = { "netease-cloud-music netease-cloud-music",
"bytedance-feishu bytedance-feishu",
"xmind xmind",
"mtxx mtxx",
"ynote-desktop ynote-desktop",
// Open source software
"code code",

Loading…
Cancel
Save