如何在QT中实现按键组合? [英] How to implement key press key combinations in QT?

查看:906
本文介绍了如何在QT中实现按键组合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

if ((event->type()==QEvent::KeyPress) && (event->modifiers() &&
     Qt::ControlModifier) &&
     (event->modifiers() && Qt::AltModifier) && (event->key()==Qt::Key_L))
{
    QMessageBox::warning(NULL,"keypress","key pressed",QMessageBox::Ok);
}



此代码在xp上工作正常,但在 xp Win7中失败..请帮助我



This code works fine in xp but fails in xp Win7.. Please help me

推荐答案

您的代码中没有语言问题" .您只需要调用许多Qt API.可能是您使用的Qt版本与W7不完全兼容.
There are no "language issues" in your code. You just call a number of Qt API. May be the version of Qt you are using is not fully compatible with W7.


由于失败,我想您是说从未输入if -block .您应该在调试器中在此处中断,看看哪些子条件在Windows 7上不返回true .这可能是W7的QT问题,可能是代码中的错误,可能是因为您需要更新的QT版本,可能确实是任何东西.
By fail, I assume you mean the if-block is never entered. You should break there in the debugger and see which of the sub-conditions do not return true on Windows 7. It may be a QT issue with W7, it may be a bug in your code, it may be that you need an updated QT version, could be anything really.


这篇关于如何在QT中实现按键组合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆