Results 1 to 2 of 2

Thread: itemPressed of QTreeWidget

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

    Default itemPressed of QTreeWidget

    If click the treeitem,I want to do something.So I use the following code:

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

    the slot SlotItemClicked define as follows:
    Qt Code:
    1. void SlotItemClicked(QTreeWidgetItem *item, int)))
    2. {
    3. .....
    4. if(item->checkState(0)==Qt::Checked)
    5. hideObj();
    6. else
    7. adddelobj->showObj();
    8. ....
    9.  
    10. }
    To copy to clipboard, switch view to plain text mode 

    but I find that,if the text of the item is clicked,the check state of the item is not changed(that is, the check box is still selected or still unselected,how to deal with it?

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

    Default Re: itemPressed of QTreeWidget

    Anyone help me?

Similar Threads

  1. QTreeWidget
    By chris_helloworld in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2010, 18:42
  2. Replies: 2
    Last Post: 17th March 2008, 13:53
  3. QTreeWidget
    By coderbob in forum Qt Programming
    Replies: 4
    Last Post: 21st February 2008, 10:40
  4. Replies: 1
    Last Post: 19th October 2007, 02:29
  5. QTreeWidget Help pls
    By munna in forum Newbie
    Replies: 3
    Last Post: 16th March 2006, 15:39

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.