Yuhang Zhao
2023-12-19 78f31c67d71ee743f022dd6f5930abae6f6d54f9
src/core/qwkglobal_p.h
@@ -2,8 +2,9 @@
#define QWKGLOBAL_P_H
#include <QtCore/QLoggingCategory>
#include <QtGui/QMouseEvent>
#include <QWKCore/qwkcoreglobal.h>
#include <QWKCore/qwkglobal.h>
QWK_CORE_EXPORT Q_DECLARE_LOGGING_CATEGORY(qWindowKitLog)
@@ -30,4 +31,24 @@
#  define QWK_USED     __attribute__((used))
#endif
namespace QWK {
    inline QPoint getMouseEventScenePos(const QMouseEvent *event) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
        return event->scenePosition().toPoint();
#else
        return event->windowPos().toPoint();
#endif
    }
    inline QPoint getMouseEventGlobalPos(const QMouseEvent *event) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
        return event->globalPosition().toPoint();
#else
        return event->screenPos().toPoint();
#endif
    }
}
#endif // QWKGLOBAL_P_H