[PyQt] Bug: QOpenGLWidget does not update
Neil Girdhar
mistersheik at gmail.com
Tue May 10 05:31:11 BST 2016
Hello,
I'm still puzzled by this problem. I've posted a minimum working example
of QOpenGLWidget not updating:
http://stackoverflow.com/questions/37127997/how-should-viewportevent-be-implemented-in-a-qabstractscrollarea/37128875
import sys
from PyQt5.QtCore import QEvent
from PyQt5.QtWidgets import (QAbstractScrollArea, QApplication, QMainWindow,
QOpenGLWidget)
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.scope_view_widget = ScrollingScopeView()
self.setCentralWidget(self.scope_view_widget)
class ScopeView(QOpenGLWidget):
def paintGL(self):
super().paintGL()
print("Painting")
class ScrollingScopeView(QAbstractScrollArea):
def __init__(self):
super().__init__()
self.set_my_viewport(ScopeView())
def set_my_viewport(self, new_viewport):
self.my_viewport = new_viewport
self.setViewport(self.my_viewport)
def viewportEvent(self, event):
# Uncommenting this breaks painting.
if event.type() == QEvent.Paint:
self.my_viewport.paintEvent(event)
return super().viewportEvent(event)
application = QApplication(sys.argv)
main_window = MainWindow()
main_window.show()
sys.exit(application.exec_())
On Mon, Nov 2, 2015 at 7:24 AM Neil Girdhar <mistersheik at gmail.com> wrote:
> On Mon, Nov 2, 2015 at 7:14 AM Phil Thompson <phil at riverbankcomputing.com>
> wrote:
>
>>
>> > On 2 Nov 2015, at 11:15 a.m., Neil Girdhar <mistersheik at gmail.com>
>> wrote:
>> >
>> > Problem described here:
>> http://stackoverflow.com/questions/30748991/how-can-qopenglwidget-update-not-result-in-paintgl-events
>> >
>> > and here:
>> >
>> http://stackoverflow.com/questions/32428687/pyqt5-qopenglwidget-idle-issue
>> >
>> > This is a crippling issue since QGLWidget has a lot of bugs (on OS X at
>> least).
>>
>> Version numbers and a short script that demonstrates the problem would be
>> helpful.
>>
>
> My versions are:
> Python 3.5
> PyQt: 5.5.1
> Qt: 5.5
>
> I will try to put together a short script, but my experiments show that
> despite update being called, paintGL is only called twice when the widget
> is created. Some things like adding and removing widgets from the vbox
> layout that the QOpenGLWidget belongs to also triggers paintGL
> invocations. For some reason the paintGL invocations are not being emitted
> by QOpenGLWidget.update.
>
>
>> What's to suggest this is a PyQt problem rather than a Qt problem?
>>
>
> Of course, I can't know, but I cannot find anyone running into this
> problem on Qt, whereas two people have run into it on PyQt.
>
>>
>> > Also, why is there no externally-facing issue tracker for PyQt? How
>> are people supposed to submit issues?
>>
>> You just did.
>>
>
> Okay, thanks for your help!
>
>>
>> Phil
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160510/b87a18b0/attachment-0001.html>
More information about the PyQt
mailing list