diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2014-01-22 17:54:24 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-01-22 13:13:20 -0800 |
commit | 629a1ea0f983b38ead21883d87eabd9cda16c9ad (patch) | |
tree | 3559eb907ab49d56acc4dbe35b9231c3f42016da /qt-ui/profile/diveprofileitem.cpp | |
parent | bc7b221498e6f07c26fd8455f9992657f0a1a162 (diff) | |
download | subsurface-629a1ea0f983b38ead21883d87eabd9cda16c9ad.tar.gz |
Simplify the code for the reported ceiling.
The reported ceiling now behaves better by not being deleted / recreated,
instead it uses the same object and connects to the model to know when to
regenerate its plot.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/diveprofileitem.cpp')
-rw-r--r-- | qt-ui/profile/diveprofileitem.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index 1c49b7eee..5599b7eaf 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -15,6 +15,7 @@ #include <QDebug> #include <QApplication> #include <QGraphicsItem> +#include <QSettings> AbstractProfilePolygonItem::AbstractProfilePolygonItem(): QObject(), QGraphicsPolygonItem(), hAxis(NULL), vAxis(NULL), dataModel(NULL), hDataColumn(-1), vDataColumn(-1) @@ -42,6 +43,7 @@ void AbstractProfilePolygonItem::setModel(DivePlotDataModel* model) { dataModel = model; connect(dataModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelDataChanged())); + connect(dataModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(modelDataChanged())); modelDataChanged(); } @@ -413,11 +415,9 @@ void DiveReportedCeiling::modelDataChanged() void DiveReportedCeiling::preferencesChanged() { - if (prefs.profile_dc_ceiling) { - setVisible(prefs.profile_red_ceiling); - } else { - setVisible(false); - } + QSettings s; + s.beginGroup("TecDetails"); + setVisible(s.value("redceiling").toBool()); } void DiveReportedCeiling::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) |