Use QWindowSystemInterface::handleWheelEvent.
This commit is contained in:
parent
ed00cd2809
commit
08f8054866
1 changed files with 10 additions and 12 deletions
|
|
@ -25,6 +25,7 @@
|
||||||
#include <QtWidgets/QStyleFactory>
|
#include <QtWidgets/QStyleFactory>
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
#include <qpa/qplatformnativeinterface.h>
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
|
#include <qpa/qwindowsysteminterface.h>
|
||||||
|
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#include <uxtheme.h>
|
#include <uxtheme.h>
|
||||||
|
|
@ -32,8 +33,6 @@
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QMargins);
|
Q_DECLARE_METATYPE(QMargins);
|
||||||
|
|
||||||
bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event);
|
|
||||||
|
|
||||||
namespace Ui::Platform {
|
namespace Ui::Platform {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
@ -422,20 +421,19 @@ void WindowHelper::handleDirectManipulationEvent(
|
||||||
using Type = DirectManipulationEventType;
|
using Type = DirectManipulationEventType;
|
||||||
const auto send = [&](Qt::ScrollPhase phase) {
|
const auto send = [&](Qt::ScrollPhase phase) {
|
||||||
if (const auto windowHandle = window()->windowHandle()) {
|
if (const auto windowHandle = window()->windowHandle()) {
|
||||||
const auto global = QCursor::pos();
|
auto global = POINT();
|
||||||
const auto local = windowHandle->mapFromGlobal(global);
|
::GetCursorPos(&global);
|
||||||
auto e = QWheelEvent(
|
auto local = global;
|
||||||
QPointF(local),
|
::ScreenToClient(_handle, &local);
|
||||||
QPointF(global),
|
QWindowSystemInterface::handleWheelEvent(
|
||||||
|
windowHandle,
|
||||||
|
QPointF(local.x, local.y),
|
||||||
|
QPointF(global.x, global.y),
|
||||||
event.delta,
|
event.delta,
|
||||||
event.delta,
|
event.delta,
|
||||||
QGuiApplication::mouseButtons(),
|
|
||||||
QGuiApplication::keyboardModifiers(),
|
QGuiApplication::keyboardModifiers(),
|
||||||
phase,
|
phase,
|
||||||
false,
|
Qt::MouseEventSynthesizedBySystem);
|
||||||
Qt::MouseEventSynthesizedByApplication);
|
|
||||||
e.setTimestamp(crl::now());
|
|
||||||
qt_sendSpontaneousEvent(windowHandle, &e);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue