mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: render profile on desktop via QtQuick
This breaks all dynamic features, including animations, zooming tooltips, planner-handles, etc. They will have to be converted one-by-one to QtQuick, which will be a major pain, as the ProfileView is destroyed by Qt6 on reparenting. This means that the view cannot store any persistent state. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
7eecc85464
commit
75886dd4d6
25 changed files with 322 additions and 76 deletions
42
profile-widget/profileview.h
Normal file
42
profile-widget/profileview.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#ifndef PROFILE_VIEW_H
|
||||
#define PROFILE_VIEW_H
|
||||
|
||||
#include "qt-quick/chartview.h"
|
||||
#include <memory>
|
||||
|
||||
class ChartGraphicsSceneItem;
|
||||
class ProfileScene;
|
||||
|
||||
class ProfileView : public ChartView {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProfileView();
|
||||
ProfileView(QQuickItem *parent);
|
||||
~ProfileView();
|
||||
|
||||
struct RenderFlags {
|
||||
static constexpr int None = 0;
|
||||
static constexpr int Instant = 1 << 0;
|
||||
static constexpr int DontRecalculatePlotInfo = 1 << 1;
|
||||
static constexpr int EditMode = 1 << 2;
|
||||
static constexpr int PlanMode = 1 << 3;
|
||||
};
|
||||
|
||||
void plotDive(const struct dive *d, int dc, int flags = RenderFlags::None);
|
||||
void clear();
|
||||
private:
|
||||
const struct dive *d;
|
||||
int dc;
|
||||
int zoomLevel;
|
||||
double zoomedPosition; // Position when zoomed: 0.0 = beginning, 1.0 = end.
|
||||
bool empty; // No dive shown.
|
||||
bool shouldCalculateMax; // Calculate maximum time and depth (default). False when dragging handles.
|
||||
std::unique_ptr<ProfileScene> profileScene;
|
||||
ChartItemPtr<ChartGraphicsSceneItem> profileItem;
|
||||
|
||||
void plotAreaChanged(const QSizeF &size) override;
|
||||
void resetPointers() override;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue