mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Untangle DiveCalculatedCeiling from MainWindow
DiveCalculatedCeiling is the last class the references MainWindow in the profile-widget stack. In modelDataChanged() it looks for the information() widget and sets a slot for the dateTimeChanged() signal that information() emits. To solve the issue we make DiveCalculatedCeiling recieve a ProfileWidget2 reference and make ProfileWidget2 emit the dateTimeChangedItems() signal. ProfileWidget2 itself listens for the dateTimeChanged() signal that information() emits and emits dateTimeChangedItems() to notify any possible children/item listeners in the ProfileWidget2::dateTimeChanged() slot. The connection between ProfileWidget2 and information() is set in MainWindow. This makes DiveCalculatedCeiling unaware of MainWindow and which class originally emits the dateTimeChanged() signal to ProfileWidget2. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> -- Think delegation. Tomaz, please take a look at this one, to double check if i messed up. also i have zero idea how the mobile app is setting these connections, if it does so even. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
61e768036e
commit
8e7be1b50a
5 changed files with 21 additions and 8 deletions
|
|
@ -21,6 +21,7 @@
|
|||
This is a generically item and should be used as a base for others, I think...
|
||||
*/
|
||||
|
||||
class ProfileWidget2;
|
||||
class DivePlotDataModel;
|
||||
class DiveTextItem;
|
||||
class DiveCartesianAxis;
|
||||
|
|
@ -175,7 +176,7 @@ class DiveCalculatedCeiling : public AbstractProfilePolygonItem {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DiveCalculatedCeiling();
|
||||
DiveCalculatedCeiling(ProfileWidget2 *profileWidget);
|
||||
virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
virtual void settingsChanged();
|
||||
|
|
@ -184,6 +185,9 @@ public
|
|||
slots:
|
||||
void recalc();
|
||||
|
||||
protected:
|
||||
ProfileWidget2 *profileWidget;
|
||||
|
||||
private:
|
||||
bool is3mIncrement;
|
||||
};
|
||||
|
|
@ -200,7 +204,7 @@ public:
|
|||
class DiveCalculatedTissue : public DiveCalculatedCeiling {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DiveCalculatedTissue();
|
||||
DiveCalculatedTissue(ProfileWidget2 *profileWidget);
|
||||
virtual void settingsChanged();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue