Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Cant able to access qml file from source project into Qt Quick Test project
QtWS25 Last Chance

Cant able to access qml file from source project into Qt Quick Test project

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qtquicktestunit-testingqmlqml binding
1 Posts 1 Posters 242 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.
  • H Offline
    H Offline
    HemantSuryawanshi
    wrote on last edited by HemantSuryawanshi
    #1

    I have a source project which contains some QML files. I wanted to apply unit testing on that QML files by creating different Qt Quick test project. Thats why I am trying to access that QML file from source project into Qt Quick Test project.

    Following is my project structure:

    MainProject
          - CMakeLists.txt
          - src
                 - CMakeLists.txt
                 - main.cpp
                 - qml.qrc
                           - MyWindow.qml
          - QuickTest
                 - CMakeLists.txt
                 - main.cpp
                 - qml.qrc
                           - tst_mywindow.qml
    

    Now I am trying to access the component from MyWindow file into tst_mywindow file to apply unit testing on it. I tried to link both projects using various ways but didn't work. The ways I tried

    set(QML_IMPORT_PATH "${CMAKE_SOURCE_DIR}/src/MyWindow.qml")
    
    add_executable(QuickTest
        main.cpp
        ${CMAKE_SOURCE_DIR}/src/MyWindow.qml
        qml.qrc)
    
    target_sources(QuickTest
    PRIVATE
        ${CMAKE_SOURCE_DIR}/src/MyWindow.qml
    )
    

    Please tell me any way so I can access that qml file in my test project. Thanks in advance.

    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