mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:23:25 +00:00
Move two necessary functions for the Planner behavior to the Profile code.
Those two functions are important and necessary for the Planner, they create and remove the little balls that act as handlers so the profile can be edited with the mouse. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
fe1df6b1cc
commit
27afb33806
2 changed files with 38 additions and 1 deletions
|
@ -919,3 +919,32 @@ void ProfileWidget2::editName()
|
||||||
}
|
}
|
||||||
replot();
|
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();
|
||||||
|
}
|
||||||
|
|
|
@ -40,6 +40,9 @@ class DiveCalculatedTissue;
|
||||||
class PartialPressureGasItem;
|
class PartialPressureGasItem;
|
||||||
class PartialGasPressureAxis;
|
class PartialGasPressureAxis;
|
||||||
class AbstractProfilePolygonItem;
|
class AbstractProfilePolygonItem;
|
||||||
|
class DiveHandler;
|
||||||
|
class QGraphicsSimpleTextItem;
|
||||||
|
class QModelIndex;
|
||||||
|
|
||||||
class ProfileWidget2 : public QGraphicsView {
|
class ProfileWidget2 : public QGraphicsView {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -85,6 +88,8 @@ slots: // Necessary to call from QAction's signals.
|
||||||
void removeEvent();
|
void removeEvent();
|
||||||
void editName();
|
void editName();
|
||||||
void makeFirstDC();
|
void makeFirstDC();
|
||||||
|
void pointInserted(const QModelIndex &parent, int start, int end);
|
||||||
|
void pointsRemoved(const QModelIndex &, int start, int end);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *event);
|
virtual void resizeEvent(QResizeEvent *event);
|
||||||
|
@ -100,7 +105,6 @@ private: /*methods*/
|
||||||
void setupItemSizes();
|
void setupItemSizes();
|
||||||
void addItemsToScene();
|
void addItemsToScene();
|
||||||
void setupItemOnScene();
|
void setupItemOnScene();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DivePlotDataModel *dataModel;
|
DivePlotDataModel *dataModel;
|
||||||
int zoomLevel;
|
int zoomLevel;
|
||||||
|
@ -135,6 +139,10 @@ private:
|
||||||
RulerItem2 *rulerItem;
|
RulerItem2 *rulerItem;
|
||||||
bool isGrayscale;
|
bool isGrayscale;
|
||||||
bool printMode;
|
bool printMode;
|
||||||
|
|
||||||
|
//specifics for ADD and PLAN
|
||||||
|
QList<DiveHandler *> handles;
|
||||||
|
QList<QGraphicsSimpleTextItem *> gases;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROFILEWIDGET2_H
|
#endif // PROFILEWIDGET2_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue