mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Replace raster qbt logo with vector version
Add helper function for svg icons.
This commit is contained in:
parent
f934042a98
commit
4d04af4043
4 changed files with 23 additions and 5 deletions
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QPixmapCache>
|
||||
#include <QScreen>
|
||||
#include <QStyle>
|
||||
#include <QWidget>
|
||||
|
@ -69,6 +70,20 @@ QPixmap Utils::Gui::scaledPixmap(const QString &path, const QWidget *widget, con
|
|||
return pixmap.scaledToHeight(scaledHeight, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
QPixmap Utils::Gui::scaledPixmapSvg(const QString &path, const QWidget *widget, const int baseHeight)
|
||||
{
|
||||
const int scaledHeight = baseHeight * Utils::Gui::screenScalingFactor(widget);
|
||||
const QString normalizedKey = path + "@" + QString::number(scaledHeight);
|
||||
|
||||
QPixmap pm;
|
||||
QPixmapCache cache;
|
||||
if (!cache.find(normalizedKey, &pm)) {
|
||||
pm = QIcon(path).pixmap(scaledHeight);
|
||||
cache.insert(normalizedKey, pm);
|
||||
}
|
||||
return pm;
|
||||
}
|
||||
|
||||
QSize Utils::Gui::smallIconSize(const QWidget *widget)
|
||||
{
|
||||
// Get DPI scaled icon size (device-dependent), see QT source
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue