Skip to content

Commit

Permalink
Reworked ctrl key
Browse files Browse the repository at this point in the history
  • Loading branch information
a-st committed Nov 5, 2024
1 parent 4f9eca3 commit 9854353
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/de@terminal/qml/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ KeyPad {

height: panel.keyHeight + Device.row_margin;

ControlKey { id: controlKey; label: "strg"; shifted: "ctrl"; anchors.left: parent.left; height: parent.height; }
ControlKey { id: controlKey; label: "strg"; shifted: "strg"; anchors.left: parent.left; height: parent.height; }
SymbolShiftKey { id: symShiftKey; anchors.left: controlKey.right; height: parent.height; }
LanguageKey { id: languageMenuButton; anchors.left: symShiftKey.right; height: parent.height; }
SpaceKey { id: spaceKey; anchors.left: languageMenuButton.right; anchors.right: enterKey.left; noMagnifier: true; height: parent.height; }
Expand Down
35 changes: 34 additions & 1 deletion qml/keys/ControlKey.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,41 @@

import QtQuick 2.4

import QtQuick.Controls 2.12
import QtQuick.Window 2.12
import MaliitKeyboard 2.0

ActionKey {

label: "ctrl"
shifted: "ctrl"
action: "ctrl";
action: "ctrl"

switchBackFromSymbols: true
overridePressArea: true

Rectangle {
anchors.margins: 8
anchors.fill: parent
color: "#888888"
radius: 8 / Screen.devicePixelRatio
opacity: panel.activeKeypadState == "CONTROL" ? 0.25 : 0.0
}

Label {
anchors.centerIn: parent
font.weight: Font.Light
opacity: 0.6
font.pixelSize: parent.fontSize * 0.6
horizontalAlignment: Text.AlignHCenter
}

MouseArea {
anchors.fill: parent

onPressed: {
Feedback.keyPressed();
panel.activeKeypadState = "CONTROL";
}
}
}
2 changes: 1 addition & 1 deletion src/view/abstracttexteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ void AbstractTextEditor::sendKeySequence(const QString &action, const QKeySequen
const int key = actionSequence[i] & ~AllModifiers;
const int modifiers = actionSequence[i] & AllModifiers;
QString text("");
if (modifiers == Qt::NoModifier || modifiers == Qt::ShiftModifier) {
if (modifiers == Qt::NoModifier || modifiers == Qt::ShiftModifier || modifiers == Qt::ControlModifier) {
text = QString(key);
}
sendKeyPressAndReleaseEvents(key, static_cast<Qt::KeyboardModifiers>(modifiers), text);
Expand Down

0 comments on commit 9854353

Please sign in to comment.