Better alternative to create QApplication without using a context manager

classic Classic list List threaded Threaded
1 message Options
BPL
Reply | Threaded
Open this post in threaded view
|

Better alternative to create QApplication without using a context manager

BPL
Phil,

A while ago I'd reported a bug related to the clipboard getting screwed up, more 

At that time you'd provided a bug fix where you'd need to create a QApplication
using a context manager, that bug fix worked wonderfully. 

That said, wouldn't be possible to provide a better solution that doesn't 
involve using a context manager at all? IMHO that'd be a much better 
clean&ideal solution, that way all existing pyqt application would benefit 
from the bug fix without having to change any existing production code, 
plus... in pyside2 the bug doesn't exist when using the normal way of 
creating the QApplication instance, check this one out:

USE_PYQT = True

if USE_PYQT:
    from PyQt5.Qt import *
else:
    from PySide2.QtGui import *
    from PySide2.QtCore import *
    from PySide2.QtWidgets import *

if __name__ == '__main__':
    app = QApplication([])
    w = QPlainTextEdit()
    w.setPlainText("hello world")
    w.show()
    app.exec_()

When using pyside2 the clipboard bug doesn't exist while in pyqt right
now you're forced to use the context manager, otherwise you'll get the
bug... but ideally both should expose the same right behaviour 
without forcing the user to use any context manager :)

Thanks!



_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt