Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

StackViewDelegate

A delegate used by NavigationStack for loading transitions. More...

Import Statement: import Felgo 4.0
Inherits:

Item

Properties

Detailed Description

This type defines the page transitions for NavigationStack. Use it with the NavigationStack::transitionDelegate property.

Use the properties pushEnter and pushExit to define the transitions for pushing pages.

Use the properties popEnter and popExit to define the transitions for popping pages.

During transition, you can use the properties enterItem and exitItem. They contain the currently entering and exiting AppPage items.

Note: To move AppPage items contained in a NavigationStack, animate the xOffset and yOffset properties. Their x and y properties are controlled by anchors and cannot be animated.

Example of a custom StackViewDelegate:

 import Felgo
 import QtQuick
 import QtQuick.Controls

 App {

   // NavigationStack
   NavigationStack {
     initialPage: pageComponent

     // custom transition delegate
     transitionDelegate: StackViewDelegate {
       id: delegate

       property int duration: 300

       pushEnter: Transition {
         NumberAnimation {
           property: "opacity"
           from: 0
           to: 1
           duration: delegate.duration
         }
       }

       pushExit: Transition {
         NumberAnimation {
           property: "xOffset"
           from: 0
           to: -delegate.exitItem.width
           duration: delegate.duration
         }
       }

       popEnter: Transition {
         NumberAnimation {
           property: "xOffset"
           from: -delegate.exitItem.width
           to: 0
           duration: delegate.duration
         }
       }

       popExit: Transition {
         NumberAnimation {
           property: "opacity"
           from: 1
           to: 0
           duration: delegate.duration
         }
       }
     }
   }

   // Component for pages
   Component {
     id: pageComponent
     AppPage {
       id: page
       title: "Page 1"

       Rectangle {
         anchors.centerIn: parent
         color: Qt.rgba(Math.random(255), Math.random(255), Math.random(255))
         width: parent.width / 2
         height: parent.height / 2
       }

       AppButton {
         anchors.horizontalCenter: parent.horizontalCenter
         text: "Push"
         onClicked: {
           var properties = { title: "Page " + (page.navigationStack.depth + 1) }
           page.navigationStack.push(pageComponent, properties)
         }
       }
     } // Page
   } // Component
 }

Property Documentation

enterItem : Item [read-only]

Contains the currently entering AppPage item.

This is the new page during push and the previous page during pop.


exitItem : Item [read-only]

Contains the currently exiting AppPage item.

This is the previous page during push and the current page during pop.


popEnter : Transition

A Transition for popping the current AppPage from the NavigationStack.


popExit : Transition

A Transition for adding the previous AppPage to he NavigationStack during pop.


pushEnter : Transition

A Transition for pushing a new AppPage onto the NavigationStack.


pushExit : Transition

A Transition for removing the current AppPage from the NavigationStack during push.


Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded