Skip to content

Provider an accessor to the Rubberband's current position #42

@paravoid

Description

@paravoid

(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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions