profile: pass dive to DiveHandler

The DiveHandler shows a context menu where a cylinder can be
chosen. This indirectly accesses the global displayed_dive
variable.

Remove this in a step to make the profile reentrant.

The code was quite ominous: instead of simply generating the
list of cylinders, a global model was reset and then accessed
with Qt's cumbersome model/view API. All this trampling over
global state can be removed by simply making the function
that generates the list globally accessible.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-01-09 21:18:37 +01:00 committed by Dirk Hohndel
parent 88c6ce988d
commit 235146a95f
6 changed files with 30 additions and 27 deletions

View file

@ -1695,7 +1695,7 @@ void ProfileWidget2::disconnectTemporaryConnections()
#ifndef SUBSURFACE_MOBILE
void ProfileWidget2::pointInserted(const QModelIndex&, int, int)
{
DiveHandler *item = new DiveHandler();
DiveHandler *item = new DiveHandler(&displayed_dive);
scene()->addItem(item);
handles << item;