scribblearea.cpp
void ScribbleArea::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);

    // Returns the rectangle that needs to be updated
    QRect dirtyRect = event->rect();

    // Draws the rectangle where the image needs to
    // be updated
    painter.drawImage(dirtyRect, image, dirtyRect);
}
// QPainter provides functions to draw on the widget
// The QPaintEvent is sent to widgets that need to
// update themselves
QPainter provides functions to draw on the widget
The QPaintEvent is sent to widgets that need to
update themselves
QPainter provides functions to draw on the widget The QPaintEvent is sent to widgets that need to update themselves
void ScribbleArea::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    QRect dirtyRect = event->rect();
    painter.drawImage(dirtyRect, image, dirtyRect);
}
void ScribbleArea :: paintEvent ( QPaintEvent * event ) { QPainter painter ( this ) ; QRect dirtyRect = event -> rect ( ) ; painter . drawImage ( dirtyRect , image , dirtyRect ) ; }
QPainter provides functions to draw on the widget
The QPaintEvent is sent to widgets that need to
update themselves
QPainter provides functions to draw on the widget The QPaintEvent is sent to widgets that need to update themselves
// Returns the rectangle that needs to be updated // Draws the rectangle where the image needs to // be updated