QListView how to add column?

Samir picture Samir · Apr 15, 2010 · Viewed 39.3k times · Source

How can I add columns to QListView control. Found a method addColumn while seardhing, but in my Qt Creator 1.2.1 based on Qt 4.5.2(32 bit) QListView doesn't have such method at all !!!

So how would I add columns ?

Say I have 3 columns then what is the code to add a row ?

Answer

user456310 picture user456310 · Nov 25, 2010

You can use QTableView for this purpose. But if you need QListView look & feel, you can use QTableView borderless using Qt Stylesheet. Also you may want to add an icon. You can add icons to your QTableView by setting icon data to Qt::DecorationRole.