Results 1 to 3 of 3

Thread: Showing a QtreeWidget branch as selected

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

    Default Showing a QtreeWidget branch as selected

    Hi,

    I have a QTreeWidget comprised of QTreeWidgetItems.
    After I build the tree and collapse it I want a particular
    parent node highlighted (as if user clicked on it in the tree)
    as shown in the second image.

    I have tried all combinations of setCurrentItem(), setselected()
    etc, but none seem to have any effect.

    What is the solution to this seemingly simple function?

    Thanks!

    Mark
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Showing a QtreeWidget branch as selected

    QTreeWidgetItem::setSelected() should have worked just fine. Can we see the code you tried?

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Showing a QtreeWidget branch as selected

    QTreeWidgetItem::setBackground might also help you.

Similar Threads

  1. Showing selected rows in a separate table
    By dnnc in forum Qt Programming
    Replies: 3
    Last Post: 21st June 2007, 16:35
  2. [QT4] Selected row in a QTreeWidget
    By vfernandez in forum Qt Programming
    Replies: 3
    Last Post: 9th March 2006, 11:54

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.