the previous formulation creates an ndarray and then creates an QImage
over it w/o copying. this relies on the QImage thus created being
non-const.
if the QImage was (unintentionally) created as const, the subsequent
QPainter render on the const QImage would trigger a COW. i.e. the
original underlying ndarray wouldn't be updated.
this is only an issue for PyQt bindings where const QImages can be
created.
* Correct id-based keying of scatter plot pixmap cache
Note: naively using the id function results in non-unique keys.
Alternatively, we could serialize the Qt objects and use these in the key. This would provide protection from the user mutating these later, but at a cost to performance.
* Make id attribute private
* Access class variable instead of instance
Multiple tests are executed by pytest with the same Python process.
The QApplication instance is a global object that will be used by
subsequent tests.
The Qt documentation says that the object will only be deleted while
running in an event loop. In addition, the Qt docs also specifically
say that processEvents() does not process DeferredDelete events.
i.e. calling processEvents() in a loop is not equivalent to calling
QApplication.instance().exec_()
the code being removed was committed in 2012.
the reason for the workaround no longer exists.
the reason this code is under scrutiny is because while porting to
PyQt6, calling ev.type() triggered a bug in PyQt6 6.0
The bug that this workaround was for has been fixed in PyQt6 6.0.1.
However our feature test for the bug was faulty and triggers positive
for PyQt6 6.0.1. In other words, we would be needlessly monkey patching
where it wasn't needed.
in PyQt6 6.0.0, QEvent.Type was automatically pickled / unpickled.
in PyQt6 6.0.1, QEvent.Type is now pickled to be an int, so needs to be
recreated back explicitly (like the other bindings)
this change is backwards compatible with PyQt6 6.0.0
triggered only for PyQt binding, Python 3.8, 3.9
there is a mismatch in API:
- QScreen.logicalDotsPerInchX() -> float
- QSvgGenerator.setResolution(int)
* LegendItem: fix spelling mistake
* LegendItem: remove unused curRow variable
* LegendItem: correct calculation of rowCount
Previously, rowCount would never be updated unless setColumnCount()
was called. This fixes that issue.
It also fixes that setColumnCount() rounded down (floored) the
number of rows, instead of providing an accurate number:
e.g. 4 items in 3 columns would yield rowCount=1, when it should be 2
* LegendItem: remove rowCount argument (not implemented)
Logic to actually use the rowCount argument was not implemented.
Users might expect rowCount to limit the number of rows to e.g. 1,
but that is not what the current code does (it only works with limiting
the number of columns).
Thus, we were exposing an unused/misleading parameter to users.
This can and should be reverted if the logic for limiting the number
of rows is added.
* LegendItem: add colCount docs
* test (LegendItem): remove unused curRow variable
* test (LegendItem): check increasing rowCount as add items
* Fixed logic in placement of items in legend with multiple columns
* Actual row count here should be 2, not 3
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
* get test_ref_cycles to pass
let objects die without gc.collect()
if you don't have cyclic references, there should be no need to call
gc.collect()
the usage of gc.collect() was causing pytest running with coverage to
crash on Python 3.7 / PySide2 5.12 / {Linux, Windows}.
* remove imports used only by the removed code