Mercurial > octave-dspies
comparison libgui/src/m-editor/octave-qscintilla.cc @ 18954:c6b89c4a9e63 gui-release
Swap Ctrl and Meta in Qscintilla shortcut list for mac (bug #41217)
* octave-qscintilla.cc (octave_qscintilla::octave_qscintilla):
under mac platform, manually swap Ctrl an Meta modifers in Qscintilla's
shortcut list, in order to conform to octave settings.
author | pantxo <pantxo.diribarne@gmail.com> |
---|---|
date | Wed, 23 Jul 2014 08:52:42 +0200 |
parents | 095fdef3d67c |
children | dcb260e7a648 00b1d60500bd |
comparison
equal
deleted
inserted
replaced
18946:0be65bd7f369 | 18954:c6b89c4a9e63 |
---|---|
96 case Qt::Key_T | Qt::CTRL | Qt::SHIFT : // LineCopy | 96 case Qt::Key_T | Qt::CTRL | Qt::SHIFT : // LineCopy |
97 cmd_list.at (i)->setKey (0); | 97 cmd_list.at (i)->setKey (0); |
98 } | 98 } |
99 } | 99 } |
100 #endif | 100 #endif |
101 | |
102 #if defined (Q_OS_MAC) | |
103 // Octave interprets Cmd key as Meta whereas Qscintilla interprets it | |
104 // as Ctrl. We thus invert Meta/Ctrl in Qscintilla's shortcuts list. | |
105 QList< QsciCommand * > cmd_list_mac = cmd_set->commands (); | |
106 for (int i = 0; i < cmd_list_mac.length (); i++) | |
107 { | |
108 // Primary key | |
109 int key = cmd_list_mac.at (i)->key (); | |
110 | |
111 if (static_cast<int> (key | Qt::META) == key && | |
112 static_cast<int> (key | Qt::CTRL) != key) | |
113 key = (key ^ Qt::META) | Qt::CTRL; | |
114 else if (static_cast<int> (key | Qt::CTRL) == key) | |
115 key = (key ^ Qt::CTRL) | Qt::META; | |
116 | |
117 cmd_list_mac.at (i)->setKey (key); | |
118 | |
119 // Alternate key | |
120 key = cmd_list_mac.at (i)->alternateKey (); | |
121 | |
122 if (static_cast<int> (key | Qt::META) == key && | |
123 static_cast<int> (key | Qt::CTRL) != key) | |
124 key = (key ^ Qt::META) | Qt::CTRL; | |
125 else if (static_cast<int> (key | Qt::CTRL) == key) | |
126 key = (key ^ Qt::CTRL) | Qt::META; | |
127 | |
128 cmd_list_mac.at (i)->setAlternateKey (key); | |
129 } | |
130 #endif | |
101 } | 131 } |
102 | 132 |
103 octave_qscintilla::~octave_qscintilla () | 133 octave_qscintilla::~octave_qscintilla () |
104 { } | 134 { } |
105 | 135 |