After upgrade vtk from 7.1.0 to 8.2.0, the old project shows a warning window about VTKWidget.
The newest vtk-qt program suggest me not to use old QVTKWidget anymore, so I rewrite my qt UI file
I have qt UI file as the following code snippet, a few widgets are put above QVTKOpenGLWidget.
The progress bar is at top level, you can read it from zorder information.
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Widget</class>
<widget class="QWidget" name="Widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>726</width>
<height>458</height>
</rect>
</property>
<property name="windowTitle">
<string>Widget</string>
</property>
<widget class="QVTKOpenGLWidget" name="qvtkWidget" native="true">
<property name="geometry">
<rect>
<x>12</x>
<y>12</y>
<width>631</width>
<height>411</height>
</rect>
</property>
</widget>
<widget class="QProgressBar" name="progressBar">
<property name="geometry">
<rect>
<x>190</x>
<y>210</y>
<width>201</width>
<height>31</height>
</rect>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>480</x>
<y>390</y>
<width>112</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>220</x>
<y>290</y>
<width>131</width>
<height>111</height>
</rect>
</property>
<property name="title">
<string>GroupBox</string>
</property>
<widget class="QRadioButton" name="radioButton">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>100</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>RadioButton</string>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_2">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>100</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</widget>
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>80</x>
<y>360</y>
<width>86</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>40</x>
<y>70</y>
<width>113</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QTextEdit" name="textEdit">
<property name="geometry">
<rect>
<x>340</x>
<y>50</y>
<width>104</width>
<height>71</height>
</rect>
</property>
</widget>
<widget class="QTextEdit" name="textEdit_2">
<property name="geometry">
<rect>
<x>50</x>
<y>200</y>
<width>104</width>
<height>71</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>640</x>
<y>10</y>
<width>75</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>Open</string>
</property>
</widget>
<zorder>qvtkWidget</zorder>
<zorder>pushButton_2</zorder>
<zorder>groupBox</zorder>
<zorder>checkBox</zorder>
<zorder>lineEdit</zorder>
<zorder>textEdit</zorder>
<zorder>textEdit_2</zorder>
<zorder>progressBar</zorder>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QVTKOpenGLWidget</class>
<extends>QWidget</extends>
<header>QVTKOpenGLWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
The results on windows and mac os x are different with same code, the project had been uploaded to GitHub:
https://github.com/theArcticOcean/CLib/tree/master/VTKLearn/exploreProgressBar
The widgets above QVTKOpenGLWidget are invisible on windows, but they are normal on mac os x.
Relevant development environment on windows:
Qt 5.12.2 (MSVC 2017, 32 bit)
Qt Creator 4.9.0
VTK8.2.0
Maybe it’s a bug on windows in VTK8.2.0 and QT5.12.3.
Mac
Windows
I can confirm the bug. I couldn’t find a solution to make it work with QVTKOpenGLWidget. But when using a QVTKOpenGLNativeWidget instead, the overlayed widgets will show up.
Well, that’s interesting, I will try QVTKOpenGLNativeWidget in the project. Thanks for your comments.
Yes, it works.
I just replaced all QVTKOpenGLWidget with QVTKOpenGLNativeWidget in my project, Thanks!