mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: read DPR from QML page
This is needed on mobile, where some screens have a high DPR. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
75886dd4d6
commit
15ea0440ad
1 changed files with 8 additions and 3 deletions
|
@ -24,8 +24,7 @@ ProfileView::ProfileView(QQuickItem *parent) : ChartView(parent, ProfileZValue::
|
|||
zoomLevel(0),
|
||||
zoomedPosition(0.0),
|
||||
empty(true),
|
||||
shouldCalculateMax(true),
|
||||
profileScene(std::make_unique<ProfileScene>(1.0, false, false))
|
||||
shouldCalculateMax(true)
|
||||
{
|
||||
setBackgroundColor(Qt::black);
|
||||
setFlag(ItemHasContents, true);
|
||||
|
@ -57,7 +56,8 @@ void ProfileView::clear()
|
|||
{
|
||||
//clearPictures();
|
||||
//disconnectPlannerConnections();
|
||||
profileScene->clear();
|
||||
if (profileScene)
|
||||
profileScene->clear();
|
||||
//handles.clear();
|
||||
//gases.clear();
|
||||
empty = true;
|
||||
|
@ -74,6 +74,11 @@ void ProfileView::plotDive(const struct dive *dIn, int dcIn, int flags)
|
|||
return;
|
||||
}
|
||||
|
||||
// We can't create the scene in the constructor, because we can't get the DPR property there. Oh joy!
|
||||
if (!profileScene) {
|
||||
double dpr = std::clamp(property("dpr").toReal(), 1.0, 100.0);
|
||||
profileScene = std::make_unique<ProfileScene>(dpr, false, false);
|
||||
}
|
||||
// If there was no previously displayed dive, turn off animations
|
||||
if (empty)
|
||||
flags |= RenderFlags::Instant;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue