11#if QT_VERSION >= QT_VERSION_CHECK( 6, 4, 0 )
12 #include "QskPlatform.h"
13 #include <qpa/qplatformtheme.h>
16static void qskRegisterEventTypes()
23 for (
int i = QskEvent::NoEvent; i <= QskEvent::MaxEvent; i++ )
25 const int id = QEvent::registerEventType( i );
30Q_CONSTRUCTOR_FUNCTION( qskRegisterEventTypes )
32int qskFocusChainIncrement(
const QEvent* event )
34 if ( event && event->type() == QEvent::KeyPress )
36 const auto keyEvent =
static_cast< const QKeyEvent*
>( event );
37 if ( !( keyEvent->modifiers() & ( Qt::ControlModifier | Qt::AltModifier ) ) )
39 switch ( keyEvent->key() )
53QPointF qskMousePosition(
const QMouseEvent* event )
55#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
56 return event->position();
58 return event->localPos();
62QPointF qskMouseScenePosition(
const QMouseEvent* event )
64#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
65 return event->scenePosition();
67 return event->windowPos();
71QPointF qskHoverPosition(
const QHoverEvent* event )
73#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
74 return event->position();
80#ifndef QT_NO_WHEELEVENT
82QPointF qskWheelPosition(
const QWheelEvent* event )
84 return event->position();
89#ifndef QT_NO_WHEELEVENT
91qreal qskWheelSteps(
const QWheelEvent* event )
93 const auto angleDelta =
event->angleDelta();
95 const qreal delta = angleDelta.y() ? angleDelta.y() : angleDelta.x();
96 return delta / QWheelEvent::DefaultDeltasPerStep;
99qreal qskWheelIncrement(
const QWheelEvent* event )
107 auto angleDelta =
event->angleDelta();
109 if ( event->inverted() )
110 angleDelta.setY( -angleDelta.y() );
112 const qreal delta = angleDelta.y() ? angleDelta.y() : angleDelta.x();
113 return delta / QWheelEvent::DefaultDeltasPerStep;
118bool qskIsStandardKeyInput(
const QKeyEvent* event, QKeySequence::StandardKey key )
121 return event->matches( key );
123 constexpr auto mask = ~( Qt::KeypadModifier | Qt::GroupSwitchModifier );
126 const auto theme = qskPlatformTheme();
127 const auto bindings = theme->keyBindings( ( event->modifiers() | event->key() ) & mask );
129 return bindings.contains( QKeySequence(searchkey) );
133bool qskIsButtonPressKey(
const QKeyEvent* event )
135#if QT_VERSION >= QT_VERSION_CHECK( 6, 4, 0 )
137 const auto hint = qskPlatformTheme()->themeHint( QPlatformTheme::ButtonPressKeys );
139 const auto keys = hint.value< QList< Qt::Key > >();
140 return keys.contains(
static_cast< Qt::Key
>( event->key() ) );
144 switch( event->key() )
157bool qskIsTouchOrMouseEvent( QEvent::Type type )
161 case QEvent::MouseButtonPress:
162 case QEvent::MouseMove:
163 case QEvent::MouseButtonRelease:
164 case QEvent::MouseButtonDblClick:
165 case QEvent::UngrabMouse:
167 case QEvent::TouchBegin:
168 case QEvent::TouchCancel:
169 case QEvent::TouchUpdate:
170 case QEvent::TouchEnd:
179QskEvent::QskEvent( QskEvent::Type type )
180 : QEvent( static_cast< QEvent::Type >( type ) )
184#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
194QskGeometryChangeEvent::QskGeometryChangeEvent(
195 const QRectF& rect,
const QRectF& oldRect )
198 , m_oldRect( oldRect )
207bool QskGeometryChangeEvent::isResized()
const
209 return ( m_rect.width() != m_oldRect.width() ) ||
210 ( m_rect.height() != m_oldRect.height() );
213bool QskGeometryChangeEvent::isMoved()
const
215 return ( m_rect.x() != m_oldRect.x() ) ||
216 ( m_rect.y() != m_oldRect.y() );
221QskWindowChangeEvent::QskWindowChangeEvent(
222 QQuickWindow* oldWindow, QQuickWindow* window )
224 , m_oldWindow( oldWindow )
236QskPopupEvent::QskPopupEvent( Type type,
QskPopup* popup )
249QskGestureEvent::QskGestureEvent( std::shared_ptr< const QskGesture > gesture )
251 , m_gesture( gesture )
262QskAnimatorEvent::QskAnimatorEvent(
QskAspect aspect,
int index, State state )
277QskGestureFilterEvent::QskGestureFilterEvent(
278 const QQuickItem* item,
const QEvent* event )
282 , m_maybeGesture( false )
Lookup key for a QskSkinHintTable.