forked from github_mirror/framelesshelper
minor tweaks
Doesn't seem to affect the final appearance Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
d13d74783f
commit
45b3657d7e
|
@ -99,7 +99,9 @@ QT_END_NAMESPACE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_BYTEARRAY_LITERAL
|
#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
|
# define FRAMELESSHELPER_BYTEARRAY_LITERAL(ba) ba##_qba
|
||||||
# else
|
# else
|
||||||
# define FRAMELESSHELPER_BYTEARRAY_LITERAL(ba) QByteArrayLiteral(ba)
|
# define FRAMELESSHELPER_BYTEARRAY_LITERAL(ba) QByteArrayLiteral(ba)
|
||||||
|
@ -107,7 +109,9 @@ QT_END_NAMESPACE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FRAMELESSHELPER_STRING_LITERAL
|
#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
|
# define FRAMELESSHELPER_STRING_LITERAL(str) u##str##_qs
|
||||||
# else
|
# else
|
||||||
# define FRAMELESSHELPER_STRING_LITERAL(str) QStringLiteral(str)
|
# define FRAMELESSHELPER_STRING_LITERAL(str) QStringLiteral(str)
|
||||||
|
|
|
@ -146,7 +146,9 @@ void QuickStandardSystemButton::initialize()
|
||||||
setImplicitHeight(kDefaultSystemButtonSize.height());
|
setImplicitHeight(kDefaultSystemButtonSize.height());
|
||||||
|
|
||||||
m_contentItem.reset(new QQuickImage(this));
|
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->setWidth(kDefaultSystemButtonIconSize.width());
|
||||||
m_contentItem->setHeight(kDefaultSystemButtonIconSize.height());
|
m_contentItem->setHeight(kDefaultSystemButtonIconSize.height());
|
||||||
connect(FramelessManager::instance(), &FramelessManager::systemThemeChanged, this, &QuickStandardSystemButton::updateForeground);
|
connect(FramelessManager::instance(), &FramelessManager::systemThemeChanged, this, &QuickStandardSystemButton::updateForeground);
|
||||||
|
|
|
@ -300,6 +300,9 @@ void StandardSystemButtonPrivate::paintEventHandler(QPaintEvent *event)
|
||||||
Q_Q(StandardSystemButton);
|
Q_Q(StandardSystemButton);
|
||||||
QPainter painter(q);
|
QPainter painter(q);
|
||||||
painter.save();
|
painter.save();
|
||||||
|
// Enabling "QPainter::SmoothPixmapTransform" will cause the painted image
|
||||||
|
// looks blurry, strange.
|
||||||
|
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
||||||
QColor color = {};
|
QColor color = {};
|
||||||
// The pressed state has higher priority than the hovered state.
|
// The pressed state has higher priority than the hovered state.
|
||||||
if (m_pressed && m_pressColor.isValid()) {
|
if (m_pressed && m_pressColor.isValid()) {
|
||||||
|
|
Loading…
Reference in New Issue