qskIsButtonPressKey moved to QskEvent.h, Qt5 build break fixed
This commit is contained in:
parent
dae0cd7b1b
commit
5246f618a7
@ -10,37 +10,9 @@
|
|||||||
|
|
||||||
#include <qbasictimer.h>
|
#include <qbasictimer.h>
|
||||||
|
|
||||||
QSK_QT_PRIVATE_BEGIN
|
|
||||||
#include <private/qguiapplication_p.h>
|
|
||||||
QSK_QT_PRIVATE_END
|
|
||||||
|
|
||||||
#include <qpa/qplatformtheme.h>
|
|
||||||
|
|
||||||
QSK_SYSTEM_STATE( QskAbstractButton, Checked, QskAspect::LastSystemState >> 3 )
|
QSK_SYSTEM_STATE( QskAbstractButton, Checked, QskAspect::LastSystemState >> 3 )
|
||||||
QSK_SYSTEM_STATE( QskAbstractButton, Pressed, QskAspect::LastSystemState >> 2 )
|
QSK_SYSTEM_STATE( QskAbstractButton, Pressed, QskAspect::LastSystemState >> 2 )
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
|
||||||
|
|
||||||
static inline QList< Qt::Key > qskButtonPressKeys()
|
|
||||||
{
|
|
||||||
const auto hint = QGuiApplicationPrivate::platformTheme()->themeHint(
|
|
||||||
QPlatformTheme::ButtonPressKeys );
|
|
||||||
|
|
||||||
return hint.value< QList< Qt::Key > >();
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static inline QList< Qt::Key > qskButtonPressKeys()
|
|
||||||
{
|
|
||||||
static const QList< Qt::Key > keys =
|
|
||||||
{ Qt::Key_Space, Qt::Key_Enter, Qt::Key_Return, Qt::Key_Select };
|
|
||||||
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static QskAbstractButton* qskCheckedSibling( const QskAbstractButton * button )
|
static QskAbstractButton* qskCheckedSibling( const QskAbstractButton * button )
|
||||||
{
|
{
|
||||||
const auto parentItem = button->parentItem();
|
const auto parentItem = button->parentItem();
|
||||||
@ -292,7 +264,7 @@ bool QskAbstractButton::event( QEvent* event )
|
|||||||
|
|
||||||
void QskAbstractButton::keyPressEvent( QKeyEvent* event )
|
void QskAbstractButton::keyPressEvent( QKeyEvent* event )
|
||||||
{
|
{
|
||||||
if ( qskButtonPressKeys().contains( event->key() ) )
|
if ( qskIsButtonPressKey( event ) )
|
||||||
{
|
{
|
||||||
if ( !event->isAutoRepeat() )
|
if ( !event->isAutoRepeat() )
|
||||||
setPressed( true );
|
setPressed( true );
|
||||||
@ -306,7 +278,7 @@ void QskAbstractButton::keyPressEvent( QKeyEvent* event )
|
|||||||
|
|
||||||
void QskAbstractButton::keyReleaseEvent( QKeyEvent* event )
|
void QskAbstractButton::keyReleaseEvent( QKeyEvent* event )
|
||||||
{
|
{
|
||||||
if ( qskButtonPressKeys().contains( event->key() ) )
|
if ( qskIsButtonPressKey( event ) )
|
||||||
{
|
{
|
||||||
releaseButton();
|
releaseButton();
|
||||||
return;
|
return;
|
||||||
|
@ -12,12 +12,6 @@
|
|||||||
|
|
||||||
#include <qquickwindow.h>
|
#include <qquickwindow.h>
|
||||||
|
|
||||||
QSK_QT_PRIVATE_BEGIN
|
|
||||||
#include <private/qguiapplication_p.h>
|
|
||||||
QSK_QT_PRIVATE_END
|
|
||||||
|
|
||||||
#include <qpa/qplatformtheme.h>
|
|
||||||
|
|
||||||
QSK_SUBCONTROL( QskComboBox, Panel )
|
QSK_SUBCONTROL( QskComboBox, Panel )
|
||||||
QSK_SUBCONTROL( QskComboBox, Graphic )
|
QSK_SUBCONTROL( QskComboBox, Graphic )
|
||||||
QSK_SUBCONTROL( QskComboBox, Text )
|
QSK_SUBCONTROL( QskComboBox, Text )
|
||||||
@ -26,28 +20,6 @@ QSK_SUBCONTROL( QskComboBox, Splash )
|
|||||||
|
|
||||||
QSK_SYSTEM_STATE( QskComboBox, PopupOpen, QskAspect::FirstSystemState << 1 )
|
QSK_SYSTEM_STATE( QskComboBox, PopupOpen, QskAspect::FirstSystemState << 1 )
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
|
||||||
|
|
||||||
static inline QList< Qt::Key > qskButtonPressKeys()
|
|
||||||
{
|
|
||||||
const auto hint = QGuiApplicationPrivate::platformTheme()->themeHint(
|
|
||||||
QPlatformTheme::ButtonPressKeys );
|
|
||||||
|
|
||||||
return hint.value< QList< Qt::Key > >();
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static inline QList< Qt::Key > qskButtonPressKeys()
|
|
||||||
{
|
|
||||||
static const QList< Qt::Key > keys =
|
|
||||||
{ Qt::Key_Space, Qt::Key_Enter, Qt::Key_Return, Qt::Key_Select };
|
|
||||||
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class QskComboBox::PrivateData
|
class QskComboBox::PrivateData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -212,7 +184,7 @@ void QskComboBox::mouseReleaseEvent( QMouseEvent* )
|
|||||||
|
|
||||||
void QskComboBox::keyPressEvent( QKeyEvent* event )
|
void QskComboBox::keyPressEvent( QKeyEvent* event )
|
||||||
{
|
{
|
||||||
if ( qskButtonPressKeys().contains( event->key() ) )
|
if ( qskIsButtonPressKey( event ) )
|
||||||
{
|
{
|
||||||
if ( !event->isAutoRepeat() )
|
if ( !event->isAutoRepeat() )
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,15 @@
|
|||||||
|
|
||||||
#include <qevent.h>
|
#include <qevent.h>
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
|
||||||
|
QSK_QT_PRIVATE_BEGIN
|
||||||
|
#include <private/qguiapplication_p.h>
|
||||||
|
QSK_QT_PRIVATE_END
|
||||||
|
|
||||||
|
#include <qpa/qplatformtheme.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static void qskRegisterEventTypes()
|
static void qskRegisterEventTypes()
|
||||||
{
|
{
|
||||||
// We don't ask QEvent::registerEventType for unique ids as it prevents
|
// We don't ask QEvent::registerEventType for unique ids as it prevents
|
||||||
@ -125,6 +134,31 @@ bool qskIsStandardKeyInput( const QKeyEvent* event, QKeySequence::StandardKey ke
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool qskIsButtonPressKey( const QKeyEvent* event )
|
||||||
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
|
||||||
|
const auto hint = QGuiApplicationPrivate::platformTheme()->themeHint(
|
||||||
|
QPlatformTheme::ButtonPressKeys );
|
||||||
|
|
||||||
|
const auto keys = hint.value< QList< Qt::Key > >();
|
||||||
|
return keys.contains( static_cast< Qt::Key >( event->key() ) );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
switch( event->key() )
|
||||||
|
{
|
||||||
|
case Qt::Key_Space:
|
||||||
|
case Qt::Key_Enter:
|
||||||
|
case Qt::Key_Return:
|
||||||
|
case Qt::Key_Select:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
QskEvent::QskEvent( QskEvent::Type type )
|
QskEvent::QskEvent( QskEvent::Type type )
|
||||||
: QEvent( static_cast< QEvent::Type >( type ) )
|
: QEvent( static_cast< QEvent::Type >( type ) )
|
||||||
{
|
{
|
||||||
|
@ -176,5 +176,6 @@ QSK_EXPORT qreal qskWheelIncrement( const QWheelEvent* );
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QSK_EXPORT bool qskIsStandardKeyInput( const QKeyEvent*, QKeySequence::StandardKey );
|
QSK_EXPORT bool qskIsStandardKeyInput( const QKeyEvent*, QKeySequence::StandardKey );
|
||||||
|
QSK_EXPORT bool qskIsButtonPressKey( const QKeyEvent* );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user