qtopia让窗体区别触摸屏短按与长按
板子:君益兴helper2416 qtopia2.2 作者:帅得不敢出门 c++哈哈堂:31843264
在窗体构造函数中
-
right_pressed = false;
-
-
QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
然后
-
void xx::mouseReleaseEvent( QMouseEvent* e )
-
{
-
-
if( !right_pressed && e->button() == Qt::LeftButton ) emit selected();
-
}
-
-
void xx::mousePressEvent( QMouseEvent* e )
-
{
-
right_pressed = false;
-
-
if( e->button() == Qt::RightButton ) {
-
right_pressed = true;
-
emit held( e->globalPos() );
-
}
-
}
这个例子是短按发送selected() 信号, 长按发送held(QPoint)信号.
阅读(1768) | 评论(0) | 转发(0) |