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. Signal sent to component when shown by StackView?
Forum Updated to NodeBB v4.3 + New Features

Signal sent to component when shown by StackView?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 1.8k 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.
  • I Offline
    I Offline
    igor_stravinsky
    wrote on last edited by
    #1

    I've got a number of components in a StackView.

    I'd like to trigger animations when the views are shown, meaning when the value of Item::visible in the StackView changes.

    Is there a signal sent to components for those actions? I'd like to handle the action in the item being shown or hidden, not in the StackView.

    Is there a code example of onActivated() being used in this scenario?

    1 Reply Last reply
    0
    • ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      Hello,

      In QML every property has its on<PropertyName>Changed signal :

      Exemple :

      Rectangle{
      visible : true
      onVisibleChanged : Console.log("visible prop changed to " + visible )

      width : 50
      onWidthChanged : Console.log("new width is " + width )
      }

      LA

      1 Reply Last reply
      0
      • ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on last edited by
        #3

        Hello @igor_stravinsky,

        In QML every property has its on<PropertyName>Changed signal :

        Exemple :

        Rectangle{
        visible : true
        onVisibleChanged : Console.log("visible prop changed to " + visible )

        width : 50
        onWidthChanged : Console.log("new width is " + width )
        }

        LA

        1 Reply Last reply
        0
        • jpnurmiJ Offline
          jpnurmiJ Offline
          jpnurmi
          wrote on last edited by
          #4

          StackView.onActivated is not a signal of StackView itself, but an attached signal provided by StackView, for the items on the stack.

          Component {
              id: page
              Page {
                  StackView.onActivated: console.log("activated")
              }
          }
          
          StackView { 
              id: stackView
          }
          
          // ...
          stackView.push(page)
          
          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