[Interest] How to expand and collapse Tableview

Poonam Sangale sanglepoonam123 at gmail.com
Mon Apr 17 07:14:19 CEST 2023


Hi Everyone,
I'm trying to implement a tableview for event log  which contains 3
columns. First column contains logo, second column contain date and time
and third column contain event name which can expand when we click on this
column and shows brief event description and respectively other column
height should also expand and when we again click on the column 3 it should
collapse to its original size.

In this example 2nd and 3rd column data will come from the model. So
basically What I'm doing I'm changing the state of the 3rd column rectangle
when
the description of the event text is visible initially visibility would be
false but when I'm doing that I'm unable to expand the whole row and all
others should not expand; only that particular row should expand. How can I
do that?



 TableView {
            id:tableView1
            Layout.preferredHeight: 330
            Layout.preferredWidth: 900
            clip: true
            boundsBehavior: Flickable.StopAtBounds
            model: tablemodel
            ScrollBar.vertical: ScrollBar{}

            delegate: DelegateChooser {
                id:delegateChooser

                DelegateChoice {
                    column: 0; Rectangle{
                        id:mainImage
                        implicitWidth: 72
                        implicitHeight: 76
                        Image {
                            //source: imagepath
                            anchors.centerIn: parent
                        }
                    }
                }
                DelegateChoice { column: 1; Rectangle{
                        id:dateAndTime
                        implicitWidth: 149
                        implicitHeight: 76

                        Text {
                            text: EventDateTime
                            font.pixelSize:20
                            height: 76
                            width: 115
                            wrapMode: Text.WordWrap

                        }
                        Rectangle{
                            width: 3
                            height: 40
                            anchors.right: dateAndTime.right
                            anchors.rightMargin: 20
                            anchors.top: parent.top
                            anchors.topMargin: 20
                        }
                    }
                }
                DelegateChoice { column: 2; DropDown{}
                }
            }
        }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230417/61e2698f/attachment.htm>


More information about the Interest mailing list