Clean up QFbCursor

Task-number: QTBUG-56306
Change-Id: If0cccbf20d4956c19622651864f42f854247b54b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2016-10-10 10:02:40 +02:00
parent daf5d3cf13
commit e6dd52f836
2 changed files with 14 additions and 15 deletions

View File

@ -60,8 +60,8 @@ QFbCursor::QFbCursor(QFbScreen *screen)
mScreen(screen),
mDirty(false),
mOnScreen(false),
mGraphic(0),
mDeviceListener(0)
mCursorImage(nullptr),
mDeviceListener(nullptr)
{
QByteArray hideCursorVal = qgetenv("QT_QPA_FB_HIDECURSOR");
if (!hideCursorVal.isEmpty())
@ -69,7 +69,7 @@ QFbCursor::QFbCursor(QFbScreen *screen)
if (!mVisible)
return;
mGraphic = new QPlatformCursorImage(0, 0, 0, 0, 0, 0);
mCursorImage = new QPlatformCursorImage(0, 0, 0, 0, 0, 0);
setCursor(Qt::ArrowCursor);
mDeviceListener = new QFbCursorDeviceListener(this);
@ -85,8 +85,8 @@ QFbCursor::~QFbCursor()
QRect QFbCursor::getCurrentRect()
{
QRect rect = mGraphic->image()->rect().translated(-mGraphic->hotspot().x(),
-mGraphic->hotspot().y());
QRect rect = mCursorImage->image()->rect().translated(-mCursorImage->hotspot().x(),
-mCursorImage->hotspot().y());
rect.translate(m_pos);
QPoint mScreenOffset = mScreen->geometry().topLeft();
rect.translate(-mScreenOffset); // global to local translation
@ -133,7 +133,7 @@ QRect QFbCursor::drawCursor(QPainter & painter)
return QRect();
mPrevRect = mCurrentRect;
painter.drawImage(mPrevRect, *mGraphic->image());
painter.drawImage(mPrevRect, *mCursorImage->image());
mOnScreen = true;
return mPrevRect;
}
@ -149,17 +149,17 @@ QRect QFbCursor::dirtyRect()
void QFbCursor::setCursor(Qt::CursorShape shape)
{
mGraphic->set(shape);
mCursorImage->set(shape);
}
void QFbCursor::setCursor(const QImage &image, int hotx, int hoty)
{
mGraphic->set(image, hotx, hoty);
mCursorImage->set(image, hotx, hoty);
}
void QFbCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
{
mGraphic->set(data, mask, width, height, hotX, hotY);
mCursorImage->set(data, mask, width, height, hotX, hotY);
}
#ifndef QT_NO_CURSOR

View File

@ -87,11 +87,11 @@ public:
virtual QRect drawCursor(QPainter &painter);
// input methods
void pointerEvent(const QMouseEvent &event) Q_DECL_OVERRIDE;
QPoint pos() const Q_DECL_OVERRIDE;
void setPos(const QPoint &pos) Q_DECL_OVERRIDE;
void pointerEvent(const QMouseEvent &event) override;
QPoint pos() const override;
void setPos(const QPoint &pos) override;
#ifndef QT_NO_CURSOR
void changeCursor(QCursor *widgetCursor, QWindow *window) Q_DECL_OVERRIDE;
void changeCursor(QCursor *widgetCursor, QWindow *window) override;
#endif
virtual void setDirty();
@ -113,7 +113,7 @@ private:
QRect mPrevRect; // last place the cursor was drawn
bool mDirty;
bool mOnScreen;
QPlatformCursorImage *mGraphic;
QPlatformCursorImage *mCursorImage;
QFbCursorDeviceListener *mDeviceListener;
QPoint m_pos;
};
@ -121,4 +121,3 @@ private:
QT_END_NAMESPACE
#endif // QFBCURSOR_P_H