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

@ -122,7 +122,8 @@ void ProfileView::clear()
profileScene->clear();
//handles.clear();
//gases.clear();
tooltip.reset();
if (tooltip)
tooltip->setVisible(false);
empty = true;
d = nullptr;
dc = 0;
@ -261,6 +262,11 @@ void ProfileView::wheelEvent(QWheelEvent *event)
void ProfileView::mousePressEvent(QMouseEvent *event)
{
// Handle dragging of items
ChartView::mousePressEvent(event);
if (event->isAccepted())
return;
panning = true;
QPointF pos = mapToScene(event->pos());
panStart(pos.x(), pos.y());
@ -268,8 +274,10 @@ void ProfileView::mousePressEvent(QMouseEvent *event)
event->accept();
}
void ProfileView::mouseReleaseEvent(QMouseEvent *)
void ProfileView::mouseReleaseEvent(QMouseEvent *event)
{
ChartView::mouseReleaseEvent(event);
if (panning) {
panning = false;
unsetCursor();
@ -282,6 +290,8 @@ void ProfileView::mouseReleaseEvent(QMouseEvent *)
void ProfileView::mouseMoveEvent(QMouseEvent *event)
{
ChartView::mouseMoveEvent(event);
QPointF pos = mapToScene(event->pos());
if (panning)
pan(pos.x(), pos.y());