A collection of C++ helpers for (my) QML applications. Works with Qt5 and Qt6.
Copy the AppUtils directory into your project, then include the library files with
either the AppUtils.pro
QMake project file or the CMakeLists.txt
CMake project file.
include(src/thirdparty/AppUtils/AppUtils.pri)
add_subdirectory(src/thirdparty/AppUtils)
target_link_libraries(${PROJECT_NAME} AppUtils::AppUtils)
Registering the QML type in C++ in your main.cpp file:
#include <utils_app.h>
#include <utils_screen.h>
int main(int argc, char *argv[])
{
UtilsApp *utilsApp = UtilsApp::getInstance();
UtilsScreen *utilsScreen = UtilsScreen::getInstance(&app);
QQmlApplicationEngine engine;
QQmlContext *engine_context = engine.rootContext();
engine_context->setContextProperty("utilsApp", utilsApp);
engine_context->setContextProperty("utilsScreen", utilsScreen);
return app.exec();
}
TODO
This project is licensed under the MIT license, see LICENSE file for details.
Emeric Grange [email protected]