Prefer QIcon::pixmap(QWindow*, ...) overload
Summary: It takes into account the dpi of the screen we're rendering to. Other overloads assume the window is nullptr and will use the primary screen's dpi which can change almost randomly. Test Plan: Icons still look fine even if I drag windows from a screen to another. Reviewers: #plasma, #frameworks, davidedmundson Reviewed By: #plasma, davidedmundson Subscribers: davidedmundson, ngraham, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D29102
This commit is contained in:
parent
77be3197e2
commit
25ce2b90da
@ -598,7 +598,7 @@ void IconItem::loadPixmap()
|
|||||||
}
|
}
|
||||||
} else if (!m_icon.isNull()) {
|
} else if (!m_icon.isNull()) {
|
||||||
KIconLoader::global()->setCustomPalette(Plasma::Theme().palette());
|
KIconLoader::global()->setCustomPalette(Plasma::Theme().palette());
|
||||||
result = m_icon.pixmap(QSize(size, size) * (window() ? window()->devicePixelRatio() : qApp->devicePixelRatio()));
|
result = m_icon.pixmap(window(), QSize(size, size));
|
||||||
KIconLoader::global()->resetPalette();
|
KIconLoader::global()->resetPalette();
|
||||||
} else if (!m_imageIcon.isNull()) {
|
} else if (!m_imageIcon.isNull()) {
|
||||||
result = QPixmap::fromImage(m_imageIcon);
|
result = QPixmap::fromImage(m_imageIcon);
|
||||||
|
@ -381,7 +381,7 @@ void WindowThumbnail::iconToTexture(WindowTextureNode *textureNode)
|
|||||||
// fallback to plasma icon
|
// fallback to plasma icon
|
||||||
icon = QIcon::fromTheme(QStringLiteral("plasma"));
|
icon = QIcon::fromTheme(QStringLiteral("plasma"));
|
||||||
}
|
}
|
||||||
QImage image = icon.pixmap(boundingRect().size().toSize()).toImage();
|
QImage image = icon.pixmap(window(), boundingRect().size().toSize()).toImage();
|
||||||
textureNode->reset(window()->createTextureFromImage(image, QQuickWindow::TextureCanUseAtlas));
|
textureNode->reset(window()->createTextureFromImage(image, QQuickWindow::TextureCanUseAtlas));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user