diff options
Diffstat (limited to 'examples/quick/tableview')
-rw-r--r-- | examples/quick/tableview/pixelator/doc/images/qt-pixelator.png (renamed from examples/quick/tableview/doc/images/qt-pixelator.png) | bin | 23771 -> 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/pixelator.pro | 11 | ||||
-rw-r--r-- | examples/quick/tableview/pixelator/qt.png (renamed from examples/quick/tableview/qt.png) | bin | 3858 -> 3858 bytes | |||
-rw-r--r-- | examples/quick/tableview/tableview.pro | 12 |
9 files changed, 24 insertions, 21 deletions
diff --git a/examples/quick/tableview/doc/images/qt-pixelator.png b/examples/quick/tableview/pixelator/doc/images/qt-pixelator.png Binary files differindex a6c4a3b40b..a6c4a3b40b 100644 --- a/examples/quick/tableview/doc/images/qt-pixelator.png +++ b/examples/quick/tableview/pixelator/doc/images/qt-pixelator.png 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/pixelator.pro b/examples/quick/tableview/pixelator/pixelator.pro new file mode 100644 index 0000000000..6c863cb304 --- /dev/null +++ b/examples/quick/tableview/pixelator/pixelator.pro @@ -0,0 +1,11 @@ +TEMPLATE = app + +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 Binary files differindex e3301c4a02..e3301c4a02 100644 --- a/examples/quick/tableview/qt.png +++ b/examples/quick/tableview/pixelator/qt.png diff --git a/examples/quick/tableview/tableview.pro b/examples/quick/tableview/tableview.pro index ea8e3bd12b..2bcd119c31 100644 --- a/examples/quick/tableview/tableview.pro +++ b/examples/quick/tableview/tableview.pro @@ -1,11 +1,3 @@ -TEMPLATE = app +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 |