History

better support for shortcuts

ZappoMan committed 12 years ago

Commit a3d0c201 parent 03f88855 files · +60 −19Browse files

Showing the changes to libraries/script-engine/src/EventTypes.cpp (1 of 5 files). Show all

Unified · Split

libraries/script-engine/src/EventTypes.cpp+24−0
@@ -126,6 +126,30 @@ bool KeyEvent::operator==(const KeyEvent& other) const { · 125 unmodified lines
126126 && other.isKeypad == isKeypad;
127127 }
128128
129+
130+KeyEvent::operator QKeySequence() const {
131+ int resultCode = 0;
132+ if (text >= "a" && text <= "z") {
133+ resultCode = text.toUpper().at(0).unicode();
134+ } else {
135+ resultCode = key;
136+ }
137+
138+ if (isMeta) {
139+ resultCode |= Qt::META;
140+ }
141+ if (isAlt) {
142+ resultCode |= Qt::ALT;
143+ }
144+ if (isControl) {
145+ resultCode |= Qt::CTRL;
146+ }
147+ if (isShifted) {
148+ resultCode |= Qt::SHIFT;
149+ }
150+ return QKeySequence(resultCode);
151+}
152+
129153 QScriptValue keyEventToScriptValue(QScriptEngine* engine, const KeyEvent& event) {
130154 QScriptValue obj = engine->newObject();
131155 obj.setProperty("key", event.key);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t