Fix crash when moving the mouse over the profile when no dive is shown

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-09-20 13:41:36 -03:00 committed by Dirk Hohndel
parent a2f2751792
commit 2b760bdd39

View file

@ -235,23 +235,25 @@ void ToolTipItem::refresh(const QPointF &pos)
struct membuffer mb = { 0 }; struct membuffer mb = { 0 };
entry = get_plot_details_new(&pInfo, time, &mb); entry = get_plot_details_new(&pInfo, time, &mb);
tissues->fill(); if (entry) {
painter->setPen(QColor(0, 0, 0, 0)); tissues->fill();
painter->setBrush(QColor(LIMENADE1)); painter->setPen(QColor(0, 0, 0, 0));
painter->drawRect(0, 10 + (100 - AMB_PERCENTAGE) / 2, 16, AMB_PERCENTAGE / 2); painter->setBrush(QColor(LIMENADE1));
painter->setBrush(QColor(SPRINGWOOD1)); painter->drawRect(0, 10 + (100 - AMB_PERCENTAGE) / 2, 16, AMB_PERCENTAGE / 2);
painter->drawRect(0, 10, 16, (100 - AMB_PERCENTAGE) / 2); painter->setBrush(QColor(SPRINGWOOD1));
painter->setBrush(QColor("Red")); painter->drawRect(0, 10, 16, (100 - AMB_PERCENTAGE) / 2);
painter->drawRect(0,0,16,10); painter->setBrush(QColor("Red"));
painter->setPen(QColor(0, 0, 0, 255)); painter->drawRect(0,0,16,10);
painter->drawLine(0, 60 - entry->gfline / 2, 16, 60 - entry->gfline / 2); painter->setPen(QColor(0, 0, 0, 255));
painter->drawLine(0, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure / 2, painter->drawLine(0, 60 - entry->gfline / 2, 16, 60 - entry->gfline / 2);
16, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure /2); painter->drawLine(0, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure / 2,
painter->setPen(QColor(0, 0, 0, 127)); 16, 60 - AMB_PERCENTAGE * (entry->pressures.n2 + entry->pressures.he) / entry->ambpressure /2);
for (i=0; i<16; i++) { painter->setPen(QColor(0, 0, 0, 127));
painter->drawLine(i, 60, i, 60 - entry->percentages[i] / 2); for (i=0; i<16; i++) {
painter->drawLine(i, 60, i, 60 - entry->percentages[i] / 2);
}
addToolTip(QString::fromUtf8(mb.buffer, mb.len),QIcon(), tissues);
} }
addToolTip(QString::fromUtf8(mb.buffer, mb.len),QIcon(), tissues);
free_buffer(&mb); free_buffer(&mb);
Q_FOREACH (QGraphicsItem *item, scene()->items(pos, Qt::IntersectsItemShape Q_FOREACH (QGraphicsItem *item, scene()->items(pos, Qt::IntersectsItemShape