Results 1 to 4 of 4

Thread: when click the text of QTreeWidgetItem,let it no reaction

  1. #1
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default when click the text of QTreeWidgetItem,let it no reaction

    I create a tree with

    and add signal and slots to it with the following code:

    Qt Code:
    1. connect(tree,SIGNAL(itemPressed(QTreeWidgetItem *, int)), this,SLOT(SlotItemClicked(QTreeWidgetItem *, int)));
    To copy to clipboard, switch view to plain text mode 

    I create a tree item of it with QTreeWidgetItem,and set it checked with setCheckState(0,Qt::Checked);
    When I don't click checkbox of the tree item but the text of it,I find that it still has reaction,that is,the slot SlotItemClicked() still executes,but the check state of the tree item does not change.
    Now I want to it reacts only the checkbox of the tree item is clicked.
    How to do it?
    Last edited by weixj2003ld; 13th March 2012 at 02:37.

  2. #2
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: when click the text of QTreeWidgetItem,let it no reaction

    Is there no help?

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: when click the text of QTreeWidgetItem,let it no reaction

    Look for the check box state change rather than a click on the visual. The "itemChanged(QTreeWidgetItem*, int)" signal from the QTreeView might be a good place to start.

  4. #4
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: when click the text of QTreeWidgetItem,let it no reaction

    There are checkable items and uncheckable items in my tree, If I use "itemChanged(QTreeWidgetItem*, int)" ,I find that there is no respones when I click an uncheckable item(for its state does not change ).

    How to confirm the state of an checkable item changes or not when click it?

Similar Threads

  1. Edit Text of a QPushButton with mouse right click
    By theria05 in forum Qt Programming
    Replies: 6
    Last Post: 8th December 2010, 19:49
  2. QTreeWidgetItem text color
    By Arthur in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2009, 17:59
  3. set color in QTreeWidgetItem text
    By mattia in forum Newbie
    Replies: 2
    Last Post: 7th January 2008, 10:06
  4. formatted text in QTreeWidgetItem
    By swiety in forum Qt Programming
    Replies: 1
    Last Post: 30th October 2007, 17:26
  5. QTreeWidgetItem setting color for the text
    By arjunasd in forum Qt Programming
    Replies: 1
    Last Post: 29th August 2007, 18:22

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.