Emulating ListView as TableView
-
wrote on 21 Feb 2020, 09:28 last edited by Ahti
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 ?
-
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 ?
-
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
-
@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
wrote on 27 Feb 2020, 17:53 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.
-
wrote on 27 Feb 2020, 20:15 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.
-
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.
wrote on 28 Feb 2020, 06:29 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
6/6