I required own Qt slots within a mex-file, so a solution was needed to use own slots without the necessity of using MOC. Therefore the virtual slots of Qt classes are helpful. The keyword 'virtual' enables the object orientated concept of dynamic binding. Dynamic binding is a concept in which the function being called upon an object, is looked up by name at runtime. Functions of a superclass which are declared as virtual, can get overriden in derived classes.
This is not an example of clean coding, but it works. Maybe someone'll find it useful for playing around. ;-)
NoMoc.cpp is a demo for creating a Qt GUI in a mex file
demoqtvtk.cpp is a demo for visualization of VTK elements with QVTKWidget, the white line is modified from http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Line :-P
calldemo.m creates the mexfiles
There are precompiled versions of Qt available.
I work with Qt 5.4 and MSVS 2016 64bit.
I need to copy the directories from Qt/include into my Matlab.../extern/include directory and the files QWidget and QWidget.h. (Both are contained in the Qt/include/QtWidgets directory, but I had problems adressing them.)
For using VTK with Qt you have to build VTK with Qt support. You'll get QVTKWidgetPlugin.dll. I need to copy it into my Matlab workspace together with the *.dlls from Qt/bin and the Qt/plugins/platforms directory.
For easier building of the mex-file I copied the *.lib files from Qt/lib into my VTK/lib directory. So calldemo.m loads everything automatically.
인용 양식
Mimi (2025). Visualize VTK elements in Qt GUI from mex-file (https://kr.mathworks.com/matlabcentral/fileexchange/55595-visualize-vtk-elements-in-qt-gui-from-mex-file), MATLAB Central File Exchange. 검색 날짜: .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!MexQtVTK/
| 버전 | 게시됨 | 릴리스 정보 | |
|---|---|---|---|
| 1.0.0.0 | spelling.... |