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:
Berthold Stoeger 2021-06-05 18:42:56 +02:00 committed by Dirk Hohndel
parent 5a34bdccb5
commit 15342232ca
6 changed files with 34 additions and 1 deletions

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "profile-widget/profilewidget2.h"
#include "profile-widget/profilescene.h"
#include "qt-models/diveplotdatamodel.h"
#include "core/event.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),
profileScene(new ProfileScene),
currentState(INVALID),
dataModel(new DivePlotDataModel(this)),
plannerModel(plannerModelIn),
@ -463,7 +465,7 @@ ItemPos::ItemPos()
void ProfileWidget2::setupSceneAndFlags()
{
setScene(new QGraphicsScene(this));
setScene(profileScene.get());
scene()->setSceneRect(0, 0, 100, 100);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);