diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-07-15 17:56:18 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-23 15:58:55 -0700 |
commit | b3feaa80e26510928c73e92049ec346841f6093a (patch) | |
tree | 1a1f002959ea09aa5a16a5cc04ace06326941377 /profile-widget/divepixmapitem.cpp | |
parent | c7428859840bfcf973a14f27c6376e39e915cb29 (diff) | |
download | subsurface-b3feaa80e26510928c73e92049ec346841f6093a.tar.gz |
Dive video: paint duration-bar above thumbnail in profile plot
Paint a rectangle on top of thumbnails indicating the run-time
of the video.
Use the z=100.0-101.0 range for painting the thumbnails, whereby
the z-value increases uniformly from first to last thumbnail
(sorted by timestamp). The duration-bars are placed at z-values
midway between those of the thumbnails.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget/divepixmapitem.cpp')
-rw-r--r-- | profile-widget/divepixmapitem.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/profile-widget/divepixmapitem.cpp b/profile-widget/divepixmapitem.cpp index d295fb4dd..730cdf606 100644 --- a/profile-widget/divepixmapitem.cpp +++ b/profile-widget/divepixmapitem.cpp @@ -42,7 +42,8 @@ void CloseButtonItem::show() DivePictureItem::DivePictureItem(QGraphicsItem *parent): DivePixmapItem(parent), canvas(new QGraphicsRectItem(this)), shadow(new QGraphicsRectItem(this)), - button(new CloseButtonItem(this)) + button(new CloseButtonItem(this)), + baseZValue(0.0) { setFlag(ItemIgnoresTransformations); setAcceptHoverEvents(true); @@ -67,6 +68,14 @@ DivePictureItem::DivePictureItem(QGraphicsItem *parent): DivePixmapItem(parent), button->hide(); } +// The base z-value is used for correct paint-order of the thumbnails. On hoverEnter the z-value is raised +// so that the thumbnail is drawn on top of all other thumbnails and on hoverExit it is restored to the base value. +void DivePictureItem::setBaseZValue(double z) +{ + baseZValue = z; + setZValue(z); +} + void DivePictureItem::settingsChanged() { setVisible(prefs.show_pictures_in_profile); @@ -85,7 +94,7 @@ void DivePictureItem::setPixmap(const QPixmap &pix) void DivePictureItem::hoverEnterEvent(QGraphicsSceneHoverEvent*) { Animations::scaleTo(this, 1.0); - setZValue(5); + setZValue(baseZValue + 5.0); button->setOpacity(0); button->show(); @@ -100,7 +109,7 @@ void DivePictureItem::setFileUrl(const QString &s) void DivePictureItem::hoverLeaveEvent(QGraphicsSceneHoverEvent*) { Animations::scaleTo(this, 0.2); - setZValue(0); + setZValue(baseZValue); Animations::hide(button); } |