From 9293268027e193c9da7b069706ffcb5a3ac4c68f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 4 Jun 2018 18:32:17 +0200 Subject: 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 --- profile-widget/divepixmapitem.cpp | 1 - profile-widget/profilewidget2.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/profile-widget/divepixmapitem.cpp b/profile-widget/divepixmapitem.cpp index 959e8d2c4..d295fb4dd 100644 --- a/profile-widget/divepixmapitem.cpp +++ b/profile-widget/divepixmapitem.cpp @@ -50,7 +50,6 @@ DivePictureItem::DivePictureItem(QGraphicsItem *parent): DivePixmapItem(parent), #ifndef SUBSURFACE_MOBILE connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); #endif - setVisible(prefs.show_pictures_in_profile); canvas->setPen(Qt::NoPen); canvas->setBrush(QColor(Qt::white)); diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 5a1babb99..a69b59085 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -2077,6 +2077,7 @@ void ProfileWidget2::plotPictures() pictures[picItemNr].reset(item); scene()->addItem(item); } + item->setVisible(prefs.show_pictures_in_profile); item->setPixmap(m->index(i, 0).data(Qt::UserRole).value()); 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 -- cgit v1.2.3-70-g09d2