Handle differences between Qt5 and Qt6.
More...
|
| template<typename EventType > |
| QPoint | eventPos (EventType *event) |
| | Get the event position (QPoint)
|
| |
| template<typename EventType > |
| int | eventPosX (EventType *event) |
| | Get the x coordinate of the event.
|
| |
| template<typename EventType > |
| int | eventPosY (EventType *event) |
| | Get the y coordinate of the event.
|
| |
| int | horizontalAdvance (const QFontMetrics &fm, const QString &str) |
| | Calculate the horizontal advance of a string (integer version)
|
| |
| qreal | horizontalAdvanceF (const QFontMetricsF &fm, const QString &str) |
| | Calculate the horizontal advance of a string (floating-point version)
|
| |
| int | wheelEventDelta (QWheelEvent *e) |
| | Get vertical wheel delta value compatible with Qt5 and Qt6.
|
| |
| QTimeZone | utcTimeZone () |
| | Get the UTC time zone.
|
| |
| QTimeZone | systemTimeZone () |
| | Get the system time zone.
|
| |
| QTimeZone | offsetTimeZone (int seconds) |
| | Create a time zone from an offset in seconds ahead of UTC.
|
| |
Handle differences between Qt5 and Qt6.
◆ eventPos()
template<typename EventType >
| QPoint qwt::compat::eventPos |
( |
EventType * |
event | ) |
|
|
inline |
Get the event position (QPoint)
- Template Parameters
-
| EventType | Event type (must support pos() or position() method) |
- Parameters
-
- Returns
- Event position as QPoint
◆ eventPosX()
template<typename EventType >
| int qwt::compat::eventPosX |
( |
EventType * |
event | ) |
|
|
inline |
Get the x coordinate of the event.
- Template Parameters
-
- Parameters
-
- Returns
- x coordinate (integer)
◆ eventPosY()
template<typename EventType >
| int qwt::compat::eventPosY |
( |
EventType * |
event | ) |
|
|
inline |
Get the y coordinate of the event.
- Template Parameters
-
- Parameters
-
- Returns
- y coordinate (integer)
◆ horizontalAdvance()
| int qwt::compat::horizontalAdvance |
( |
const QFontMetrics & |
fm, |
|
|
const QString & |
str |
|
) |
| |
|
inline |
Calculate the horizontal advance of a string (integer version)
- Parameters
-
| fm | QFontMetrics object |
| str | Target string |
- Returns
- Width (integer)
◆ horizontalAdvanceF()
| qreal qwt::compat::horizontalAdvanceF |
( |
const QFontMetricsF & |
fm, |
|
|
const QString & |
str |
|
) |
| |
|
inline |
Calculate the horizontal advance of a string (floating-point version)
- Parameters
-
| fm | QFontMetricsF object |
| str | Target string |
- Returns
- Width (floating-point)
◆ offsetTimeZone()
| QTimeZone qwt::compat::offsetTimeZone |
( |
int |
seconds | ) |
|
|
inline |
Create a time zone from an offset in seconds ahead of UTC.
- Parameters
-
| seconds | Offset in seconds from UTC |
- Returns
- QTimeZone with the given offset
- Note
- QTimeZone::fromSecondsAheadOfUtc() is available since Qt 6.4; for earlier versions the deprecated integer constructor is used.
◆ systemTimeZone()
| QTimeZone qwt::compat::systemTimeZone |
( |
| ) |
|
|
inline |
Get the system time zone.
- Returns
- QTimeZone representing the system's local time zone
◆ utcTimeZone()
| QTimeZone qwt::compat::utcTimeZone |
( |
| ) |
|
|
inline |
Get the UTC time zone.
- Returns
- QTimeZone representing UTC
- Note
- QTimeZone::utc() is available since Qt 6.5; for earlier versions the constructor with the IANA ID "UTC" is used.
◆ wheelEventDelta()
| int qwt::compat::wheelEventDelta |
( |
QWheelEvent * |
e | ) |
|
|
inline |
Get vertical wheel delta value compatible with Qt5 and Qt6.
This function provides a unified interface to retrieve the vertical scroll delta from a QWheelEvent, supporting both Qt5 (using delta()) and Qt6 (using angleDelta().y()) without changing the calling code.
The return value represents the vertical scroll amount:
- Positive value: Wheel scrolled up
- Negative value: Wheel scrolled down
- The magnitude follows the standard wheel step (typically ±120 per notch)
- Parameters
-
| e | Pointer to the QWheelEvent object (must not be nullptr) |
- Returns
- Integer delta value of vertical wheel movement
- Note
- The function only returns vertical wheel delta (ignores horizontal scroll via angleDelta().x())
- Warning
- Ensure the input QWheelEvent pointer is valid to avoid null pointer dereference