Results 1 to 4 of 4

Thread: QtreeWidget

  1. #1
    Join Date
    May 2015
    Posts
    6
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default QtreeWidget

    Hello,

    I'm trying to expand and collapse the tree when the QtreeWidget is checked or unchecked respectively.

    I've tried to implement in two ways:

    1. Trying to see what the checkState is and then setExpanded true or fales. Which dosen't work.
    2. I tried to add the click signal on the treewidget , but as it's a treeWidget connect only takes QtObject and not QtTreeWidget.

    Any help would be appreciated.

    Thank you.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QtreeWidget

    Quote Originally Posted by h4harman View Post
    2. I tried to add the click signal on the treewidget , but as it's a treeWidget connect only takes QtObject and not QtTreeWidget.
    all widgets are QObject derived classes because QWidget is

    Cheers,
    _

  3. #3
    Join Date
    May 2015
    Posts
    6
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QtreeWidget

    So I tried to do something like this:

    Qt Code:
    1. connect(treeWidget, SIGNAL(itemClicked(RootWidget,0)),this,SLOT(Expand(RootWidget)));
    To copy to clipboard, switch view to plain text mode 

    but then nothing happens. I guess itemClicked is not the signal I need. I'm not sure, how to implement a slot if the item is checked. If the itemClicked signal is not right?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QtreeWidget

    itemClicked() is a signal of QTreeWidget, but your SIGNAL macro does not contain that signal's signature.

    Qt Code:
    1. SIGNAL(itemClicked(QTreeWidgetItem*, int))
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

Similar Threads

  1. How QTreeWidget 4.8.5 different from 5.2.1?
    By neosettler in forum Qt Programming
    Replies: 2
    Last Post: 13th March 2014, 07:14
  2. Replies: 0
    Last Post: 21st October 2013, 09:16
  3. Replies: 2
    Last Post: 17th March 2008, 12:53
  4. Replies: 1
    Last Post: 19th October 2007, 01:29
  5. QTreeWidget
    By allensr in forum Qt Programming
    Replies: 3
    Last Post: 14th November 2006, 16:24

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.