GIPdA / runtimeqml

Adds non-intrusive runtime QML reload capabilities to your Qt project.
BSD 3-Clause "New" or "Revised" License
17 stars 3 forks source link

Reload only once! #1

Closed LinArcX closed 5 years ago

LinArcX commented 5 years ago

Hi, and thank you for your great efforts. I tested your sample and for the first time it reloads automatically, but if you change same file, it print this log on terminal:

Watching QML files:
     "/home/linarcx/temp/runtimeqml_examples/main.qml"
     "/home/linarcx/temp/runtimeqml_examples/Page1.qml"
     "/home/linarcx/temp/runtimeqml_examples/Page1Form.ui.qml"
     "/home/linarcx/temp/runtimeqml_examples/Page2.qml"
     "/home/linarcx/temp/runtimeqml_examples/pages/Page3.qml"
     "/home/linarcx/temp/runtimeqml_examples/Page4.qml"
  Total: 6
Reloading qml: "/home/linarcx/temp/runtimeqml_examples/main.qml"

Look at the last line..

GIPdA commented 5 years ago

Hello, Thank you.

I never tested it on Linux, but maybe you are experiencing the same issue I had under Windows: modified files are deleted and re-created, which causes the file watcher to stop watching them. Try enabling the #if defined at line 291 in runtimeqml.cpp (RuntimeQML::fileChanged) to see if it fix the issue. That will re-add the file to the watch list. Either remove the #if or modify it like: #if defined(Q_OS_WIN) || defined(Q_OS_UNIX)

The log looks ok to me, it is the default behaviour without calling noDebug() to stop debugging prints. The watched file list is printed on startup, and each time a file is modified and reloaded it prints it.

LinArcX commented 5 years ago

@GIPdA Yess. actually changin that if statement works for me:

#if defined(Q_OS_WIN) || defined(Q_OS_UNIX)

Thank you so much.

GIPdA commented 5 years ago

Good! I will push this change then.