PDA

View Full Version : get rid of grid lines & vertical table header in QTableView



krystosan
8th December 2013, 17:45
9841

How can I get rid of grid lines and vertical header of QTableView and display text underneath the image instead of being displayed on the right of image ?

ChrisW67
8th December 2013, 21:57
How can I get rid of grid lines


view->setShowGrid(false);


and vertical header of QTableView


view->verticalheader()->setVisible(false);


and display text underneath the image instead of being displayed on the right of image ?
Use a delegate, but consider whether QListView with QListView::setViewMode() with QListView::IconMode is a better fit first

krystosan
9th December 2013, 18:12
view->verticalheader()->setVisible(false);


Use a delegate, but consider whether QListView with QListView::setViewMode() with QListView::IconMode is a better fit first
Doesn't work in python

self.verticalheader().setVisible(False)

i do not know how to use delegate, could you please refer me some example.

Thanks!!!

ChrisW67
9th December 2013, 21:32
Not literally no... But then you did not ask for python. You need to identify the vertical header object of the view in a Pythonic fashion and then you need to call its setVisible method. If I had to guess then


self.verticalHeader.setVisible(false)


QStyledItemDelegate but do check out the QListView first.

krystosan
10th December 2013, 17:00
Not literally no... But then you did not ask for python. You need to identify the vertical header object of the view in a Pythonic fashion and then you need to call its setVisible method. If I had to guess then


self.verticalHeader.setVisible(false)




got it this way



def headerData(self, section, orientation, role):
if role == QtCore.Qt.DisplayRole:
if orientation == QtCore.Qt.Vertical:
return None