profile: activate dragging of tooltipitem

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2023-06-25 17:31:58 +02:00
parent a527415ac9
commit 4c227aba42
6 changed files with 32 additions and 3 deletions

View file

@ -41,6 +41,10 @@ void ChartItem::setPos(QPointF)
{
}
void ChartItem::stopDrag(QPointF pos)
{
}
static int round_up(double f)
{
return static_cast<int>(ceil(f));

View file

@ -31,6 +31,7 @@ public:
virtual ~ChartItem(); // Attention: must only be called by render thread.
QRectF getRect() const;
virtual void setPos(QPointF pos); // Called when dragging the item
virtual void stopDrag(QPointF pos); // Called when dragging the item finished
protected:
ChartItem(ChartView &v, size_t z, bool dragable = false);
QSizeF sceneSize() const;

View file

@ -282,6 +282,8 @@ void ChartView::mousePressEvent(QMouseEvent *event)
void ChartView::mouseReleaseEvent(QMouseEvent *event)
{
if (draggedItem) {
QPointF pos = event->localPos();
draggedItem->stopDrag(pos);
draggedItem.reset();
ungrabMouse();
event->accept();