QTableview: Extra Column Space [Solved]
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
Does this work for you?
void QTableView::resizeRowToContents ( int row ) [slot]
thank you for your reply, but no it doesn't work. i do this to resize the cells to the optimal size but the empty space still stays the same.
Mayby you find a solution in:
void QTableView::setSpan ( int row, int column, int rowSpanCount, int columnSpanCount )@
Dont know exactly what it does (never worked with tableview), but you can try
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 )
sorry, i cant be of any help now.
I hope for you that one of the guru's know how to solve your problem.
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:
Alternatively, you can reimplement paint() for the item delegate to draw the margins as you want.
I use delegates now, thank you.