You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code demonstrates the difference. It uses QBuffer, as QIODevice is an abstract class and cannot be instantiated.
fromqtpy.QtCoreimportQBuffer# `data` should be a variable. It has buffer: QBuffer=QBuffer()
buffer.open(QBuffer.OpenModeFlag.ReadWrite)
buffer.write(b"abc")
buffer.seek(0)
# `QByteArray(b'abc')` in PySide6, `b'abc'` in PyQt5/6print(f'1. {buffer.read(3) = !r}')
# `QByteArray(b'')` in PySide6, `b''` in PyQt5/6print(f'2. {buffer.read(3) = !r}')
buffer.close()
# `QByteArray(b'')` in PySide6, `None` in PyQt5/6. And a warning to `stderr`.print(f'3. {buffer.read(3) = !r}')
I could write a wrapper. I'm unsure which way to make it:
The following code demonstrates the difference. It uses
QBuffer
, asQIODevice
is an abstract class and cannot be instantiated.I could write a wrapper. I'm unsure which way to make it:
I haven't checked PySide2, having too modern Python at hand.
The text was updated successfully, but these errors were encountered: