Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Adding Items to SwipeView
Forum Updated to NodeBB v4.3 + New Features

Adding Items to SwipeView

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 450 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.
  • admiral142A Offline
    admiral142A Offline
    admiral142
    wrote on last edited by
    #1

    I searched the forums, but couldn't find anything about this. I'm trying to add items to a SwipeView; specifically, a rectangle. I don't get any results when I try to add the item. I have also tried adding a SwipeViewDelegate, but that has some odd behavior, and doesn't work more than once. Here is some code:

    SwipeView {
            id: swipeView
            anchors.fill: parent
            currentIndex: tabBar.currentIndex
    
            Rectangle{
                width: 640
                height: 480
                color: "red"
            }
    
            Rectangle{
                width: 640
                height: 480
                color: "green"
            }
    
            Rectangle{
                width: 640
                height: 480
                color: "blue"
            }
    
            onCountChanged: {
                console.log("Count has changed");
            }
    
        }
    
    Component{
            id: rectangleDelegate
            Rectangle{
                width: 640
                height: 480
                color: "black"
            }
        }
    
        Button{
            width: 100
            height: 50
            text: qsTr("Add Page")
            onClicked: {
                swipeView.addItem(rectangleDelegate);  //This does not work
                //swipeView.addItem(Rectangle); //This also does not work
            }
    
        }
    

    I have not included the SwipeDelegate code, as it doesn't do what I'm intending it to do anyway. The question is, how do you add items to SwipeView dynamically?

    Thanks!
    -Alex

    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