Results 1 to 3 of 3

Thread: QFileSystemWatcher emits/handles fileChanged signal after complete script execution.

  1. #1

    Default QFileSystemWatcher emits/handles fileChanged signal after complete script execution.

    Hi,

    I am using QFileSystemWatcher to track any modifications on a file. When I am editing that file using UI, fileChanged signal is emitted after each modification but if I do that through a script, only a single fileChanged signal is emitted after the script has been executed completely and has returned control. e.g.

    a. Execute an operation which impacts "file".
    b. FileChanged signal is emitted.
    c. Execute other operation which impact "file".
    d. fileChanged signal is emitted.

    So far, prefect. Now I wrote a script say editFile as

    a. Execute an operation which impacts "file".
    b. Execute another operation which impact "file".

    Now, if I load/execute script editFile, fileChanged signal is emitted only after the script has executed completely i.e. no fileChanged signal is emitted/handled after step a. execution. Seems like some event loop that is emitting/handling fileChanged signal does that only after control has been returned from script.

    Anything I can do to make sure that fileChanged signal is emitted/handled as soon as the file is edited rather than after the complete script has executed.
    Thanks.

    Best R
    Ajay

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QFileSystemWatcher emits/handles fileChanged signal after complete script executi

    Qt Code:
    1. QApplication::processEvents(); //Try calling in-between
    To copy to clipboard, switch view to plain text mode 
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3

    Default Re: QFileSystemWatcher emits/handles fileChanged signal after complete script executi

    Thanks a lot Santosh, it worked perfectly..

Similar Threads

  1. How can a delete a widget after it emits a signal
    By Linwood in forum Qt Programming
    Replies: 4
    Last Post: 11th March 2017, 10:54
  2. QFileSystemWatcher no fileChanged signal
    By Talei in forum Newbie
    Replies: 6
    Last Post: 18th December 2011, 11:05
  3. QFilesystemWatcher fileChanged events
    By rhblind in forum Newbie
    Replies: 0
    Last Post: 17th August 2011, 10:19
  4. Replies: 3
    Last Post: 2nd April 2011, 13:13
  5. QFileSystemWatcher fileChanged signal doubling
    By roxton in forum Qt Programming
    Replies: 6
    Last Post: 16th May 2008, 13:01

Tags for this Thread

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.