Important: Please read the Qt Code of Conduct -

How to manipulate view in a QPainter?

  • Greetings to all!

    I have a QPainter on a Widget and would like to, at least, scroll it, but any mouse event manipulation at all would be nice. I've gloogle it a lot and no clue about.

    Many thanks in advance!

  • Lifetime Qt Champion

    You could put the widget inside a scrollarea?
    and make widget larger then area.
    Then u can scroll the area and what part / section of you widget that is visible.

    A painter is just a way to draw on screen so Im not sure what u mean by scrolling it.

    also " mouse event manipulation" ?
    You can get events via void YourWidget::mousePressEvent(QMouseEvent *event)
    there is also a move, and release.
    Its virtual functions so you will implement them in your subclass widget and
    get the event that way.

Log in to reply