mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive pictures: connect DivePictureModel signals in constructor
The DivePictureModel signals were connected int the setProfileState() function of ProfileWidget2. If this function was called repeatedly (e.g. after adding a dive), multiple connections were made, which led to multiply delivered signals. This in turn led to confusion, when deleting pictures (i.e. multiple pictures were deleted). Instead, connect once in ProfileWidget2's constructor. It is unclear whether these signals should be disconnected temporarily if no pictures are shown. In any case, the weren't, so this shouldn't introduce any regression. Fixes #1441 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
1a5e54e5eb
commit
1de6962efb
1 changed files with 5 additions and 6 deletions
|
@ -151,6 +151,11 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
|||
addActionShortcut(Qt::Key_Down, &ProfileWidget2::keyDownAction);
|
||||
addActionShortcut(Qt::Key_Left, &ProfileWidget2::keyLeftAction);
|
||||
addActionShortcut(Qt::Key_Right, &ProfileWidget2::keyRightAction);
|
||||
|
||||
connect(DivePictureModel::instance(), &DivePictureModel::dataChanged, this, &ProfileWidget2::updatePictures);
|
||||
connect(DivePictureModel::instance(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(plotPictures()));
|
||||
connect(DivePictureModel::instance(), &DivePictureModel::rowsRemoved, this, &ProfileWidget2::removePictures);
|
||||
connect(DivePictureModel::instance(), &DivePictureModel::modelReset, this, &ProfileWidget2::plotPictures);
|
||||
#endif // SUBSURFACE_MOBILE
|
||||
|
||||
#if !defined(QT_NO_DEBUG) && defined(SHOW_PLOT_INFO_TABLE)
|
||||
|
@ -1125,12 +1130,6 @@ void ProfileWidget2::setProfileState()
|
|||
return;
|
||||
|
||||
disconnectTemporaryConnections();
|
||||
#ifndef SUBSURFACE_MOBILE
|
||||
connect(DivePictureModel::instance(), &DivePictureModel::dataChanged, this, &ProfileWidget2::updatePictures);
|
||||
connect(DivePictureModel::instance(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(plotPictures()));
|
||||
connect(DivePictureModel::instance(), &DivePictureModel::rowsRemoved, this, &ProfileWidget2::removePictures);
|
||||
connect(DivePictureModel::instance(), &DivePictureModel::modelReset, this, &ProfileWidget2::plotPictures);
|
||||
#endif
|
||||
/* show the same stuff that the profile shows. */
|
||||
|
||||
emit enableShortcuts();
|
||||
|
|
Loading…
Add table
Reference in a new issue