I am trying to use a VTK renderer in Qt central widget with a file explorer tree view in a QDockWidget using Qt creator 4.0. It seams that qvtkwidget doesnt work with QFileSystemModel in a QTreeView for some reason. Here is the code fragment that generate the error:'
qvtkWidget = new QVTKWidget(centralWidget)
....
QFileSystemModel *dirModel = new QFileSystemModel(treeView);
QString sPath
=dirModel
->myComputer
().
toString();
dirModel
->setFilter
(QDir::NoDotAndDotDot |
QDir::AllDirs |QDir
::AllEntries);
dirModel->setRootPath(sPath);
treeView->setModel(dirModel);
qvtkWidget = new QVTKWidget(centralWidget)
....
QTreeView *treeView = new QTreeView(dockWidgetContents);
QFileSystemModel *dirModel = new QFileSystemModel(treeView);
QString sPath=dirModel->myComputer().toString();
dirModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs |QDir::AllEntries);
dirModel->setRootPath(sPath);
treeView->setModel(dirModel);
To copy to clipboard, switch view to plain text mode
The above code produces a run-time error
handled exception at 0x6016A4F0 (Qt5Gui.dll) in myApp.exe: 0xC0000005: Access violation reading location 0x000000E8.
Unhandled exception at 0x6036A4F0 (Qt5Gui.dll) in myApp.exe: 0xC000041D: An unhandled exception was encountered during a user callback.
The error stops when i either remove QVTKWidget or comment out the code line
dirModel->setRootPath(sPath);
dirModel->setRootPath(sPath);
To copy to clipboard, switch view to plain text mode
I have built VTK 7.0.0 in release mode, so I cant debug into the code. I am using installed Qt 5.5.1 built for mvsc2013 32bit on windows 10
Anyone with any idea?
Bookmarks