aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-06-03 19:24:01 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 16:43:06 -0700
commit43cf9fdb7a5cc27357c9c111baa6a11b57366a7a (patch)
treead0842e5956a839bad50efd3746c461638c89149
parentebe799e0a02723a6499e60da66e62ea18aceb52b (diff)
downloadsubsurface-43cf9fdb7a5cc27357c9c111baa6a11b57366a7a.tar.gz
Add a method to plot the pictures on the profile.
It plots in the wrong place for now, because I need to change the model a bit. But it shares the same pixmap with the other widget which is nice. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/profile/profilewidget2.cpp20
-rw-r--r--qt-ui/profile/profilewidget2.h2
2 files changed, 20 insertions, 2 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index a63c83d68..e4cf384cf 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -702,7 +702,7 @@ void ProfileWidget2::setProfileState()
disconnectTemporaryConnections();
connect(DivePictureModel::instance(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(plotPictures()));
- connect(DivePictureModel::instance(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),this, SLOT(plotPictureS()));
+ connect(DivePictureModel::instance(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),this, SLOT(plotPictures()));
connect(DivePictureModel::instance(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),this, SLOT(plotPictures()));
/* show the same stuff that the profile shows. */
@@ -1050,7 +1050,7 @@ void ProfileWidget2::disconnectTemporaryConnections()
this, SLOT(pointsRemoved(const QModelIndex &, int, int)));
disconnect(DivePictureModel::instance(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(plotPictures()));
- disconnect(DivePictureModel::instance(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),this, SLOT(plotPictureS()));
+ disconnect(DivePictureModel::instance(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),this, SLOT(plotPictures()));
disconnect(DivePictureModel::instance(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)),this, SLOT(plotPictures()));
Q_FOREACH (QAction *action, actionsForKeys.values()) {
@@ -1288,3 +1288,19 @@ void ProfileWidget2::keyEscAction()
if (plannerModel->isPlanner())
plannerModel->cancelPlan();
}
+
+void ProfileWidget2::plotPictures()
+{
+ qDeleteAll(pictures);
+ pictures.clear();
+
+ DivePictureModel *m = DivePictureModel::instance();
+ for(int i = 0; i < m->rowCount(); i++){
+ DivePixmapItem *item = new DivePixmapItem();
+ item->setPixmap(m->index(i,0).data(Qt::DecorationRole).value<QPixmap>());
+ item->setPos(10,10); // TODO: put the item in the correct place.
+ item->setFlag(QGraphicsItem::ItemIgnoresTransformations);
+ scene()->addItem(item);
+ pictures.push_back(item);
+ }
+}
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index 9c7610526..a1ba7a23a 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -91,6 +91,7 @@ slots: // Necessary to call from QAction's signals.
void makeFirstDC();
void pointInserted(const QModelIndex &parent, int start, int end);
void pointsRemoved(const QModelIndex &, int start, int end);
+ void plotPictures();
void replot();
/* this is called for every move on the handlers. maybe we can speed up this a bit? */
@@ -159,6 +160,7 @@ private:
//specifics for ADD and PLAN
QList<DiveHandler *> handles;
QList<QGraphicsSimpleTextItem *> gases;
+ QList<DivePixmapItem*> pictures;
void repositionDiveHandlers();
int fixHandlerIndex(DiveHandler *activeHandler);
friend class DiveHandler;