Better alternative to create QApplication without using a context manager

BPL <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <CAAfY3fYEoAdEL7PXzDkXnhKQs8Dm4o2zTSHSpPsmRTQAqdnD3w@mail.gmail.com>
Phil,

A while ago I'd reported a bug related to the clipboard getting screwed up,
more
info about it here
https://www.riverbankcomputing.com/pipermail/qscintilla/2019-June/001404.html

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    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.