c++ - Recreate QApplication after previous instance has been exited -


is possible create , use new qapplication instance after previous 1 has been exited?

yes, can create new qapplication after previous instance destroyed. verified in windows using pyqt4. program below displays empty windows. upon closing first window first qapplication destroyed , second qapplication created shows second blank window. note had problems without del app statement. equivalent using delete on qapplication in c++. make sure allocate qapplication instance on heap instead of stack.

from pyqt4 import qtcore, qtgui import sys  app = qtgui.qapplication(sys.argv) window = qtgui.qwidget() window.show() app.exec_() del app # force garbage collection of first qapplication  app = qtgui.qapplication(sys.argv) window = qtgui.qwidget() window.show() app.exec_() 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -