Results 1 to 6 of 6

Thread: Determining QTreeWidget parent

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Determining QTreeWidget parent

    Nice spaghetti code, however you can do this:
    Qt Code:
    1. QTreeWidgetItem *item = ...;
    2. while(item->parent()) item = item->parent();
    3. int index = TreeWidget->invisibleRootItem()->indexOf(item);
    4. switch(index) {
    5. case 0: ...; break;
    6. case 1: ...; break;
    7. // etc.
    8. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. The following user says thank you to wysota for this useful post:

    iaguirre (6th November 2012)

Similar Threads

  1. Determining QTextBlock font
    By smhall316 in forum Newbie
    Replies: 1
    Last Post: 19th October 2010, 22:00
  2. Replies: 5
    Last Post: 21st April 2010, 21:36
  3. Determining no. of CPU cores available
    By cnbp173 in forum Qt Programming
    Replies: 3
    Last Post: 21st April 2009, 17:55
  4. determining how to bounce the ball
    By Binji in forum Qt Programming
    Replies: 9
    Last Post: 29th December 2007, 12:24
  5. Determining Logged In State
    By TheGrimace in forum Qt Programming
    Replies: 2
    Last Post: 22nd October 2007, 15:40

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.