Dive picture: fix toggling of picture-visibility

In a recent commit, the profile widget was changed to reuse
DivePictureItems. This made toggling of picture-visibility
disfunctional, because the visibility was set in the constructor.
Only on change of dive would the setting take effect.

Therefore, move the setting of the visibility up to the
ProfileWidget2::plotPictures() call. This is more consistent
anyway, since at this level pixmap and fileUrl are set.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-06-04 18:32:17 +02:00 committed by Dirk Hohndel
parent efab7e3357
commit 9293268027
2 changed files with 1 additions and 1 deletions

View file

@ -50,7 +50,6 @@ DivePictureItem::DivePictureItem(QGraphicsItem *parent): DivePixmapItem(parent),
#ifndef SUBSURFACE_MOBILE #ifndef SUBSURFACE_MOBILE
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
#endif #endif
setVisible(prefs.show_pictures_in_profile);
canvas->setPen(Qt::NoPen); canvas->setPen(Qt::NoPen);
canvas->setBrush(QColor(Qt::white)); canvas->setBrush(QColor(Qt::white));

View file

@ -2077,6 +2077,7 @@ void ProfileWidget2::plotPictures()
pictures[picItemNr].reset(item); pictures[picItemNr].reset(item);
scene()->addItem(item); scene()->addItem(item);
} }
item->setVisible(prefs.show_pictures_in_profile);
item->setPixmap(m->index(i, 0).data(Qt::UserRole).value<QPixmap>()); item->setPixmap(m->index(i, 0).data(Qt::UserRole).value<QPixmap>());
item->setFileUrl(m->index(i, 1).data().toString()); item->setFileUrl(m->index(i, 1).data().toString());
// let's put the picture at the correct time, but at a fixed "depth" on the profile // let's put the picture at the correct time, but at a fixed "depth" on the profile