Fix issue with high DPI versions of transformation handles.

This commit is contained in:
Roman Telezhynskyi 2023-08-30 16:22:36 +03:00
parent 324d7977f6
commit 5b533473bd
2 changed files with 15 additions and 11 deletions

View File

@ -566,11 +566,11 @@ void VPGraphicsPieceControls::InitPixmaps()
auto InitPixmap = [this](VPHandleCornerType type, const QString &imageName)
{
const QString fileName = QStringLiteral("32x32/%1.png").arg(imageName);
const QString fileNameHover = QStringLiteral("32x32/%1-hover.png").arg(imageName);
const QString resource = QStringLiteral("icon");
const QString fileName = QStringLiteral("32x32/%1.png").arg(imageName);
QPixmap handlePixmap = VTheme::GetPixmapResource(resource, fileName);
if (QGuiApplication::primaryScreen()->devicePixelRatio() >= 2)
{
const QString fileName2x = QStringLiteral("32x32/%1@2x.png").arg(imageName);
@ -581,11 +581,13 @@ void VPGraphicsPieceControls::InitPixmaps()
}
else
{
m_handlePixmaps.insert(type, VTheme::GetPixmapResource(resource, fileName));
const QString fileNameHover = QStringLiteral("32x32/%1-hover.png").arg(imageName);
m_handlePixmaps.insert(type, handlePixmap);
m_handleHoverPixmaps.insert(type, VTheme::GetPixmapResource(resource, fileNameHover));
}
QPainterPath p = PixmapToPainterPath(m_handlePixmaps.value(type));
QPainterPath p = PixmapToPainterPath(handlePixmap);
p.setFillRule(Qt::WindingFill);
p.closeSubpath();
m_handlePaths.insert(type, p);

View File

@ -482,12 +482,11 @@ void VBackgroundImageControls::InitPixmaps()
auto InitPixmap = [this](BIHandleCornerType type, const QString &imageName)
{
const QString fileName = QStringLiteral("32x32/%1.png").arg(imageName);
const QString fileNameHover = QStringLiteral("32x32/%1-hover.png").arg(imageName);
const QString fileNameDisabled = QStringLiteral("32x32/%1-disabled.png").arg(imageName);
const QString resource = QStringLiteral("icon");
const QString fileName = QStringLiteral("32x32/%1.png").arg(imageName);
QPixmap handlePixmap = VTheme::GetPixmapResource(resource, fileName);
if (QGuiApplication::primaryScreen()->devicePixelRatio() >= 2)
{
const QString fileName2x = QStringLiteral("32x32/%1@2x.png").arg(imageName);
@ -500,12 +499,15 @@ void VBackgroundImageControls::InitPixmaps()
}
else
{
m_handlePixmaps.insert(type, VTheme::GetPixmapResource(resource, fileName));
const QString fileNameHover = QStringLiteral("32x32/%1-hover.png").arg(imageName);
const QString fileNameDisabled = QStringLiteral("32x32/%1-disabled.png").arg(imageName);
m_handlePixmaps.insert(type, handlePixmap);
m_handleHoverPixmaps.insert(type, VTheme::GetPixmapResource(resource, fileNameHover));
m_handleDisabledPixmaps.insert(type, VTheme::GetPixmapResource(resource, fileNameDisabled));
}
QPainterPath p = PixmapToPainterPath(m_handlePixmaps.value(type));
QPainterPath p = PixmapToPainterPath(handlePixmap);
p.setFillRule(Qt::WindingFill);
p.closeSubpath();
m_handlePaths.insert(type, p);