void Plot::printCanvas(QPainter *painter, const QRect &canvasRect, const QwtArray<QwtScaleMap> &map, const QwtPlotPrintFilter &pfilter) const { const QwtPlotCanvas* plotCanvas=canvas(); QRect rect=canvasRect; int w=plotCanvas->lineWidth(); if (w>0) { QPalette pal = plotCanvas->palette(); QColor color=pal.color(QPalette::Active, QColorGroup::Foreground); painter->save(); painter->setPen (QPen(color,w,Qt::SolidLine)); if (canvasBackground() != Qt::white) painter->setBrush(canvasBackground()); //if (w == 1 && majorTicksType[QwtPlot::xBottom] == Plot::Out) rect.setHeight(canvasRect.height() + 1); QwtPainter::drawRect(painter, rect.x(), rect.y(), rect.width(), rect.height()); painter->restore(); } painter->setClipping(TRUE); rect = QRect(canvasRect.x()+1, canvasRect.y()+1, canvasRect.width(), canvasRect.height()-1); QwtPainter::setClipRect(painter, rect); drawItems(painter, canvasRect, map, pfilter); }
void Plot::printCanvas(QPainter *painter, const QRect&, const QRect &canvasRect, const QwtScaleMap map[axisCnt], const QwtPlotPrintFilter &pfilter) const { painter->save(); const QwtPlotCanvas* plotCanvas = canvas(); //commented it was clipping the top part of the graph //QRect rect = canvasRect.adjusted(1, 1, -2, -2); QRect rect = canvasRect.adjusted(1, -1, -2, -1); QwtPainter::fillRect(painter, rect, canvasBackground()); painter->setClipping(true); QwtPainter::setClipRect(painter, rect); drawItems(painter, canvasRect, map, pfilter); painter->restore(); painter->save(); int lw = plotCanvas->lineWidth(); if(lw > 0){ QColor color = plotCanvas->palette().color(QPalette::Active, QColorGroup::Foreground); painter->setPen (QPen(color, lw, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin)); QwtPainter::drawRect(painter, canvasRect.adjusted(0, 0, -1, -1)); } painter->restore(); // print texts QObjectList lst = children(); foreach(QObject *o, lst){ if (o->inherits("LegendWidget") && !((QWidget *)o)->isHidden()) ((LegendWidget *)o)->print(painter, map); } }
void Plot::printCanvas(QPainter *painter, const QRect &canvasRect, const QwtScaleMap map[axisCnt], const QwtPlotPrintFilter &pfilter) const { const QwtPlotCanvas* plotCanvas=canvas(); if (plotCanvas->lineWidth() > 0) { QPalette pal = plotCanvas->palette(); QColor color=pal.color(QPalette::Active, QColorGroup::Foreground); painter->save(); painter->setPen (QPen(color, plotCanvas->lineWidth(), Qt::SolidLine)); if (canvasBackground() != Qt::white) painter->setBrush(canvasBackground()); QwtPainter::drawRect(painter, canvasRect); painter->restore(); } painter->setClipping(TRUE); QwtPainter::setClipRect(painter, canvasRect); drawItems(painter, canvasRect, map, pfilter); }
void QwtPlot::printCanvas(QPainter *painter, const QRect &canvasRect, const QwtArray<QwtDiMap> &map, const QwtPlotPrintFilter &pfilter) const { if ( pfilter.options() & QwtPlotPrintFilter::PrintCanvasBackground ) { QwtPainter::fillRect(painter, QRect(canvasRect.x(), canvasRect.y(), canvasRect.width() - 1, canvasRect.height() - 1), canvasBackground()); } else QwtPainter::drawRect(painter, canvasRect.x() - 1, canvasRect.y() - 1, canvasRect.width() + 1, canvasRect.height() + 1); painter->setClipping(TRUE); QwtPainter::setClipRect(painter, canvasRect); drawCanvasItems(painter, canvasRect, map, pfilter); }
int QwtPlot::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 < 5) qt_static_metacall(this, _c, _id, _a); _id -= 5; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QBrush*>(_v) = canvasBackground(); break; case 1: *reinterpret_cast< bool*>(_v) = autoReplot(); break; } _id -= 2; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setCanvasBackground(*reinterpret_cast< QBrush*>(_v)); break; case 1: setAutoReplot(*reinterpret_cast< bool*>(_v)); break; } _id -= 2; } else if (_c == QMetaObject::ResetProperty) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 2; } #endif // QT_NO_PROPERTIES return _id; }