diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/declarative/fillmode/content/QtLogo.qml | 30 | ||||
-rw-r--r-- | examples/declarative/fillmode/content/qt-logo.png | bin | 0 -> 5149 bytes | |||
-rw-r--r-- | examples/declarative/fillmode/face.png | bin | 905 -> 0 bytes | |||
-rw-r--r-- | examples/declarative/fillmode/fillmode.qml | 52 |
4 files changed, 45 insertions, 37 deletions
diff --git a/examples/declarative/fillmode/content/QtLogo.qml b/examples/declarative/fillmode/content/QtLogo.qml new file mode 100644 index 0000000..6dd714d --- /dev/null +++ b/examples/declarative/fillmode/content/QtLogo.qml @@ -0,0 +1,30 @@ +import Qt 4.7 + +Item { + id: qtLogo + + property alias fillMode: image.fillMode + property alias label: labelText.text + + width: ((window.width - 20) - ((grid.columns - 1) * grid.spacing)) / grid.columns + height: ((window.height - 20) - ((grid.rows - 1) * grid.spacing)) / grid.rows + + Column { + anchors.fill: parent + + Rectangle { + height: qtLogo.height - 30; width: qtLogo.width + border.color: "black"; clip: true + + Image { + id: image + anchors.fill: parent; smooth: true; source: "qt-logo.png" + } + } + + Text { + id: labelText; anchors.horizontalCenter: parent.horizontalCenter + height: 30; verticalAlignment: Text.AlignVCenter + } + } +} diff --git a/examples/declarative/fillmode/content/qt-logo.png b/examples/declarative/fillmode/content/qt-logo.png Binary files differnew file mode 100644 index 0000000..14ddf2a --- /dev/null +++ b/examples/declarative/fillmode/content/qt-logo.png diff --git a/examples/declarative/fillmode/face.png b/examples/declarative/fillmode/face.png Binary files differdeleted file mode 100644 index 9623b1a..0000000 --- a/examples/declarative/fillmode/face.png +++ /dev/null diff --git a/examples/declarative/fillmode/fillmode.qml b/examples/declarative/fillmode/fillmode.qml index e47fc9b..e5b0336 100644 --- a/examples/declarative/fillmode/fillmode.qml +++ b/examples/declarative/fillmode/fillmode.qml @@ -1,44 +1,22 @@ import Qt 4.7 +import "content" -Image { - width: 400 - height: 250 - source: "face.png" +Rectangle { + id: window - SequentialAnimation on fillMode { - loops: Animation.Infinite - PropertyAction { value: Image.Stretch } - PropertyAction { target: label; property: "text"; value: "Stretch" } - PauseAnimation { duration: 1000 } - PropertyAction { value: Image.PreserveAspectFit } - PropertyAction { target: label; property: "text"; value: "PreserveAspectFit" } - PauseAnimation { duration: 1000 } - PropertyAction { value: Image.PreserveAspectCrop } - PropertyAction { target: label; property: "text"; value: "PreserveAspectCrop" } - PauseAnimation { duration: 1000 } - PropertyAction { value: Image.Tile } - PropertyAction { target: label; property: "text"; value: "Tile" } - PauseAnimation { duration: 1000 } - PropertyAction { value: Image.TileHorizontally } - PropertyAction { target: label; property: "text"; value: "TileHorizontally" } - PauseAnimation { duration: 1000 } - PropertyAction { value: Image.TileVertically } - PropertyAction { target: label; property: "text"; value: "TileVertically" } - PauseAnimation { duration: 1000 } - } + width: 800; height: 480 + color: "#cdcdcd" - Text { - id: label - font.pointSize: 24 - color: "blue" - style: Text.Outline - styleColor: "white" - anchors.centerIn: parent - } + Grid { + id: grid + anchors { fill: parent; topMargin: 10; leftMargin: 10; rightMargin: 10; bottomMargin: 10 } + columns: 3; rows: 2; spacing: 20 - Rectangle { - border.color: "black" - color: "transparent" - anchors { fill: parent; rightMargin: 1; bottomMargin: 1 } + QtLogo { fillMode: Image.Stretch; label: "Stretch" } + QtLogo { fillMode: Image.PreserveAspectFit; label: "PreserveAspectFit" } + QtLogo { fillMode: Image.PreserveAspectCrop; label: "PreserveAspectCrop" } + QtLogo { fillMode: Image.Tile; label: "Tile" } + QtLogo { fillMode: Image.TileHorizontally; label: "TileHorizontally" } + QtLogo { fillMode: Image.TileVertically; label: "TileVertically" } } } |