PDA

View Full Version : Strange "1" in QTreeView with QStandardItemModel



JediMaster
16th May 2012, 08:08
Hi,

I'm a newbie to Qt4. I created a simple QTreeView with QStandardItemModel as following code


QStandardItemModel *pItemModel = new QStandardItemModel;
QStandardItem *parentItem = pItemModel->invisibleRootItem();
QStandardItem* pItem = new QStandardItem(QString("root"));
parentItem->setChild(0, pItem);
pItem->setChild(0, new QStandardItem(QString("child0")));
pItem->setChild(1, new QStandardItem(QString("child1")));
m_pContentView->setModel(pItemModel);

Why there is a "1" in the window ? How should I clear this text ? Thanks !
7727

tferreira
16th May 2012, 12:20
That's probably the header.
If you want to have an header for each column, try to set the header name accordingly.
If not, just hide the headers: m_pContentView->setHeaderHidden(true);