diff options
author | Jeremy Katz <jeremy.katz@nokia.com> | 2009-12-08 11:54:00 +0100 |
---|---|---|
committer | Jeremy Katz <jeremy.katz@nokia.com> | 2009-12-08 11:54:00 +0100 |
commit | 426334321319054fedf8993bba6482ce90a2c4ee (patch) | |
tree | 2274f672a390a60368e11cee7f3473c6e72fa3de /src | |
parent | 52613f91fe4c8bb4faa93c50cc3fab2d8082fc30 (diff) |
fix application supplied image cursors
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qgraphicssystemcursor.cpp | 7 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystemcursor.h | 1 | ||||
-rw-r--r-- | src/plugins/graphicssystems/fb_base/fb_base.cpp | 9 | ||||
-rw-r--r-- | src/plugins/graphicssystems/fb_base/fb_base.h | 1 |
4 files changed, 15 insertions, 3 deletions
diff --git a/src/gui/painting/qgraphicssystemcursor.cpp b/src/gui/painting/qgraphicssystemcursor.cpp index 3fc836d359..9a0e135142 100644 --- a/src/gui/painting/qgraphicssystemcursor.cpp +++ b/src/gui/painting/qgraphicssystemcursor.cpp @@ -513,6 +513,13 @@ void QGraphicsSystemCursorImage::set(Qt::CursorShape id) hot = cursor->hot; } +void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) +{ + hot.setX(hx); + hot.setY(hy); + cursorImage = *image; +} + void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) { diff --git a/src/gui/painting/qgraphicssystemcursor.h b/src/gui/painting/qgraphicssystemcursor.h index 42727a828a..0d57d52e12 100644 --- a/src/gui/painting/qgraphicssystemcursor.h +++ b/src/gui/painting/qgraphicssystemcursor.h @@ -58,6 +58,7 @@ public: QImage * image() { return &cursorImage; } QPoint hotspot() { return hot; } void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); + void set(const QImage * image, int hx, int hy); void set(Qt::CursorShape); private: static void createSystemCursor(int id); diff --git a/src/plugins/graphicssystems/fb_base/fb_base.cpp b/src/plugins/graphicssystems/fb_base/fb_base.cpp index 27cb8a44e6..f9ea97f165 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.cpp +++ b/src/plugins/graphicssystems/fb_base/fb_base.cpp @@ -54,6 +54,11 @@ void QGraphicsSystemSoftwareCursor::setCursor(Qt::CursorShape shape) graphic->set(shape); } +void QGraphicsSystemSoftwareCursor::setCursor(const QImage * image, int hotx, int hoty) +{ + graphic->set(image, hotx, hoty); +} + void QGraphicsSystemSoftwareCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) { graphic->set(data, mask, width, height, hotX, hotY); @@ -66,10 +71,8 @@ void QGraphicsSystemSoftwareCursor::changeCursor(QCursor * widgetCursor, QWidget if (shape == Qt::BitmapCursor) { // application supplied cursor - const QBitmap * map = widgetCursor->bitmap(); - const QBitmap * mask = widgetCursor->mask(); QPoint spot = widgetCursor->hotSpot(); - setCursor(map->toImage().bits(), mask->toImage().bits(), map->width(), map->height(), spot.x(), spot.y()); + setCursor(&widgetCursor->pixmap().toImage(), spot.x(), spot.y()); } else { // system cursor setCursor(shape); diff --git a/src/plugins/graphicssystems/fb_base/fb_base.h b/src/plugins/graphicssystems/fb_base/fb_base.h index 9abd5d07f8..58f340d241 100644 --- a/src/plugins/graphicssystems/fb_base/fb_base.h +++ b/src/plugins/graphicssystems/fb_base/fb_base.h @@ -34,6 +34,7 @@ protected: private: void setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY); void setCursor(Qt::CursorShape shape); + void setCursor(const QImage * image, int hotx, int hoty); QRect currentRect; // next place to draw the cursor QRect prevRect; // last place the cursor was drawn QRect getCurrentRect(); |