QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
函数
qwt::compat 命名空间参考

Handle differences between Qt5 and Qt6 更多...

函数

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)

模板参数
EventTypeEvent type (must support pos() or position() method)
参数
eventEvent pointer
返回
Event position as QPoint

◆ eventPosX()

template<typename EventType >
int qwt::compat::eventPosX ( EventType *  event)
inline

Get the x coordinate of the event

模板参数
EventTypeEvent type
参数
eventEvent pointer
返回
x coordinate (integer)

◆ eventPosY()

template<typename EventType >
int qwt::compat::eventPosY ( EventType *  event)
inline

Get the y coordinate of the event

模板参数
EventTypeEvent type
参数
eventEvent pointer
返回
y coordinate (integer)

◆ horizontalAdvance()

int qwt::compat::horizontalAdvance ( const QFontMetrics &  fm,
const QString &  str 
)
inline

Calculate the horizontal advance of a string (integer version)

参数
fmQFontMetrics object
strTarget string
返回
Width (integer)

◆ horizontalAdvanceF()

qreal qwt::compat::horizontalAdvanceF ( const QFontMetricsF &  fm,
const QString &  str 
)
inline

Calculate the horizontal advance of a string (floating-point version)

参数
fmQFontMetricsF object
strTarget string
返回
Width (floating-point)

◆ offsetTimeZone()

QTimeZone qwt::compat::offsetTimeZone ( int  seconds)
inline

Create a time zone from an offset in seconds ahead of UTC

参数
secondsOffset in seconds from UTC
返回
QTimeZone with the given offset
注解
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

返回
QTimeZone representing the system's local time zone

◆ utcTimeZone()

QTimeZone qwt::compat::utcTimeZone ( )
inline

Get the UTC time zone

返回
QTimeZone representing UTC
注解
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)
参数
ePointer to the QWheelEvent object (must not be nullptr)
返回
Integer delta value of vertical wheel movement
注解
The function only returns vertical wheel delta (ignores horizontal scroll via angleDelta().x())
警告
Ensure the input QWheelEvent pointer is valid to avoid null pointer dereference