StupidBeauty
Read times:1567Posted at:Fri Feb 3 18:01:54 2012
- no title specified

转载:Qt获取组合键

表示键盘上的“Ctrl”键的常量是Qt :: ControlModifier。

http://cool.worm.blog.163.com/blog/static/643390062009614248349/

亮点:

键盘按住 Ctrl + 鼠标左键的实现

在窗体中相应 mousePressEvent 事件函数在其中检测 Ctrl 键是否按住即可。

void Window ::mousePressEvent (QMouseEvent *e)
{
//
获取鼠标在点击窗体上的坐标
QPoint pos = e->pos();
if ( e->button() == LeftButton)
{
if ( QApplication::keyboardModifiers () == Qt::ControlModifier)
{
//pressed
}
}
}

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands