diff --git a/.gitignore b/.gitignore index ff66a5e6..989e876f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ cscope* .clang_complete *wintoastlib* /.ccls-cache +/.cache /.exrc .gdb_history .hunter diff --git a/resources/qml/ImageButton.qml b/resources/qml/ImageButton.qml index ffd3e920..080bea23 100644 --- a/resources/qml/ImageButton.qml +++ b/resources/qml/ImageButton.qml @@ -28,6 +28,8 @@ AbstractButton { // Workaround, can't get icon.source working for now... anchors.fill: parent source: image != "" ? ("image://colorimage/" + image + "?" + ((button.hovered && changeColorOnHover) ? highlightColor : buttonTextColor)) : "" + sourceSize.height: button.height + sourceSize.width: button.width fillMode: Image.PreserveAspectFit } diff --git a/src/ColorImageProvider.cpp b/src/ColorImageProvider.cpp index 74e9eff7..6a38c46c 100644 --- a/src/ColorImageProvider.cpp +++ b/src/ColorImageProvider.cpp @@ -5,10 +5,11 @@ #include "ColorImageProvider.h" +#include #include QPixmap -ColorImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &) +ColorImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &req) { auto args = id.split('?'); @@ -17,6 +18,8 @@ ColorImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &) if (size) *size = QSize(source.width(), source.height()); + if (req.width() > 0 && req.height() > 0) + source = QIcon(args[0]).pixmap(req); if (args.size() < 2) return source;