Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Emulating ListView as TableView

    QML and Qt Quick
    qml view listview tableview
    3
    6
    385
    Loading More Posts
    • 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.
    • Ahti
      Ahti last edited by Ahti

      I want to do the following with TableView instead of ListView :

      StackView {
              id: home
              anchors.fill: parent
              padding: 0
              property var model: null
      
              initialItem: Pane {
                  ColumnLayout {
                          id: body
      
                          ListView {
                              id: view
                              currentIndex: -1
                              height: body.height
                              width: body.width
      
                              delegate: SwipeDelegate {
                                      id: content
                                      width: parent.width
                                      height: 50
                                      text: model.name
                                      swipe.onCompleted: {
                                          if (swipe.position > 0){
                                               home.model = model
                                               home.pop()										 
                                               home.push("Profile.qml")
      					}
                                          swipe.close()
                                      }
      
                                      swipe.left: Label {
                                          text: qsTr("Profile")
                                          color: "white"
                                          verticalAlignment: Label.AlignVCenter
                                          padding: 12
                                          height: parent.height
                                          anchors.left: parent.left
                                          opacity: 2 * content.swipe.position
                                      }
                              }
                              model: UserModel { id: user_model }
      
                              ScrollIndicator.vertical: ScrollIndicator {}
                          }
                      }
      	      }				
            }
      

      How could I do it ?

      what is a signature ?? Lol

      Ahti raven-worx 2 Replies Last reply Reply Quote 0
      • Ahti
        Ahti @Ahti last edited by Ahti

        @GrecKo can you please answer this...

        what is a signature ?? Lol

        1 Reply Last reply Reply Quote 0
        • raven-worx
          raven-worx Moderators @Ahti last edited by raven-worx

          @Ahti said in Emulating ListView as TableView:

          I want to do the following

          what exactly? swipe the whole table row? if so it wont work, since each cell has it's own delegate

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          Ahti 1 Reply Last reply Reply Quote 0
          • Ahti
            Ahti @raven-worx last edited by

            @raven-worx I just want to display the first column and hide all the other columns... This first column should be swipable.

            what is a signature ?? Lol

            1 Reply Last reply Reply Quote 0
            • fcarney
              fcarney last edited by

              Would something like this work:

              itemDelegate: styleData.column == 0 ? SwipeDelegate {} : Item {}
              

              Of course you will have to determine how the SwipeDelegate and Item are constructed. Maybe need to use a Loader somehow and specify the source using the column info for the cell.

              C++ is a perfectly valid school of magic.

              Ahti 1 Reply Last reply Reply Quote 0
              • Ahti
                Ahti @fcarney last edited by Ahti

                @fcarney I am new to Qt so don't anything about Loader and Can you please take a look at this question too: https://forum.qt.io/topic/111852/inconsistency-between-model-and-view-while-updating-qsqltablemodel-cell

                what is a signature ?? Lol

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post