Results 1 to 2 of 2

Thread: QTreeWidgetItem

  1. #1
    Join Date
    Mar 2006
    Location
    Hyderabad
    Posts
    69
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default QTreeWidgetItem

    Hi all
    QTreeWidgetItem-i tried to add items to the tree using QTreeWidgetItem
    but they dint get added.
    here r the steps wat i did.
    1-created a QTreeWidget
    2-added item using QTreeWidgetItem(QStringList(QString))

    is tht correct?
    plz do reply
    very urgent
    thanks iin advance
    Sarma

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTreeWidgetItem

    From QTreeWidget docs:
    In its simplest form, a tree widget can be constructed in the following way:
    Qt Code:
    1. QTreeWidget *treeWidget = new QTreeWidget();
    2. treeWidget->setColumnCount(1);
    3. for (int i = 0; i < 10; ++i)
    4. new QTreeWidgetItem(treeWidget, QStringList(QString("item: %1").arg(i)));
    To copy to clipboard, switch view to plain text mode 
    Before items can be added to the tree widget, the number of columns must be set with setColumnCount().
    You can create QTreeWidgetItems (take a look at its constructors) with QTreeWidget as parent which leads a top level item to be created, or with another QTreeWidgetItem as parent which leads a child to be created.
    You can also add top level items by QTreeWidget::addTopLevelItem().
    Childs to a specific item can be added by QTreeWidgetItem::addChild().

    These aren't even all, and as you can see, there are several ways to construct a tree.
    Just take a look at the docs, there are examples there..
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    Sarma (7th April 2006)

Similar Threads

  1. hidden a QTreeWidgetItem
    By mattia in forum Newbie
    Replies: 6
    Last Post: 19th February 2014, 14:04
  2. Custom QTreeWidgetItem context menu?
    By AaronMK in forum Qt Programming
    Replies: 4
    Last Post: 1st February 2010, 04:42
  3. PyQt remove the current QTreeWidgetItem
    By koenux in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2009, 23:08
  4. Replies: 3
    Last Post: 26th April 2008, 18:42
  5. QTreeWidgetItem ?
    By allensr in forum Qt Programming
    Replies: 5
    Last Post: 3rd January 2007, 17:51

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.