(This is a simplified problem of a broader use case)
Let's say that I want to extract the Rubberband's position, save it, clear it, and later programmatically restore it where it was.
- I can restore its position with
view.rubberband().setSelection()
- During the rubberband's lifetime, I can get the current selection through the
selectionChanged signal (When the selection is changed, the selectionChanged signal is emitted, having the selection rectangle in layout coordinates as argument.).
- However, I don't seem to be able to find the current selection from the Rubberband object itself, e.g. a
view.rubberband().selection.
Apparently the code necessary for this is in _setSelectionFromGeometry:
view = self.parent().parent()
rect = rect.translated(-view.layoutPosition())
I can't say I understand yet what this translation does. But perhaps it's worthwhile to provide a method/property in the Rubberband class for convenience & abstraction?
(This is a simplified problem of a broader use case)
Let's say that I want to extract the Rubberband's position, save it, clear it, and later programmatically restore it where it was.
view.rubberband().setSelection()selectionChangedsignal (When the selection is changed, the selectionChanged signal is emitted, having the selection rectangle in layout coordinates as argument.).view.rubberband().selection.Apparently the code necessary for this is in
_setSelectionFromGeometry:I can't say I understand yet what this translation does. But perhaps it's worthwhile to provide a method/property in the Rubberband class for convenience & abstraction?