# Qml integration issue : Cannot assign object to list property "data"

**URL:** https://discourse.vtk.org/t/qml-integration-issue-cannot-assign-object-to-list-property-data/14634
**Category:** Development
**Created:** [September 30, 2024, 11:50am UTC](https://discourse.vtk.org/t/qml-integration-issue-cannot-assign-object-to-list-property-data/14634 "2024-09-30T11:50:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![krenouj](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/a9adbd/32.png) [@krenouj](https://discourse.vtk.org/u/krenouj)
#### Post date: [September 30, 2024, 11:50am UTC](https://discourse.vtk.org/t/qml-integration-issue-cannot-assign-object-to-list-property-data/14634/1 "2024-09-30T11:50:37Z")

</div>

I don’t have any problems on linux, but on windows, when I instantiate a simple QQuickVTKItem item, I get the error:

QQmlApplicationEngine failed to load component  
qrc:/qt/qml/minVtkQml/Main.qml:10:5: Cannot assign object to list property “data”

Has anyone ever had the problem? ? I can’t find a way to debug

win10/msvc2019/ninja/Qt6.7.2 and Qt6.7.3 and VTK 9.3 compiled with -DVTK\_GROUP\_ENABLE\_Qt:STRING=YES

main.cpp

```auto
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickVTKItem.h>

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    qmlRegisterType<QQuickVTKItem> ("Test", 1, 0, "Vtk");

    QQmlApplicationEngine engine;

    QObject::connect(
        &engine,
        &QQmlApplicationEngine::objectCreationFailed,
        &app,
        []() { QCoreApplication::exit(-1); },
        Qt::QueuedConnection);
    engine.loadFromModule("minVtkQml", "Main");

    return app.exec();
}

```

Main.qml

```auto
import QtQuick
import Test 1.0

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    Vtk{

    }
}

```

CMakeLists.txt

```auto
cmake_minimum_required(VERSION 3.16)

project(minVtkQml VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 6.7 REQUIRED COMPONENTS Quick)

set(VTK_DIR "../VTK/bin/lib/cmake/vtk-9.3/")
find_package(VTK REQUIRED)

qt_standard_project_setup(REQUIRES 6.7)

qt_add_executable(appminVtkQml
    main.cpp
)

qt_add_qml_module(appminVtkQml
    URI minVtkQml
    VERSION 1.0
    QML_FILES
        Main.qml
)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(appminVtkQml PROPERTIES
# MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appminVtkQml
    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(appminVtkQml PRIVATE
    Qt${QT_VERSION_MAJOR}::Quick
    ${VTK_LIBRARIES}
)

vtk_module_autoinit( TARGETS appminVtkQml MODULES ${VTK_LIBRARIES} )

include(GNUInstallDirs)
install(TARGETS appminVtkQml
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

```

---

<div class="post-metadata">

### Author: ![krenouj](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/k/a9adbd/32.png) [@krenouj](https://discourse.vtk.org/u/krenouj)
#### Post date: [October 14, 2024, 8:59pm UTC](https://discourse.vtk.org/t/qml-integration-issue-cannot-assign-object-to-list-property-data/14634/2 "2024-10-14T20:59:54Z")

</div>

This error appears because I was running a Debug target with a Release version of VTK. No problem if you link a Debug app with a Debug VTK or Release app with a Release VTK.
