PDA

View Full Version : VTK + TranslucentBackground + FramelessWindow = Bug ?



odgygsf
8th June 2015, 18:44
Hello everyone.

I've made a program with PyQt4 that uses VTK. This bug probably occurs with QT too.

The base class of the program is a QWidget with :

self.setAttribute(QtCore.Qt.WA_TranslucentBackgrou nd, True)
self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
(The window has a customized titlebar and I use the transparency to show a QGraphicsDropShadowEffect)

I have a QVTKRenderWindowInteractor embed inside my application. Everything works fine without or with one of the two lines above. But with these two lines together, the QVTKRenderWindowInteractor is completly transparent (I see behind the program, like a hole). All other QWidgets such as QPushbuttons are displayed normally.

I know this may seem quite precise, but it is very frustrating.

You can probably notice this bug with any example of VTK + pyqt and adding the two lines above.

Any help is welcome :)

Thank you..

odgygsf
9th June 2015, 10:08
I found this :
https://bugreports.qt.io/browse/QTBUG-8119
https://bugs.webkit.org/show_bug.cgi?id=29482
https://bugreports.qt.io/browse/QTBUG-4483

It doesn't involve VTK but the issue seems to be the same.

odgygsf
9th June 2015, 15:06
OK after many tries, I may have found a lead.

I subclassed the QVTKRenderWindowInteractor and I implemented a definition for a paintEvent.



def paintEvent(self, event):
o = QStyleOption()
o.initFrom(self)
p = QPainter(self)
self.style().drawPrimitive(QStyle.PE_Widget, o, p, self)

With this, there is no more "hole" and the Canvas area in filled with an opaque color instead. However, there is still no 3D.
I've picked this code from http://stackoverflow.com/questions/19351432/how-to-inherit-from-qwidget-in-pyqt
I don't really understand the code and maybe with some modifications it would be possible to fix the issue.

Is there someone familiar with this code ?

odgygsf
21st June 2015, 22:23
up ?
I'm still stuck on this, it is driving me crazy...
I hope that someone can help.
Thanks in advance.

odgygsf
6th July 2015, 14:22
up...
I really don't know how I can deal with this.