diff options
| author | Christoph Berg <myon@debian.org> | 2020-05-11 22:18:20 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2020-05-11 22:18:20 +0200 |
| commit | a8edac06b534058e52126c4d55e23b217df2df91 (patch) | |
| tree | f2c3567fae58aad676d544ee8f07ac78dd2eb1ec /qcustomplot-source | |
| parent | 4f6c0156a70e8f2ff70fe5a1a39f5e9b22ffd026 (diff) | |
| parent | 32a41b1abe1a4aab0892c9c2051be6ba5b379f1e (diff) | |
Update upstream source from tag 'upstream/2.2.0_rc1+repack'
Update to upstream version '2.2.0~rc1+repack'
with Debian dir fe177bc6cd2d4c1256a3775504f6010be54e7463
Diffstat (limited to 'qcustomplot-source')
| -rw-r--r-- | qcustomplot-source/qcustomplot.cpp | 45 | ||||
| -rw-r--r-- | qcustomplot-source/qcustomplot.h | 24 |
2 files changed, 34 insertions, 35 deletions
diff --git a/qcustomplot-source/qcustomplot.cpp b/qcustomplot-source/qcustomplot.cpp index 94cd3c20..d51ccde7 100644 --- a/qcustomplot-source/qcustomplot.cpp +++ b/qcustomplot-source/qcustomplot.cpp @@ -1104,8 +1104,8 @@ void QCPLayer::setMode(QCPLayer::LayerMode mode) if (mMode != mode) { mMode = mode; - if (!mPaintBuffer.isNull()) - mPaintBuffer.data()->setInvalidated(); + if (auto paint_buffer = mPaintBuffer.toStrongRef()) + paint_buffer->setInvalidated(); } } @@ -1140,16 +1140,15 @@ void QCPLayer::draw(QCPPainter *painter) */ void QCPLayer::drawToPaintBuffer() { - if (!mPaintBuffer.isNull()) - { - if (QCPPainter *painter = mPaintBuffer.data()->startPainting()) + if (auto paint_buffer = mPaintBuffer.toStrongRef()) { + if (auto painter = paint_buffer->startPainting()) { if (painter->isActive()) draw(painter); else qDebug() << Q_FUNC_INFO << "paint buffer returned inactive painter"; delete painter; - mPaintBuffer.data()->donePainting(); + paint_buffer->donePainting(); } else qDebug() << Q_FUNC_INFO << "paint buffer returned zero painter"; } else @@ -1173,11 +1172,11 @@ void QCPLayer::replot() { if (mMode == lmBuffered && !mParentPlot->hasInvalidatedPaintBuffers()) { - if (!mPaintBuffer.isNull()) + if (auto paint_buffer = mPaintBuffer.toStrongRef()) { - mPaintBuffer.data()->clear(Qt::transparent); + paint_buffer->clear(Qt::transparent); drawToPaintBuffer(); - mPaintBuffer.data()->setInvalidated(false); + paint_buffer->setInvalidated(false); mParentPlot->update(); } else qDebug() << Q_FUNC_INFO << "no valid paint buffer associated with this layer"; @@ -1203,8 +1202,8 @@ void QCPLayer::addChild(QCPLayerable *layerable, bool prepend) mChildren.prepend(layerable); else mChildren.append(layerable); - if (!mPaintBuffer.isNull()) - mPaintBuffer.data()->setInvalidated(); + if (auto paint_buffer = mPaintBuffer.toStrongRef()) + paint_buffer->setInvalidated(); } else qDebug() << Q_FUNC_INFO << "layerable is already child of this layer" << reinterpret_cast<quintptr>(layerable); } @@ -1222,8 +1221,8 @@ void QCPLayer::removeChild(QCPLayerable *layerable) { if (mChildren.removeOne(layerable)) { - if (!mPaintBuffer.isNull()) - mPaintBuffer.data()->setInvalidated(); + if (auto paint_buffer = mPaintBuffer.toStrongRef()) + paint_buffer->setInvalidated(); } else qDebug() << Q_FUNC_INFO << "layerable is not child of this layer" << reinterpret_cast<quintptr>(layerable); } @@ -11067,12 +11066,12 @@ QCPItemAnchor::QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentIte QCPItemAnchor::~QCPItemAnchor() { // unregister as parent at children: - foreach (QCPItemPosition *child, mChildrenX.toList()) + foreach (QCPItemPosition *child, mChildrenX.values()) { if (child->parentAnchorX() == this) child->setParentAnchorX(0); // this acts back on this anchor and child removes itself from mChildrenX } - foreach (QCPItemPosition *child, mChildrenY.toList()) + foreach (QCPItemPosition *child, mChildrenY.values()) { if (child->parentAnchorY() == this) child->setParentAnchorY(0); // this acts back on this anchor and child removes itself from mChildrenY @@ -11245,12 +11244,12 @@ QCPItemPosition::~QCPItemPosition() // unregister as parent at children: // Note: this is done in ~QCPItemAnchor again, but it's important QCPItemPosition does it itself, because only then // the setParentAnchor(0) call the correct QCPItemPosition::pixelPosition function instead of QCPItemAnchor::pixelPosition - foreach (QCPItemPosition *child, mChildrenX.toList()) + foreach (QCPItemPosition *child, mChildrenX.values()) { if (child->parentAnchorX() == this) child->setParentAnchorX(0); // this acts back on this anchor and child removes itself from mChildrenX } - foreach (QCPItemPosition *child, mChildrenY.toList()) + foreach (QCPItemPosition *child, mChildrenY.values()) { if (child->parentAnchorY() == this) child->setParentAnchorY(0); // this acts back on this anchor and child removes itself from mChildrenY @@ -13857,8 +13856,8 @@ bool QCustomPlot::removeLayer(QCPLayer *layer) if (layer == mCurrentLayer) setCurrentLayer(targetLayer); // invalidate the paint buffer that was responsible for this layer: - if (!layer->mPaintBuffer.isNull()) - layer->mPaintBuffer.data()->setInvalidated(); + if (auto paint_buffer = layer->mPaintBuffer.toStrongRef()) + paint_buffer->setInvalidated(); // remove layer: delete layer; mLayers.removeOne(layer); @@ -13894,10 +13893,10 @@ bool QCustomPlot::moveLayer(QCPLayer *layer, QCPLayer *otherLayer, QCustomPlot:: mLayers.move(layer->index(), otherLayer->index() + (insertMode==limAbove ? 0:-1)); // invalidate the paint buffers that are responsible for the layers: - if (!layer->mPaintBuffer.isNull()) - layer->mPaintBuffer.data()->setInvalidated(); - if (!otherLayer->mPaintBuffer.isNull()) - otherLayer->mPaintBuffer.data()->setInvalidated(); + if (auto paint_buffer = layer->mPaintBuffer.toStrongRef()) + paint_buffer->setInvalidated(); + if (auto paint_buffer = otherLayer->mPaintBuffer.toStrongRef()) + paint_buffer->setInvalidated(); updateLayerIndices(); return true; diff --git a/qcustomplot-source/qcustomplot.h b/qcustomplot-source/qcustomplot.h index 0b1bb274..b79c809d 100644 --- a/qcustomplot-source/qcustomplot.h +++ b/qcustomplot-source/qcustomplot.h @@ -3298,7 +3298,7 @@ public: void setSelectionDecorator(QCPSelectionDecorator *decorator); // introduced virtual methods: - virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const = 0; + virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE = 0; virtual QCPPlottableInterface1D *interface1D() { return 0; } virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const = 0; virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const = 0; @@ -3438,7 +3438,7 @@ public: QCPAxis *keyAxis() const { return mKeyAxis.data(); } QCPAxis *valueAxis() const { return mValueAxis.data(); } QCPAxisRect *axisRect() const; - virtual QPointF pixelPosition() const; + virtual QPointF pixelPosition() const Q_DECL_OVERRIDE; // setters: void setType(PositionType type); @@ -5995,16 +5995,16 @@ public: void addData(double errorMinus, double errorPlus); // virtual methods of 1d plottable interface: - virtual int dataCount() const; - virtual double dataMainKey(int index) const; - virtual double dataSortKey(int index) const; - virtual double dataMainValue(int index) const; - virtual QCPRange dataValueRange(int index) const; - virtual QPointF dataPixelPosition(int index) const; - virtual bool sortKeyIsMainKey() const; - virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const; - virtual int findBegin(double sortKey, bool expandedRange=true) const; - virtual int findEnd(double sortKey, bool expandedRange=true) const; + virtual int dataCount() const Q_DECL_OVERRIDE; + virtual double dataMainKey(int index) const Q_DECL_OVERRIDE; + virtual double dataSortKey(int index) const Q_DECL_OVERRIDE; + virtual double dataMainValue(int index) const Q_DECL_OVERRIDE; + virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE; + virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE; + virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE; + virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE; + virtual int findBegin(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE; + virtual int findEnd(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE; // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; |
