From 3f25010cd9ea3cedda9d501a924ab3c289267310 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Sun, 19 May 2013 03:43:50 +0200 Subject: [PATCH] add animation to FlexibleHeader --- data/qml/tomahawkimports/FlexibleHeader.qml | 26 ++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/data/qml/tomahawkimports/FlexibleHeader.qml b/data/qml/tomahawkimports/FlexibleHeader.qml index 04c5e2566..4822b76f4 100644 --- a/data/qml/tomahawkimports/FlexibleHeader.qml +++ b/data/qml/tomahawkimports/FlexibleHeader.qml @@ -66,8 +66,9 @@ Rectangle { } Column { - height: parent.height + height: childrenRect.height width: parent.width - iconImage.width - parent.spacing + anchors.verticalCenter: parent.verticalCenter Item { id: titleItem @@ -131,7 +132,30 @@ Rectangle { font.pointSize: defaultFontSize * 1.2 width: parent.width elide: Text.ElideRight + height: text.length > 0 ? defaultFontHeight : 0 + opacity: text.length > 0 ? 1 : 0 + Behavior on height { + NumberAnimation { duration: 200 } + } + Behavior on opacity { + NumberAnimation { duration: 200 } + } + + onTextChanged: { + if (text.length > 0) { + animationText.text = text + } + } + + Text { + id: animationText + color: parent.color + font: parent.font + elide: parent.elide + anchors.fill: parent + } } + } }