Results 1 to 4 of 4

Thread: When itemChanged is emitted, can the change type be detected?

  1. #1
    Join Date
    Feb 2006
    Posts
    47
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question When itemChanged is emitted, can the change type be detected?

    QTreeWidget::itemChanged(QTreeWidgetItem*,int) signals when an item has changed. Is there a way to detect what has changed?

    For example, if I edit an item (let's say it is text) - the signal is emitted. Based on the text value, the color of this item is changed. In a validation scheme, this would be like an item turning red because the value was not acceptable.

    In the above case, the signal is emitted for the color and text change. I only want my block of code to be executed once so how can this be done? I am assuming that this can be done by detecting the type of change that occured... Is this reasonable?

    J.

  2. #2
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: When itemChanged is emitted, can the change type be detected?

    Block signals when changing the color of the text.
    Save yourself some pain. Learn C++ before learning Qt.

  3. #3
    Join Date
    Feb 2006
    Posts
    47
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: When itemChanged is emitted, can the change type be detected?

    You can do that???
    How can one block a signal?

    Once a connect has been established, I assumed that the mechanism could not be broken....

  4. #4
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: When itemChanged is emitted, can the change type be detected?

    Look at QObject::blockSignals(bool)
    Save yourself some pain. Learn C++ before learning Qt.

Similar Threads

  1. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  2. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 19th July 2007, 23:38
  3. How to dinamically change the type of a QCheckListItem
    By kalos80 in forum Qt Programming
    Replies: 4
    Last Post: 12th March 2007, 15:25

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.