Get visible area of QPainter
问题 I have an owner-drawn QWidget inside a QScrollArea , so when painting, and I want to paint only the parts that are visible. To do so, I need to have the rectangle of the visible area of the QPainter . The only candidates were QPainter::viewport() , QPainter::window() , and QPainter::clipBoundingRect() , so I put this code to log their output: setMinimumHeight(3000); setMinimumWidth(3000); } void MyWidget::paintEvent(QPaintEvent *) { QPainter painter(this); qDebug() << painter.viewport() <<