#4220 Apply picking cursor only when over a 3d View

This commit is contained in:
Gaute Lindkvist
2019-03-22 15:55:51 +01:00
parent ef182da8a9
commit 44f3882ecb
5 changed files with 52 additions and 10 deletions

View File

@@ -77,6 +77,8 @@ using cvf::ManipulatorTrackball;
const double RI_MIN_NEARPLANE_DISTANCE = 0.1;
std::unique_ptr<QCursor> RiuViewer::s_hoverCursor;
//==================================================================================================
///
/// \class RiuViewer
@@ -841,11 +843,24 @@ void RiuViewer::mouseMoveEvent(QMouseEvent* mouseEvent)
caf::Viewer::mouseMoveEvent(mouseEvent);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewer::enterEvent(QEvent*)
{
if (s_hoverCursor)
{
QApplication::setOverrideCursor(*s_hoverCursor);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewer::leaveEvent(QEvent*)
{
QApplication::restoreOverrideCursor();
if (m_rimView && m_rimView->assosiatedViewLinker())
{
RimViewLinker* viewLinker = m_rimView->assosiatedViewLinker();
@@ -1026,6 +1041,22 @@ void RiuViewer::showScaleLegend(bool show)
updateLegendLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewer::setHoverCursor(const QCursor& cursor)
{
s_hoverCursor.reset(new QCursor(cursor));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewer::clearHoverCursor()
{
s_hoverCursor.reset();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------