PDA

View Full Version : Qt and VTK graphical issue on MacOS when using QVTKWidget and QMainWindow



jonob23@gmail.com
1st August 2017, 14:19
I get a graphical glitch with the top toolbar in a QMainWidow when going fullscreen with macOS. The issue appears when using QVTKWidget in the central widget.

Minimal program that reproduces the issue:



#include <QApplication>
#include <QMainWindow>
#include <QWidget>
#include <QToolBar>
#include <QVTKWidget.h>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

QMainWindow * window = new QMainWindow();
QVTKWidget * widget = new QVTKWidget(window);
window->setCentralWidget(widget);
QToolBar * toolBar = new QToolBar(window);
window->addToolBar(Qt::TopToolBarArea, toolBar);

window->show();
return app.exec();
}


12536

If QWidget is used instead of a QVTKWidget the glitch does not occur:



#include <QApplication>
#include <QMainWindow>
#include <QWidget>
#include <QToolBar>
#include <QVTKWidget.h>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

QMainWindow * window = new QMainWindow();
QWidget * widget = new QWidget(window);
window->setCentralWidget(widget);
QToolBar * toolBar = new QToolBar(window);
window->addToolBar(Qt::TopToolBarArea, toolBar);

window->show();
return app.exec();
}


12535

macOS Sierra, Qt 5.9.1, VTK 8.0.0 (I also observed this behavior with previous versions of VTK).

patrik08
1st August 2017, 20:44
Which Xcode version you use?

terminal this...


/usr/bin/xcodebuild -version

patrik08
2nd August 2017, 14:32
I use cmake & Xcode Xcode 7.3.1 osx 10.11.6 el capitan
Build version 7D1014
This error i have to build your code:
Ask error in beautifull new Xcode 7-8

http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Factories_now_require_defines

If you build your project with CMake, and you use the standard find_package(VTK) and include(${VTK_USE_FILE}) then this problem should not occur. (Because the defines will be automatically added for you by virtue of the include(${VTK_USE_FILE})...) Consider following the guide to using implementation modules, which has fuller details on using implementation modules without using CMake if your project demands it.