QTableview: Extra Column Space [Solved]
-
Hi,
I'm starting with QTableView and haven't much experience with it. So maybe I have overseen sth. obvious.I try to display an image in every cell. Some images are doublesized so I try to display them in two columns or to rows. But when I set the column.width() = image.width() there is still a small margin (maybe 2 pixels) at the left side of the cell (and therefore between the imageparts). I tried to set every margin and so on to 0 but nothing changes.
Can anyone help?
Edit: removed [Closed] tag, and replaced it by [Solved]; Andre
-
thank you, but i tried this befor and it doesnt seem to work. it is noct, that the cell has not the correct size, it is that left oft the pixmap there is some extra space where no space is wanted. when i resize the cell to a smaller size, the extra space still appears.
maybe it has sth. to do with the headers or the item delgate? any ideas?
here a list of what i have tried so far:
@void setColumnWidth ( int column, 0 )
void setSpan ( int row, int column, 0, 0 )
setAutoScrollMargin (0 )
resizeColumnToContents ( int column )
resizeRowsToContents ()@ -
In order to specify the margins internally in a cell, you can subclass the style and reimplement pixelMetric() to return the value you want from PM_FocusFrameHMargin. See the documentation:
http://doc.qt.nokia.com/qstyle.html#pixelMetric
Alternatively, you can reimplement paint() for the item delegate to draw the margins as you want.