Solved Page Stack in Qt QuickControls 2
-
Hi, I'm trying to using Qt 5.7.1 with QuickControls 2.0 and I'm facing this converting issue of my qml file for Page component. In Qt Creator, it shows that "Stack" is an "invalid property name". Please help. Thanks.
import QtQuick 2.6 import QtQuick.Controls 2.0 Page { Stack.onStatusChanged: { if (Stack.status === Stack.Activating) { //print something } else if (Stack.status === Stack.Deactivating) { //print something } } }
-
In Qt Quick Controls 1, StackView is implemented in QML and the attached property is implemented in C++. Both types couldn't be called "StackView", so as a workaround, the attached property was named "Stack". Qt Quick Controls 2 does not have this problem. Attached properties are provided by the same "StackView" name.
https://doc.qt.io/qt-5/qml-qtquick-controls2-stackview.html#attached-properties
import QtQuick.Controls 2.0 Page { StackView.onStatusChanged: { ... } }
-
@jpnurmi Thanks a lot, JP. That does the trick. Do you have any recommendation links that help to convert QtQuickControls 1 qml files to QtQuickControls 2?