• 8369阅读
  • 3回复

有关菜单快捷键设置的问题 [复制链接]

上一主题 下一主题
离线chuwenhua
 
只看楼主 倒序阅读 楼主  发表于: 2009-03-27
请问,在Qt Designer中,设置菜单如 "&New" ,如何设置后面的快捷键 Ctrl + N?谢谢.
离线many_many
只看该作者 1楼 发表于: 2009-04-03
我不知道怎样在QTDesigner里面设置,
不过,我知道可以用代码实现:
just like this:

void YourClassName::keyPressEvent(QKeyEvent *event)
{
 if(event->modifiers() == Qt::ControlModifier
   && event->key() == Qt::Key_Z)
 {
   cout<<"yyyyyyyyyyyyyyyyyyyyyyyyyyy"<<endl;

//......
 }
 else
 {
  cout<<"it is not  ctrl+Z"<<endl;

//.....
 }
}


在“//......“这里就可以实现你需要的功能。
从而达到了你所要的组合键ctrl + z的目的。
Qt::ControlModifier

Qt::Key_Z
都是可以替换的
更多的组合键,你只需要在条件里面添加就可以了
联系方式:
lishenzhi123@163.com
QQ:904421718
离线many_many
只看该作者 2楼 发表于: 2009-04-04
今天我看到了QTDesigner里的快捷键的设置在哪里了

在”属性编辑器“里的shorcut里设置你的快捷键就ok啦。
just like:

step 1:
    click the edit of the shorcut
step 2:
    press the key or keys which you need,
then the key or keys information will be shown .
E.g., shortcut Ctrl + Z, you just press the Ctrl key and press the Z key, release them at the same time. The Ctrl + Z will be shown.

当然,你可以手动输入字符,但是,有功能键组合或者大小写切换手动输入都是不行的。
联系方式:
lishenzhi123@163.com
QQ:904421718
离线chuwenhua
只看该作者 3楼 发表于: 2009-04-07
非常感谢
快速回复
限100 字节
 
上一个 下一个