Results 1 to 2 of 2

Thread: Strange "1" in QTreeView with QStandardItemModel

  1. #1
    Join Date
    May 2012
    Posts
    5
    Qt products
    Qt4

    Default Strange "1" in QTreeView with QStandardItemModel

    Hi,

    I'm a newbie to Qt4. I created a simple QTreeView with QStandardItemModel as following code
    Qt Code:
    1. QStandardItem *parentItem = pItemModel->invisibleRootItem();
    2. QStandardItem* pItem = new QStandardItem(QString("root"));
    3. parentItem->setChild(0, pItem);
    4. pItem->setChild(0, new QStandardItem(QString("child0")));
    5. pItem->setChild(1, new QStandardItem(QString("child1")));
    6. m_pContentView->setModel(pItemModel);
    To copy to clipboard, switch view to plain text mode 
    Why there is a "1" in the window ? How should I clear this text ? Thanks !
    1.png

  2. #2
    Join Date
    Sep 2011
    Location
    Portugal
    Posts
    25
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanked 5 Times in 5 Posts

    Default Re: Strange "1" in QTreeView with QStandardItemModel

    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);

Similar Threads

  1. Replies: 0
    Last Post: 15th April 2011, 19:04
  2. Replies: 22
    Last Post: 2nd January 2011, 21:52
  3. The strange problem:"QSqlDatabase: QMYSQL driver not loaded"
    By osmanthus in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd January 2009, 15:12
  4. strange ailment "Object moved to here"
    By s410i in forum Qt Programming
    Replies: 1
    Last Post: 28th August 2008, 23:27
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.