Commit 33fd8e5c authored by David Saxton's avatar David Saxton

Fix cursor issue.

svn path=/trunk/KDE/kdeedu/kmplot/; revision=522231
parent cddfcf32
...@@ -106,6 +106,7 @@ View::View(bool const r, bool &mo, KMenu *p, QWidget* parent, KActionCollection ...@@ -106,6 +106,7 @@ View::View(bool const r, bool &mo, KMenu *p, QWidget* parent, KActionCollection
isDrawing = false; isDrawing = false;
m_popupmenushown = 0; m_popupmenushown = 0;
zoom_mode = Normal; zoom_mode = Normal;
m_prevCursor = CursorArrow;
m_parser = new XParser(mo); m_parser = new XParser(mo);
init(); init();
...@@ -2136,34 +2137,65 @@ void View::invertColor(QColor &org, QColor &inv) ...@@ -2136,34 +2137,65 @@ void View::invertColor(QColor &org, QColor &inv)
void View::updateCursor() void View::updateCursor()
{ {
Cursor newCursor;
if ( isDrawing ) if ( isDrawing )
setCursor(Qt::WaitCursor ); newCursor = CursorWait;
else switch (zoom_mode) else switch (zoom_mode)
{ {
case Normal: case Normal:
if ( shouldShowCrosshairs() ) if ( shouldShowCrosshairs() )
setCursor(Qt::BlankCursor); newCursor = CursorBlank;
else else
setCursor(Qt::ArrowCursor); newCursor = CursorArrow;
break; break;
case Rectangular: case Rectangular:
case DrawingRectangle: case DrawingRectangle:
setCursor(Qt::CrossCursor); newCursor = CursorCross;
break; break;
case ZoomIn: case ZoomIn:
setCursor( QCursor( SmallIcon( "magnify", 32), 10, 10 ) ); newCursor = CursorMagnify;
break; break;
case ZoomOut: case ZoomOut:
setCursor( QCursor( SmallIcon( "lessen", 32), 10, 10 ) ); newCursor = CursorLessen;
break; break;
case Center: case Center:
setCursor(Qt::PointingHandCursor); newCursor = CursorPointing;
break;
}
if ( newCursor == m_prevCursor )
return;
m_prevCursor = newCursor;
switch ( newCursor )
{
case CursorWait:
setCursor( Qt::WaitCursor );
break; break;
case CursorBlank:
setCursor( Qt::BlankCursor );
break;
case CursorArrow:
setCursor( Qt::ArrowCursor );
break;
case CursorCross:
setCursor( Qt::CrossCursor );
break;
case CursorMagnify:
setCursor( QCursor( SmallIcon( "magnify", 32), 10, 10 ) );
break;
case CursorLessen:
setCursor( QCursor( SmallIcon( "lessen", 32), 10, 10 ) );
break;
case CursorPointing:
setCursor( Qt::PointingHandCursor );
} }
} }
......
...@@ -290,6 +290,9 @@ private: ...@@ -290,6 +290,9 @@ private:
QString m_statusbartext3; QString m_statusbartext3;
QString m_statusbartext4; QString m_statusbartext4;
KActionCollection *m_ac; KActionCollection *m_ac;
enum Cursor { CursorWait, CursorBlank, CursorArrow, CursorCross, CursorMagnify, CursorLessen, CursorPointing };
Cursor m_prevCursor;
}; };
#endif // View_included #endif // View_included
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment