Qt 5 / QML

Hello, is someone did or have some samples using occ (6.7.0) with a qml view in Qt 5 ?

Do we need to embeed qt 4 component in a qml view in qt 5 to render an occ scene ?


Daniel Park's picture


Do you have to use qml?
Opencascade provides an example using Qt Opengl.


Marcin's picture

I have problems with samples for QT 5 provided with Opencascade.
Is this possible to find any example to understand and use Opencascade tools as a simple graphic QT widget for example to draw some lines only?

Forum supervisor's picture

Dear Marcin,
As you can see from OCCT6.7.0 Release Notes OCCT is certified for QT4.6.2 only.
So, to use OCCT Samples with Qt5 you need to port Samples to Qt5.
If you will succeed you are welcome to make a contribution via the Collaborative portal - http://dev.opencascade.org/index.php?q=home/get_involved.
Best regards

Dragan Vidovic's picture


According to the 6.7.1 Release Notes:

"QT samples have been updated for the current OCCT version and now support both Qt
4.x and Qt 5.x."

However, opencascade-6.7.1/samples/qt/Common/src/View.cxx still uses the x11Info function from the QX11Info header, and this function has been removed, at least in the version of Qt that I have (5.2.1 on Ubuntu). More precisely, this function is defined in qwidget.h but only if Q_WS_X11 is defined, and it isn't, and if I define it then I have to include QX11Info at a few places in the sample and add QT += x11extras to Tutorial.pro but finally the example won't link because there is no x11Info in any of the libraries. According to http://qt-project.org/forums/viewthread/20363

"QX11 is gone because Qt5 is made more platform-independent with Qt Platform Abstraction (QPA). Windows’, Mac’s, Symbian’s, MeeGo’s stuff is gone, too."

So these days Qt offers a platform-independent way to use OpenGL, but what I see in View.cxx is still very much platform-dependent. Is there any way to embed OpenCascade into Qt in a less platform-dependent way or is there any effort in this direction, and is there any example that works on Linux with Qt5?

Forum supervisor's picture

Dear Dragan,
OCCT samples have been checked to build and execute with Qt 5 on Windows, however no in-depth testing has been performed.
In production and testing we still use Qt 4.6.2 (see Requirements).
If you find some problems with using Qt 5, you are welcome to share your findings and fixes. The Collaborative portal - http://dev.opencascade.org/index.php?q=home/get_involved is under your disposal.
Best regards

Daniel Neander's picture

Please refer to this about using Qt5 and OCC

Aris Karagiannidis's picture

Hello, is there a sample regarding the latest version of OCC?

Daniel Neander's picture

The samples for the latest version of OCC are located in the same directory "samples/qt"