aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols2
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-04-25 17:19:18 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-04-26 07:34:24 +0000
commitde6d7e1de7d6b9f6bc45f087c76cb84ac8af1fe0 (patch)
tree6b907bd3724562eaeef4b4a6c7c7ca321ce7f88d /examples/quickcontrols2
parent86f546dc658106eab9ef489b5473a5407ff8c3c0 (diff)
Gallery: utilize the new icon-support for the tool buttons
Change-Id: I275856925ebf82c0ed8822d45299fd4d5c9218ba Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples/quickcontrols2')
-rw-r--r--examples/quickcontrols2/gallery/gallery.cpp3
-rw-r--r--examples/quickcontrols2/gallery/gallery.pro3
-rw-r--r--examples/quickcontrols2/gallery/gallery.qml16
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20/+material/back.png (renamed from examples/quickcontrols2/gallery/images/+material/back.png)bin219 -> 219 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20/+material/drawer.png (renamed from examples/quickcontrols2/gallery/images/+material/drawer.png)bin213 -> 213 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20/+material/menu.png (renamed from examples/quickcontrols2/gallery/images/+material/menu.png)bin232 -> 232 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20/back.png (renamed from examples/quickcontrols2/gallery/images/back.png)bin220 -> 220 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20/drawer.png (renamed from examples/quickcontrols2/gallery/images/drawer.png)bin123 -> 123 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20/menu.png (renamed from examples/quickcontrols2/gallery/images/menu.png)bin123 -> 123 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@2/+material/back.png (renamed from examples/quickcontrols2/gallery/images/+material/back@2x.png)bin299 -> 299 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@2/+material/drawer.png (renamed from examples/quickcontrols2/gallery/images/+material/drawer@2x.png)bin286 -> 286 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@2/+material/menu.png (renamed from examples/quickcontrols2/gallery/images/+material/menu@2x.png)bin366 -> 366 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@2/back.png (renamed from examples/quickcontrols2/gallery/images/back@2x.png)bin289 -> 289 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@2/drawer.png (renamed from examples/quickcontrols2/gallery/images/drawer@2x.png)bin126 -> 126 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@2/menu.png (renamed from examples/quickcontrols2/gallery/images/menu@2x.png)bin158 -> 158 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@3/+material/back.png (renamed from examples/quickcontrols2/gallery/images/+material/back@3x.png)bin344 -> 344 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@3/+material/drawer.png (renamed from examples/quickcontrols2/gallery/images/+material/drawer@3x.png)bin345 -> 345 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@3/+material/menu.png (renamed from examples/quickcontrols2/gallery/images/+material/menu@3x.png)bin499 -> 499 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@3/back.png (renamed from examples/quickcontrols2/gallery/images/back@3x.png)bin351 -> 351 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@3/drawer.png (renamed from examples/quickcontrols2/gallery/images/drawer@3x.png)bin130 -> 130 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@3/menu.png (renamed from examples/quickcontrols2/gallery/images/menu@3x.png)bin193 -> 193 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@4/+material/back.png (renamed from examples/quickcontrols2/gallery/images/+material/back@4x.png)bin473 -> 473 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@4/+material/drawer.png (renamed from examples/quickcontrols2/gallery/images/+material/drawer@4x.png)bin420 -> 420 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@4/+material/menu.png (renamed from examples/quickcontrols2/gallery/images/+material/menu@4x.png)bin642 -> 642 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@4/back.png (renamed from examples/quickcontrols2/gallery/images/back@4x.png)bin452 -> 452 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@4/drawer.png (renamed from examples/quickcontrols2/gallery/images/drawer@4x.png)bin131 -> 131 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/20x20@4/menu.png (renamed from examples/quickcontrols2/gallery/images/menu@4x.png)bin223 -> 223 bytes
-rw-r--r--examples/quickcontrols2/gallery/icons/gallery/index.theme24
28 files changed, 32 insertions, 14 deletions
diff --git a/examples/quickcontrols2/gallery/gallery.cpp b/examples/quickcontrols2/gallery/gallery.cpp
index 7b70f1c8..b4d59685 100644
--- a/examples/quickcontrols2/gallery/gallery.cpp
+++ b/examples/quickcontrols2/gallery/gallery.cpp
@@ -53,6 +53,7 @@
#include <QQmlContext>
#include <QSettings>
#include <QQuickStyle>
+#include <QIcon>
int main(int argc, char *argv[])
{
@@ -62,6 +63,8 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
+ QIcon::setThemeName("gallery");
+
QSettings settings;
QString style = QQuickStyle::name();
if (!style.isEmpty())
diff --git a/examples/quickcontrols2/gallery/gallery.pro b/examples/quickcontrols2/gallery/gallery.pro
index 45496a35..705eeae0 100644
--- a/examples/quickcontrols2/gallery/gallery.pro
+++ b/examples/quickcontrols2/gallery/gallery.pro
@@ -8,8 +8,9 @@ SOURCES += \
RESOURCES += \
gallery.qml \
qtquickcontrols2.conf \
+ icons/gallery/index.theme \
+ $$files(icons/*.png, true) \
$$files(images/*.png) \
- $$files(images/+material/*.png) \
$$files(pages/*.qml)
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/gallery
diff --git a/examples/quickcontrols2/gallery/gallery.qml b/examples/quickcontrols2/gallery/gallery.qml
index 9f253ab3..5344b74e 100644
--- a/examples/quickcontrols2/gallery/gallery.qml
+++ b/examples/quickcontrols2/gallery/gallery.qml
@@ -50,7 +50,7 @@
import QtQuick 2.9
import QtQuick.Layouts 1.3
-import QtQuick.Controls 2.2
+import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.1
import QtQuick.Controls.Universal 2.1
import Qt.labs.settings 1.0
@@ -89,12 +89,7 @@ ApplicationWindow {
anchors.fill: parent
ToolButton {
- contentItem: Image {
- fillMode: Image.Pad
- horizontalAlignment: Image.AlignHCenter
- verticalAlignment: Image.AlignVCenter
- source: stackView.depth > 1 ? "images/back.png" : "images/drawer.png"
- }
+ icon.name: stackView.depth > 1 ? "back" : "drawer"
onClicked: {
if (stackView.depth > 1) {
stackView.pop()
@@ -116,12 +111,7 @@ ApplicationWindow {
}
ToolButton {
- contentItem: Image {
- fillMode: Image.Pad
- horizontalAlignment: Image.AlignHCenter
- verticalAlignment: Image.AlignVCenter
- source: "images/menu.png"
- }
+ icon.name: "menu"
onClicked: optionsMenu.open()
Menu {
diff --git a/examples/quickcontrols2/gallery/images/+material/back.png b/examples/quickcontrols2/gallery/icons/gallery/20x20/+material/back.png
index ebc1000f..ebc1000f 100644
--- a/examples/quickcontrols2/gallery/images/+material/back.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20/+material/back.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/+material/drawer.png b/examples/quickcontrols2/gallery/icons/gallery/20x20/+material/drawer.png
index 615cc817..615cc817 100644
--- a/examples/quickcontrols2/gallery/images/+material/drawer.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20/+material/drawer.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/+material/menu.png b/examples/quickcontrols2/gallery/icons/gallery/20x20/+material/menu.png
index f02429e9..f02429e9 100644
--- a/examples/quickcontrols2/gallery/images/+material/menu.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20/+material/menu.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/back.png b/examples/quickcontrols2/gallery/icons/gallery/20x20/back.png
index db43e273..db43e273 100644
--- a/examples/quickcontrols2/gallery/images/back.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20/back.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/drawer.png b/examples/quickcontrols2/gallery/icons/gallery/20x20/drawer.png
index 1e974efa..1e974efa 100644
--- a/examples/quickcontrols2/gallery/images/drawer.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20/drawer.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/menu.png b/examples/quickcontrols2/gallery/icons/gallery/20x20/menu.png
index a10473d9..a10473d9 100644
--- a/examples/quickcontrols2/gallery/images/menu.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20/menu.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/+material/back@2x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/+material/back.png
index cf6163c8..cf6163c8 100644
--- a/examples/quickcontrols2/gallery/images/+material/back@2x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/+material/back.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/+material/drawer@2x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/+material/drawer.png
index b1dd106d..b1dd106d 100644
--- a/examples/quickcontrols2/gallery/images/+material/drawer@2x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/+material/drawer.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/+material/menu@2x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/+material/menu.png
index 9309ad9a..9309ad9a 100644
--- a/examples/quickcontrols2/gallery/images/+material/menu@2x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/+material/menu.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/back@2x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/back.png
index c55ab315..c55ab315 100644
--- a/examples/quickcontrols2/gallery/images/back@2x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/back.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/drawer@2x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/drawer.png
index eba3b6cc..eba3b6cc 100644
--- a/examples/quickcontrols2/gallery/images/drawer@2x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/drawer.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/menu@2x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/menu.png
index 649c2a08..649c2a08 100644
--- a/examples/quickcontrols2/gallery/images/menu@2x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@2/menu.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/+material/back@3x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/+material/back.png
index 96376a5a..96376a5a 100644
--- a/examples/quickcontrols2/gallery/images/+material/back@3x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/+material/back.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/+material/drawer@3x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/+material/drawer.png
index 289889bf..289889bf 100644
--- a/examples/quickcontrols2/gallery/images/+material/drawer@3x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/+material/drawer.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/+material/menu@3x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/+material/menu.png
index 7bddf71f..7bddf71f 100644
--- a/examples/quickcontrols2/gallery/images/+material/menu@3x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/+material/menu.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/back@3x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/back.png
index b228eb87..b228eb87 100644
--- a/examples/quickcontrols2/gallery/images/back@3x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/back.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/drawer@3x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/drawer.png
index 3584ed6d..3584ed6d 100644
--- a/examples/quickcontrols2/gallery/images/drawer@3x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/drawer.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/menu@3x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/menu.png
index 9554b695..9554b695 100644
--- a/examples/quickcontrols2/gallery/images/menu@3x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@3/menu.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/+material/back@4x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/+material/back.png
index 578ac14f..578ac14f 100644
--- a/examples/quickcontrols2/gallery/images/+material/back@4x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/+material/back.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/+material/drawer@4x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/+material/drawer.png
index 215e6a82..215e6a82 100644
--- a/examples/quickcontrols2/gallery/images/+material/drawer@4x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/+material/drawer.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/+material/menu@4x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/+material/menu.png
index e5c23a3b..e5c23a3b 100644
--- a/examples/quickcontrols2/gallery/images/+material/menu@4x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/+material/menu.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/back@4x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/back.png
index dd157e78..dd157e78 100644
--- a/examples/quickcontrols2/gallery/images/back@4x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/back.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/drawer@4x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/drawer.png
index 60d93aff..60d93aff 100644
--- a/examples/quickcontrols2/gallery/images/drawer@4x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/drawer.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/images/menu@4x.png b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/menu.png
index 187c171c..187c171c 100644
--- a/examples/quickcontrols2/gallery/images/menu@4x.png
+++ b/examples/quickcontrols2/gallery/icons/gallery/20x20@4/menu.png
Binary files differ
diff --git a/examples/quickcontrols2/gallery/icons/gallery/index.theme b/examples/quickcontrols2/gallery/icons/gallery/index.theme
new file mode 100644
index 00000000..a1bcd5e0
--- /dev/null
+++ b/examples/quickcontrols2/gallery/icons/gallery/index.theme
@@ -0,0 +1,24 @@
+[Icon Theme]
+Name=Gallery
+Comment=Qt Quick Controls 2 Gallery Example Icon Theme
+
+Directories=20x20,20x20@2,20x20@3,20x20@4
+
+[20x20]
+Size=20
+Type=Fixed
+
+[20x20@2]
+Size=20
+Scale=2
+Type=Fixed
+
+[20x20@3]
+Size=20
+Scale=3
+Type=Fixed
+
+[20x20@4]
+Size=20
+Scale=4
+Type=Fixed