Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kumir2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kumir
kumir2
Commits
fb46a688
Commit
fb46a688
authored
Oct 10, 2014
by
Victor Yacovlev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt non-latin shortcuts bug workaround (#kumir2-1769)
parent
e4c98df2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
5 deletions
+43
-5
src/plugins/editor/CMakeLists.txt
src/plugins/editor/CMakeLists.txt
+1
-0
src/plugins/editor/editor.cpp
src/plugins/editor/editor.cpp
+19
-0
src/plugins/editor/editor.h
src/plugins/editor/editor.h
+1
-0
src/plugins/editor/editorplane.cpp
src/plugins/editor/editorplane.cpp
+21
-5
src/plugins/editor/editorplane.h
src/plugins/editor/editorplane.h
+1
-0
No files found.
src/plugins/editor/CMakeLists.txt
View file @
fb46a688
...
...
@@ -15,6 +15,7 @@ else()
set
(
QT_USE_QTMAIN 1
)
find_package
(
Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml REQUIRED
)
include
(
${
QT_USE_FILE
}
)
add_definitions
(
-DQT_NONLATIN_SHORTCUTS_BUG
)
endif
()
include
(
../../kumir2_plugin.cmake
)
...
...
src/plugins/editor/editor.cpp
View file @
fb46a688
...
...
@@ -407,6 +407,25 @@ void EditorInstance::updateInsertMenu()
editMacros_
->
setEnabled
(
userMacros_
.
size
()
>
0
);
}
bool
EditorInstance
::
tryEscKeyAction
(
const
QString
&
text
)
{
if
(
text
.
length
()
!=
1
&&
text
.
at
(
0
).
toAscii
())
{
return
false
;
// workarund required only for non-latin keys
}
const
QList
<
Macro
>
allMacros
=
systemMacros_
+
userMacros_
;
const
QChar
ch
=
text
.
at
(
0
);
foreach
(
const
Macro
&
m
,
allMacros
)
{
bool
keyMatch
=
m
.
key
==
ch
;
bool
enabled
=
m
.
action
&&
m
.
action
->
isEnabled
();
if
(
keyMatch
&&
enabled
)
{
m
.
action
->
trigger
();
return
true
;
}
}
return
false
;
}
void
EditorInstance
::
playMacro
()
{
QAction
*
a
=
qobject_cast
<
QAction
*>
(
sender
());
...
...
src/plugins/editor/editor.h
View file @
fb46a688
...
...
@@ -101,6 +101,7 @@ public slots:
void
changeGlobalState
(
quint32
prevv
,
quint32
currentt
);
void
updateSettings
(
const
QStringList
&
keys
);
void
updateInsertMenu
();
bool
tryEscKeyAction
(
const
QString
&
text
);
signals:
void
urlsDragAndDropped
(
const
QList
<
QUrl
>
&
);
...
...
src/plugins/editor/editorplane.cpp
View file @
fb46a688
...
...
@@ -44,6 +44,7 @@ EditorPlane::EditorPlane(EditorInstance * editor)
,
pnt_dropPosCorner
(
QPoint
(
-
1000
,
-
1000
))
,
selectionInProgressFlag_
(
false
)
,
marginHintBox_
(
new
QLabel
(
this
,
Qt
::
ToolTip
))
,
escPressFlag_
(
false
)
{
if
(
editor
->
analizer
())
{
caseInsensitive_
=
editor
->
analizer
()
->
plugin
()
->
caseInsensitiveGrammatic
();
...
...
@@ -124,6 +125,7 @@ void EditorPlane::contextMenuEvent(QContextMenuEvent *e)
*/
void
EditorPlane
::
mousePressEvent
(
QMouseEvent
*
e
)
{
escPressFlag_
=
false
;
emit
message
(
QString
());
// Ensure auto scrolling by timer is stopped
emit
requestAutoScroll
(
0
);
...
...
@@ -1220,6 +1222,13 @@ void EditorPlane::keyReleaseEvent(QKeyEvent *e)
if
(
e
->
key
()
==
Qt
::
Key_Shift
||
(
e
->
key
()
==-
1
&&
e
->
modifiers
()
&
Qt
::
ShiftModifier
))
{
Utils
::
shiftKeyPressed
=
false
;
}
if
(
Qt
::
Key_Escape
==
e
->
key
()
&&
e
->
modifiers
()
==
0
)
{
escPressFlag_
=
true
;
}
else
{
escPressFlag_
=
false
;
}
if
(
editor_
->
cursor
()
->
isEnabled
())
{
e
->
accept
();
}
...
...
@@ -1513,11 +1522,17 @@ void EditorPlane::keyPressEvent(QKeyEvent *e)
!
e
->
modifiers
().
testFlag
(
Qt
::
ControlModifier
)
&&
!
ignoreTextEvent
)
{
editor_
->
cursor
()
->
evaluateCommand
(
Utils
::
textByKey
(
Qt
::
Key
(
e
->
key
())
,
e
->
text
()
,
e
->
modifiers
().
testFlag
(
Qt
::
ShiftModifier
)
,
editor_
->
isTeacherMode
()
&&
editor_
->
analizer
()
));
bool
escSequence
=
false
;
#ifdef QT_NONLATIN_SHORTCUTS_BUG
escSequence
=
escPressFlag_
&&
editor_
->
tryEscKeyAction
(
e
->
text
());
#endif
if
(
!
escSequence
)
{
editor_
->
cursor
()
->
evaluateCommand
(
Utils
::
textByKey
(
Qt
::
Key
(
e
->
key
())
,
e
->
text
()
,
e
->
modifiers
().
testFlag
(
Qt
::
ShiftModifier
)
,
editor_
->
isTeacherMode
()
&&
editor_
->
analizer
()
));
}
}
Qt
::
Key
tempSwichLayoutKey
=
Qt
::
Key
(
...
...
@@ -1534,6 +1549,7 @@ void EditorPlane::keyPressEvent(QKeyEvent *e)
}
findCursor
();
}
escPressFlag_
=
false
;
if
(
e
->
key
()
>=
Qt
::
Key_F1
&&
e
->
key
()
<=
Qt
::
Key_F35
)
e
->
ignore
();
else
...
...
src/plugins/editor/editorplane.h
View file @
fb46a688
...
...
@@ -120,6 +120,7 @@ private:
QList
<
QAction
*>
contextMenuActions_
;
QLabel
*
marginHintBox_
;
bool
escPressFlag_
;
signals:
void
urlsDragAndDropped
(
const
QList
<
QUrl
>
&
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment