mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: introduce a ProfileScene stub
This simply subclasses QGraphicsScene and is used as a drop-in replacement. The plan is to step-by-step move rendering functions there until the non-interactive code can only use the scene and doesn't have to use the QGraphicsView. This will hopefully remove quite some conditional code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5a34bdccb5
commit
15342232ca
6 changed files with 34 additions and 1 deletions
|
@ -170,6 +170,7 @@ SOURCES += subsurface-mobile-main.cpp \
|
||||||
profile-widget/diveeventitem.cpp \
|
profile-widget/diveeventitem.cpp \
|
||||||
profile-widget/diveprofileitem.cpp \
|
profile-widget/diveprofileitem.cpp \
|
||||||
profile-widget/profilewidget2.cpp \
|
profile-widget/profilewidget2.cpp \
|
||||||
|
profile-widget/profilescene.cpp \
|
||||||
profile-widget/ruleritem.cpp \
|
profile-widget/ruleritem.cpp \
|
||||||
profile-widget/animationfunctions.cpp \
|
profile-widget/animationfunctions.cpp \
|
||||||
profile-widget/divepixmapitem.cpp \
|
profile-widget/divepixmapitem.cpp \
|
||||||
|
@ -325,6 +326,7 @@ HEADERS += \
|
||||||
profile-widget/qmlprofile.h \
|
profile-widget/qmlprofile.h \
|
||||||
profile-widget/diveprofileitem.h \
|
profile-widget/diveprofileitem.h \
|
||||||
profile-widget/profilewidget2.h \
|
profile-widget/profilewidget2.h \
|
||||||
|
profile-widget/profilescene.h \
|
||||||
profile-widget/ruleritem.h \
|
profile-widget/ruleritem.h \
|
||||||
profile-widget/diveeventitem.h \
|
profile-widget/diveeventitem.h \
|
||||||
profile-widget/divetooltipitem.h \
|
profile-widget/divetooltipitem.h \
|
||||||
|
|
|
@ -22,6 +22,8 @@ set(SUBSURFACE_PROFILE_LIB_SRCS
|
||||||
divetooltipitem.h
|
divetooltipitem.h
|
||||||
profilewidget2.cpp
|
profilewidget2.cpp
|
||||||
profilewidget2.h
|
profilewidget2.h
|
||||||
|
profilescene.cpp
|
||||||
|
profilescene.h
|
||||||
ruleritem.cpp
|
ruleritem.cpp
|
||||||
ruleritem.h
|
ruleritem.h
|
||||||
tankitem.cpp
|
tankitem.cpp
|
||||||
|
|
10
profile-widget/profilescene.cpp
Normal file
10
profile-widget/profilescene.cpp
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#include "profilescene.h"
|
||||||
|
|
||||||
|
ProfileScene::ProfileScene()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ProfileScene::~ProfileScene()
|
||||||
|
{
|
||||||
|
}
|
15
profile-widget/profilescene.h
Normal file
15
profile-widget/profilescene.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
// Displays the dive profile. Used by the interactive profile widget
|
||||||
|
// and the printing/exporting code.
|
||||||
|
#ifndef PROFILESCENE_H
|
||||||
|
#define PROFILESCENE_H
|
||||||
|
|
||||||
|
#include <QGraphicsScene>
|
||||||
|
|
||||||
|
class ProfileScene : public QGraphicsScene {
|
||||||
|
public:
|
||||||
|
ProfileScene();
|
||||||
|
~ProfileScene();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,5 +1,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
#include "profile-widget/profilewidget2.h"
|
#include "profile-widget/profilewidget2.h"
|
||||||
|
#include "profile-widget/profilescene.h"
|
||||||
#include "qt-models/diveplotdatamodel.h"
|
#include "qt-models/diveplotdatamodel.h"
|
||||||
#include "core/event.h"
|
#include "core/event.h"
|
||||||
#include "core/subsurface-string.h"
|
#include "core/subsurface-string.h"
|
||||||
|
@ -96,6 +97,7 @@ T *ProfileWidget2::createItem(const DiveCartesianAxis &vAxis, int vColumn, int z
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileWidget2::ProfileWidget2(DivePlannerPointsModel *plannerModelIn, double fontPrintScale, QWidget *parent) : QGraphicsView(parent),
|
ProfileWidget2::ProfileWidget2(DivePlannerPointsModel *plannerModelIn, double fontPrintScale, QWidget *parent) : QGraphicsView(parent),
|
||||||
|
profileScene(new ProfileScene),
|
||||||
currentState(INVALID),
|
currentState(INVALID),
|
||||||
dataModel(new DivePlotDataModel(this)),
|
dataModel(new DivePlotDataModel(this)),
|
||||||
plannerModel(plannerModelIn),
|
plannerModel(plannerModelIn),
|
||||||
|
@ -463,7 +465,7 @@ ItemPos::ItemPos()
|
||||||
|
|
||||||
void ProfileWidget2::setupSceneAndFlags()
|
void ProfileWidget2::setupSceneAndFlags()
|
||||||
{
|
{
|
||||||
setScene(new QGraphicsScene(this));
|
setScene(profileScene.get());
|
||||||
scene()->setSceneRect(0, 0, 100, 100);
|
scene()->setSceneRect(0, 0, 100, 100);
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "core/units.h"
|
#include "core/units.h"
|
||||||
#include "core/subsurface-qt/divelistnotifier.h"
|
#include "core/subsurface-qt/divelistnotifier.h"
|
||||||
|
|
||||||
|
class ProfileScene;
|
||||||
class RulerItem2;
|
class RulerItem2;
|
||||||
struct dive;
|
struct dive;
|
||||||
struct plot_info;
|
struct plot_info;
|
||||||
|
@ -82,6 +83,7 @@ public:
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
bool eventFilter(QObject *, QEvent *) override;
|
bool eventFilter(QObject *, QEvent *) override;
|
||||||
#endif
|
#endif
|
||||||
|
std::unique_ptr<ProfileScene> profileScene;
|
||||||
State currentState;
|
State currentState;
|
||||||
int animSpeed;
|
int animSpeed;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue