subsurface/profile-widget/diveeventitem.h
Berthold Stoeger eb081f4564 profile: remove DivePixmapItem
After porting the picture-items to qt-quick, all that was left
of DivePixmapItem was an empty hull. Remove it. The only problem
was that the DiveEventItem is not derived from QObject anymore,
so we have to explicitly add the translation functions with the
Q_DECLARE_TR_FUNCTIONS macro.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-09-12 15:15:32 +02:00

42 lines
1.5 KiB
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef DIVEEVENTITEM_H
#define DIVEEVENTITEM_H
#include "core/event.h"
#include <QCoreApplication> // for Q_DECLARE_TR_FUNCTIONS
#include <QGraphicsPixmapItem>
class DiveCartesianAxis;
class DivePixmaps;
struct event;
struct plot_info;
class DiveEventItem : public QGraphicsPixmapItem {
Q_DECLARE_TR_FUNCTIONS(DiveEventItem)
public:
DiveEventItem(const struct dive *d, int idx, const struct event &ev, struct gasmix lastgasmix,
const struct plot_info &pi, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis,
int speed, const DivePixmaps &pixmaps, QGraphicsItem *parent = nullptr);
~DiveEventItem();
void eventVisibilityChanged(const QString &eventName, bool visible);
void setVerticalAxis(DiveCartesianAxis *axis, int speed);
void setHorizontalAxis(DiveCartesianAxis *axis);
static bool isInteresting(const struct dive *d, const struct divecomputer *dc,
const struct event &ev, const struct plot_info &pi,
int firstSecond, int lastSecond);
const QString text;
const QPixmap pixmap;
private:
static QString setupToolTipString(const struct dive *d, const struct event &ev, struct gasmix lastgasmix);
static QPixmap setupPixmap(const struct dive *d, const struct event &ev, struct gasmix lastgasmix, const DivePixmaps &pixmaps);
void recalculatePos();
DiveCartesianAxis *vAxis;
DiveCartesianAxis *hAxis;
public:
int idx;
struct event ev;
const struct dive *dive;
int depth;
};
#endif // DIVEEVENTITEM_H