mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't try to setup event if it is NULL
This also fixes the whitespace in a function that I instrumented to figure out what's going on. I restored it to its original state, but I couldn't leave the whitespace unfixed... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
48db63736b
commit
f5862201a8
1 changed files with 9 additions and 7 deletions
|
|
@ -33,6 +33,8 @@ void DiveEventItem::setVerticalAxis(DiveCartesianAxis* axis)
|
||||||
|
|
||||||
void DiveEventItem::setEvent(struct event* ev)
|
void DiveEventItem::setEvent(struct event* ev)
|
||||||
{
|
{
|
||||||
|
if (!ev)
|
||||||
|
return;
|
||||||
internalEvent = ev;
|
internalEvent = ev;
|
||||||
setupPixmap();
|
setupPixmap();
|
||||||
setupToolTipString();
|
setupToolTipString();
|
||||||
|
|
@ -109,23 +111,23 @@ void DiveEventItem::eventVisibilityChanged(const QString& eventName, bool visibl
|
||||||
|
|
||||||
void DiveEventItem::recalculatePos(bool instant)
|
void DiveEventItem::recalculatePos(bool instant)
|
||||||
{
|
{
|
||||||
if (!vAxis || !hAxis || !internalEvent || !dataModel) {
|
if (!vAxis || !hAxis || !internalEvent || !dataModel)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
QModelIndexList result = dataModel->match(dataModel->index(0,DivePlotDataModel::TIME), Qt::DisplayRole, internalEvent->time.seconds );
|
QModelIndexList result = dataModel->match(dataModel->index(0,DivePlotDataModel::TIME), Qt::DisplayRole, internalEvent->time.seconds );
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
|
Q_ASSERT("can't find a spot in the dataModel");
|
||||||
hide();
|
hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isVisible()) {
|
if (!isVisible())
|
||||||
show();
|
show();
|
||||||
}
|
|
||||||
int depth = dataModel->data(dataModel->index(result.first().row(), DivePlotDataModel::DEPTH)).toInt();
|
int depth = dataModel->data(dataModel->index(result.first().row(), DivePlotDataModel::DEPTH)).toInt();
|
||||||
qreal x = hAxis->posAtValue(internalEvent->time.seconds);
|
qreal x = hAxis->posAtValue(internalEvent->time.seconds);
|
||||||
qreal y = vAxis->posAtValue(depth);
|
qreal y = vAxis->posAtValue(depth);
|
||||||
if (!instant){
|
if (!instant)
|
||||||
Animations::moveTo(this, x, y, 500);
|
Animations::moveTo(this, x, y, 500);
|
||||||
}else{
|
else
|
||||||
setPos(x,y);
|
setPos(x,y);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue