首页 > 编程知识 正文

电脑键盘复制粘贴快捷键,win10键盘全变成快捷键

时间:2023-05-05 10:18:09 阅读:121038 作者:382

在最近的项目中,需要在目标板上实现键盘快捷键的双击调用操作菜单。 在此,我们将在qml提供的Shortcut快捷方式控件的模拟中实现

创建qml组件:CustomKeyEvent.qml

importqtquick 2.0 importqtquick 2.12 item { id : keyitempropertyvarcustomkey 3360 qstr (' tab ' ) } propertyintispressed 3360 propertyintcustomkeydoubleclick : anchors.fill : parent focus 3360 true timer { id 3360 keytimeminnning 00 on triggered : { key item.is pressed=0} shortcut { sequence : customkeyautorepeat 3360 false//context : Qt.applicationshortcutonactivated : { console.log (customkey ' activate ' ) dClick ) } } function dClick ) 长按不触发{if(1===keyitem.ispressed )//key item.is pressed=0key item.customkeydoubleclick=1key time.stop

importqtquick 2.12 importqtquick.window 2.12 importqtquick.controls 2.12 window { id : win visible 3360 true width : screen.wind button { id : testbtnanchors.center in : parent background : rectangle { color : ' orange ' opacity 3360.2 width 3360 } text : qstr (测试按钮)自定义密钥(自定义密钥: qstr (空间) ) )。 oncustomkeydoubleclickchanged : { if (1==customkeydoubleclick ) testBTN.text=qstr ) testbuttondoubleclick.' else rectangle (anchors.fill : parent color 3360 ) #00ffee ) opacity3360

# includeqguiapplication # includeqqmlapplicationengineintmain (int argc,char *argv[] () ) qcoreapplication 33603360 seta TTA QQmlApplicationEngine engine; 控制字符串(qrc :/main.qml ); qobject:3360connect(engine,qqmlapplicationengine :3360 object created,app,[URL] ) qobject*obj,constqurlobj 、Qt :3360排队连接; engine.load(URL; 返回app.exec (; }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。