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. [SOLVED]StackViewDelegate getTransition
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]StackViewDelegate getTransition

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.2k Views 1 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.
  • W Offline
    W Offline
    winkler3523
    wrote on last edited by
    #1

    Hello,

    i would like to use a property from the StackView in the StackViewDelegate function getTransition.
    Here is a sample code:
    @
    StackView {
    id: pageStack
    anchors.fill: parent

        property string transitionType: "Goto"
    
        delegate: StackViewDelegate {
            function getTransition(properties)
            {
                switch(transitionType) {
                    case "Up": return upTransition
                    case "Down": return downTransition
                    default: return gotoTransition
                }
            }
     ...
    

    @

    In the above code the variable transitionType in Line 10 is not defined. The idea is to change the transition type from extern.
    How can i do this?

    Thanks

    1 Reply Last reply
    0
    • O Offline
      O Offline
      onek24
      wrote on last edited by
      #2

      The property string transitionType is defined in it's parent, so just access it that way:
      @ function getTransition(properties)
      {
      switch(parent.transitionType) {
      case "Up": return upTransition
      case "Down": return downTransition
      default: return gotoTransition
      }
      }@

      Also it is possible to access it's id and then the property:

      @ function getTransition(properties)
      {
      switch(pageStack.transitionType) {
      case "Up": return upTransition
      case "Down": return downTransition
      default: return gotoTransition
      }
      }@

      1 Reply Last reply
      0
      • W Offline
        W Offline
        winkler3523
        wrote on last edited by
        #3

        Thank you. That worked.

        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