summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-models/divetripmodel.cpp15
-rw-r--r--qt-models/divetripmodel.h6
2 files changed, 9 insertions, 12 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index bcca977b5..207962906 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -190,16 +190,7 @@ static QString displayWeight(const struct dive *d, bool units)
return s + gettextFromC::tr("lbs");
}
-static QFont struckOutFont()
-{
- QFont font;
- font.setStrikeOut(true);
- return font;
-}
-static QBrush invalidForeground(Qt::gray);
-static QFont invalidFont = struckOutFont();
-
-QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role)
+QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role) const
{
#ifdef SUBSURFACE_MOBILE
// Special roles for mobile
@@ -509,8 +500,10 @@ void DiveTripModelBase::reset()
emit diveListNotifier.numShownChanged();
}
-DiveTripModelBase::DiveTripModelBase(QObject *parent) : QAbstractItemModel(parent)
+DiveTripModelBase::DiveTripModelBase(QObject *parent) : QAbstractItemModel(parent),
+ invalidForeground(Qt::gray)
{
+ invalidFont.setStrikeOut(true);
}
int DiveTripModelBase::columnCount(const QModelIndex&) const
diff --git a/qt-models/divetripmodel.h b/qt-models/divetripmodel.h
index 0eb78d6a3..52173a48c 100644
--- a/qt-models/divetripmodel.h
+++ b/qt-models/divetripmodel.h
@@ -5,6 +5,8 @@
#include "core/dive.h"
#include "core/subsurface-qt/divelistnotifier.h"
#include <QAbstractItemModel>
+#include <QBrush>
+#include <QFont>
class DiveFilter;
@@ -88,9 +90,11 @@ signals:
void currentDiveChanged(QModelIndex index);
protected:
dive *oldCurrent;
+ QBrush invalidForeground;
+ QFont invalidFont;
// Access trip and dive data
- static QVariant diveData(const struct dive *d, int column, int role);
+ QVariant diveData(const struct dive *d, int column, int role) const; // Not static because we have to access invalidFont
static QVariant tripData(const dive_trip *trip, int column, int role);
static QString tripTitle(const dive_trip *trip);
static QString tripShortDate(const dive_trip *trip);