Emulating ListView as TableView
Unsolved
QML and Qt Quick
-
I want to do the following with
TableView
instead ofListView
: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 ?
-
@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
-
@raven-worx I just want to display the first column and hide all the other columns... This first column should be swipable.
-
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.