Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFileSystemWatcher not sending signal when monitored folder itself deleted.
Forum Updated to NodeBB v4.3 + New Features

QFileSystemWatcher not sending signal when monitored folder itself deleted.

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 6.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    @QFileSystemWatcher *watch_files = new QFileSystemWatcher;
    connect(watch_files, SIGNAL(directoryChanged(QString)), this, SLOT(research_folders()));@

    Video reproducing this problem:
    "http://www.youtube.com/watch?v=1IyjO6-osGU":http://www.youtube.com/watch?v=1IyjO6-osGU

    What can i do for this?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      broadpeak
      wrote on last edited by
      #2

      Have you initialized the path?
      @ watcher->addPath("/usr/name/jadajada"); @

      see "this":http://www.voslov.com/c++/qt/showPage.php?ID=281&SAMPLEID=QFileSystemWatcherDetectDirandFileChange

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Leon
        wrote on last edited by
        #3

        Didn't u saw the video?

        u can see that the path is added to the QFileSystemWatcher (renaming or deleting an image inside the folder will send a signal directoryChanged)

        yes i am using watcher->addPath(path);

        The problem is when deleting the monitored folder itself

        [quote author="broadpeak" date="1359721966"]Have you initialized the path?
        @ watcher->addPath("/usr/name/jadajada"); @

        see "this":http://www.voslov.com/c++/qt/showPage.php?ID=281&SAMPLEID=QFileSystemWatcherDetectDirandFileChange[/quote]

        1 Reply Last reply
        0
        • B Offline
          B Offline
          broadpeak
          wrote on last edited by
          #4

          OFF:
          Anyway, I'm a great TheCardigans fan too
          and its No Sleep song is one of my favourite :)
          ON:

          Sorry, but the code is hardly seen...
          So:
          What I have code linked, that is working on my machine (Win7, Qt 4.8.3).
          Try that code in your machine too. Can be a Qt bug...

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Leon
            wrote on last edited by
            #5

            ON
            I dont want you to see any code from the video, as said in 1st post the code is simple:
            @QFileSystemWatcher *watch_files = new QFileSystemWatcher;
            connect(watch_files, SIGNAL(directoryChanged(QString)), this, SLOT(research_folders()));@

            And when you click on my program the Browze button, then select the folder the code is:
            @watch_files->addPath(path);@

            And it doesn't work when u delete the folder ^^ :/

            OFF
            I am digging threw my fathers music alphabetically, and i have stopped in cardigans folder 2 weeks now
            I love all of their songs without an exception ;)

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              Looks to me like you should connect to the fileChanged signal too. The documentation for directoryChanged only talks about changes to the content of the directory, like a file in that directory being added, renamed or removed. However, the documentation for fileChanged talk about changes to the changes to the monitored path itself. I bet directoryChanged also doesn't fire when you change the name of the directory you're monitoring.

              I do admit that the docs can use a bit more clarity here, but this is what I read from it.

              1 Reply Last reply
              0
              • L Offline
                L Offline
                Leon
                wrote on last edited by
                #7

                [quote author="broadpeak" date="1359721966"]
                see "this":http://www.voslov.com/c++/qt/showPage.php?ID=281&SAMPLEID=QFileSystemWatcherDetectDirandFileChange[/quote]

                about tou code.. u are claiming to monitor the /usr folder.. try to monitor a folder in your Desktop and then delete this folder..

                The only different your code have, is the fileChanged signal, which in my code will do anything when u delete the monitored folder itself...

                [quote author="Andre" date="1359729069"]Looks to me like you should connect to the fileChanged signal too. The documentation for directoryChanged only talks about changes to the content of the directory, like a file in that directory being added, renamed or removed. However, the documentation for fileChanged talk about changes to the changes to the monitored path itself. I bet directoryChanged also doesn't fire when you change the name of the directory you're monitoring.

                I do admit that the docs can use a bit more clarity here, but this is what I read from it.[/quote]

                Andre the only way i can think of doing something like this is to have a 2nd filesystemwatcher which will monitor the folder that the monitored folder is( confusing? hope not ).. Can u think of something else?

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  Did you try listening for the fileChanged signal as well as the directoryChanged signal?

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    Leon
                    wrote on last edited by
                    #9

                    [quote author="Andre" date="1359801908"]Did you try listening for the fileChanged signal as well as the directoryChanged signal?[/quote]

                    By listening you mean the thing i do in the video? (Have u seen it?)

                    the file changed signal will never emit.. whatever i do.. rename a picture, delete picture, delete folder.. it never sends signal..

                    1 Reply Last reply
                    0
                    • I Offline
                      I Offline
                      iceguan
                      wrote on last edited by
                      #10
                      This post is deleted!
                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved