mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
planner: implement move semantics in DivePlannerPointsModel
When reordering the points, the DivePlannerPointsModel would not emit the appropriate move signals, but simply a data-changed signal over all elements. This obviously violates Qt's model/view API, though it is probably harmless. Let's do the right thing so that the frontend knows that the selected item changed place. Also, emit dataChanged only on the actually changed element, not all elements. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
79ddb23edf
commit
dee1fea683
2 changed files with 35 additions and 4 deletions
|
@ -1289,6 +1289,7 @@ void ProfileWidget2::setAddState()
|
|||
connect(plannerModel, &DivePlannerPointsModel::modelReset, this, &ProfileWidget2::pointsReset);
|
||||
connect(plannerModel, &DivePlannerPointsModel::rowsInserted, this, &ProfileWidget2::pointInserted);
|
||||
connect(plannerModel, &DivePlannerPointsModel::rowsRemoved, this, &ProfileWidget2::pointsRemoved);
|
||||
connect(plannerModel, &DivePlannerPointsModel::rowsMoved, this, &ProfileWidget2::pointsMoved);
|
||||
/* show the same stuff that the profile shows. */
|
||||
currentState = ADD; /* enable the add state. */
|
||||
diveCeiling->setVisible(true);
|
||||
|
@ -1321,6 +1322,7 @@ void ProfileWidget2::setPlanState()
|
|||
connect(plannerModel, &DivePlannerPointsModel::modelReset, this, &ProfileWidget2::pointsReset);
|
||||
connect(plannerModel, &DivePlannerPointsModel::rowsInserted, this, &ProfileWidget2::pointInserted);
|
||||
connect(plannerModel, &DivePlannerPointsModel::rowsRemoved, this, &ProfileWidget2::pointsRemoved);
|
||||
connect(plannerModel, &DivePlannerPointsModel::rowsMoved, this, &ProfileWidget2::pointsMoved);
|
||||
/* show the same stuff that the profile shows. */
|
||||
currentState = PLAN; /* enable the add state. */
|
||||
diveCeiling->setVisible(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue