mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: port basic dive editing to QtQuick
This needed a bit of refactoring of the ChartItem code, because we have to be signaled on drag start. Currently only one handle can be selected at a time. This was (implicitly) the case anyway, as far as I can tell. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ea0085fef6
commit
bece0a0652
21 changed files with 597 additions and 477 deletions
|
@ -37,6 +37,10 @@ QRectF ChartItem::getRect() const
|
|||
return rect;
|
||||
}
|
||||
|
||||
void ChartItem::startDrag(QPointF pos)
|
||||
{
|
||||
}
|
||||
|
||||
void ChartItem::drag(QPointF)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -30,9 +30,11 @@ public:
|
|||
const bool dragable; // Item can be dragged with the mouse. Must be set in constructor.
|
||||
virtual ~ChartItem(); // Attention: must only be called by render thread.
|
||||
QRectF getRect() const;
|
||||
virtual void startDrag(QPointF pos); // Called when user clicks on a draggable item
|
||||
virtual void drag(QPointF pos); // Called when dragging the item
|
||||
virtual void stopDrag(QPointF pos); // Called when dragging the item finished
|
||||
protected:
|
||||
template <typename T> friend class ChartItemPtr;
|
||||
ChartItem(ChartView &v, size_t z, bool dragable = false);
|
||||
QSizeF sceneSize() const;
|
||||
ChartView &view;
|
||||
|
|
|
@ -49,6 +49,12 @@ public:
|
|||
{
|
||||
return ptr;
|
||||
}
|
||||
void del()
|
||||
{
|
||||
if (!ptr)
|
||||
return;
|
||||
ptr->view.deleteChartItem(*this);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -315,6 +315,7 @@ void ChartView::mousePressEvent(QMouseEvent *event)
|
|||
dragStartMouse = pos;
|
||||
dragStartItem = rect.topLeft();
|
||||
draggedItem = item;
|
||||
draggedItem->startDrag(pos);
|
||||
grabMouse();
|
||||
setKeepMouseGrab(true); // don't allow Qt to steal the grab
|
||||
event->accept();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue