Results 1 to 5 of 5

Thread: QtreeWidgetItem: setFlags emits QTreeWidget::itemChanged

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2009
    Posts
    92
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Default Re: QtreeWidgetItem: setFlags emits QTreeWidget::itemChanged

    Yes, probably it's right, itemChanged is thrown because the flags of the item are changed.
    But the docs specifies "the content of the item", this is why I was a bit surprised when I've seen that the signal is thrown also when I change the flags.
    Thanks for the suggestion but how should I use that signal ? I've never used models, that's my problem.
    I guess I have to connect to the model of the QTableWidget...


    Added after 5 minutes:


    I've tried now in this way:
    Qt Code:
    1. connect (m_TreeWidget->model(), SIGNAL(dataChanged (const QModelIndex&, const QModelIndex&)),
    2. this , SLOT (ItemDataChanged(const QModelIndex&, const QModelIndex&)) );
    To copy to clipboard, switch view to plain text mode 
    but the signal is emitted also when the flags are set.
    Thanks anyway.
    Last edited by trallallero; 16th November 2011 at 07:03.

  2. #2
    Join Date
    Oct 2010
    Posts
    13
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: QtreeWidgetItem: setFlags emits QTreeWidget::itemChanged

    Did you ever find a solution? I have a similar problem. My slot that I connected to the itemChanged signal is being called way too often. I want to only know when the checkstate is changed, is that possible? Any suggestions?

  3. #3
    Join Date
    Aug 2009
    Posts
    92
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Default Re: QtreeWidgetItem: setFlags emits QTreeWidget::itemChanged

    I've solved in this (hacky) way:

    Qt Code:
    1. void PluginOptions::On_itemDoubleClicked(QTreeWidgetItem *item, int column)
    2. {
    3. m_SessionActive = true;
    4.  
    5. <set the flags>
    6.  
    7. m_SessionActive = false;
    8. }
    9.  
    10. void PluginOptions::On_itemChanged(QTreeWidgetItem* item, int column)
    11. {
    12. if (m_SessionActive)
    13. return;
    14. <...>
    15. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 4
    Last Post: 22nd September 2011, 19:37
  2. QTreeWidget::setCurrentItem ( QTreeWidgetItem * item )
    By gboelter in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2011, 22:21
  3. Unable to remove QTreeWidgetItem row from Qtreewidget
    By moh.gup@gmail.com in forum Qt Programming
    Replies: 2
    Last Post: 1st December 2010, 05:40
  4. Customizing QTreeWidget and QTreeWidgetItem
    By mots_g in forum Qt Programming
    Replies: 0
    Last Post: 18th August 2010, 06:53
  5. Replies: 2
    Last Post: 24th May 2009, 10:27

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.