Results 1 to 3 of 3

Thread: problem: reparenting qtreewidget items in QT4

  1. #1
    Join Date
    Nov 2007
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question problem: reparenting qtreewidget items in QT4

    Hi,

    little problem:
    i have a simple treewidgetitem struct of depth 3:

    <L-01>
    |---<L-11>
    | |----<L-21>
    |
    |
    <L-02>
    ...

    As soon as i call
    <L-01>->removeChild(<L-11>)

    and afterwards ...

    <L-02>->addChild( <L-11> )

    <L-21> is no longer listed as a child of the "new" reparented <L-11> ...it seems to be lost!

    Am i doing anything wrong here?

    -frank

  2. #2
    Join Date
    Nov 2007
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem: reparenting qtreewidget items in QT4

    Hi,
    one addition is missing:
    the Items on Level-2X have an associated widget set with:
    <L-2X>->setItemWidget

    as soon as i remove the setitemwidget call everything works as expected......so do i need to perform the setitemwidget call after reparenting again?

    -frank

  3. #3
    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: problem: reparenting qtreewidget items in QT4

    Quote Originally Posted by uglykid View Post
    so do i need to perform the setitemwidget call after reparenting again?
    Well, item widgets are not part of item hierarchy, so yes, I'm afraid you will have to relocate them yourself when item hierarchy changes.
    J-P Nurmi

Similar Threads

  1. Problem related to porting from QT3 to QT4 in list items
    By rohitjun in forum Qt Programming
    Replies: 5
    Last Post: 1st June 2007, 09:05
  2. again problem in add items in tablewidget
    By jyoti in forum Qt Tools
    Replies: 3
    Last Post: 24th November 2006, 12:03
  3. QGraphicsItem problem - how to save items info ??
    By aamer4yu in forum Qt Programming
    Replies: 3
    Last Post: 17th October 2006, 12:17

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.