Hot Reload
Quik supports UI hot reload during development: after modifying and saving an XML file, the interface refreshes automatically without recompiling the program.
Enable Hot Reload
Use the Quik_BUILD macro to build UI, hot reload is automatically enabled:
cpp
Quik::XMLUIBuilder builder;
QWidget* ui = Quik_BUILD(builder, "Panel.xml");The Quik_BUILD macro will:
- Automatically get the full path of the XML file
- Enable file watcher to detect file changes
- Automatically reload UI when file is saved
Development Workflow
- Start the program, display UI
- Modify XML file in editor
- Save file (Ctrl+S)
- UI refreshes immediately, no restart needed
This greatly speeds up UI debugging and iteration.
Disable for Release
When releasing production versions, disable hot reload for better performance. Set in Quik.h:
cpp
#define QUIK_HOT_RELOAD_ENABLED falseWhen disabled, Quik_BUILD uses embedded resource files instead of watching external files.
Recommendation
Use compile macros to distinguish development and release modes:
cpp
#ifdef QT_DEBUG
#define QUIK_HOT_RELOAD_ENABLED true
#else
#define QUIK_HOT_RELOAD_ENABLED false
#endifNotes
- Hot reload only refreshes UI structure, doesn't reset variable values
- If XML has syntax errors, error messages are output to console
- Hot reload doesn't affect already-bound event handlers