void QwtPlotAbstractCanvas::drawCanvas( QPainter *painter ) { QWidget *w = canvasWidget(); painter->save(); if ( !d_data->styleSheet.borderPath.isEmpty() ) { painter->setClipPath( d_data->styleSheet.borderPath, Qt::IntersectClip ); } else { if ( borderRadius() > 0.0 ) { const QRect frameRect = w->property( "frameRect" ).toRect(); painter->setClipPath( borderPath2( frameRect ), Qt::IntersectClip ); } else { painter->setClipRect( w->contentsRect(), Qt::IntersectClip ); } } QwtPlot *plot = qobject_cast< QwtPlot *>( w->parent() ); if ( plot ) plot->drawCanvas( painter ); painter->restore(); }
void QwtPlotAbstractCanvas::drawUnstyled( QPainter *painter ) { fillBackground( painter ); QWidget *w = canvasWidget(); if ( w->autoFillBackground() ) { const QRect canvasRect = w->rect(); painter->save(); painter->setPen( Qt::NoPen ); painter->setBrush( w->palette().brush( w->backgroundRole() ) ); const QRect frameRect = w->property( "frameRect" ).toRect(); if ( borderRadius() > 0.0 && ( canvasRect == frameRect ) ) { const int frameWidth = w->property( "frameWidth" ).toInt(); if ( frameWidth > 0 ) { painter->setClipPath( borderPath2( canvasRect ) ); painter->drawRect( canvasRect ); } else { painter->setRenderHint( QPainter::Antialiasing, true ); painter->drawPath( borderPath2( canvasRect ) ); } } else { painter->drawRect( canvasRect ); } painter->restore(); } drawCanvas( painter ); }
int QwtPlotCanvas::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QFrame::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 2) qt_static_metacall(this, _c, _id, _a); _id -= 2; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< double*>(_v) = borderRadius(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setBorderRadius(*reinterpret_cast< double*>(_v)); break; } _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
/*! Paint event \param event Paint event */ void QwtPlotCanvas::paintEvent( QPaintEvent *event ) { QPainter painter( this ); painter.setClipRegion( event->region() ); if ( testPaintAttribute( QwtPlotCanvas::BackingStore ) && d_data->backingStore != NULL ) { QPixmap &bs = *d_data->backingStore; if ( bs.size() != size() ) { bs = QPixmap( size() ); #ifdef Q_WS_X11 if ( bs.x11Info().screen() != x11Info().screen() ) bs.x11SetScreen( x11Info().screen() ); #endif if ( testAttribute(Qt::WA_StyledBackground) ) { QPainter p( &bs ); qwtFillBackground( &p, this ); drawCanvas( &p, true ); } else { QPainter p; if ( d_data->borderRadius <= 0.0 ) { qwtFillPixmap( this, bs ); p.begin( &bs ); drawCanvas( &p, false ); } else { p.begin( &bs ); qwtFillBackground( &p, this ); drawCanvas( &p, true ); } if ( frameWidth() > 0 ) drawBorder( &p ); } } painter.drawPixmap( 0, 0, *d_data->backingStore ); } else { if ( testAttribute(Qt::WA_StyledBackground ) ) { if ( testAttribute( Qt::WA_OpaquePaintEvent ) ) { qwtFillBackground( &painter, this ); drawCanvas( &painter, true ); } else { drawCanvas( &painter, false ); } } else { if ( testAttribute( Qt::WA_OpaquePaintEvent ) ) { if ( autoFillBackground() ) { qwtFillBackground( &painter, this ); qwtDrawBackground( &painter, this ); } } else { if ( borderRadius() > 0.0 ) { QPainterPath clipPath; clipPath.addRect( rect() ); clipPath = clipPath.subtracted( borderPath( rect() ) ); painter.save(); painter.setClipPath( clipPath, Qt::IntersectClip ); qwtFillBackground( &painter, this ); qwtDrawBackground( &painter, this ); painter.restore(); } } drawCanvas( &painter, false ); if ( frameWidth() > 0 ) drawBorder( &painter ); } } if ( hasFocus() && focusIndicator() == CanvasFocusIndicator ) drawFocusIndicator( &painter ); }