mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-12-06 08:42:36 -08:00
Scale new custom icons down to 64x64 if they are larger.
This commit is contained in:
1 parent
940a5026c1
commit
3ab1072e9e
3 files changed
+18
-1
No files matched your search
@@ -343,6 +343,22 @@ void Metadata::addCustomIcon(const Uuid& uuid, const QImage& icon)
|
||||
Q_EMIT modified();
|
||||
}
|
||||
|
||||
void Metadata::addCustomIconScaled(const Uuid& uuid, const QImage& icon)
|
||||
{
|
||||
QImage iconScaled;
|
||||
|
||||
// scale down to 64x64 if icon is larger
|
||||
if (icon.width() > 64 || icon.height() > 64) {
|
||||
iconScaled = icon.scaled(QSize(64, 64), Qt::KeepAspectRatio,
|
||||
Qt::SmoothTransformation);
|
||||
}
|
||||
else {
|
||||
iconScaled = icon;
|
||||
}
|
||||
|
||||
addCustomIcon(uuid, iconScaled);
|
||||
}
|
||||
|
||||
void Metadata::removeCustomIcon(const Uuid& uuid)
|
||||
{
|
||||
Q_ASSERT(!uuid.isNull());
|
||||
|
||||
Reference in new issue
Block a user