mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 01:30:46 +03:00
Fix blurriness of svg icons (#1108)
This commit is contained in:
parent
3256d9bafe
commit
7a29531739
3 changed files with 7 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,6 +4,7 @@ cscope*
|
||||||
.clang_complete
|
.clang_complete
|
||||||
*wintoastlib*
|
*wintoastlib*
|
||||||
/.ccls-cache
|
/.ccls-cache
|
||||||
|
/.cache
|
||||||
/.exrc
|
/.exrc
|
||||||
.gdb_history
|
.gdb_history
|
||||||
.hunter
|
.hunter
|
||||||
|
|
|
@ -28,6 +28,8 @@ AbstractButton {
|
||||||
// Workaround, can't get icon.source working for now...
|
// Workaround, can't get icon.source working for now...
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: image != "" ? ("image://colorimage/" + image + "?" + ((button.hovered && changeColorOnHover) ? highlightColor : buttonTextColor)) : ""
|
source: image != "" ? ("image://colorimage/" + image + "?" + ((button.hovered && changeColorOnHover) ? highlightColor : buttonTextColor)) : ""
|
||||||
|
sourceSize.height: button.height
|
||||||
|
sourceSize.width: button.width
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
|
|
||||||
#include "ColorImageProvider.h"
|
#include "ColorImageProvider.h"
|
||||||
|
|
||||||
|
#include <QIcon>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
QPixmap
|
QPixmap
|
||||||
ColorImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &)
|
ColorImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &req)
|
||||||
{
|
{
|
||||||
auto args = id.split('?');
|
auto args = id.split('?');
|
||||||
|
|
||||||
|
@ -17,6 +18,8 @@ ColorImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &)
|
||||||
if (size)
|
if (size)
|
||||||
*size = QSize(source.width(), source.height());
|
*size = QSize(source.width(), source.height());
|
||||||
|
|
||||||
|
if (req.width() > 0 && req.height() > 0)
|
||||||
|
source = QIcon(args[0]).pixmap(req);
|
||||||
if (args.size() < 2)
|
if (args.size() < 2)
|
||||||
return source;
|
return source;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue