Results 1 to 3 of 3

Thread: QDateEdit: Don't emit dateChanged when calling setDate

  1. #1
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QDateEdit: Don't emit dateChanged when calling setDate

    I have a QDateEdit-dateChanged-signal connected to a model-class.
    When i do change the date in the model-class from outside (open a file in my application) i call QDateEdit::setDate.
    Which then emits the dateCahnged signal and calls the slot in my model-class - setting the date AGAIN (which the model-class just changed!)

    Can i avoid this? For examle a QDateEdit::setDateWithoutSignals; or a possibility to temporaly disable the signals?

    ....or is the common way to just ignore this?


    thanks,
    niko

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDateEdit: Don't emit dateChanged when calling setDate

    Quote Originally Posted by niko
    Can i avoid this? For examle a QDateEdit::setDateWithoutSignals; or a possibility to temporaly disable the signals?
    You can use QObject::blockSignals() or just don't invoke setDate() if the date you receive is equal to the date set in QDateEdit.

  3. The following user says thank you to jacek for this useful post:

    niko (8th July 2006)

  4. #3
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDateEdit: Don't emit dateChanged when calling setDate

    blockSignals is exaclty waht i was looking for, much thanks!

Similar Threads

  1. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36

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.