summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2016-10-01 17:38:12 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-10-03 07:58:43 -0700
commit87ced29e0954b7776d13e578727a7a216b97055c (patch)
tree56b055318c0fd109bf67da9eb56a15e5011f0c52
parentf2ed9ede770729fb85835ce2c1e6d135188a42ea (diff)
downloadsubsurface-87ced29e0954b7776d13e578727a7a216b97055c.tar.gz
Initialize tooltip tissue pixmap properly
...otherwise we show garbage before the mouse enters the profile for the first time. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--profile-widget/divetooltipitem.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/profile-widget/divetooltipitem.cpp b/profile-widget/divetooltipitem.cpp
index 49e9bdca7..fb7511e69 100644
--- a/profile-widget/divetooltipitem.cpp
+++ b/profile-widget/divetooltipitem.cpp
@@ -253,15 +253,16 @@ void ToolTipItem::refresh(const QPointF &pos)
mb.len = 0;
entry = get_plot_details_new(&pInfo, time, &mb);
+
+ tissues.fill();
+ painter.setPen(QColor(0, 0, 0, 0));
+ painter.setBrush(QColor(LIMENADE1));
+ painter.drawRect(0, 10 + (100 - AMB_PERCENTAGE) / 2, 16, AMB_PERCENTAGE / 2);
+ painter.setBrush(QColor(SPRINGWOOD1));
+ painter.drawRect(0, 10, 16, (100 - AMB_PERCENTAGE) / 2);
+ painter.setBrush(QColor(Qt::red));
+ painter.drawRect(0,0,16,10);
if (entry) {
- tissues.fill();
- painter.setPen(QColor(0, 0, 0, 0));
- painter.setBrush(QColor(LIMENADE1));
- painter.drawRect(0, 10 + (100 - AMB_PERCENTAGE) / 2, 16, AMB_PERCENTAGE / 2);
- painter.setBrush(QColor(SPRINGWOOD1));
- painter.drawRect(0, 10, 16, (100 - AMB_PERCENTAGE) / 2);
- painter.setBrush(QColor(Qt::red));
- painter.drawRect(0,0,16,10);
painter.setPen(QColor(0, 0, 0, 255));
painter.drawLine(0, 60 - entry->gfline / 2, 16, 60 - entry->gfline / 2);
painter.drawLine(0, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure / 2,
@@ -270,9 +271,9 @@ void ToolTipItem::refresh(const QPointF &pos)
for (int i=0; i<16; i++) {
painter.drawLine(i, 60, i, 60 - entry->percentages[i] / 2);
}
- entryToolTip.first->setPixmap(tissues);
entryToolTip.second->setText(QString::fromUtf8(mb.buffer, mb.len));
}
+ entryToolTip.first->setPixmap(tissues);
Q_FOREACH (QGraphicsItem *item, scene()->items(pos, Qt::IntersectsItemBoundingRect
,Qt::DescendingOrder, scene()->views().first()->transform())) {