为什么QT运行Android平台的程序时,mouseMoveEvent事件响应的间隔时间很长??????????
代码如下,做了一个类,继承自QTableWidget。编译成Android平台版本,在平板上运行,间隔时间大多几毫秒,有时会达到50-70毫秒。
导致滑动时看着不流畅。
但在Windows平台,间隔时间一直小于10毫秒。
#ifndef MYTABLEWIDGET_H
#define MYTABLEWIDGET_H
#include <QTableWidget>
#include <QTime>
#include <QEvent>
#include <QDebug>
#include <QMouseEvent>
class CMyTableWidget : public QTableWidget
{
protected:
bool eventFilter(QObject *obj, QEvent *event)
{
if( obj == this || obj == this->viewport() )
{
if(event->type() == QEvent::MouseMove)
{
QTime oTempTime = QTime::currentTime();
qDebug()<<"eventFilter MouseMove : "<<((QMouseEvent*)event)->pos()<<oTempTime<<oTempTime.msec()<<endl;
}
else if(event->type() == QEvent::DragMove)
{
QTime oTempTime = QTime::currentTime();
qDebug()<<"eventFilter DragMove : "<<oTempTime<<oTempTime.msec()<<endl;
}
else if(event->type() == QEvent::TouchUpdate)
{
QTime oTempTime = QTime::currentTime();
qDebug()<<"eventFilter TouchUpdate : "<<oTempTime<<oTempTime.msec()<<endl;
}
}
return QTableWidget::event(event);
}
void dragMoveEvent(QDragMoveEvent *event)
{
qDebug()<<"dragMoveEvent";
}
void mouseMoveEvent(QMouseEvent *event)
{
int nTimeInter = m_oLastTime.msecsTo(QTime::currentTime());
qDebug()<<"Time Interval : "<<nTimeInter;
m_oLastTime = QTime::currentTime();
}
private:
QTime m_oLastTime;
};
#endif // MYTABLEWIDGET_H
补充:移动开发 , Qt