Ich möchte meine Vollbild-App auf einem meiner Bildschirme einstellen, also muss ich Höhe, Breite, x, y und so weiter einstellen. Ich fand jedoch, dass die Animation nicht funktioniert.Warum funktioniert meine Animation in QML nicht?
Ich dachte immer dies verursacht durch Ich setzte es auf einem Zielbildschirm, also erstelle ich einen Test-Code, hier hart Code X, y, aber die Animation funktioniert immer noch nicht, kann mir jemand sagen, warum?
Mein Testcode ist wie folgt:
import QtQuick 2.6
import QtQuick.Window 2.2
Window {
visible: true
title: qsTr("Hello World")
flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint
opacity: 0.6
id: root
MouseArea {
anchors.fill: parent
onClicked: {
//Qt.quit();
}
}
Component.onCompleted: {
root.x = 0;
root.y = 0;
root.width = Screen.width;
root.height = Screen.height;
initWindow.start();
}
PropertyAnimation {
id: initWindow
target: root
from: 0
to: Screen.height
duration: 2000
easing.type: Easing.InOutQuad
onRunningChanged: {
if(!initWindow.running && root.visibility != Window.Hidden){
console.log("here is initWindow animation.")
}
}
}
}
Ihr Code ist gut, aber Sie vergessen, eine Eigenschaft zu setzen, die Sie animieren möchten. – folibis