diff options
author | Topi Reinio <topi.reinio@digia.com> | 2014-06-27 10:00:24 +0200 |
---|---|---|
committer | Topi Reiniƶ <topi.reinio@digia.com> | 2014-07-07 11:02:48 +0200 |
commit | 217f07d2f230bc6f64ec11be57f203c3646cba43 (patch) | |
tree | 3260897e30f0d0c3e950df3a0896fd67de6f4f26 /examples | |
parent | 2e75be5f64fb21cbbdff3353dbd507c2ca26946a (diff) |
Remove usage of external dependencies from the RSS News demo
Examples in qtdeclarative shouldn't depend on Qt Quick Controls,
Layouts, or add on modules like Qt Graphical Effects.
Change-Id: Ic069ed3223a4cfebde5263e846ae394aebed0b33
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Niels Weber <niels.weber@digia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/quick/demos/rssnews/content/CategoryDelegate.qml | 60 | ||||
-rw-r--r-- | examples/quick/demos/rssnews/content/NewsDelegate.qml | 21 |
2 files changed, 23 insertions, 58 deletions
diff --git a/examples/quick/demos/rssnews/content/CategoryDelegate.qml b/examples/quick/demos/rssnews/content/CategoryDelegate.qml index cb48715609..93d688a29c 100644 --- a/examples/quick/demos/rssnews/content/CategoryDelegate.qml +++ b/examples/quick/demos/rssnews/content/CategoryDelegate.qml @@ -39,7 +39,6 @@ ****************************************************************************/ import QtQuick 2.2 -import QtGraphicalEffects 1.0 Rectangle { id: delegate @@ -54,56 +53,21 @@ Rectangle { source: image } - Item { - id: title - anchors.fill: parent + Text { + id: titleText - Text { - id: titleText - - anchors { - left: parent.left; leftMargin: 20 - right: parent.right; rightMargin: 20 - top: parent.top; topMargin: 20 - } - font { pixelSize: 18; bold: true } - text: name - color: selected ? "#ffffff" : "#ebebdd" - Behavior on color { ColorAnimation { duration: 150 } } + anchors { + left: parent.left; leftMargin: 20 + right: parent.right; rightMargin: 20 + top: parent.top; topMargin: 20 } - DropShadow { - source: titleText - anchors.fill: titleText - horizontalOffset: selected ? 3 : 1 - verticalOffset: selected ? 3 : 1 - radius: 4 - color: "#2f1000" - samples: 8 - - Behavior on horizontalOffset { NumberAnimation { duration: 300 } } - Behavior on verticalOffset { NumberAnimation { duration: 300 } } - } - - states: [ - State { - name: "selected" - when: selected - PropertyChanges { target: title; scale: "1.1" } - }] - - transitions: [ - Transition { - to: "selected" - SequentialAnimation { - id: titleAnimation - PropertyAnimation { target: title; property: "scale"; duration: 300 } - } - }, - Transition { - to: "" - animations: titleAnimation - }] + font { pixelSize: 18; bold: true } + text: name + color: selected ? "#ffffff" : "#ebebdd" + scale: selected ? 1.15 : 1.0 + Behavior on color { ColorAnimation { duration: 150 } } + Behavior on scale { PropertyAnimation { duration: 300 } } } BusyIndicator { diff --git a/examples/quick/demos/rssnews/content/NewsDelegate.qml b/examples/quick/demos/rssnews/content/NewsDelegate.qml index fee1119b08..280e4d1631 100644 --- a/examples/quick/demos/rssnews/content/NewsDelegate.qml +++ b/examples/quick/demos/rssnews/content/NewsDelegate.qml @@ -39,11 +39,11 @@ ****************************************************************************/ import QtQuick 2.2 -import QtQuick.Layouts 1.1 -ColumnLayout { +Column { id: delegate width: delegate.ListView.view.width + spacing: 8 // Returns a string representing how long ago an event occurred function timeSinceEvent(pubDate) { @@ -77,13 +77,15 @@ ColumnLayout { return result; } - RowLayout { - Layout.maximumWidth: parent.width + Item { height: 8; width: delegate.width } - ColumnLayout { - Layout.alignment: Qt.AlignTop + Row { + width: parent.width + spacing: 8 + Column { Item { + width: 4 height: titleText.font.pixelSize / 4 } @@ -97,7 +99,7 @@ ColumnLayout { id: titleText text: title - Layout.maximumWidth: delegate.width - titleImage.width + width: delegate.width - titleImage.width wrapMode: Text.WordWrap font.pixelSize: 26 font.bold: true @@ -105,11 +107,10 @@ ColumnLayout { } Text { - Layout.maximumWidth: delegate.width + width: delegate.width font.pixelSize: 12 textFormat: Text.RichText font.italic: true - Layout.alignment: Qt.AlignLeft text: timeSinceEvent(pubDate) + " (<a href=\"" + link + "\">Link</a>)" onLinkActivated: { Qt.openUrlExternally(link) @@ -120,7 +121,7 @@ ColumnLayout { id: descriptionText text: description - Layout.maximumWidth: parent.width + width: parent.width wrapMode: Text.WordWrap font.pixelSize: 14 textFormat: Text.StyledText |