- fix: can't set shortcut that contains shift and non-alphabet characters
This commit is contained in:
parent
6b64eab16b
commit
a8dc93d4b4
1
NEWS.md
1
NEWS.md
|
@ -5,6 +5,7 @@ Red Panda C++ Version 1.2
|
||||||
- change: reorganization templates in subfolders
|
- change: reorganization templates in subfolders
|
||||||
- enhancement: create template from project
|
- enhancement: create template from project
|
||||||
- fix: can't correctly set project icon
|
- fix: can't correctly set project icon
|
||||||
|
- fix: can't set shortcut that contains shift and non-alphabet characters
|
||||||
|
|
||||||
Red Panda C++ Version 1.1.6
|
Red Panda C++ Version 1.1.6
|
||||||
|
|
||||||
|
|
|
@ -40,14 +40,33 @@ void ShortcutInputEdit::keyPressEvent(QKeyEvent *event)
|
||||||
event->key()==Qt::Key_Shift ||
|
event->key()==Qt::Key_Shift ||
|
||||||
event->key()==Qt::Key_Meta
|
event->key()==Qt::Key_Meta
|
||||||
) {
|
) {
|
||||||
QKeySequence seq(event->modifiers());
|
//setText("");
|
||||||
setText("");
|
return;
|
||||||
|
} else if (event->modifiers()==Qt::ShiftModifier
|
||||||
|
&& !event->text().isEmpty()
|
||||||
|
&& event->text().at(0).unicode()>32
|
||||||
|
&& event->text().at(0).unicode()<127){
|
||||||
|
//setText("");
|
||||||
|
return;
|
||||||
|
} else if (event->modifiers()==Qt::NoModifier
|
||||||
|
&& !event->text().isEmpty()
|
||||||
|
&& event->text().at(0).unicode()>32
|
||||||
|
&& event->text().at(0).unicode()<127){
|
||||||
|
//setText("");
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
int key = event->key();
|
int key = event->key();
|
||||||
if (key==Qt::Key_Backtab)
|
if (key==Qt::Key_Backtab)
|
||||||
key = Qt::Key_Tab;
|
key = Qt::Key_Tab;
|
||||||
QKeySequence seq(event->modifiers()|key);
|
QKeySequence seq(event->modifiers()|key);
|
||||||
setText(seq.toString());
|
QString s=seq.toString();
|
||||||
|
if (event->modifiers().testFlag(Qt::ShiftModifier)
|
||||||
|
&& !event->text().isEmpty()
|
||||||
|
&& event->text().at(0).unicode()>32
|
||||||
|
&& event->text().at(0).unicode()<127) {
|
||||||
|
s = s.mid(0,s.lastIndexOf('+')+1) + event->text().at(0);
|
||||||
|
}
|
||||||
|
setText(s);
|
||||||
if (key!=Qt::Key_Tab
|
if (key!=Qt::Key_Tab
|
||||||
&& key!=Qt::Key_Enter
|
&& key!=Qt::Key_Enter
|
||||||
&& key!=Qt::Key_Return)
|
&& key!=Qt::Key_Return)
|
||||||
|
|
Loading…
Reference in New Issue