PDA

View Full Version : QListView: how to adding column text?



richardander
31st December 2013, 00:08
In Q3ListView, setColumnText() is used to set the name of each column. But this is removed in QListView. Is there a way to set up it?

Also, is there a way to set the height of text bar for each column in Q3ListView? All the letters "g" and "q" are but at bottom. how about in QListView?

thank you,

ChrisW67
31st December 2013, 02:29
As the QListView docs say:


This view does not display horizontal or vertical headers; to display a list of items with a horizontal header, use QTreeView instead.

The default column and row heading would typically be provided by the underlying model in Qt4/Qt5 and displayed in the default QHeaderView. You can replace the default QHeaderView or the data underlying it if you wish.

If you use the QTreeWidget subclass then the internal model's headers are accessed with QTreeWidget::setHeaderLabel().

anda_skoa
31st December 2013, 10:40
As ChrisW67 said use a QTreeWidget or QTreeView.
It is the equivalent of Qt3's QListView.

Qt4 and Qt5's QListView is more like Qt3's QListBox

Cheers,
_