faraslacks
17th December 2008, 06:06
I realise drag&drop actions on QTableView. My reimplemented mouseMoveEvent() looks so:
void
MyClass::mouseMoveEvent(QMouseMove* event)
{
qDebug() << event->button();
if (event->button() == Qt::LeftButton) {
int distance = (event->pos() - fPressPos).manhattanLength();
if (distance > QApplication::startDragDistance()) {
startDrag();
}
}
QTableView::mouseMoveEvent(event);
}
I execute my application and tried to move mouse with pressed left button above my widget. In debug messages I see 0. And function did not enter first condition. So move event called, but QMouseEvent not contains information about buttons pressed. I have not idea why it happening.
void
MyClass::mouseMoveEvent(QMouseMove* event)
{
qDebug() << event->button();
if (event->button() == Qt::LeftButton) {
int distance = (event->pos() - fPressPos).manhattanLength();
if (distance > QApplication::startDragDistance()) {
startDrag();
}
}
QTableView::mouseMoveEvent(event);
}
I execute my application and tried to move mouse with pressed left button above my widget. In debug messages I see 0. And function did not enter first condition. So move event called, but QMouseEvent not contains information about buttons pressed. I have not idea why it happening.