From 2c2d3351ac3718c13adab88c9b9b9f73ab17aced Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 23 Jan 2014 15:35:32 -0200 Subject: Move the creation of the Gas Pressure item to the constructor This makes the Gas Pressure Item a 'cached' item, when the dive changes, the item will regenerate the drawing based on it's model. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveprofileitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qt-ui/profile/diveprofileitem.cpp') diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index 0768f38f6..c2c95bd89 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -258,7 +258,7 @@ void DiveTemperatureItem::paint(QPainter* painter, const QStyleOptionGraphicsIte void DiveGasPressureItem::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; int last_index = -1; int lift_pen = false; -- cgit v1.2.3-70-g09d2