keyboard: Store ints rather than Qt::Keys
This commit is contained in:
parent
ee5cffdc79
commit
745adf463e
|
@ -80,8 +80,8 @@ static constexpr const QskInputPanelLayouts qskInputPanelLayouts =
|
||||||
|
|
||||||
QSK_DECLARE_OPERATORS_FOR_FLAGS( Qt::Key ) // Must appear after the LOWER macro
|
QSK_DECLARE_OPERATORS_FOR_FLAGS( Qt::Key ) // Must appear after the LOWER macro
|
||||||
|
|
||||||
static const Qt::Key KeyLocked = static_cast< Qt::Key >( Qt::ControlModifier );
|
static const int KeyLocked = static_cast< int >( Qt::ControlModifier );
|
||||||
static const Qt::Key KeyStates = static_cast< Qt::Key >( Qt::KeyboardModifierMask );
|
static const int KeyStates = static_cast< int >( Qt::KeyboardModifierMask );
|
||||||
|
|
||||||
static qreal qskKeyStretch( Qt::Key key )
|
static qreal qskKeyStretch( Qt::Key key )
|
||||||
{
|
{
|
||||||
|
@ -128,7 +128,7 @@ static qreal qskRowStretch( const QskInputPanel::KeyRow& keyRow )
|
||||||
return stretch;
|
return stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool qskIsAutorepeat( Qt::Key key )
|
static bool qskIsAutorepeat( int key )
|
||||||
{
|
{
|
||||||
return ( key != Qt::Key_Return && key != Qt::Key_Enter
|
return ( key != Qt::Key_Return && key != Qt::Key_Enter
|
||||||
&& key != Qt::Key_Shift && key!= Qt::Key_CapsLock
|
&& key != Qt::Key_Shift && key!= Qt::Key_CapsLock
|
||||||
|
@ -344,7 +344,7 @@ const QskInputPanel::KeyDataSet& QskInputPanel::keyData( Mode mode ) const
|
||||||
return m_data->keyTable[ mode ].data;
|
return m_data->keyTable[ mode ].data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QskInputPanel::textForKey( Qt::Key key ) const
|
QString QskInputPanel::textForKey( int key ) const
|
||||||
{
|
{
|
||||||
key &= ~KeyStates;
|
key &= ~KeyStates;
|
||||||
|
|
||||||
|
@ -703,7 +703,7 @@ QString QskInputPanel::currentTextForKeyIndex( int keyIndex ) const
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::compose( Qt::Key key )
|
void QskInputPanel::compose( int key )
|
||||||
{
|
{
|
||||||
QGuiApplication::inputMethod()->invokeAction(
|
QGuiApplication::inputMethod()->invokeAction(
|
||||||
static_cast< QInputMethod::Action >( Compose ), key );
|
static_cast< QInputMethod::Action >( Compose ), key );
|
||||||
|
@ -715,7 +715,8 @@ void QskInputPanel::selectGroup( int index )
|
||||||
|
|
||||||
if( m_data->selectedGroup >= 0 )
|
if( m_data->selectedGroup >= 0 )
|
||||||
{
|
{
|
||||||
topRow[ m_data->selectedGroup ].key &= ~KeyLocked;
|
auto group = static_cast< int >( m_data->selectedGroup );
|
||||||
|
topRow[ group ].key &= ~KeyLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_data->selectedGroup == index )
|
if( m_data->selectedGroup == index )
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
|
|
||||||
struct KeyData
|
struct KeyData
|
||||||
{
|
{
|
||||||
Qt::Key key = Qt::Key( 0 );
|
int key = 0;
|
||||||
bool isSuggestionKey = false;
|
bool isSuggestionKey = false;
|
||||||
QRectF rect;
|
QRectF rect;
|
||||||
};
|
};
|
||||||
|
@ -100,7 +100,7 @@ public:
|
||||||
|
|
||||||
const KeyDataSet& keyData( QskInputPanel::Mode = CurrentMode ) const;
|
const KeyDataSet& keyData( QskInputPanel::Mode = CurrentMode ) const;
|
||||||
|
|
||||||
QString textForKey( Qt::Key ) const;
|
QString textForKey( int ) const;
|
||||||
QString displayLanguageName() const;
|
QString displayLanguageName() const;
|
||||||
|
|
||||||
QRectF keyboardRect() const;
|
QRectF keyboardRect() const;
|
||||||
|
@ -125,7 +125,7 @@ private:
|
||||||
void createUI();
|
void createUI();
|
||||||
void updateUI(); // e.g. called when updating Pinyin suggestions
|
void updateUI(); // e.g. called when updating Pinyin suggestions
|
||||||
|
|
||||||
void compose( Qt::Key );
|
void compose( int );
|
||||||
void selectGroup( int );
|
void selectGroup( int );
|
||||||
void selectCandidate( int );
|
void selectCandidate( int );
|
||||||
void setCandidateOffset( int );
|
void setCandidateOffset( int );
|
||||||
|
|
Loading…
Reference in New Issue