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. Add a Rectangle child to a SwipeDelegate
Forum Updated to NodeBB v4.3 + New Features

Add a Rectangle child to a SwipeDelegate

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 401 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.
  • M Offline
    M Offline
    Marc_Van_Daele
    wrote on last edited by
    #1

    I succeed in running the example on https://doc.qt.io/qt-5/qml-qtquick-controls2-swipedelegate.html
    However, I would like to add some children (eg a Rectangle) to the SwipeDelegate: when I try this

    delegate: SwipeDelegate {
                            id: swipeDelegate
                            text: model.sender + " - " + model.title
                            width: parent.width
    
                            Rectangle {
                                anchors.fill: parent
                                color: "green"
                            }
    

    I notice that:

    • the text is still swiped
    • the Rectangle isn't swiped and remains on the original location
    • the "Delete" action doesn't show up (probably still underneath the Rectangle)

    Is it somehow possible to add child-items to a SwipeDelegate?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Marc_Van_Daele
      wrote on last edited by
      #2

      This seems to work when using (note both the contentItem and the removed anchoring!)

                              contentItem: Rectangle {
                                  width: parent.width
                                  height: parent.height
                                  color: "green"
                              }
      
      
      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