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
isDrawing = false;
m_popupmenushown = 0;
zoom_mode = Normal;
m_prevCursor = CursorArrow;
m_parser = new XParser(mo);
init();
......@@ -2136,34 +2137,65 @@ void View::invertColor(QColor &org, QColor &inv)
void View::updateCursor()
{
Cursor newCursor;
if ( isDrawing )
setCursor(Qt::WaitCursor );
newCursor = CursorWait;
else switch (zoom_mode)
{
case Normal:
if ( shouldShowCrosshairs() )
setCursor(Qt::BlankCursor);
newCursor = CursorBlank;
else
setCursor(Qt::ArrowCursor);
newCursor = CursorArrow;
break;
case Rectangular:
case DrawingRectangle:
setCursor(Qt::CrossCursor);
newCursor = CursorCross;
break;
case ZoomIn:
setCursor( QCursor( SmallIcon( "magnify", 32), 10, 10 ) );
newCursor = CursorMagnify;
break;
case ZoomOut:
setCursor( QCursor( SmallIcon( "lessen", 32), 10, 10 ) );
newCursor = CursorLessen;
break;
case Center:
setCursor(Qt::PointingHandCursor);
newCursor = CursorPointing;
break;
}
if ( newCursor == m_prevCursor )
return;
m_prevCursor = newCursor;
switch ( newCursor )
{
case CursorWait:
setCursor( Qt::WaitCursor );
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:
QString m_statusbartext3;
QString m_statusbartext4;
KActionCollection *m_ac;
enum Cursor { CursorWait, CursorBlank, CursorArrow, CursorCross, CursorMagnify, CursorLessen, CursorPointing };
Cursor m_prevCursor;
};
#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