void QwtPlot::drawCanvas(QPainter *painter) { QwtArray<QwtDiMap> map(axisCnt); for ( int axis = 0; axis < axisCnt; axis++ ) map[axis] = canvasMap(axis); drawCanvasItems(painter, d_canvas->contentsRect(), map, QwtPlotPrintFilter()); }
/*! \brief Adjust plot content to its current size. \sa QwtPlot::resizeEvent */ void QwtPlot::updateLayout() { int hDist, vDist; vDist = hDist = d_canvas->frameWidth() + 2; if (d_axisEnabled[xTop]) hDist = qwtMax(hDist, d_scale[xTop]->minBorderDist()); if (d_axisEnabled[xBottom]) hDist = qwtMax(hDist, d_scale[xBottom]->minBorderDist()); if (d_axisEnabled[yLeft]) vDist = qwtMax(vDist, d_scale[yLeft]->minBorderDist()); if (d_axisEnabled[yRight]) vDist = qwtMax(vDist, d_scale[yRight]->minBorderDist()); QwtRect rPlot = this->contentsRect(); rPlot.cutMargin(d_margin, d_margin, d_margin, d_margin); #ifndef QWT_NO_LEGEND if (d_legend->itemCnt() > 0) { switch(d_legendPos) { case Qwt::Top: case Qwt::Bottom: d_legend->setMaxCols( (rPlot.width() - ScrBarWidth) / d_legend->colWidth()); break; case Qwt::Right: case Qwt::Left: default: d_legend->setMaxCols(1); break; } } #endif QRect rTitle, rLegend, rPixmap, rAxis[axisCnt]; findLayout(FALSE, rPlot, hDist, vDist, QwtPlotPrintFilter(), rTitle, rLegend, rAxis, rPixmap); // // resize and show the visible widgets // if (!d_lblTitle->text().isEmpty()) { d_lblTitle->setGeometry(rTitle); if (!d_lblTitle->isVisible()) d_lblTitle->show(); } else d_lblTitle->hide(); for ( int axis = 0; axis < axisCnt; axis++ ) { if (d_axisEnabled[axis]) { if ( axis == yLeft || axis == yRight ) d_scale[axis]->setBorderDist(vDist, vDist); else d_scale[axis]->setBorderDist(hDist, hDist); d_scale[axis]->setGeometry(rAxis[axis]); if (!d_scale[axis]->isVisible()) d_scale[axis]->show(); } else d_scale[axis]->hide(); } #ifndef QWT_NO_LEGEND if (d_legend->itemCnt() > 0) { d_legend->setGeometry(rLegend); d_legend->show(); } else d_legend->hide(); #endif d_canvas->setGeometry(rPixmap); }