path: root/examples
diff options
authorMichael Winkelmann <>2018-07-11 10:58:34 +0200
committerhjk <>2018-07-13 15:25:45 +0000
commitad0f200df54e5afcb1fdcb977794259bdb9216b5 (patch)
treec18ae71137a4b8cb13b0ddd1696cc324952293af /examples
parent9dd273027bfc3fc527b9f398309b9e057b7af290 (diff)
Make a subdirectory for TableView examples
This makes more room for more tableview examples. I also added the tableview directory to the subdirs. Change-Id: Ia136150ded99c2ec627e122aa676e24a519683a9 Reviewed-by: hjk <>
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/tableview/pixelator/doc/images/qt-pixelator.png (renamed from examples/quick/tableview/doc/images/qt-pixelator.png)bin23771 -> 23771 bytes
-rw-r--r--examples/quick/tableview/pixelator/doc/src/pixelator.qdoc (renamed from examples/quick/tableview/doc/src/tableview.qdoc)22
-rw-r--r--examples/quick/tableview/pixelator/imagemodel.cpp (renamed from examples/quick/tableview/imagemodel.cpp)0
-rw-r--r--examples/quick/tableview/pixelator/imagemodel.h (renamed from examples/quick/tableview/imagemodel.h)0
-rw-r--r--examples/quick/tableview/pixelator/main.cpp (renamed from examples/quick/tableview/main.cpp)0
-rw-r--r--examples/quick/tableview/pixelator/main.qml (renamed from examples/quick/tableview/main.qml)0
-rw-r--r--examples/quick/tableview/pixelator/qt.png (renamed from examples/quick/tableview/qt.png)bin3858 -> 3858 bytes
10 files changed, 25 insertions, 21 deletions
diff --git a/examples/quick/ b/examples/quick/
index ede3c54728..deef437046 100644
--- a/examples/quick/
+++ b/examples/quick/
@@ -10,6 +10,7 @@ SUBDIRS = quick-accessibility \
localstorage \
models \
views \
+ tableview \
mousearea \
positioners \
righttoleft \
diff --git a/examples/quick/tableview/doc/images/qt-pixelator.png b/examples/quick/tableview/pixelator/doc/images/qt-pixelator.png
index a6c4a3b40b..a6c4a3b40b 100644
--- a/examples/quick/tableview/doc/images/qt-pixelator.png
+++ b/examples/quick/tableview/pixelator/doc/images/qt-pixelator.png
Binary files differ
diff --git a/examples/quick/tableview/doc/src/tableview.qdoc b/examples/quick/tableview/pixelator/doc/src/pixelator.qdoc
index e0d9200730..4f8d519060 100644
--- a/examples/quick/tableview/doc/src/tableview.qdoc
+++ b/examples/quick/tableview/pixelator/doc/src/pixelator.qdoc
@@ -26,7 +26,7 @@
\title Qt Quick TableViews examples - Pixelator
- \example tableview
+ \example pixelator
\brief The Pixelator example shows how a QML TableView and a delegate
can be used for custom table models.
@@ -35,7 +35,7 @@
\include examples-run.qdocinc
- \snippet tableview/imagemodel.h model
+ \snippet pixelator/imagemodel.h model
We only require a simple, read-only table model. Thus, we need to implement
functions to indicate the dimensions of the image and supply data to the
@@ -43,28 +43,28 @@
We use the \l{Qt property system}{Qt Property System} and a source property
as \c QString to set the path of the image.
- \snippet tableview/imagemodel.cpp setsource
+ \snippet pixelator/imagemodel.cpp setsource
Here we load the image when the source path is set.
When the source path has changed, we need to call \c beginResetModel() before.
After the image has been loaded, we need to call \c endResetModel().
- \snippet tableview/imagemodel.cpp rowcolcount
+ \snippet pixelator/imagemodel.cpp rowcolcount
The row and column count is set to image height and width, respectively.
- \snippet tableview/imagemodel.cpp data
+ \snippet pixelator/imagemodel.cpp data
This overloaded function allows us to access the pixel data from the image.
When we call this function with the display role, we return the pixel's
gray value.
- \snippet tableview/main.cpp registertype
+ \snippet pixelator/main.cpp registertype
We need to register our model in the QML type system to be able to use it
from the QML side.
- \snippet tableview/main.qml pixelcomponent
+ \snippet pixelator/main.qml pixelcomponent
Each pixel in the \c TableView is displayed via a delegate component.
It contains an item that has an implicit height and width defining the
@@ -72,22 +72,22 @@
It also has a property for the gray value of the pixel that is retrieved
from the model.
- \snippet tableview/main.qml rectshape
+ \snippet pixelator/main.qml rectshape
Inside the \c Item, there is a rounded \c Rectangle with the size and
radius according to the pixel's gray value.
- \snippet tableview/main.qml interaction
+ \snippet pixelator/main.qml interaction
For a little bit of interaction, we place a \c MouseArea inside the \c Item
and change the Rectangle's color on mouse over.
- \snippet tableview/main.qml animation
+ \snippet pixelator/main.qml animation
The \c Rectangle also has a short color animation to fade between the
colors when it is changed.
- \snippet tableview/main.qml tableview
+ \snippet pixelator/main.qml tableview
The \c TableView spans over the whole window and has an instance of our
custom \c ImageModel attached.
diff --git a/examples/quick/tableview/imagemodel.cpp b/examples/quick/tableview/pixelator/imagemodel.cpp
index 827204bc06..827204bc06 100644
--- a/examples/quick/tableview/imagemodel.cpp
+++ b/examples/quick/tableview/pixelator/imagemodel.cpp
diff --git a/examples/quick/tableview/imagemodel.h b/examples/quick/tableview/pixelator/imagemodel.h
index bf0ec90da4..bf0ec90da4 100644
--- a/examples/quick/tableview/imagemodel.h
+++ b/examples/quick/tableview/pixelator/imagemodel.h
diff --git a/examples/quick/tableview/main.cpp b/examples/quick/tableview/pixelator/main.cpp
index c57039556a..c57039556a 100644
--- a/examples/quick/tableview/main.cpp
+++ b/examples/quick/tableview/pixelator/main.cpp
diff --git a/examples/quick/tableview/main.qml b/examples/quick/tableview/pixelator/main.qml
index f471fc5c6b..f471fc5c6b 100644
--- a/examples/quick/tableview/main.qml
+++ b/examples/quick/tableview/pixelator/main.qml
diff --git a/examples/quick/tableview/pixelator/ b/examples/quick/tableview/pixelator/
new file mode 100644
index 0000000000..6c863cb304
--- /dev/null
+++ b/examples/quick/tableview/pixelator/
@@ -0,0 +1,11 @@
+QT += quick qml
+HEADERS += imagemodel.h
+SOURCES += main.cpp \
+ imagemodel.cpp
+RESOURCES += qt.png main.qml
+target.path = $$[QT_INSTALL_EXAMPLES]/quick/tableview/pixelator
+INSTALLS += target
diff --git a/examples/quick/tableview/qt.png b/examples/quick/tableview/pixelator/qt.png
index e3301c4a02..e3301c4a02 100644
--- a/examples/quick/tableview/qt.png
+++ b/examples/quick/tableview/pixelator/qt.png
Binary files differ
diff --git a/examples/quick/tableview/ b/examples/quick/tableview/
index ea8e3bd12b..2bcd119c31 100644
--- a/examples/quick/tableview/
+++ b/examples/quick/tableview/
@@ -1,11 +1,3 @@
+TEMPLATE = subdirs
-QT += quick qml
-HEADERS += imagemodel.h
-SOURCES += main.cpp \
- imagemodel.cpp
-RESOURCES += qt.png main.qml
-target.path = $$[QT_INSTALL_EXAMPLES]/quick/tableview
-INSTALLS += target
+SUBDIRS += pixelator