Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
什么珏
opencv
提交
35772655
O
opencv
项目概览
什么珏
/
opencv
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
35772655
编写于
6月 01, 2022
作者:
K
Kumataro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
highgui: Qt: waitKey() supports Cyrillic/Japanese keyboard layout
上级
1a24e316
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
9 deletion
+44
-9
modules/highgui/src/window_QT.cpp
modules/highgui/src/window_QT.cpp
+44
-9
未找到文件。
modules/highgui/src/window_QT.cpp
浏览文件 @
35772655
...
...
@@ -2194,23 +2194,58 @@ void CvWindow::displayPropertiesWin()
global_control_panel
->
hide
();
}
static
bool
isTranslatableKey
(
Qt
::
Key
key
)
{
// https://github.com/opencv/opencv/issues/21899
// https://doc.qt.io/qt-5/qt.html#Key-enum
// https://doc.qt.io/qt-6/qt.html#Key-enum
// https://github.com/qt/qtbase/blob/dev/src/testlib/qasciikey.cpp
bool
ret
=
false
;
switch
(
key
)
{
// Special keys
case
Qt
::
Key_Escape
:
case
Qt
::
Key_Tab
:
case
Qt
::
Key_Backtab
:
case
Qt
::
Key_Backspace
:
case
Qt
::
Key_Enter
:
case
Qt
::
Key_Return
:
ret
=
true
;
break
;
// latin-1 keys.
default:
ret
=
(
(
(
Qt
::
Key_Space
<=
key
)
&&
(
key
<=
Qt
::
Key_AsciiTilde
)
)
// 0x20--0x7e
||
(
(
Qt
::
Key_nobreakspace
<=
key
)
&&
(
key
<=
Qt
::
Key_ssharp
)
)
// 0x0a0--0x0de
||
(
key
==
Qt
::
Key_division
)
// 0x0f7
||
(
key
==
Qt
::
Key_ydiaeresis
)
// 0x0ff
);
break
;
}
return
ret
;
}
//Need more test here !
void
CvWindow
::
keyPressEvent
(
QKeyEvent
*
evnt
)
{
//see http://doc.trolltech.com/4.6/qt.html#Key-enum
int
key
=
evnt
->
key
();
const
Qt
::
Key
qtkey
=
static_cast
<
Qt
::
Key
>
(
key
);
Qt
::
Key
qtkey
=
static_cast
<
Qt
::
Key
>
(
key
);
char
asciiCode
=
QTest
::
keyToAscii
(
qtkey
);
if
(
asciiCode
!=
0
)
key
=
static_cast
<
int
>
(
asciiCode
);
else
key
=
evnt
->
nativeVirtualKey
();
//same codes as returned by GTK-based backend
if
(
isTranslatableKey
(
qtkey
)
)
key
=
static_cast
<
int
>
(
QTest
::
keyToAscii
(
qtkey
)
);
else
key
=
evnt
->
nativeVirtualKey
();
//same codes as returned by GTK-based backend
//control plus (Z, +, -, up, down, left, right) are used for zoom/panning functions
if
(
evnt
->
modifiers
()
!=
Qt
::
ControlModifier
)
{
if
(
evnt
->
modifiers
()
!=
Qt
::
ControlModifier
)
{
mutexKey
.
lock
();
last_key
=
key
;
mutexKey
.
unlock
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录