PDA

View Full Version : QAbstractScrollArea::setViewportMargins() not working :(



montylee
17th January 2009, 22:50
I want to add a widget in a QTableView by shifting the viewport a bit down. I tried using QAbstractScrollArea::setViewportMargins() in the constructor of QTableView but it doesn't seem to do anything. Any ideas?

montylee
18th January 2009, 03:44
just found this:
http://www.qtsoftware.com/developer/task-tracker/index_html?method=entry&id=94559



Bug Description: setViewportMargins() has no effect on QTableView, when calling this function it does not visual change to the margins for the QTableView widget.

Answer:
QTableView manages the viewport margins itself, this is not something that the user should be able to set.
so it means i can't change the margins in QTableView?

jpn
18th January 2009, 21:54
Have you tried style sheets?

montylee
19th January 2009, 00:38
Ya, i am using style sheets but i don't know if by using style sheets i can achieve what i want here.

nifei
19th January 2009, 01:49
Does setContentsMargins() and getContentsMargins() and contentsRect() work?

montylee
19th January 2009, 06:11
Does setContentsMargins() and getContentsMargins() and contentsRect() work?
nope. Doesn't seem to work with QTableView.

wysota
19th January 2009, 08:36
Have you seen if the bug was fixed in newer releases? If not, maybe you can use QTreeView instead?

montylee
21st January 2009, 15:52
doesn't seem to be fixed in the newer version too. I am using a workaround for now. Will see if i can use TreeView.