Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Using the Qt Quick TreeView with CMake



  • Hello,
    I'm trying to use the Qt Quick TreeView from Qt Marketplace inside my Qt project and I'm hitting several issues.

    I wanted to initially use Qt 5.15, but unfortunately, I'm using CMake as the build system and this commit suggests that I can only use the TreeView with CMake on Qt 6.

    Anyway, I can't get the TreeView to work with this minimal example: https://github.com/evoL/qml-treeview-demo. I managed to get my executable to use the QML plugin, but the engine can't find the TreeView QML file at runtime.

    Does somebody know what I'm doing wrong here?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    That commit only talks about building the module itself not about using it in your application.

    You should be able to use it as any other Qt module with cmake.



  • Hey, thanks for the quick response!

    I wanted to use the module via add_subdirectory in my project — it's a convenient way to manage dependencies because I can use FetchContent functions. However, this way the module gets built along with my project.

    Does it mean that in order to use it properly, I should first build and install TreeView separately and then use find_package to include it?


  • Lifetime Qt Champion

    I think the idea here is that you build and install the Quick TreeView so that you can reuse it from within different projects.


Log in to reply