Results 1 to 6 of 6

Thread: QFileSystemWatcher on a network mount

  1. #1
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QFileSystemWatcher on a network mount

    Hey all,

    I have a network mounted home directory (on linux). I want to use QFileSystemWatcher on files in this network mount.

    By default, QFileSystemWatcher uses inotify on linux (if supported by the kernel). However, inotify doesn't seem to work for files on a network mount.

    Do any of you know of a workaround to get file system notifications for network mounts?

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: QFileSystemWatcher on a network mount

    The usual workaround for this is to use a timer and periodically check the last modified timestamp of a file.
    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileSystemWatcher on a network mount

    Yes, I get that. However, the Qt documentation for QFileSystemWatcher says:

    "Note: On systems running a Linux kernel without inotify support, file systems that contain watched paths cannot be unmounted."

    From which I deduce that Qt itself will fall back to polling if inotify isn't available. Now it would be nice if I could force QFileSystemWatcher to use polling, but that doesn't appear to be in the documentation

  4. #4
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileSystemWatcher on a network mount

    I've been checking the sources and I think it may be possible to subclass qfilesystemwatcher and force it to use its polling watcher engine. Going to try that tomorrow, will post the results here of course

  5. #5
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileSystemWatcher on a network mount

    Okay, subclassing QFileSystemWatcher is not going to work because the implementation is private (pimpl). Any suggestions other than creating my own polling class would be more than welcome, I'm a bit out of options now

  6. #6
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileSystemWatcher on a network mount

    For anyone else having this problem, a "solution" can be found here: http://lists.trolltech.com/qt-intere...ad00553-0.html

Similar Threads

  1. QFIleSystemWatcher
    By jayreddy in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2009, 08:21
  2. QFileSystemWatcher
    By Kumosan in forum Qt Programming
    Replies: 2
    Last Post: 18th March 2008, 20:52
  3. Need help on mount nfs drive in Qt
    By tho97 in forum Qt Programming
    Replies: 3
    Last Post: 28th November 2007, 19:26
  4. QFileSystemWatcher
    By minty in forum Qt Programming
    Replies: 13
    Last Post: 22nd May 2007, 15:39
  5. Need help with QFileSystemWatcher
    By L.Marvell in forum Qt Programming
    Replies: 1
    Last Post: 18th August 2006, 13:19

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.