Skip to content

Commit bc31fb6

Browse files
committed
Initial commit
0 parents  commit bc31fb6

28 files changed

+634
-0
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.a filter=lfs diff=lfs merge=lfs -text
2+
FelgoHotReload filter=lfs diff=lfs merge=lfs -text
3+
*.so filter=lfs diff=lfs merge=lfs -text
4+
*.so.* filter=lfs diff=lfs merge=lfs -text

.gitignore

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# General
2+
.DS_Store
3+
.AppleDouble
4+
.LSOverride
5+
6+
# Icon must end with two \r
7+
Icon
8+
9+
# Thumbnails
10+
._*
11+
12+
# Files that might appear in the root of a volume
13+
.DocumentRevisions-V100
14+
.fseventsd
15+
.Spotlight-V100
16+
.TemporaryItems
17+
.Trashes
18+
.VolumeIcon.icns
19+
.com.apple.timemachine.donotpresent
20+
21+
/build/
22+
23+
# Directories potentially created on remote AFP share
24+
.AppleDB
25+
.AppleDesktop
26+
Network Trash Folder
27+
Temporary Items
28+
.apdisk
29+
30+
# Qt-es
31+
object_script.*.Release
32+
object_script.*.Debug
33+
*_plugin_import.cpp
34+
/.qmake.cache
35+
/.qmake.stash
36+
*.pro.user
37+
*.pro.user.*
38+
*.qbs.user
39+
*.qbs.user.*
40+
*.moc
41+
moc_*.cpp
42+
moc_*.h
43+
qrc_*.cpp
44+
ui_*.h
45+
*.qmlc
46+
*.jsc
47+
Makefile*
48+
*build-*
49+
*.qm
50+
*.prl
51+
52+
# Qt unit tests
53+
target_wrapper.*
54+
55+
# QtCreator
56+
*.autosave
57+
58+
# QtCreator Qml
59+
*.qmlproject.user
60+
*.qmlproject.user.*
61+
62+
# QtCreator CMake
63+
CMakeLists.txt.user*
64+
65+
# QtCreator 4.8< compilation database
66+
compile_commands.json
67+
68+
# QtCreator local machine specific files for imported projects
69+
*creator.user*
70+
71+
*_qmlcache.qrc
72+
73+
# CMake
74+
CMakeLists.txt.user
75+
CMakeCache.txt
76+
CMakeFiles
77+
CMakeScripts
78+
Testing
79+
Makefile
80+
cmake_install.cmake
81+
install_manifest.txt
82+
compile_commands.json
83+
CTestTestfile.cmake
84+
_deps
85+
86+
# Felgo Hot Reload
87+
hot_reload_config.json

CMakeLists.txt

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
3+
project(FelgoHotReloadDemo VERSION 0.1 LANGUAGES CXX)
4+
5+
# Provide project name
6+
set(CURRENT_PROJECT_NAME "FelgoHotReloadDemo")
7+
8+
set(CMAKE_AUTOUIC ON)
9+
set(CMAKE_AUTOMOC ON)
10+
set(CMAKE_AUTORCC ON)
11+
12+
set(CMAKE_CXX_STANDARD 17)
13+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
14+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
15+
16+
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick)
17+
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick)
18+
19+
set(PROJECT_SOURCES
20+
main.cpp
21+
qml/qml.qrc
22+
)
23+
24+
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
25+
qt_add_executable(FelgoHotReloadDemo
26+
MANUAL_FINALIZATION
27+
${PROJECT_SOURCES}
28+
)
29+
# Define target properties for Android with Qt 6 as:
30+
# set_property(TARGET FelgoHotReloadDemo APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
31+
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
32+
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
33+
else()
34+
if(ANDROID)
35+
add_library(FelgoHotReloadDemo SHARED
36+
${PROJECT_SOURCES}
37+
)
38+
# Define properties for Android with Qt 5 after find_package() calls as:
39+
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
40+
else()
41+
add_executable(FelgoHotReloadDemo
42+
${PROJECT_SOURCES}
43+
)
44+
endif()
45+
endif()
46+
47+
target_link_libraries(FelgoHotReloadDemo
48+
PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick)
49+
50+
set_target_properties(FelgoHotReloadDemo PROPERTIES
51+
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
52+
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
53+
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
54+
MACOSX_BUNDLE TRUE
55+
WIN32_EXECUTABLE TRUE
56+
)
57+
58+
install(TARGETS FelgoHotReloadDemo
59+
BUNDLE DESTINATION .
60+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
61+
62+
# Add a static plugin
63+
add_subdirectory(qml_static_plugin)
64+
target_link_libraries(FelgoHotReloadDemo PRIVATE
65+
qml_staticpluginplugin
66+
)
67+
68+
# Add a shared plugin
69+
add_subdirectory(qml_shared_plugin)
70+
71+
# Add a custom qml module
72+
qt_add_qml_module(FelgoHotReloadDemo
73+
URI "demo.qml.module"
74+
RESOURCE_PREFIX "qml"
75+
VERSION 1.0
76+
NO_PLUGIN
77+
QML_FILES qml_module/QmlModuleText.qml)
78+
79+
if(QT_VERSION_MAJOR EQUAL 6)
80+
qt_import_qml_plugins(FelgoHotReloadDemo)
81+
qt_finalize_executable(FelgoHotReloadDemo)
82+
endif()

FelgoHotReloadDemo.pro

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
QT += quick
2+
3+
# To suppress warning about platform SDK
4+
CONFIG += sdk_no_version_check
5+
6+
SOURCES += \
7+
main.cpp
8+
9+
RESOURCES += qml/qml.qrc
10+
RESOURCES += qml_module/qml_module.qrc
11+
RESOURCES += qml_static_plugin/qml_static_plugin.qrc
12+
RESOURCES += qml_shared_plugin/qml/qml_shared_plugin.qrc
13+
14+
# Additional import path used to resolve QML modules in Qt Creator's code model
15+
QML_IMPORT_PATH =
16+
17+
# Additional import path used to resolve QML modules just for Qt Quick Designer
18+
QML_DESIGNER_IMPORT_PATH =
19+
20+
# Default rules for deployment.
21+
qnx: target.path = /tmp/$${TARGET}/bin
22+
else: unix:!android: target.path = /opt/$${TARGET}/bin
23+
!isEmpty(target.path): INSTALLS += target
24+
25+
win32 {
26+
QMAKE_LFLAGS_WINDOWS += /DEBUG:NONE
27+
}

LICENSE.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Copyright (C) FELGO GmbH
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
Permission is NOT granted to merge, publish, distribute, sublicense and/or
11+
sell the provided image, audio, video and binary files of this software.
12+
13+
You may not redistribute the source code under the name of Felgo or any
14+
other FELGO related trademarks.
15+
16+
The above copyright notice and this permission notice shall be included in
17+
all copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
THE SOFTWARE.

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Felgo QML Hot Reload Demo
2+
3+
A demo integration of Felgo Hot Reload to an existing Qt project
4+
5+
To learn more about Felgo Hot Reload, have a look at https://felgo.com/qml-hot-reload
6+
7+
This repository includes two commits:
8+
9+
- An initial commit with a Qt/QML project
10+
- A [commit](https://github.com/FelgoSDK/FelgoHotReloadDemo/commit/master) with the changes applied to add Felgo Hot Reload to the project
11+
12+
## Installing Prerequisites
13+
14+
### 1. Install Qt
15+
16+
We recommend that you use Qt versions 5.15.2 or 6.5.3 with one of the kits:
17+
- `gcc_64` kit on Linux
18+
- `msvc2019_64` kit on Windows
19+
- `clang_64` kit for Qt 5.15.2 or `macos` kit for Qt 6.5.3 on macOS
20+
21+
### 2. Install Felgo Hot Reload
22+
23+
You can install Felgo Hot Reload in two ways:
24+
25+
- Download the latest release package of this repository [releases page](https://github.com/FelgoSDK/FelgoHotReloadDemo/releases). This package contains:
26+
- the Felgo Hot Reload GUI application for
27+
- **Linux**
28+
- **Windows**
29+
- **macOS**
30+
- the client libraries for the following build kits
31+
- **GNU/Linux**
32+
- Qt 5.15.2 `gcc_64`
33+
- Qt 6.5.3 `gcc_64`
34+
- **Windows**
35+
- Qt 5.15.2 `msvc2019_64`
36+
- Qt 6.5.3 `msvc2019_64`
37+
- **macOS**
38+
- Qt 5.15.2 `clang_64`
39+
- Qt 6.5.3 `macos`
40+
- Install with the official Felgo Hot Reload Installer, coming with a free evaluation (see below). Use this option if you are not using Qt 5.15.2 or Qt 6.5.3, the installer supports a large variety of development kits.
41+
42+
You need a valid license key, which you can obtain with a [free evaluation here](https://felgo.com/qml-hot-reload).
43+
44+
## Running the Project
45+
46+
### 1. Building
47+
48+
We recommend using CMakeLists.txt file to generate build files when using Qt 6 kits, and FelgoHotReloadDemo.pro file to generate build files when using Qt 5 kits.
49+
50+
#### Qt Creator
51+
52+
**Generating project files with CMake**
53+
54+
Add the `FELGO_HOT_RELOAD_PATH` variable to the Projects - Build Settings - CMake Details and set it to the Felgo Hot Reload client libraries directory for your selected kit.
55+
Assuming you are using the repository release package on a Linux machine, the path is `../client/6.5.3/gcc_64`
56+
57+
**Generating project files with qmake**
58+
59+
Add the `FELGO_HOT_RELOAD_PATH` additional argument to the Projects - Build Settings - Build Steps Details and set it to the Felgo Hot Reload client libraries directory for your selected kit.
60+
Assuming you are using the repository release package on a Linux machine, the argument is `FELGO_HOT_RELOAD_PATH=../client/5.15.2/gcc_64`
61+
62+
#### Other IDEs
63+
64+
Use your IDE build configuration features to set the `FELGO_HOT_RELOAD_PATH` variable before you generate the project files.
65+
Assuming you are using the release package on a Linux machine, the path is `../client/6.5.3/gcc_64`
66+
67+
Run CMake or qmake and build the application like any other.
68+
69+
### 2. Create Felgo Hot Reload configuration file
70+
71+
#### CMake
72+
73+
CMake creates the required `hot_reload_config.json` file automatically. There's nothing you have to do.
74+
75+
#### qmake
76+
77+
Copy or rename `hot_reload_config_qmake.json` to `hot_reload_config.json`.
78+
79+
### 3. Running
80+
81+
- Open the FelgoHotReload GUI application from the repository package or installation and select the `FelgoHotReloadDemo` folder within the opening file dialog (your project directory).
82+
- Run your application and select the “Connect to Local” option. The project loads up.
83+
- Edit the QML code of your application and see changes to the running applications.
84+

main.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <QGuiApplication>
2+
#include <QQmlApplicationEngine>
3+
#include <QStringLiteral>
4+
5+
int main(int argc, char *argv[])
6+
{
7+
8+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
9+
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
10+
#endif
11+
12+
QGuiApplication app(argc, argv);
13+
QQmlApplicationEngine engine;
14+
engine.addImportPath(":/");
15+
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
16+
const auto result = app.exec();
17+
return result;
18+
}

qml/Page1.qml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import QtQuick 2.15
2+
import QtQuick.Controls 2.15
3+
4+
Page {
5+
Rectangle {
6+
anchors.centerIn: parent
7+
width: 300
8+
height: 160
9+
color: "skyblue"
10+
border {
11+
width: 4
12+
color: "blue"
13+
}
14+
radius: 20
15+
16+
Text {
17+
anchors.centerIn: parent
18+
font {
19+
pointSize: 16
20+
bold: true
21+
}
22+
text: qsTr("Felgo Hot Reload Demo")
23+
}
24+
}
25+
}

qml/Page2.qml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import QtQuick 2.15
2+
import QtQuick.Controls 2.15
3+
4+
Page {
5+
Rectangle {
6+
id: box
7+
anchors.centerIn: parent
8+
width: 300
9+
height: 160
10+
color: "salmon"
11+
border {
12+
width: 4
13+
color: "red"
14+
}
15+
radius: 20
16+
17+
Text {
18+
anchors.centerIn: parent
19+
font {
20+
pointSize: 16
21+
bold: true
22+
}
23+
text: qsTr("<i>Rotating</i><br/>Felgo Hot Reload Demo")
24+
horizontalAlignment: Text.AlignHCenter
25+
}
26+
27+
NumberAnimation on rotation {
28+
from: 0
29+
to: 360
30+
loops: Animation.Infinite
31+
duration: 10000
32+
running: true
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)