aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models/divetripmodel.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-03-24 09:01:24 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-24 09:01:25 -0700
commit59b6ad6a0ba3527b73f008a94defe4aa57add5f6 (patch)
tree300eb907be924efb71da957c3b707cad8b569c38 /qt-models/divetripmodel.h
parent0b83971ff9bf9385bd6eca79ca796e8b5ccf346a (diff)
downloadsubsurface-59b6ad6a0ba3527b73f008a94defe4aa57add5f6.tar.gz
divelist: don't initialize invalidFont at startup
To mark invalid dives, we use a struck-out font, which was a static variable at translation unit scope, i.e. initialized at application startup. Sadly, this crashes on iOS. It is unclear when we can initialize fonts. Try to move initialization to the constructore of DiveTripModelBase and make the font a member of that class. For consistency, also make the invalidBrush a member of this class. This now means that the diveData function cannot be static anymore, since it needs access to the font and brush. But OK. Reported-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divetripmodel.h')
-rw-r--r--qt-models/divetripmodel.h6
1 files changed, 5 insertions, 1 deletions
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);