Show/Hide pictures working.

This code hoocks the pictures with the preferences change.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-07-10 21:15:20 -03:00 committed by Dirk Hohndel
parent a00d8101c5
commit b9d04c0cf4
4 changed files with 11 additions and 1 deletions

View file

@ -1279,6 +1279,7 @@ TOOLBOX_PREF_PROFILE(profRuler, rulergraph, rulergraph);
TOOLBOX_PREF_PROFILE(profSAC, show_sac, show_sac); TOOLBOX_PREF_PROFILE(profSAC, show_sac, show_sac);
TOOLBOX_PREF_PROFILE(profScaled, zoomed_plot, zoomed_plot); TOOLBOX_PREF_PROFILE(profScaled, zoomed_plot, zoomed_plot);
TOOLBOX_PREF_PROFILE(profTogglePicture, show_pictures_in_profile, show_pictures_in_profile); TOOLBOX_PREF_PROFILE(profTogglePicture, show_pictures_in_profile, show_pictures_in_profile);
void MainWindow::turnOffNdlTts() void MainWindow::turnOffNdlTts()
{ {
const bool triggered = false; const bool triggered = false;

View file

@ -1,6 +1,7 @@
#include "divepixmapitem.h" #include "divepixmapitem.h"
#include "animationfunctions.h" #include "animationfunctions.h"
#include <divepicturewidget.h> #include <divepicturewidget.h>
#include <preferences.h>
#include <QPen> #include <QPen>
#include <QBrush> #include <QBrush>
@ -22,6 +23,13 @@ DivePictureItem::DivePictureItem(int row, QObject *parent): DivePixmapItem(paren
#endif #endif
rowOnModel = row; rowOnModel = row;
setScale(0.2); setScale(0.2);
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
setVisible(prefs.show_pictures_in_profile);
}
void DivePictureItem::settingsChanged()
{
setVisible(prefs.show_pictures_in_profile);
} }
void DivePictureItem::setPixmap(const QPixmap &pix) void DivePictureItem::setPixmap(const QPixmap &pix)

View file

@ -20,6 +20,8 @@ class DivePictureItem : public DivePixmapItem {
public: public:
DivePictureItem(int row, QObject *parent = 0); DivePictureItem(int row, QObject *parent = 0);
void setPixmap(const QPixmap& pix); void setPixmap(const QPixmap& pix);
public slots:
void settingsChanged();
protected: protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);

View file

@ -555,7 +555,6 @@ void ProfileWidget2::settingsChanged()
isPlotZoomed = prefs.zoomed_plot; isPlotZoomed = prefs.zoomed_plot;
needReplot = true; needReplot = true;
} }
if (needReplot) if (needReplot)
replot(); replot();
} }