ScrollBar in TableView
-
Hi,
I am trying to use a horizontal scroll bar inside tableview. Since tableview already comes with a scrollBar, I have used the code :
TableView { id: tableView1 width: 100 height: 100 anchors.fill: parent anchors.margins: 20 horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOn flickableItem.flickableDirection : Flickable.HorizontalAndVerticalFlick }
Using ScrollViewStyle as well :
style: TableViewStyle { ScrollViewStyle { handle: Rectangle { implicitWidth: 2 implicitHeight: 5 anchors.fill: parent color: "red" } scrollBarBackground: Item { implicitWidth: 2 implicitHeight: 5 } }
But this is how my scrollBar appears
I am not able to scroll horizontally. Is there anything I am missing out? I changed the width of the table, but it didn't work
QtVersion : 5.9
OS : WindowsThanks
[@ambershark]: fixed formatting so image would appear.
-
Hi. I don't actually see any items in your table. You won't be able to scroll unless you have something that goes outside the frame. You would need column headers or an item that actually caused the need to scroll horizontally in order for it to allow scrolling.
-
Hi,
Yes there is data. I dint show it up here. As you can see my scroll bar covers the entire table.
The only way out is to increase the width of the last column to a point such that it shows scroll bar.
How do i make the width customised in an editable tableview?
Such that it increase, decreases according to data. -
@MTOLANI Sorry I don't quite understand what you want to do here...
How do i make the width customised in an editable tableview?
What width do you want customized?
Such that it increase, decreases according to data.
Does this mean you want a dynamically sized horizontal scroll bar based on window contents?
If possible can you do a quick qml example that I can run to duplicate your problem? Maybe I can figure out what the issue is if I could actually see it and play with it.