Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved QFileSystemWatcher not working

    QML and Qt Quick
    qmlfilesystemwa qml signal slot qt5
    3
    5
    332
    Loading More Posts
    • 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
      texasRanger last edited by texasRanger

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 1
        • eyllanesc
          eyllanesc last edited by eyllanesc

          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 Reply Quote 0
          • T
            texasRanger @SGaist last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • T
              texasRanger @eyllanesc last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • First post
                Last post