From eb081f45643f83bf8fb723b6abcdedf70ac0f1ac Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 12 Aug 2023 23:07:12 +0200 Subject: [PATCH] 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 --- Subsurface-mobile.pro | 2 -- profile-widget/CMakeLists.txt | 2 -- profile-widget/diveeventitem.cpp | 2 +- profile-widget/diveeventitem.h | 7 ++++--- profile-widget/divepixmapitem.cpp | 6 ------ profile-widget/divepixmapitem.h | 18 ------------------ 6 files changed, 5 insertions(+), 32 deletions(-) delete mode 100644 profile-widget/divepixmapitem.cpp delete mode 100644 profile-widget/divepixmapitem.h diff --git a/Subsurface-mobile.pro b/Subsurface-mobile.pro index 83236338a..5cded8f21 100644 --- a/Subsurface-mobile.pro +++ b/Subsurface-mobile.pro @@ -177,7 +177,6 @@ SOURCES += subsurface-mobile-main.cpp \ profile-widget/profilescene.cpp \ profile-widget/animationfunctions.cpp \ profile-widget/divepixmapcache.cpp \ - profile-widget/divepixmapitem.cpp \ profile-widget/pictureitem.cpp \ profile-widget/tankitem.cpp \ profile-widget/tooltipitem.cpp \ @@ -346,7 +345,6 @@ HEADERS += \ profile-widget/divecartesianaxis.h \ profile-widget/divelineitem.h \ profile-widget/divepixmapcache.h \ - profile-widget/divepixmapitem.h \ profile-widget/diverectitem.h \ profile-widget/divetextitem.h \ profile-widget/profileview.h diff --git a/profile-widget/CMakeLists.txt b/profile-widget/CMakeLists.txt index 571336b41..f6ec12ecb 100644 --- a/profile-widget/CMakeLists.txt +++ b/profile-widget/CMakeLists.txt @@ -10,8 +10,6 @@ set(SUBSURFACE_PROFILE_LIB_SRCS divelineitem.h divepixmapcache.cpp divepixmapcache.h - divepixmapitem.cpp - divepixmapitem.h divepercentageitem.cpp divepercentageitem.h diveprofileitem.cpp diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp index 38dc5f8de..1fbe46d1e 100644 --- a/profile-widget/diveeventitem.cpp +++ b/profile-widget/diveeventitem.cpp @@ -18,7 +18,7 @@ static int depthAtTime(const plot_info &pi, duration_t time); DiveEventItem::DiveEventItem(const struct dive *d, int idx, const struct event &ev, struct gasmix lastgasmix, const plot_info &pi, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, - int speed, const DivePixmaps &pixmaps, QGraphicsItem *parent) : DivePixmapItem(parent), + int speed, const DivePixmaps &pixmaps, QGraphicsItem *parent) : QGraphicsPixmapItem(parent), text(setupToolTipString(d, ev, lastgasmix)), pixmap(setupPixmap(d, ev, lastgasmix, pixmaps)), vAxis(vAxis), diff --git a/profile-widget/diveeventitem.h b/profile-widget/diveeventitem.h index ea21181e9..70dcf7d5b 100644 --- a/profile-widget/diveeventitem.h +++ b/profile-widget/diveeventitem.h @@ -2,16 +2,17 @@ #ifndef DIVEEVENTITEM_H #define DIVEEVENTITEM_H -#include "divepixmapitem.h" #include "core/event.h" +#include // for Q_DECLARE_TR_FUNCTIONS +#include class DiveCartesianAxis; class DivePixmaps; struct event; struct plot_info; -class DiveEventItem : public DivePixmapItem { - Q_OBJECT +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, diff --git a/profile-widget/divepixmapitem.cpp b/profile-widget/divepixmapitem.cpp deleted file mode 100644 index f3d548281..000000000 --- a/profile-widget/divepixmapitem.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include "profile-widget/divepixmapitem.h" - -DivePixmapItem::DivePixmapItem(QGraphicsItem *parent) : QGraphicsPixmapItem(parent) -{ -} diff --git a/profile-widget/divepixmapitem.h b/profile-widget/divepixmapitem.h deleted file mode 100644 index 97a17bf43..000000000 --- a/profile-widget/divepixmapitem.h +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#ifndef DIVEPIXMAPITEM_H -#define DIVEPIXMAPITEM_H - -#include -#include - -class DivePixmapItem : public QObject, public QGraphicsPixmapItem { - Q_OBJECT - Q_PROPERTY(qreal opacity WRITE setOpacity READ opacity) - Q_PROPERTY(QPointF pos WRITE setPos READ pos) - Q_PROPERTY(qreal x WRITE setX READ x) - Q_PROPERTY(qreal y WRITE setY READ y) -public: - DivePixmapItem(QGraphicsItem *parent = 0); -}; - -#endif // DIVEPIXMAPITEM_H