Full keyboard mode, Ctrl/Alt/Super, dead keys, shift levels
- Full (iPad Pro) mode: every typing key from the keymap, number row, tab, caps lock, ctrl/super/alt; shifted symbol shown above and flickable - Dead keys compose with the locale's XKB compose table - Ctrl/Alt/Super stick like shift and turn keys into shortcuts; a tapped or held shift joins shortcuts and non-text keys, auto-shift and caps lock don't - Auto-capitalization and caps lock only capitalize letters; the user's shift picks the keymap's shifted level - Mode switch in settings keeps key size by resizing the window Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#include "Modifiers.h"
|
||||
|
||||
ShiftState *Modifiers::find(const QString &name)
|
||||
{
|
||||
for (Entry &entry : m_entries) {
|
||||
if (name == QLatin1StringView(entry.name))
|
||||
return &entry.state;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Modifiers::press(const QString &name, qint64 timeMs)
|
||||
{
|
||||
if (ShiftState *state = find(name))
|
||||
state->press(timeMs);
|
||||
}
|
||||
|
||||
void Modifiers::release(const QString &name)
|
||||
{
|
||||
if (ShiftState *state = find(name))
|
||||
state->release();
|
||||
}
|
||||
|
||||
void Modifiers::keyTyped()
|
||||
{
|
||||
for (Entry &entry : m_entries)
|
||||
entry.state.characterTyped();
|
||||
}
|
||||
|
||||
void Modifiers::clear()
|
||||
{
|
||||
for (Entry &entry : m_entries)
|
||||
entry.state = {};
|
||||
}
|
||||
|
||||
Qt::KeyboardModifiers Modifiers::active() const
|
||||
{
|
||||
Qt::KeyboardModifiers flags;
|
||||
for (const Entry &entry : m_entries) {
|
||||
if (entry.state.isActive())
|
||||
flags |= entry.flag;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
QVariantMap Modifiers::modes() const
|
||||
{
|
||||
QVariantMap modes;
|
||||
for (const Entry &entry : m_entries)
|
||||
modes.insert(QString::fromLatin1(entry.name), int(entry.state.mode()));
|
||||
return modes;
|
||||
}
|
||||
Reference in New Issue
Block a user