mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Created a method to check if calculations should take place.
Created a method to check if calculations should take place taking into consideration what changed on the model. if the model changes *everything*, them, all calculations should be done, but if just some of the columns of the model are changed, only those columns should trigger an visual update on the items. In theory this patch looks right, but something is wrong ( calculations are not being made. ), so I'll commit this any how, and fix on the next commit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0ae7c820f2
commit
25b0a846af
6 changed files with 96 additions and 49 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue