summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Nurmenniemi <sami.nurmenniemi@qt.io>2017-10-02 15:00:42 +0300
committerSami Nurmenniemi <sami.nurmenniemi@qt.io>2017-11-22 10:43:04 +0000
commit0e5fbfcb9b8527cc5303547667f3a6a6e5e3ffdc (patch)
tree0796f46c78ff6fb64e9722539161a6af1194b92c
parenta0857629b3adf8247946e7cc0ae6d4561925587e (diff)
Change grid view gradients to match UI specs
Task-number: QTBUG-63091 Change-Id: Ieec5d291a645a62350fdd233574b02e189b46783 Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
-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);
}