Rectangle instead of BackgroundImage as scrollbar handle for a TableView?
-
wrote on 20 Dec 2013, 12:25 last edited by
Hi,
I am currently developing using Qt 5.1.1.
I need to implement a custom style for a "TableView". Thus I define a new TableViewStyle for my TableView including delegates: itemDelegate, headerDelegate, handle etc.
When defining the scrollbar handle delegate I tried first to define it as a simple Rectangle with a certain background color. This did not work, the scrollbar handle was not visible.
When i use Image or BackgroundImage all is fine. Can anybody explain to me why I can't use a Rectangle here?Also, I had trouble to find good documentation concerning the TableViewStyle. I had to gather a lot of information from the code. Am I missing a source of documentation?
Some code for explanation:
@TableView {
model : id_dbaseLibModel
style : TableViewStyle
{
itemDelegate: id_itemDelegate
headerDelegate: id_headerDelegate
rowDelegate: id_rowDelegateminimumHandleLength: 20 handleOverlap: 5 /* not working: handle: Rectangle { width: 10; color: "black"; } */ /* working fine: */ handle: Image { source: "/gfx/icons/naviOff.png" // random image, temporary } decrementControl: Component { Rectangle{} } incrementControl: Component { Rectangle{} } scrollBarBackground : Rectangle { width: 10; color: "green" } } TableViewColumn{ ..... } TableViewColumn{ ..... }
}
@Thx
DaWoo -
wrote on 20 Dec 2013, 20:19 last edited by
Hi,
I use this, and it works for me:
@
handle: Rectangle {
implicitWidth: 8
implicitHeight: 8
color: "black"
}
@ -
wrote on 6 Jan 2014, 13:50 last edited by
Hi Torgeir,
your handle definition works for me also. It seems to be important to define the implicitWidth of the handle instead of just the width.
From the documentation I understand that the implicitWidth of an item is 0 by default, wich would explain why the scrollbar handle (as i defined it) was not visible.What I don't understand though: why is the "explicit" width ignored in this case?
Thanks
DaWoo