コード例 #1
0
ファイル: utils.cpp プロジェクト: elFarto/qBittorrent
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;
}