summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/diveprofileitem.h
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile/diveprofileitem.h')
-rw-r--r--qt-ui/profile/diveprofileitem.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/qt-ui/profile/diveprofileitem.h b/qt-ui/profile/diveprofileitem.h
index 980b99213..4dd32b9fa 100644
--- a/qt-ui/profile/diveprofileitem.h
+++ b/qt-ui/profile/diveprofileitem.h
@@ -3,6 +3,8 @@
#include <QObject>
#include <QGraphicsPolygonItem>
+#include <QModelIndex>
+
#include "graphicsview-common.h"
#include "divelineitem.h"
@@ -41,8 +43,17 @@ public:
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) = 0;
public slots:
virtual void preferencesChanged();
- virtual void modelDataChanged();
+ virtual void modelDataChanged(const QModelIndex& topLeft = QModelIndex(), const QModelIndex& bottomRight = QModelIndex());
protected:
+ /* when the model emits a 'datachanged' signal, this method below should be used to check if the
+ * modified data affects this particular item ( for example, when setting the '3m increment'
+ * the data for Ceiling and tissues will be changed, and only those. so, the topLeft will be the CEILING
+ * column and the bottomRight will have the TISSUE_16 column. this method takes the vDataColumn and hDataColumn
+ * into consideration when returning 'true' for "yes, continue the calculation', and 'false' for
+ * 'do not recalculate, we already have the right data.
+ */
+ bool shouldCalculateStuff(const QModelIndex& topLeft, const QModelIndex& bottomRight);
+
DiveCartesianAxis *hAxis;
DiveCartesianAxis *vAxis;
DivePlotDataModel *dataModel;
@@ -56,7 +67,7 @@ class DiveProfileItem : public AbstractProfilePolygonItem{
public:
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
- virtual void modelDataChanged();
+ virtual void modelDataChanged(const QModelIndex& topLeft = QModelIndex(), const QModelIndex& bottomRight = QModelIndex());
virtual void preferencesChanged();
void plot_depth_sample(struct plot_data *entry,QFlags<Qt::AlignmentFlag> flags,const QColor& color);
private:
@@ -68,7 +79,7 @@ class DiveTemperatureItem : public AbstractProfilePolygonItem{
Q_OBJECT
public:
DiveTemperatureItem();
- virtual void modelDataChanged();
+ virtual void modelDataChanged(const QModelIndex& topLeft = QModelIndex(), const QModelIndex& bottomRight = QModelIndex());
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
private:
void createTextItem(int seconds, int mkelvin);
@@ -78,7 +89,7 @@ class DiveGasPressureItem : public AbstractProfilePolygonItem{
Q_OBJECT
public:
- virtual void modelDataChanged();
+ virtual void modelDataChanged(const QModelIndex& topLeft = QModelIndex(), const QModelIndex& bottomRight = QModelIndex());
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
private:
void plot_pressure_value(int mbar, int sec, QFlags<Qt::AlignmentFlag> align);
@@ -91,10 +102,11 @@ class DiveCalculatedCeiling : public AbstractProfilePolygonItem{
public:
DiveCalculatedCeiling();
- virtual void modelDataChanged();
+ virtual void modelDataChanged(const QModelIndex& topLeft = QModelIndex(), const QModelIndex& bottomRight = QModelIndex());
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
virtual void preferencesChanged();
private:
+ bool is3mIncrement;
DiveTextItem *gradientFactor;
};
@@ -102,7 +114,7 @@ class DiveReportedCeiling : public AbstractProfilePolygonItem{
Q_OBJECT
public:
- virtual void modelDataChanged();
+ virtual void modelDataChanged(const QModelIndex& topLeft = QModelIndex(), const QModelIndex& bottomRight = QModelIndex());
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
virtual void preferencesChanged();
};
@@ -131,7 +143,7 @@ class PartialPressureGasItem : public AbstractProfilePolygonItem{
public:
PartialPressureGasItem();
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
- virtual void modelDataChanged();
+ virtual void modelDataChanged(const QModelIndex& topLeft = QModelIndex(), const QModelIndex& bottomRight = QModelIndex());
virtual void preferencesChanged();
void setThreshouldSettingsKey(const QString& threshouldSettingsKey);
void setVisibilitySettingsKey(const QString& setVisibilitySettingsKey);