streamline behaviours/animations

This commit is contained in:
John Gibbon 2020-10-24 19:32:21 +02:00
parent d3324bfab2
commit c4d67de8a5
2 changed files with 8 additions and 10 deletions

View file

@ -46,7 +46,7 @@ Item {
property Item messageItem property Item messageItem
height: pollColumn.height height: pollColumn.height
opacity: 0 opacity: 0
Behavior on opacity { FadeAnimator {} } Behavior on opacity { FadeAnimation {} }
function handleChoose(index) { function handleChoose(index) {
if(!pollData.type.allow_multiple_answers) { if(!pollData.type.allow_multiple_answers) {
chosenIndexes = [index]; chosenIndexes = [index];
@ -233,7 +233,7 @@ Item {
IconButton { IconButton {
visible: !pollData.is_closed && pollMessageComponent.chosenIndexes.length > 0 && pollData.type.allow_multiple_answers && !pollMessageComponent.hasAnswered visible: !pollData.is_closed && pollMessageComponent.chosenIndexes.length > 0 && pollData.type.allow_multiple_answers && !pollMessageComponent.hasAnswered
opacity: visible ? 1.0 : 0.0 opacity: visible ? 1.0 : 0.0
Behavior on opacity { NumberAnimation {}} Behavior on opacity { FadeAnimation {}}
icon.source: "image://theme/icon-m-send" icon.source: "image://theme/icon-m-send"
onClicked: { onClicked: {
pollMessageComponent.sendResponse() pollMessageComponent.sendResponse()

View file

@ -144,8 +144,8 @@ Dialog {
height: pollCreationPage.validationErrorsVisible ? visibleHeight : 0 height: pollCreationPage.validationErrorsVisible ? visibleHeight : 0
clip: true; clip: true;
opacity: pollCreationPage.validationErrorsVisible ? 1.0 : 0.0 opacity: pollCreationPage.validationErrorsVisible ? 1.0 : 0.0
Behavior on opacity { PropertyAnimation {duration: 500; easing.type: Easing.InOutCubic}} Behavior on opacity { FadeAnimation {} }
Behavior on height { PropertyAnimation {duration: 200; easing.type: Easing.InOutCubic}} Behavior on height { NumberAnimation {duration: 200; easing.type: Easing.InOutQuad}}
Rectangle { Rectangle {
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity) color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
anchors.fill: parent anchors.fill: parent
@ -216,10 +216,9 @@ Dialog {
move: Transition { move: Transition {
NumberAnimation { properties: "y"; duration: 200; easing.type: Easing.InOutCubic } NumberAnimation { properties: "y"; duration: 200; easing.type: Easing.InOutCubic }
} }
Behavior on height { PropertyAnimation {duration: 200; easing.type: Easing.InOutCubic}} Behavior on height { NumberAnimation {duration: 200; easing.type: Easing.InOutCubic}}
Repeater { Repeater {
model: pollCreationPage.options model: pollCreationPage.options
delegate: Row { delegate: Row {
width: parent.width width: parent.width
BackgroundItem { BackgroundItem {
@ -230,8 +229,8 @@ Dialog {
property bool checked: pollCreationPage.correctOption === index property bool checked: pollCreationPage.correctOption === index
enabled: pollCreationPage.quiz enabled: pollCreationPage.quiz
opacity: enabled ? (checked ? 1.0 : 0.5) : 0.0 opacity: enabled ? (checked ? 1.0 : 0.5) : 0.0
Behavior on opacity { PropertyAnimation {duration: 500; easing.type: Easing.InOutCubic}} Behavior on opacity { FadeAnimation {} }
Behavior on width { PropertyAnimation {duration: 500; easing.type: Easing.InOutCubic}} Behavior on width { NumberAnimation {duration: 500; easing.type: Easing.InOutQuad}}
Icon { Icon {
source: "image://theme/icon-m-accept" source: "image://theme/icon-m-accept"
anchors.centerIn: parent anchors.centerIn: parent
@ -240,14 +239,13 @@ Dialog {
pollCreationPage.correctOption = index pollCreationPage.correctOption = index
validate(); validate();
} }
} }
TextField { TextField {
id: answerTextArea id: answerTextArea
textMargin: Theme.paddingSmall textMargin: Theme.paddingSmall
width: answerCorrectBackgroundItem.enabled ? parent.width - Theme.itemSizeSmall * 2 : parent.width - Theme.itemSizeSmall width: answerCorrectBackgroundItem.enabled ? parent.width - Theme.itemSizeSmall * 2 : parent.width - Theme.itemSizeSmall
Behavior on width { PropertyAnimation {duration: 500; easing.type: Easing.InOutCubic}} Behavior on width { NumberAnimation {duration: 500; easing.type: Easing.InOutCubic}}
text: model.text text: model.text
onTextChanged: { onTextChanged: {
pollCreationPage.options.setProperty(index, "text", text) pollCreationPage.options.setProperty(index, "text", text)