mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: Turn widget accessor-functions into simple pointers
The keeps track of different sub widgets needed by other parts of the code, notably: MainTab PlannerDetails PlannerSettingsWidget ProfileWidget2 DivePlannerWidget DiveListView Access to these widgets was provided with accessor functions. Now these functions were very weird: instead of simply returning pointers that were stored in the class, they accessed a data structure which describes the different application states. But this data structure was "duck-typed", so there was an implicit agreement at which position the pointers to the widgets were put inside. The widgets were then down-cast by the accessor functions. This might make sense if the individual widgets could for some reason be replaced by other widgets [dynamic plugins?], but even then it would be strange, as one would expect to get a pointer to some base class. Therefore, directly store the properly typed pointers to the widgets and simply remove the accessor functions. Why bother? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
11a211fb02
commit
78e2560296
14 changed files with 175 additions and 201 deletions
|
@ -263,10 +263,10 @@ TankInfoDelegate::TankInfoDelegate(QObject *parent) : ComboBoxDelegate(TankInfoM
|
|||
|
||||
void TankInfoDelegate::reenableReplot(QWidget*, QAbstractItemDelegate::EndEditHint)
|
||||
{
|
||||
MainWindow::instance()->graphics()->setReplot(true);
|
||||
MainWindow::instance()->graphics->setReplot(true);
|
||||
// FIXME: We need to replot after a cylinder is selected but the replot below overwrites
|
||||
// the newly selected cylinder.
|
||||
// MainWindow::instance()->graphics()->replot();
|
||||
// MainWindow::instance()->graphics->replot();
|
||||
}
|
||||
|
||||
void TankInfoDelegate::revertModelData(QWidget*, QAbstractItemDelegate::EndEditHint hint)
|
||||
|
@ -290,7 +290,7 @@ QWidget *TankInfoDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
|
|||
currCylinderData.type = copy_string(cyl->type.description);
|
||||
currCylinderData.pressure = cyl->type.workingpressure.mbar;
|
||||
currCylinderData.size = cyl->type.size.mliter;
|
||||
MainWindow::instance()->graphics()->setReplot(false);
|
||||
MainWindow::instance()->graphics->setReplot(false);
|
||||
return delegate;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue