1#ifndef QWT_QT5QT6_COMPAT_HPP
2#define QWT_QT5QT6_COMPAT_HPP
3#include <QtCore/QtGlobal>
4#include <QtCore/QObject>
5#include <QtCore/QTimeZone>
6#include <QtGui/QMouseEvent>
7#include <QtGui/QKeyEvent>
8#include <QtGui/QWheelEvent>
9#include <QtGui/QFontMetrics>
10#include <QtGui/QFontMetricsF>
28template<
typename EventType >
31#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
34 return event->position().toPoint();
44template<
typename EventType >
47#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
48 return event->pos().x();
50 return static_cast< int >(
event->position().x());
60template<
typename EventType >
63#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
64 return event->pos().y();
66 return static_cast< int >(
event->position().y());
78#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
81 return fm.horizontalAdvance(str);
93#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
96 return fm.horizontalAdvance(str);
119#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
122 return e->angleDelta().y();
133#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
134 return QTimeZone::utc();
136 return QTimeZone(
"UTC");
146 return QTimeZone::systemTimeZone();
158#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
159 return QTimeZone::fromSecondsAheadOfUtc(seconds);
161 return QTimeZone(seconds);
int eventPosX(EventType *event)
Get the x coordinate of the event
Definition qwt_qt5qt6_compat.hpp:45
int horizontalAdvance(const QFontMetrics &fm, const QString &str)
Calculate the horizontal advance of a string (integer version)
Definition qwt_qt5qt6_compat.hpp:76
QTimeZone systemTimeZone()
Get the system time zone
Definition qwt_qt5qt6_compat.hpp:144
QTimeZone utcTimeZone()
Get the UTC time zone
Definition qwt_qt5qt6_compat.hpp:131
int wheelEventDelta(QWheelEvent *e)
Get vertical wheel delta value compatible with Qt5 and Qt6
Definition qwt_qt5qt6_compat.hpp:117
QPoint eventPos(EventType *event)
Get the event position (QPoint)
Definition qwt_qt5qt6_compat.hpp:29
QTimeZone offsetTimeZone(int seconds)
Create a time zone from an offset in seconds ahead of UTC
Definition qwt_qt5qt6_compat.hpp:156
qreal horizontalAdvanceF(const QFontMetricsF &fm, const QString &str)
Calculate the horizontal advance of a string (floating-point version)
Definition qwt_qt5qt6_compat.hpp:91
int eventPosY(EventType *event)
Get the y coordinate of the event
Definition qwt_qt5qt6_compat.hpp:61