From 919a68f109e67c98b4a426c33ba249acd86dd975 Mon Sep 17 00:00:00 2001 From: mzn Date: Tue, 10 Apr 2007 15:08:26 +0000 Subject: [PATCH] Change signature of hilight() method. --- src/QxGraph/QxGraph_ActiveItem.h | 2 +- src/QxGraph/QxGraph_CanvasView.cxx | 44 ++++++++++++++---------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/src/QxGraph/QxGraph_ActiveItem.h b/src/QxGraph/QxGraph_ActiveItem.h index f221da795..728be6a12 100644 --- a/src/QxGraph/QxGraph_ActiveItem.h +++ b/src/QxGraph/QxGraph_ActiveItem.h @@ -39,7 +39,7 @@ class QXGRAPH_EXPORT QxGraph_ActiveItem virtual void resize(QPoint thePoint) {} virtual void afterResizing() {} - virtual void hilight(const bool toHilight = true) = 0; + virtual void hilight(const QPoint& theMousePos, const bool toHilight = true) = 0; virtual void select(const QPoint& theMousePos, const bool toSelect = true) = 0; virtual void showPopup() = 0; diff --git a/src/QxGraph/QxGraph_CanvasView.cxx b/src/QxGraph/QxGraph_CanvasView.cxx index 12b826967..d668123de 100644 --- a/src/QxGraph/QxGraph_CanvasView.cxx +++ b/src/QxGraph/QxGraph_CanvasView.cxx @@ -288,28 +288,28 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) else { QCanvasItemList aList = canvas()->collisions(aPoint); - // to set hilight and resize cursor if needed + // perform actions for active items bool isHilightPerformed = false; for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) { QxGraph_ActiveItem* anActItem = dynamic_cast( *it ); - - // hilight - if (!isHilightPerformed && anActItem) - { - if (anActItem != myHilightedItem) - { - anActItem->hilight(); - if (myHilightedItem) - myHilightedItem->hilight(false); - myHilightedItem = anActItem; - isHilightPerformed = true; - } + + if (!isHilightPerformed && anActItem && anActItem != myHilightedItem) { + // hilight + anActItem->hilight(aPoint); + if (myHilightedItem) + myHilightedItem->hilight(aPoint, false); + myHilightedItem = anActItem; + isHilightPerformed = true; + + // show tooltip + QxGraph_ToolTip* aToolTip = new QxGraph_ToolTip(this); + aToolTip->maybeTip(aPoint); } int aCursorType; - if ( anActItem && anActItem->isResizable(aPoint,aCursorType) ) - { // set resize cursor + if ( anActItem && anActItem->isResizable(aPoint,aCursorType) ) { + // set resize cursor QCursor resizeCursor; switch (aCursorType) { @@ -336,27 +336,23 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) setCursor(resizeCursor); return; } - else - { // reset old cursor + else { + // reset old cursor setCursor(QCursor(Qt::ArrowCursor)); return; } } - if (!isHilightPerformed && myHilightedItem) - { - myHilightedItem->hilight(false); + if (!isHilightPerformed && myHilightedItem) { + myHilightedItem->hilight(aPoint, false); myHilightedItem = 0; + QToolTip::hide(); //@ temporary solution } if ( cursor().shape() == Qt::SizeVerCursor || cursor().shape() == Qt::SizeHorCursor || cursor().shape() == Qt::SizeBDiagCursor || cursor().shape() == Qt::SizeFDiagCursor) setCursor(QCursor(Qt::ArrowCursor)); } - - // show tooltip - QxGraph_ToolTip* aToolTip = new QxGraph_ToolTip(this); - aToolTip->maybeTip(aPoint); } void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) -- 2.39.2