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. QML SwipeView Signals
Forum Updated to NodeBB v4.3 + New Features

QML SwipeView Signals

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 3 Posters 4.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.
  • Z Offline
    Z Offline
    zeroc8
    wrote on 14 Jun 2016, 19:34 last edited by zeroc8
    #1

    Hi, is there any signal I can connect to when a SwipeView Page gets loaded?

    SwipeView {
             // this doesn't work
             // onChanged: { console.log('page changed'); }
       Page {
              // this doesn't work
             // onLoaded: { console.log('page loaded'); }
      }
    Page {
      }
    Page {
      }
    }
    
    ? 1 Reply Last reply 14 Jun 2016, 19:44
    0
    • Z zeroc8
      14 Jun 2016, 19:34

      Hi, is there any signal I can connect to when a SwipeView Page gets loaded?

      SwipeView {
               // this doesn't work
               // onChanged: { console.log('page changed'); }
         Page {
                // this doesn't work
               // onLoaded: { console.log('page loaded'); }
        }
      Page {
        }
      Page {
        }
      }
      
      ? Offline
      ? Offline
      A Former User
      wrote on 14 Jun 2016, 19:44 last edited by
      #2

      Hi! You can use onCurrentIndexChanged:

      SwipeView {
              id: view
              anchors.fill: parent
              
              currentIndex: 1
              onCurrentIndexChanged: console.log(currentIndex)
              
              Rectangle {
                  color: "red"
                  width: 300
                  height: 400
              }
              Rectangle {
                  color: "green"
                  width: 300
                  height: 400
              }
              Rectangle {
                  color: "blue"
                  width: 300
                  height: 400
              }
          }
      
      Z 1 Reply Last reply 15 Jun 2016, 06:35
      1
      • J Offline
        J Offline
        jpnurmi
        wrote on 14 Jun 2016, 21:16 last edited by
        #3

        Perhaps the SwipeView.isCurrentItem attached property is of use for you?

        SwipeView {
            Rectangle {
                color: SwipeView.isCurrentItem ? "red" : "green"
            }
        }
        
        1 Reply Last reply
        1
        • ? A Former User
          14 Jun 2016, 19:44

          Hi! You can use onCurrentIndexChanged:

          SwipeView {
                  id: view
                  anchors.fill: parent
                  
                  currentIndex: 1
                  onCurrentIndexChanged: console.log(currentIndex)
                  
                  Rectangle {
                      color: "red"
                      width: 300
                      height: 400
                  }
                  Rectangle {
                      color: "green"
                      width: 300
                      height: 400
                  }
                  Rectangle {
                      color: "blue"
                      width: 300
                      height: 400
                  }
              }
          
          Z Offline
          Z Offline
          zeroc8
          wrote on 15 Jun 2016, 06:35 last edited by
          #4

          @Wieland Thankyou, that works. It seems that signal is missing from the documentation that comes with QtCreator.

          J 1 Reply Last reply 15 Jun 2016, 06:58
          0
          • Z zeroc8
            15 Jun 2016, 06:35

            @Wieland Thankyou, that works. It seems that signal is missing from the documentation that comes with QtCreator.

            J Offline
            J Offline
            jpnurmi
            wrote on 15 Jun 2016, 06:58 last edited by
            #5

            Property Change Signal Handlers:
            http://doc.qt.io/qt-5/qtqml-syntax-signals.html#property-change-signal-handlers

            1 Reply Last reply
            0

            1/5

            14 Jun 2016, 19:34

            • Login

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