Results 1 to 3 of 3

Thread: QGLWidget crashes program when the window is resized rapidly

  1. #1
    Join Date
    May 2016
    Posts
    2
    Qt products
    Platforms
    Windows

    Default QGLWidget crashes program when the window is resized rapidly

    Hi there,

    I've run into a strange bug, and I'm hoping someone here might have seen it before and can help me get past it. Basically, if I have a pyqt window with a QGLWidget, I get a "python has stopped working..." error when I resize the window rapidly. Curiously, it only happens if I resize via the corner, so height and width are changing at the same time. I know the qglwidget is the source of the problem because if I get rid of it, or just break the layout so it doesn't change size with the window, the problem goes away. I'm fairly sure it's not a code issue, but here's a simple example just to be sure:

    Qt Code:
    1. import sys
    2. from PyQt4 import QtCore, QtGui, QtOpenGL
    3. from PyQt4.uic import loadUiType
    4.  
    5. Ui_MainWindow, QMainWindow = loadUiType('crashtest.ui')
    6.  
    7. class Main(QMainWindow, Ui_MainWindow):
    8. def __init__(self):
    9. super(Main, self).__init__()
    10. self.setupUi(self)
    11.  
    12. self.glWidget = QtOpenGL.QGLWidget()
    13. self.plotCanvas.addWidget(self.glWidget)
    14.  
    15. self.show()
    16.  
    17. def main():
    18. app = QtGui.QApplication(sys.argv)
    19. window = Main()
    20.  
    21. sys.exit(app.exec_())
    22.  
    23. if __name__ == "__main__":
    24. main()
    To copy to clipboard, switch view to plain text mode 

    and the .ui file is basically just a main window with an empty vertical layout:

    Qt Code:
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <ui version="4.0">
    3. <class>MainWindow</class>
    4. <widget class="QMainWindow" name="MainWindow">
    5. <property name="geometry">
    6. <rect>
    7. <x>0</x>
    8. <y>0</y>
    9. <width>1051</width>
    10. <height>529</height>
    11. </rect>
    12. </property>
    13. <property name="windowTitle">
    14. <string>MainWindow</string>
    15. </property>
    16. <widget class="QWidget" name="centralwidget">
    17. <layout class="QGridLayout" name="gridLayout">
    18. <item row="0" column="0" rowspan="2">
    19. <layout class="QVBoxLayout" name="plotCanvas"/>
    20. </item>
    21. </layout>
    22. </widget>
    23. </widget>
    24. <resources/>
    25. <connections/>
    26. </ui>
    To copy to clipboard, switch view to plain text mode 

    I'm on windows 10 using python 3.5.1 and pyqt 4.11.4, from the latest anaconda distribution. I'm also using pyopengl 3.1.1 from this unofficial source because the offical sources don't properly install glut on windows. Was pointed to that site by several different sources so I'm pretty sure it's reliable. I'm not sure how to debug this, so any advice along that line would be much appreciated. Thanks.

  2. #2
    Join Date
    May 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QGLWidget crashes program when the window is resized rapidly

    Did you ever figure out the issue? I'm using PyQt5.5 with Python 2.7 and I'm having a similar issue. When I resize the QOpenGLWidget window, it crashes or slows down the painting quite a bit.

  3. #3
    Join Date
    May 2016
    Posts
    2
    Qt products
    Platforms
    Windows

    Default Re: QGLWidget crashes program when the window is resized rapidly

    Quote Originally Posted by Apexdev View Post
    Did you ever figure out the issue? I'm using PyQt5.5 with Python 2.7 and I'm having a similar issue. When I resize the QOpenGLWidget window, it crashes or slows down the painting quite a bit.
    Unfortunately not. I eventually got frustrated and made the window a fixed size. Would still very much like to know the solution if you have better luck than I did.

Similar Threads

  1. QGLWidget crashes with QPainter in some OpenGL versions
    By prosa21 in forum Qt Programming
    Replies: 0
    Last Post: 16th March 2012, 10:44
  2. Replies: 2
    Last Post: 29th June 2011, 15:24
  3. QGLWidget crashes on frequent updates
    By kkk777kkk in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2010, 11:35
  4. QFileDialog QGLWidget crashes
    By SenSej in forum Newbie
    Replies: 1
    Last Post: 17th October 2008, 18:06
  5. QMdiSubWindow problem with resized window
    By estanisgeyer in forum Qt Programming
    Replies: 2
    Last Post: 7th January 2008, 15:39

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.