aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/profilewidget2.cpp29
-rw-r--r--qt-ui/profile/profilewidget2.h10
2 files changed, 38 insertions, 1 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 919db5c38..bc540fe22 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -919,3 +919,32 @@ void ProfileWidget2::editName()
}
replot();
}
+
+void ProfileWidget2::pointInserted(const QModelIndex &parent, int start, int end)
+{
+ DiveHandler *item = new DiveHandler();
+ scene()->addItem(item);
+ handles << item;
+
+ QGraphicsSimpleTextItem *gasChooseBtn = new QGraphicsSimpleTextItem();
+ scene()->addItem(gasChooseBtn);
+ gasChooseBtn->setZValue(10);
+ gasChooseBtn->setFlag(QGraphicsItem::ItemIgnoresTransformations);
+ gases << gasChooseBtn;
+ DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
+ if (plannerModel->recalcQ())
+ replot();
+}
+
+void ProfileWidget2::pointsRemoved(const QModelIndex &, int start, int end)
+{ // start and end are inclusive.
+ int num = (end - start) + 1;
+ for (int i = num; i != 0; i--) {
+ delete handles.back();
+ handles.pop_back();
+ delete gases.back();
+ gases.pop_back();
+ }
+ scene()->clearSelection();
+ replot();
+}
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index 1ba6e5723..46c1ee0b6 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -40,6 +40,9 @@ class DiveCalculatedTissue;
class PartialPressureGasItem;
class PartialGasPressureAxis;
class AbstractProfilePolygonItem;
+class DiveHandler;
+class QGraphicsSimpleTextItem;
+class QModelIndex;
class ProfileWidget2 : public QGraphicsView {
Q_OBJECT
@@ -85,6 +88,8 @@ slots: // Necessary to call from QAction's signals.
void removeEvent();
void editName();
void makeFirstDC();
+ void pointInserted(const QModelIndex &parent, int start, int end);
+ void pointsRemoved(const QModelIndex &, int start, int end);
protected:
virtual void resizeEvent(QResizeEvent *event);
@@ -100,7 +105,6 @@ private: /*methods*/
void setupItemSizes();
void addItemsToScene();
void setupItemOnScene();
-
private:
DivePlotDataModel *dataModel;
int zoomLevel;
@@ -135,6 +139,10 @@ private:
RulerItem2 *rulerItem;
bool isGrayscale;
bool printMode;
+
+ //specifics for ADD and PLAN
+ QList<DiveHandler *> handles;
+ QList<QGraphicsSimpleTextItem *> gases;
};
#endif // PROFILEWIDGET2_H