# VTK 9.1 + GUISupportQtQUICK + Qt5

**URL:** https://discourse.vtk.org/t/vtk-9-1-guisupportqtquick-qt5/8084
**Category:** Support
**Created:** [March 18, 2022, 8:44pm UTC](https://discourse.vtk.org/t/vtk-9-1-guisupportqtquick-qt5/8084 "2022-03-18T20:44:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Parisa\_Rabbani](https://discourse.vtk.org/user_avatar/discourse.vtk.org/parisa_rabbani/32/4295_2.png) [@Parisa\_Rabbani](https://discourse.vtk.org/u/Parisa_Rabbani)
#### Post date: [March 18, 2022, 8:44pm UTC](https://discourse.vtk.org/t/vtk-9-1-guisupportqtquick-qt5/8084/1 "2022-03-18T20:44:40Z")

</div>

Hi! I built VTK 9.1 on windows 10 with GUISupportQtQuick enabled and QT 5. The build is done without any error. However, I am not able to import VTK in qml. Here is the error I get:

 ![error](https://discourse.vtk.org/uploads/default/original/2X/f/f52146bb94ba9e4fce1c5d058479a5b001f3c4b3.png)

I have defined the environment variable QML2\_Import\_PATH to where qmldir directory.

Any help would be much appreciated.

Thanks,  
Parisa

---

<div class="post-metadata">

### Author: ![Julienchz](https://discourse.vtk.org/user_avatar/discourse.vtk.org/julienchz/32/4106_2.png) [@Julienchz](https://discourse.vtk.org/u/Julienchz)
#### Post date: [March 21, 2022, 8:19am UTC](https://discourse.vtk.org/t/vtk-9-1-guisupportqtquick-qt5/8084/2 "2022-03-21T08:19:17Z")

</div>

```auto
set(VTK_DIR "C:/VTK9/${BUILD_ARCH}/VTK/${CMAKE_BUILD_TYPE}")
set(VTK_BIN ${VTK_DIR}/bin)

    message("VTK Dir: ${VTK_DIR}")
    set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${VTK_DIR}/lib/cmake/vtk-9.1")
    set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${VTK_DIR}/lib/cmake/vtk-9.1")
    set(QML_IMPORT_PATH_VTK "${VTK_DIR}/lib/qml/${CMAKE_BUILD_TYPE}")

	find_package(VTK
		COMPONENTS
			CommonCore
			CommonColor
			GUISupportQt
			GUISupportQtQuick
			IOImage
			IOGeometry
			IOPLY
			FiltersModeling
			ImagingColor
			ImagingGeneral
			InteractionImage
			InteractionStyle
			InteractionWidgets
			RenderingAnnotation
			RenderingLabel
			REQUIRED)

			set(VTK_LIBRARIES
				VTK::CommonCore
				VTK::CommonColor
				VTK::GUISupportQt
				VTK::GUISupportQtQuick
				VTK::IOImage
				VTK::IOGeometry
				VTK::IOPLY
				VTK::FiltersModeling
				VTK::ImagingColor
				VTK::ImagingGeneral
				VTK::InteractionImage
				VTK::InteractionStyle
				VTK::InteractionWidgets
				VTK::RenderingLabel
				VTK::RenderingAnnotation
				)
endif()

```

```auto
add_dll(NAME ...
	NAMESPACE ...
	LINK_LIBRARIES
            ...
            ${VTK_LIBRARIES}
        SOURCES
            ${_sources}
            ${_headers}
            ${_other}
)

```

It can maybe help you

---

<div class="post-metadata">

### Author: ![Parisa\_Rabbani](https://discourse.vtk.org/user_avatar/discourse.vtk.org/parisa_rabbani/32/4295_2.png) [@Parisa\_Rabbani](https://discourse.vtk.org/u/Parisa_Rabbani)
#### Post date: [June 22, 2022, 3:57pm UTC](https://discourse.vtk.org/t/vtk-9-1-guisupportqtquick-qt5/8084/3 "2022-06-22T15:57:38Z")

</div>

I figured out what was missing based on:  
[GitHub - dezbracaty/QtVtk9.1: A qt vtk demo with vtk 9.1](https://github.com/dezbracaty/QtVtk9.1)

After adding the following lines to main.cpp I was able to import VTK and render 3D volume:  
qmlRegisterType(“VTK”, 9, 1, “VTKRenderWindow”);  
qmlRegisterType(“VTK”, 9, 1, “VTKRenderItem”);  
qmlRegisterType(“VTK”, 9, 1, “VTKWidget”);

---

<div class="post-metadata">

### Author: ![edwardAllen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/edwardallen/32/4576_2.png) [@edwardAllen](https://discourse.vtk.org/u/edwardAllen)
#### Post date: [July 4, 2022, 2:02am UTC](https://discourse.vtk.org/t/vtk-9-1-guisupportqtquick-qt5/8084/4 "2022-07-04T02:02:06Z")

</div>

In fact , there. are many ways to fix this . You can use qmlResisterType to let qt know this object , and you can make a qml plugin to let qt know this object too , There are other methods, mainly you can let qt know this type。the second way is in vtk-example.  
And i am the author of the project.
