summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qml/ApplicationIcon.qml3
-rw-r--r--src/imageproviders.cpp13
2 files changed, 14 insertions, 2 deletions
diff --git a/qml/ApplicationIcon.qml b/qml/ApplicationIcon.qml
index 8522ad5..c755a10 100644
--- a/qml/ApplicationIcon.qml
+++ b/qml/ApplicationIcon.qml
@@ -41,7 +41,8 @@ Item {
id: preview;
anchors.fill: parent
anchors.margins: viewSettings.pageMargin*0.5
- source: "image://QtSquareImage/" + icon
+ source: highlight ? "image://QtSquareImage/" + icon :
+ "image://QtSquareImage/gradient/" + icon
sourceSize: Qt.size(width, height)
Image {
diff --git a/src/imageproviders.cpp b/src/imageproviders.cpp
index 1fef429..f91f24e 100644
--- a/src/imageproviders.cpp
+++ b/src/imageproviders.cpp
@@ -109,6 +109,7 @@ QPixmap QtSquareImageProvider::requestPixmap(const QString &id, QSize *size, con
QString idd = id;
idd.remove("file://");
+ idd.remove("gradient/");
QImage image(idd);
if (!image.isNull()) {
@@ -116,6 +117,16 @@ QPixmap QtSquareImageProvider::requestPixmap(const QString &id, QSize *size, con
image = image.copy(BORDERSIZE, BORDERSIZE, min - BORDERSIZE * 2, min - BORDERSIZE * 2)
.scaled(requestedSize.width(), requestedSize.height())
.convertToFormat(QImage::Format_ARGB32);
+
+ if (id.contains("gradient")) {
+ QPainter p(&image);
+ QRect r = image.rect();
+ QLinearGradient gradient(r.topLeft(), r.bottomLeft());
+ gradient.setColorAt(0, QColor("#99FFFFFF"));
+ gradient.setColorAt(1, Qt::transparent);
+ p.fillRect(r, gradient);
+ }
+
cutEdges(image, CORNER_CUTSIZE);
}
@@ -141,7 +152,7 @@ QPixmap QtImageMaskProvider::requestPixmap(const QString &id, QSize *size, const
if (id.contains("hover")) {
QRect r = image.rect().adjusted(1, 1, -1, -1);
QLinearGradient gradient(r.topLeft(), r.bottomRight());
- gradient.setColorAt(0, Qt::transparent);
+ gradient.setColorAt(0, QColor("#99000000"));
gradient.setColorAt(1, QColor("#9941cd52"));
p.fillRect(r, gradient);
}