Results 1 to 2 of 2

Thread: QTreeWidget nextSibling()

  1. #1
    Join Date
    Jan 2007
    Posts
    92
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default QTreeWidget nextSibling()

    Q3ListView nextsibling ()method in QTreeWidget.

    I am process of coverting Q3ListView and Q3ListItemView to QTreeWidget and QTreeWidgetItem recursively. But I can not find equivalent nextSibling( ) method in QTreeWidget. How do I iterate for next sibling?
    CCheckListTreeItem is Q3CheckListItem
    m_pListView is Q3ListView and now it is QTreeWidget

    Qt Code:
    1. CCheckListTreeItem * pChild = (CCheckListTreeItem*) m_pListView ->firstChild();
    2.  
    3. while(pChild)
    4. {
    5. if(pChild->isOn())
    6. strListIDS->append(pChild->text());
    7. pChild = (CCheckListTreeItem*)pChild->nextSibling();
    8. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTreeWidget nextSibling()

    Qt Code:
    1. QTreeWidgetItem *current = ...;
    2. QTreeWidgetItem *parent = current->parent();
    3. QTreeWidgetItem *nextSibling;
    4. if(parent){
    5. nextSibling =parent()->child(parent->indexOfChild(current)+1);
    6. else {
    7. QTreeWidget *treeWidget = current->treeWidget();
    8. nextSibling = treeWidget->topLevelItem(treeWidget->indexOfTopLevelItem(current)+1);
    9. }
    To copy to clipboard, switch view to plain text mode 

    Wasn't that hard, was it? Please at least look at available methods for all the related classes before asking such questions...

Similar Threads

  1. QTreeWidget Drag and Drop
    By tommydent in forum Qt Programming
    Replies: 10
    Last Post: 25th August 2008, 15:25
  2. Having trouble clearing a QTreeWidget.
    By Nyphel in forum Qt Programming
    Replies: 28
    Last Post: 10th October 2007, 15:33
  3. how to add icons to QTreeWidget?
    By wei243 in forum Qt Programming
    Replies: 4
    Last Post: 21st September 2007, 08:34
  4. resizing a QTreeWidget
    By drhex in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2006, 22:32
  5. few questions related to QTreeWidget
    By prakash in forum Qt Programming
    Replies: 9
    Last Post: 10th March 2006, 07:32

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.