From 71e117669d835c477c9a4eec4b4d84f91962f8f7 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 27 Feb 2021 16:01:28 +0100 Subject: profile: populate dive handlers when switching to edit/plan mode The dive handlers are only updated by signals. This means that switching into edit-mode has to be done in steps: 1) initialize the DivePointsPlannerModel 2) switch profile mode 3) load dive into DivePointsPlannerModel 2) and 3) cannot be exchanged, or the dive handlers are not initialized. To avoid this sandwitching of profile- and model-initialization, populate the dive handlers when switching the profile mode. Thus, the profile can be switched into edit/plan mode when the DivePointsPlannerModel is fully initialized. This will be important in upcoming commits, when the initialization of the dive is moved from the profile to the DivePointsPlannerModel. Signed-off-by: Berthold Stoeger --- profile-widget/profilewidget2.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'profile-widget') diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index d0c58c8ab..8c1783998 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -1300,6 +1300,9 @@ void ProfileWidget2::setAddState(const dive *d, int dc) diveCeiling->setVisible(true); decoModelParameters->setVisible(true); setBackgroundBrush(QColor("#A7DCFF")); + + pointsReset(); + repositionDiveHandlers(); } void ProfileWidget2::setPlanState(const dive *d, int dc) @@ -1328,6 +1331,9 @@ void ProfileWidget2::setPlanState(const dive *d, int dc) diveCeiling->setVisible(true); decoModelParameters->setVisible(true); setBackgroundBrush(QColor("#D7E3EF")); + + pointsReset(); + repositionDiveHandlers(); } #endif -- cgit v1.2.3-70-g09d2