Windows: Fix QPlatformCursor::pos()/setPos() for DPR scaling.
Task-number: QTBUG-38858 Change-Id: Ibb0355ae19a382e4eb3805fe6d6afab2a2a603e6 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
This commit is contained in:
parent
1d66c9eba8
commit
83dab766fc
@ -44,6 +44,7 @@
|
|||||||
#include "qwindowscontext.h"
|
#include "qwindowscontext.h"
|
||||||
#include "qwindowswindow.h"
|
#include "qwindowswindow.h"
|
||||||
#include "qwindowsscreen.h"
|
#include "qwindowsscreen.h"
|
||||||
|
#include "qwindowsscaling.h"
|
||||||
|
|
||||||
#include <QtGui/QBitmap>
|
#include <QtGui/QBitmap>
|
||||||
#include <QtGui/QImage>
|
#include <QtGui/QImage>
|
||||||
@ -624,9 +625,15 @@ QWindowsCursor::CursorState QWindowsCursor::cursorState()
|
|||||||
return CursorHidden;
|
return CursorHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPoint QWindowsCursor::pos() const
|
||||||
|
{
|
||||||
|
return mousePosition() / QWindowsScaling::factor();
|
||||||
|
}
|
||||||
|
|
||||||
void QWindowsCursor::setPos(const QPoint &pos)
|
void QWindowsCursor::setPos(const QPoint &pos)
|
||||||
{
|
{
|
||||||
SetCursorPos(pos.x(), pos.y());
|
const QPoint posDp = pos * QWindowsScaling::factor();
|
||||||
|
SetCursorPos(posDp.x() , posDp.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -102,7 +102,7 @@ public:
|
|||||||
QWindowsCursor() {}
|
QWindowsCursor() {}
|
||||||
|
|
||||||
void changeCursor(QCursor * widgetCursor, QWindow * widget) Q_DECL_OVERRIDE;
|
void changeCursor(QCursor * widgetCursor, QWindow * widget) Q_DECL_OVERRIDE;
|
||||||
QPoint pos() const Q_DECL_OVERRIDE { return mousePosition(); }
|
QPoint pos() const Q_DECL_OVERRIDE;
|
||||||
void setPos(const QPoint &pos) Q_DECL_OVERRIDE;
|
void setPos(const QPoint &pos) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
static HCURSOR createPixmapCursor(const QPixmap &pixmap, const QPoint &hotSpot);
|
static HCURSOR createPixmapCursor(const QPixmap &pixmap, const QPoint &hotSpot);
|
||||||
|
Loading…
Reference in New Issue
Block a user