minor tweaks

Doesn't seem to affect the final appearance

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2022-05-13 20:51:03 +08:00
parent d13d74783f
commit 45b3657d7e
3 changed files with 12 additions and 3 deletions

View File

@ -99,7 +99,9 @@ QT_END_NAMESPACE
#endif
#ifndef FRAMELESSHELPER_BYTEARRAY_LITERAL
# if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
# if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
# define FRAMELESSHELPER_BYTEARRAY_LITERAL(ba) ba##_ba
# elif (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
# define FRAMELESSHELPER_BYTEARRAY_LITERAL(ba) ba##_qba
# else
# define FRAMELESSHELPER_BYTEARRAY_LITERAL(ba) QByteArrayLiteral(ba)
@ -107,7 +109,9 @@ QT_END_NAMESPACE
#endif
#ifndef FRAMELESSHELPER_STRING_LITERAL
# if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
# if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
# define FRAMELESSHELPER_STRING_LITERAL(str) u##str##_s
# elif (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
# define FRAMELESSHELPER_STRING_LITERAL(str) u##str##_qs
# else
# define FRAMELESSHELPER_STRING_LITERAL(str) QStringLiteral(str)

View File

@ -146,7 +146,9 @@ void QuickStandardSystemButton::initialize()
setImplicitHeight(kDefaultSystemButtonSize.height());
m_contentItem.reset(new QQuickImage(this));
m_contentItem->setFillMode(QQuickImage::Pad);
m_contentItem->setFillMode(QQuickImage::Pad); // Don't apply any transformation to the image.
m_contentItem->setSmooth(true); // Renders better when scaling up.
m_contentItem->setMipmap(true); // Renders better when scaling down.
m_contentItem->setWidth(kDefaultSystemButtonIconSize.width());
m_contentItem->setHeight(kDefaultSystemButtonIconSize.height());
connect(FramelessManager::instance(), &FramelessManager::systemThemeChanged, this, &QuickStandardSystemButton::updateForeground);

View File

@ -300,6 +300,9 @@ void StandardSystemButtonPrivate::paintEventHandler(QPaintEvent *event)
Q_Q(StandardSystemButton);
QPainter painter(q);
painter.save();
// Enabling "QPainter::SmoothPixmapTransform" will cause the painted image
// looks blurry, strange.
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
QColor color = {};
// The pressed state has higher priority than the hovered state.
if (m_pressed && m_pressColor.isValid()) {