Picture handling: put the picture near its correct time during the dive

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-06-08 11:56:35 -07:00
parent 543f3ac584
commit f037f03268

View file

@ -1311,8 +1311,11 @@ void ProfileWidget2::plotPictures()
continue;
DivePictureItem *item = new DivePictureItem();
item->setPixmap(m->index(i,0).data(Qt::DecorationRole).value<QPixmap>());
// TODO: put the item in the correct place. use the pic.timestamp to find where it belongs on the dive.
item->setPos(10 ,10);
// let's put the picture at the correct time, but at a fixed "depth" on the profile
// not sure this is ideal, but it seems to look right.
qreal x = timeAxis->posAtValue(pic->timestamp - current_dive->when);
qreal y = 10;
item->setPos(x, y);
item->setFlag(QGraphicsItem::ItemIgnoresTransformations);
scene()->addItem(item);
pictures.push_back(item);