planner: initialize subobject of PlannerWidgets in correct order

The DivePlannerWidget was initialized before the planner models.
However, it attaches these (non existing) models to the comboboxes.
That can't work. Initialize in correct order.

Fixes #4014

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-01-16 22:45:50 +01:00 committed by Dirk Hohndel
parent 13b894a756
commit bdade9e499
2 changed files with 4 additions and 4 deletions

View file

@ -542,11 +542,11 @@ void PlannerDetails::setPlanNotes(QString plan)
PlannerWidgets::PlannerWidgets() :
planned_dive(alloc_dive()),
gasModel(std::make_unique<GasSelectionModel>()),
diveTypeModel(std::make_unique<DiveTypeSelectionModel>()),
plannerWidget(*planned_dive, this),
plannerSettingsWidget(this)
{
gasModel = std::make_unique<GasSelectionModel>();
diveTypeModel = std::make_unique<DiveTypeSelectionModel>();
connect(plannerDetails.printPlan(), &QPushButton::pressed, this, &PlannerWidgets::printDecoPlan);
connect(DivePlannerPointsModel::instance(), &DivePlannerPointsModel::calculatedPlanNotes,
&plannerDetails, &PlannerDetails::setPlanNotes);

View file

@ -94,11 +94,11 @@ slots:
public:
void repopulateGasModel();
OwningDivePtr planned_dive;
std::unique_ptr<GasSelectionModel> gasModel;
std::unique_ptr<DiveTypeSelectionModel> diveTypeModel;
DivePlannerWidget plannerWidget;
PlannerSettingsWidget plannerSettingsWidget;
PlannerDetails plannerDetails;
std::unique_ptr<GasSelectionModel> gasModel;
std::unique_ptr<DiveTypeSelectionModel> diveTypeModel;
};
#endif // DIVEPLANNER_H