Results 1 to 15 of 15

Thread: Problem inserting items inside TreeWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: Problem inserting items inside TreeWidget

    What is child1? How do you initialize this variable? And why are you iterating i from 2 and not from 0?
    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:

    hakermania (4th May 2011)

  3. #2
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem inserting items inside TreeWidget

    The code is like this:
    Qt Code:
    1. QDir his_file;
    2. .........
    3. his_file.setPath(QString(subdir1.path() + "/" + subdir1.entryList().at(j)));
    4. child1->setText(0,his_file.dirName());
    5. parnt->addChild(child1);
    To copy to clipboard, switch view to plain text mode 
    So, it starts from 2 in order to avoid the paths at 0 and 1 (which means the paths: ) . (current) and .. (one previous), because I actually read folders' names and I add them to parnt, then add parnt to list and list to treewidget...
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  4. #3
    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: Problem inserting items inside TreeWidget

    Why don't you ask QDir to skip those special entries then?
    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.


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

    hakermania (4th May 2011)

  6. #4
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem inserting items inside TreeWidget

    Thx for the suggestion but my solution at that point works perfectly and there's no point in changing it right now.
    In the point now, I don't now what the point(problem) is xD
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  7. #5
    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: Problem inserting items inside TreeWidget

    I think there is a point in changing it right now, because due to increased complexity of your code you can't be sure it is not the value of "i" that is causing the problem.
    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.


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

    hakermania (4th May 2011)

Similar Threads

  1. Inserting label inside textEdit widget
    By dshan in forum Qt Programming
    Replies: 1
    Last Post: 11th January 2011, 11:17
  2. add items to treewidget
    By Shien in forum Qt Programming
    Replies: 15
    Last Post: 1st January 2011, 19:40
  3. Problem editing TreeWidget items
    By Moezzie in forum Qt Programming
    Replies: 3
    Last Post: 15th December 2007, 21:22
  4. Replies: 2
    Last Post: 29th May 2007, 13:55
  5. Problem inserting child items into a QAbstractItemModel
    By Valheru in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2006, 18:35

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.