Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. how to use qmltc with Qt6.4
Forum Updated to NodeBB v4.3 + New Features

how to use qmltc with Qt6.4

Scheduled Pinned Locked Moved Unsolved Qt 6
3 Posts 3 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mv-whw
    wrote on last edited by mv-whw
    #1

    Hi, I want to use new qmltc funcionality in my Qt application.
    I type it as said in :

    • https://doc-snapshots.qt.io/qt6-6.4/qtqml-tool-qmltc.html

    and somehow i get this error when CMake is run:

    • /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6Gui/Qt6GuiTargets.cmake:85: error: The link interface of target "Qt6::GuiPrivate" contains: XKB::XKB but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing. /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:52 (include) /home/pureqt/Qt/Tools/CMake/share/cmake-3.24/Modules/CMakeFindDependencyMacro.cmake:47 (find_package) /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:108 (find_dependency) /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickDependencies.cmake:39 (_qt_internal_find_qt_dependencies) /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake:40 (include) /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6/Qt6Config.cmake:213 (find_package) CMakeLists.txt:8 (find_package)

    my CMakeList.txt looks like this:

    cmake_minimum_required(VERSION 3.24)

    project(my_qmltc_example VERSION 0.1 LANGUAGES CXX)

    set(CMAKE_AUTOMOC ON)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)

    find_package(Qt6 6.4 COMPONENTS Quick REQUIRED)

    qt_add_executable(appmy_qmltc_example
    main.cpp
    )

    qt_add_qml_module(appmy_qmltc_example
    URI my_qmltc_example
    VERSION 1.0
    QML_FILES main.qml
    ENABLE_TYPE_COMPILER
    )

    set_target_properties(appmy_qmltc_example PROPERTIES
    MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
    )

    target_link_libraries(appmy_qmltc_example
    PRIVATE Qt6::Quick Qt6::QmlPrivate Qt6::QuickPrivate)

    install(TARGETS appmy_qmltc_example
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

    I know that it doesnt support all modules in qml yet but this is actually totaly empty ("hello word") application, which I wanted to use it to learn it.

    S 1 Reply Last reply
    0
    • M mv-whw

      Hi, I want to use new qmltc funcionality in my Qt application.
      I type it as said in :

      • https://doc-snapshots.qt.io/qt6-6.4/qtqml-tool-qmltc.html

      and somehow i get this error when CMake is run:

      • /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6Gui/Qt6GuiTargets.cmake:85: error: The link interface of target "Qt6::GuiPrivate" contains: XKB::XKB but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing. /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:52 (include) /home/pureqt/Qt/Tools/CMake/share/cmake-3.24/Modules/CMakeFindDependencyMacro.cmake:47 (find_package) /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:108 (find_dependency) /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickDependencies.cmake:39 (_qt_internal_find_qt_dependencies) /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake:40 (include) /home/pureqt/Qt/6.4.0/gcc_64/lib/cmake/Qt6/Qt6Config.cmake:213 (find_package) CMakeLists.txt:8 (find_package)

      my CMakeList.txt looks like this:

      cmake_minimum_required(VERSION 3.24)

      project(my_qmltc_example VERSION 0.1 LANGUAGES CXX)

      set(CMAKE_AUTOMOC ON)
      set(CMAKE_CXX_STANDARD_REQUIRED ON)

      find_package(Qt6 6.4 COMPONENTS Quick REQUIRED)

      qt_add_executable(appmy_qmltc_example
      main.cpp
      )

      qt_add_qml_module(appmy_qmltc_example
      URI my_qmltc_example
      VERSION 1.0
      QML_FILES main.qml
      ENABLE_TYPE_COMPILER
      )

      set_target_properties(appmy_qmltc_example PROPERTIES
      MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
      MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
      MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
      MACOSX_BUNDLE TRUE
      WIN32_EXECUTABLE TRUE
      )

      target_link_libraries(appmy_qmltc_example
      PRIVATE Qt6::Quick Qt6::QmlPrivate Qt6::QuickPrivate)

      install(TARGETS appmy_qmltc_example
      BUNDLE DESTINATION .
      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

      I know that it doesnt support all modules in qml yet but this is actually totaly empty ("hello word") application, which I wanted to use it to learn it.

      S Offline
      S Offline
      Sami Shalayel
      wrote on last edited by
      #2

      @mv-whw Hello there!

      I am not too familiar with the error but it seems you might be missing the XKB::XKB dependency. Did you install the libxkb dev headers?
      Also, I think that you should do
      find_package(Qt6 6.4 COMPONENTS Quick Qml REQUIRED)
      to find the Qml and QmlPrivate modules for the target_link_library() call.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jumper Clown
        wrote on last edited by
        #3

        sudo apt-get install build-essential libgl1-mesa-dev

        solved the issue for me.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved