Add an AltGr key; full-mode letters flick to their AltGr symbol

The right alt in full mode is now AltGr: sticky like the other modifiers,
it types the keymap's third/fourth level (sk: AltGr+J = ') instead of an
Alt shortcut. In hold-keys mode it holds the physical right alt, since
KWin resets the modifier state after an ISO_Level3_Shift keysym.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-30 23:59:37 +01:00
co-authored by Claude Opus 5.5
parent 441c1d615b
commit b50667e508
18 changed files with 167 additions and 52 deletions
+6 -6
View File
@@ -48,9 +48,9 @@ QVariant LayoutModel::data(const QModelIndex &index, int role) const
const KeyDef &key = m_keys.at(index.row());
const QRectF rect = m_rects.value(index.row());
switch (role) {
case LabelRole: return key.text(m_shiftLevel);
// A shifted key already shows its shifted symbol (! on 1): don't repeat it.
case FlickLabelRole: return m_shiftLevel == ShiftLevel::Shifted && key.flick == key.shifted ? QString() : key.flick;
case LabelRole: return key.text(m_keyLevel);
// A shifted or AltGr key may already show its flick symbol (! on 1): don't repeat it.
case FlickLabelRole: return key.flick == key.text(m_keyLevel) ? QString() : key.flick;
case ModifierRole: return key.modifier;
case KeyTypeRole: return keyTypeName(key.type);
case KeyXRole: return rect.x();
@@ -133,11 +133,11 @@ void LayoutModel::setSize(QSizeF size)
Q_EMIT dataChanged(index(0), index(rowCount() - 1), {KeyXRole, KeyYRole, KeyWidthRole, KeyHeightRole});
}
void LayoutModel::setShiftLevel(ShiftLevel level)
void LayoutModel::setKeyLevel(KeyLevel level)
{
if (level == m_shiftLevel)
if (level == m_keyLevel)
return;
m_shiftLevel = level;
m_keyLevel = level;
if (!m_keys.isEmpty())
Q_EMIT dataChanged(index(0), index(rowCount() - 1), {LabelRole, FlickLabelRole});
}