For KDE Plasma 6, C++ QML modules should be installed in standard Qt plugin paths so that both your application and QML engine can find them. Typically, you install them to: - System-wide: `/usr/lib/qt6/qml/` (or `/usr/lib64/qt6/qml/` on some distros) - User-local: `~/.local/lib/qt6/qml/` For development, you can also set the `QML_IMPORT_PATH` environment variable to point to your custom module directory. If you are packaging for KDE, follow the conventions used by your distribution and KDE packaging guidelines. ============================================================================================================= You can find the KDE packaging guidelines at the KDE Community Wiki: https://community.kde.org/Guidelines_and_HOWTOs/Packaging For distribution-specific instructions, refer to your distro's packaging documentation or the KDE pages for your distribution // // Example QML plugin for Qt 6 // #include #include #include class MyPluginClass : public QObject { Q_OBJECT Q_PROPERTY(QString message READ message WRITE setMessage NOTIFY messageChanged) public: explicit MyPluginClass(QObject *parent = nullptr) : QObject(parent), m_message("Hello from plugin!") {} QString message() const { return m_message; } void setMessage(const QString &msg) { if (m_message != msg) { m_message = msg; emit messageChanged(); } } signals: void messageChanged(); private: QString m_message; }; class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: void registerTypes(const char *uri) override { // uri must match the import statement in QML qmlRegisterType(uri, 1, 0, "MyPluginClass"); } }; #include "plugin.moc" # CMakeLists.txt for Qt 6 QML plugin cmake_minimum_required(VERSION 3.16) project(MyQmlPlugin LANGUAGES CXX) find_package(Qt6 REQUIRED COMPONENTS Core Qml) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) add_library(MyQmlPlugin SHARED plugin.cpp ) target_link_libraries(MyQmlPlugin PRIVATE Qt6::Core Qt6::Qml) set_target_properties(MyQmlPlugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml/MyQmlPlugin" QT_QML_MODULE_VERSION 1.0 QT_QML_MODULE_URI MyQmlPlugin ) install(TARGETS MyQmlPlugin LIBRARY DESTINATION ${QT6_INSTALL_QMLDIR}/MyQmlPlugin )