mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
8a9ca5fcda
There is code to dynamically show/hide event icons of a certain type. The same code is used to hide generally non-interesting/ redundant items. Instead, don't even create these items. Yes, this is idle premature optimization. A loop over all created event icons to hide them can be removed, because the icon is hidden anyway on construction time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
42 lines
1.3 KiB
C++
42 lines
1.3 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVEEVENTITEM_H
|
|
#define DIVEEVENTITEM_H
|
|
|
|
#include "divepixmapitem.h"
|
|
|
|
class DiveCartesianAxis;
|
|
class DivePixmapCache;
|
|
class DivePixmaps;
|
|
struct event;
|
|
|
|
class DiveEventItem : public DivePixmapItem {
|
|
Q_OBJECT
|
|
public:
|
|
DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix,
|
|
DivePlotDataModel *model, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis,
|
|
int speed, const DivePixmaps &pixmaps, QGraphicsItem *parent = nullptr);
|
|
~DiveEventItem();
|
|
const struct event *getEvent() const;
|
|
struct event *getEventMutable();
|
|
void eventVisibilityChanged(const QString &eventName, bool visible);
|
|
void setVerticalAxis(DiveCartesianAxis *axis, int speed);
|
|
void setHorizontalAxis(DiveCartesianAxis *axis);
|
|
void setModel(DivePlotDataModel *model);
|
|
bool shouldBeHidden();
|
|
static bool isInteresting(const struct dive *d, const struct divecomputer *dc,
|
|
const struct event *ev, const DivePlotDataModel &model);
|
|
public
|
|
slots:
|
|
void recalculatePos(int animationSpeed);
|
|
|
|
private:
|
|
void setupToolTipString(struct gasmix lastgasmix);
|
|
void setupPixmap(struct gasmix lastgasmix, const DivePixmaps &pixmaps);
|
|
DiveCartesianAxis *vAxis;
|
|
DiveCartesianAxis *hAxis;
|
|
DivePlotDataModel *dataModel;
|
|
struct event *ev;
|
|
const struct dive *dive;
|
|
};
|
|
|
|
#endif // DIVEEVENTITEM_H
|