summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--profile-widget/diveprofileitem.cpp15
-rw-r--r--profile-widget/diveprofileitem.h2
-rw-r--r--profile-widget/profilewidget2.cpp2
3 files changed, 10 insertions, 9 deletions
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp
index c69e08489..54acee86b 100644
--- a/profile-widget/diveprofileitem.cpp
+++ b/profile-widget/diveprofileitem.cpp
@@ -18,12 +18,18 @@ AbstractProfilePolygonItem::AbstractProfilePolygonItem(const DivePlotDataModel &
{
setCacheMode(DeviceCoordinateCache);
connect(&dataModel, &DivePlotDataModel::dataChanged, this, &AbstractProfilePolygonItem::modelDataChanged);
- connect(&dataModel, &DivePlotDataModel::rowsAboutToBeRemoved, this, &AbstractProfilePolygonItem::modelDataRemoved);
connect(&hAxis, &DiveCartesianAxis::sizeChanged, this, &AbstractProfilePolygonItem::replot);
connect(&vAxis, &DiveCartesianAxis::sizeChanged, this, &AbstractProfilePolygonItem::replot);
connect(&vAxis, &DiveCartesianAxis::maxChanged, this, &AbstractProfilePolygonItem::replot);
}
+void AbstractProfilePolygonItem::clear()
+{
+ setPolygon(QPolygonF());
+ qDeleteAll(texts);
+ texts.clear();
+}
+
void AbstractProfilePolygonItem::replot()
{
modelDataChanged();
@@ -34,13 +40,6 @@ void AbstractProfilePolygonItem::setVisible(bool visible)
QGraphicsPolygonItem::setVisible(visible);
}
-void AbstractProfilePolygonItem::modelDataRemoved(const QModelIndex&, int, int)
-{
- setPolygon(QPolygonF());
- qDeleteAll(texts);
- texts.clear();
-}
-
bool AbstractProfilePolygonItem::shouldCalculateStuff(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
if (dataModel.rowCount() == 0)
diff --git a/profile-widget/diveprofileitem.h b/profile-widget/diveprofileitem.h
index 0b928514c..d85ec64fe 100644
--- a/profile-widget/diveprofileitem.h
+++ b/profile-widget/diveprofileitem.h
@@ -37,10 +37,10 @@ class AbstractProfilePolygonItem : public QObject, public QGraphicsPolygonItem {
public:
AbstractProfilePolygonItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0;
+ void clear();
public
slots:
virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
- virtual void modelDataRemoved(const QModelIndex &parent, int from, int to);
void replot();
void setVisible(bool visible);
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index a9d78f5ee..20897b674 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -1123,6 +1123,8 @@ void ProfileWidget2::setEmptyState()
heartBeatAxis->setVisible(false);
heartBeatItem->setVisible(false);
#endif
+ for (AbstractProfilePolygonItem *item: profileItems)
+ item->clear();
#ifndef SUBSURFACE_MOBILE
hideAll(allTissues);