summaryrefslogtreecommitdiff
path: root/qcustomplot-source/qcustomplot.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2020-05-11 22:18:20 +0200
committerChristoph Berg <myon@debian.org>2020-05-11 22:18:20 +0200
commita8edac06b534058e52126c4d55e23b217df2df91 (patch)
treef2c3567fae58aad676d544ee8f07ac78dd2eb1ec /qcustomplot-source/qcustomplot.cpp
parent4f6c0156a70e8f2ff70fe5a1a39f5e9b22ffd026 (diff)
parent32a41b1abe1a4aab0892c9c2051be6ba5b379f1e (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/qcustomplot.cpp')
-rw-r--r--qcustomplot-source/qcustomplot.cpp45
1 files changed, 22 insertions, 23 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;