mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-27 18:10:31 -05:00
Scale new custom icons down to 64x64 if they are larger.
This commit is contained in:
parent
940a5026c1
commit
3ab1072e9e
3 changed files with 18 additions and 1 deletions
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue