История изменений
Исправление rumgot, (текущая версия) :
Ребят, а почему не работает анимация поведения так:
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
import QtQuick.Controls.Material 2.12
import QtQml 2.12
ApplicationWindow {
visible: true
// Material.theme: Material.Dark
Material.theme: Material.Light
Material.accent: Material.Red
width: 600
height: 400
Column {
anchors.fill: parent
SwipeView {
id: view
width: parent.width
height: parent.height - indicator.height
currentIndex: indicator.currentIndex
// Это не срабатывает !!!
Behavior on currentIndex {
ScriptAction {script: console.log("currentIndex changed")}
}
Item {}
Item {}
Item {}
}
PageIndicator {
id: indicator
interactive: true
count: view.count
currentIndex: view.currentIndex
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
но работает так:
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
import QtQuick.Controls.Material 2.12
import QtQml 2.12
ApplicationWindow {
visible: true
// Material.theme: Material.Dark
Material.theme: Material.Light
Material.accent: Material.Red
width: 600
height: 400
Column {
anchors.fill: parent
SwipeView {
id: view
width: parent.width
height: parent.height - indicator.height
currentIndex: indicator.currentIndex
property bool currentIndexWasChanged: false
// А с этим костылем работает
onCurrentIndexChanged: currentIndexWasChanged = !currentIndexWasChanged
Behavior on currentIndexWasChanged {
ScriptAction {script: console.log("currentIndex changed")}
}
Item {}
Item {}
Item {}
}
PageIndicator {
id: indicator
interactive: true
count: view.count
currentIndex: view.currentIndex
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
Кстати говоря, с ApplicationWindow.width
такая же херня: не срабатывает Behavior on width
, зато если внутрь ApplicationWindow
поместить Rectangle
у которого width: parent.width
и далее сделать Behavior on width
на width
у этого Rectangle
, то тогда срабатывает.
Подскажите плиз, как это лечить?
Исправление rumgot, :
Ребят, а почему не работает анимация поведения так:
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
import QtQuick.Controls.Material 2.12
import QtQml 2.12
ApplicationWindow {
visible: true
// Material.theme: Material.Dark
Material.theme: Material.Light
Material.accent: Material.Red
width: 600
height: 400
Column {
anchors.fill: parent
SwipeView {
id: view
width: parent.width
height: parent.height - indicator.height
currentIndex: indicator.currentIndex
// Это не срабатывает !!!
Behavior on currentIndex {
ScriptAction {script: console.log("currentIndex changed")}
}
Item {}
Item {}
Item {}
}
PageIndicator {
id: indicator
interactive: true
count: view.count
currentIndex: view.currentIndex
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
но работает так:
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
import QtQuick.Controls.Material 2.12
import QtQml 2.12
ApplicationWindow {
visible: true
// Material.theme: Material.Dark
Material.theme: Material.Light
Material.accent: Material.Red
width: 600
height: 400
Column {
anchors.fill: parent
SwipeView {
id: view
width: parent.width
height: parent.height - indicator.height
currentIndex: indicator.currentIndex
property bool currentIndexWasChanged: false
// А с этим костылем работает
onCurrentIndexChanged: currentIndexWasChanged = !currentIndexWasChanged
Behavior on currentIndexWasChanged {
ScriptAction {script: console.log("currentIndex changed")}
}
Item {}
Item {}
Item {}
}
PageIndicator {
id: indicator
interactive: true
count: view.count
currentIndex: view.currentIndex
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
Кстати говоря, с ApplicationWindow.width
такая же херня: не срабатывает Behavior on width
, зато если внутрь ApplicationWindow
поместить Rectangle
у которого width: parent.width
и далее сделать Behavior on width
на width
у этого Rectangle
, то тогда срабатывает.
Исправление rumgot, :
Ребят, а почему не работает анимация поведения так:
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
import QtQuick.Controls.Material 2.12
import QtQml 2.12
ApplicationWindow {
visible: true
// Material.theme: Material.Dark
Material.theme: Material.Light
Material.accent: Material.Red
width: 600
height: 400
Column {
anchors.fill: parent
SwipeView {
id: view
width: parent.width
height: parent.height - indicator.height
currentIndex: indicator.currentIndex
// Это не срабатывает !!!
Behavior on currentIndex {
ScriptAction {script: console.log("currentIndex changed")}
}
Item {}
Item {}
Item {}
}
PageIndicator {
id: indicator
interactive: true
count: view.count
currentIndex: view.currentIndex
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
но работает так:
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
import QtQuick.Controls.Material 2.12
import QtQml 2.12
ApplicationWindow {
visible: true
// Material.theme: Material.Dark
Material.theme: Material.Light
Material.accent: Material.Red
width: 600
height: 400
Column {
anchors.fill: parent
SwipeView {
id: view
width: parent.width
height: parent.height - indicator.height
currentIndex: indicator.currentIndex
property bool currentIndexWasChanged: false
// А с этим костылем работает
onCurrentIndexChanged: currentIndexWasChanged = !currentIndexWasChanged
Behavior on currentIndexWasChanged {
ScriptAction {script: console.log("currentIndex changed")}
}
Item {}
Item {}
Item {}
}
PageIndicator {
id: indicator
interactive: true
count: view.count
currentIndex: view.currentIndex
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
Кстати говоря, с ApplicationWindow.width
такая же херня: не срабатывает Behavior
, зато если внутрь ApplicationWindow
поместить Rectangle
у которого width: parent.width
и далее сделать Behavior
на width
у этого Rectangle
, то тогда срабатывает.
Исходная версия rumgot, :
Ребят, а почему не работает анимация поведения так:
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
import QtQuick.Controls.Material 2.12
import QtQml 2.12
ApplicationWindow {
visible: true
// Material.theme: Material.Dark
Material.theme: Material.Light
Material.accent: Material.Red
width: 600
height: 400
Column {
anchors.fill: parent
SwipeView {
id: view
width: parent.width
height: parent.height - indicator.height
currentIndex: indicator.currentIndex
// Это не срабатывает !!!
Behavior on currentIndex {
ScriptAction {script: console.log("currentIndex changed")}
}
Item {}
Item {}
Item {}
}
PageIndicator {
id: indicator
interactive: true
count: view.count
currentIndex: view.currentIndex
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
но работает так:
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12
import QtQuick.Controls.Material 2.12
import QtQml 2.12
ApplicationWindow {
visible: true
// Material.theme: Material.Dark
Material.theme: Material.Light
Material.accent: Material.Red
width: 600
height: 400
Column {
anchors.fill: parent
SwipeView {
id: view
width: parent.width
height: parent.height - indicator.height
currentIndex: indicator.currentIndex
property bool currentIndexWasChanged: false
// А с этим костылем работает
onCurrentIndexChanged: currentIndexWasChanged = !currentIndexWasChanged
Behavior on currentIndexWasChanged {
ScriptAction {script: console.log("currentIndex changed")}
}
Item {}
Item {}
Item {}
}
PageIndicator {
id: indicator
interactive: true
count: view.count
currentIndex: view.currentIndex
anchors.horizontalCenter: parent.horizontalCenter
}
}
}