mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:53:23 +00:00
Move profile item to be used as cache.
the profile item should also use the model to know when to change something, this makes it happen. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
563c39b822
commit
43cf4fb984
2 changed files with 12 additions and 14 deletions
|
@ -107,6 +107,9 @@ void DiveProfileItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* o
|
|||
|
||||
void DiveProfileItem::modelDataChanged()
|
||||
{
|
||||
if (!hAxis || !vAxis || !dataModel || hDataColumn == -1 || vDataColumn == -1 || dataModel->rowCount() == 0)
|
||||
return;
|
||||
|
||||
AbstractProfilePolygonItem::modelDataChanged();
|
||||
if (polygon().isEmpty())
|
||||
return;
|
||||
|
|
|
@ -155,6 +155,15 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
|
|||
temperatureItem->setZValue(1);
|
||||
scene()->addItem(temperatureItem);
|
||||
|
||||
diveProfileItem = new DiveProfileItem();
|
||||
diveProfileItem->setHorizontalAxis(timeAxis);
|
||||
diveProfileItem->setVerticalAxis(profileYAxis);
|
||||
diveProfileItem->setModel(dataModel);
|
||||
diveProfileItem->setVerticalDataColumn(DivePlotDataModel::DEPTH);
|
||||
diveProfileItem->setHorizontalDataColumn(DivePlotDataModel::TIME);
|
||||
diveProfileItem->setZValue(0);
|
||||
scene()->addItem(diveProfileItem);
|
||||
|
||||
background->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||
|
||||
//enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID };
|
||||
|
@ -356,20 +365,6 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
|
|||
meanDepth->animateMoveTo(3, profileYAxis->posAtValue(pInfo.meandepth));
|
||||
dataModel->setDive(current_dive, pInfo);
|
||||
|
||||
if (diveProfileItem) {
|
||||
//diveProfileItem->animateDelete();
|
||||
scene()->removeItem(diveProfileItem);
|
||||
delete diveProfileItem;
|
||||
}
|
||||
diveProfileItem = new DiveProfileItem();
|
||||
diveProfileItem->setHorizontalAxis(timeAxis);
|
||||
diveProfileItem->setVerticalAxis(profileYAxis);
|
||||
diveProfileItem->setModel(dataModel);
|
||||
diveProfileItem->setVerticalDataColumn(DivePlotDataModel::DEPTH);
|
||||
diveProfileItem->setHorizontalDataColumn(DivePlotDataModel::TIME);
|
||||
diveProfileItem->setZValue(0);
|
||||
scene()->addItem(diveProfileItem);
|
||||
|
||||
qDeleteAll(eventItems);
|
||||
eventItems.clear();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue