Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QFileSystemWatcher not working
Forum Update on Monday, May 27th 2025

QFileSystemWatcher not working

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlfilesystemwaqmlsignalslotqt5
5 Posts 3 Posters 934 Views
  • 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.
  • T Offline
    T Offline
    texasRanger
    wrote on 23 Jun 2020, 21:30 last edited by texasRanger
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 23 Jun 2020, 21:41 last edited by
      #2

      Hi,

      If you want implementation details, just read Qt's source code.

      Your while loop just infinitely creates new connections.

      You need a QApplication/QGuiApplication for things to work correctly.

      Form the looks of it, you might be over-engineering stuff.

      I would recommend starting with the Qt documentation about C++ integration with QtQuick. Once you have that sorted out. Come back to your json file watcher.

      Write a simple wrapper class that contains the watcher and does the file reloading.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      T 1 Reply Last reply 23 Jun 2020, 21:56
      1
      • E Offline
        E Offline
        eyllanesc
        wrote on 23 Jun 2020, 21:49 last edited by eyllanesc
        #3

        Your code shows a lot of ignorance of how Qt works, as they point out, I recommend you read the docs urgently. Here no thread is necessary, it is only necessary to use the Qt event loop. Forget about sequential programming (Qt hates while true since they are not needed). You also do not know what the Qt signals are and how they are used.

        Also you do not understand the advantages and restrictions of threads, it is not safe to access and modify variables in different threads as you try to do.

        If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

        T 1 Reply Last reply 23 Jun 2020, 22:18
        0
        • S SGaist
          23 Jun 2020, 21:41

          Hi,

          If you want implementation details, just read Qt's source code.

          Your while loop just infinitely creates new connections.

          You need a QApplication/QGuiApplication for things to work correctly.

          Form the looks of it, you might be over-engineering stuff.

          I would recommend starting with the Qt documentation about C++ integration with QtQuick. Once you have that sorted out. Come back to your json file watcher.

          Write a simple wrapper class that contains the watcher and does the file reloading.

          T Offline
          T Offline
          texasRanger
          wrote on 23 Jun 2020, 21:56 last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • E eyllanesc
            23 Jun 2020, 21:49

            Your code shows a lot of ignorance of how Qt works, as they point out, I recommend you read the docs urgently. Here no thread is necessary, it is only necessary to use the Qt event loop. Forget about sequential programming (Qt hates while true since they are not needed). You also do not know what the Qt signals are and how they are used.

            Also you do not understand the advantages and restrictions of threads, it is not safe to access and modify variables in different threads as you try to do.

            T Offline
            T Offline
            texasRanger
            wrote on 23 Jun 2020, 22:18 last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0

            4/5

            23 Jun 2020, 21:56

            • Login

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