From 954820aa81cb52cfe4442f2c6e81117827e32ccc Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 13 Oct 2018 08:57:46 +0200 Subject: Dive site: explicitly init displayed_dive_site on show widget The global object "displayed_dive_site" is used to store the old dive site data for the edit-dive-site widget. The fields of the widget were initialized from this object in the show event. Therefore the object was updated in numerous parts of the code to make sure that it was up-to-date. Instead, move the initialization of the object to the function that also initiatlizes the fields. Call this function explicitly before showing the widget. This makes the data-fow distinctly easier to understand. Signed-off-by: Berthold Stoeger --- desktop-widgets/locationinformation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'desktop-widgets/locationinformation.h') diff --git a/desktop-widgets/locationinformation.h b/desktop-widgets/locationinformation.h index 868ea729e..402c434e1 100644 --- a/desktop-widgets/locationinformation.h +++ b/desktop-widgets/locationinformation.h @@ -14,9 +14,9 @@ Q_OBJECT public: LocationInformationWidget(QWidget *parent = 0); bool eventFilter(QObject*, QEvent*) override; + void initFields(dive_site *ds); protected: - void showEvent(QShowEvent *); void enableLocationButtons(bool enable); public slots: -- cgit v1.2.3-70-g09d2