summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJeremy Katz <jeremy.katz@nokia.com>2009-11-24 11:35:04 +0100
committerJeremy Katz <jeremy.katz@nokia.com>2009-11-24 11:35:04 +0100
commit4750df7a21748416541c88572ff46f83861745fd (patch)
tree48660ff72fa6e334c990f1f67389c19b3b20b615 /src/gui
parent52df0e48813c97e27644fb6052c541af39a8dc92 (diff)
recalculate the cursor's current QRect when changing the cursor graphic
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/painting/qgraphicssystemcursor.cpp16
-rw-r--r--src/gui/painting/qgraphicssystemcursor.h3
2 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp
index 300c71946c..cad914dc9c 100644
--- a/src/gui/painting/qgraphicssystemcursor.cpp
+++ b/src/gui/painting/qgraphicssystemcursor.cpp
@@ -94,12 +94,18 @@ QRect QGraphicsSystemCursor::drawCursor(QPainter & painter)
return prevRect;
}
+QRect QGraphicsSystemCursor::getCurrentRect()
+{
+ QRect rect = graphic->image()->rect().translated(-graphic->hotspot().x(),
+ -graphic->hotspot().y());
+ rect.translate(QCursor::pos());
+ return rect;
+}
+
void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & e)
{
- currentRect = graphic->image()->rect().translated(-graphic->hotspot().x(),
- -graphic->hotspot().y());
- currentRect.translate(e.pos());
- screen->setDirty(QRect(QRect(e.pos(), QSize(1, 1))));
+ currentRect = getCurrentRect();
+ screen->setDirty(currentRect);
}
void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor)
@@ -116,6 +122,7 @@ void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor)
// system cursor
setCursor(shape);
}
+ currentRect = getCurrentRect();
screen->setDirty(currentRect);
}
@@ -127,6 +134,7 @@ void QGraphicsSystemCursor::changeCursor(QWidget * widget)
} else {
// default cursor
setCursor(Qt::ArrowCursor);
+ currentRect = getCurrentRect();
screen->setDirty(currentRect);
}
}
diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h
index de7ce84858..ea303198d5 100644
--- a/src/gui/painting/qgraphicssystemcursor.h
+++ b/src/gui/painting/qgraphicssystemcursor.h
@@ -92,6 +92,9 @@ protected:
QWidget * currentWidget; // widget currently under the cursor
QGraphicsSystemCursorImage * graphic;
+
+private:
+ QRect getCurrentRect();
};
QT_END_NAMESPACE