diff options
-rw-r--r-- | qt-ui/profile/diveprofileitem.cpp | 2 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 22 |
2 files changed, 10 insertions, 14 deletions
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index 25d6a8415..f00fff688 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -192,7 +192,7 @@ DiveTemperatureItem::DiveTemperatureItem() void DiveTemperatureItem::modelDataChanged() { // We don't have enougth data to calculate things, quit. - if (!hAxis || !vAxis || !dataModel || hDataColumn == -1 || vDataColumn == -1) + if (!hAxis || !vAxis || !dataModel || hDataColumn == -1 || vDataColumn == -1 || dataModel->rowCount() == 0) return; qDeleteAll(texts); diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index e21af21bd..2f607590b 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -146,6 +146,15 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : gasPressureItem->setZValue(1); scene()->addItem(gasPressureItem); + temperatureItem = new DiveTemperatureItem(); + temperatureItem->setHorizontalAxis(timeAxis); + temperatureItem->setVerticalAxis(temperatureAxis); + temperatureItem->setModel(dataModel); + temperatureItem->setVerticalDataColumn(DivePlotDataModel::TEMPERATURE); + temperatureItem->setHorizontalDataColumn(DivePlotDataModel::TIME); + temperatureItem->setZValue(1); + scene()->addItem(temperatureItem); + background->setFlag(QGraphicsItem::ItemIgnoresTransformations); //enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID }; @@ -377,19 +386,6 @@ void ProfileWidget2::plotDives(QList<dive*> dives) event = event->next; } - if(temperatureItem){ - scene()->removeItem(temperatureItem); - delete temperatureItem; - } - temperatureItem = new DiveTemperatureItem(); - temperatureItem->setHorizontalAxis(timeAxis); - temperatureItem->setVerticalAxis(temperatureAxis); - temperatureItem->setModel(dataModel); - temperatureItem->setVerticalDataColumn(DivePlotDataModel::TEMPERATURE); - temperatureItem->setHorizontalDataColumn(DivePlotDataModel::TIME); - temperatureItem->setZValue(1); - scene()->addItem(temperatureItem); - diveComputerText->setText(currentdc->model); diveComputerText->animateMoveTo(1 , sceneRect().height()); emit startProfileState(); |