Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Page Stack in Qt QuickControls 2
Qt 6.11 is out! See what's new in the release blog

Page Stack in Qt QuickControls 2

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    happyprogrammer
    wrote on last edited by happyprogrammer
    #1

    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
                   }
            }
    }
    
    1 Reply Last reply
    0
    • jpnurmiJ Offline
      jpnurmiJ Offline
      jpnurmi
      wrote on last edited by
      #2

      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: { ... }
      }
      
      H 1 Reply Last reply
      2
      • jpnurmiJ jpnurmi

        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: { ... }
        }
        
        H Offline
        H Offline
        happyprogrammer
        wrote on last edited by happyprogrammer
        #3

        @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?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved