TabletEvents comes as mouse events.
Actual for MAC OS Qt 4.8.0 - 4.8.5. Works fine in Qt 4.7.3 on any OS and Qt 4.8.0 on Windows and Linux.
I have two instances of QGraphcisScene and two instances of QGraphicsView. The same types, but one view have a parent, and the another - doesn't (also it's transparent, used for drawing something over desktop).
I'm using tablet (wacom pen and touch) for painting. I handle QTabletEvents and it works only for QGrahicsView instance that doesn't have parent (means parent==0).
On the view with parent (
QMainWindow->centralWidget->ControlContainerWidget->QStackedLayout->QGraphicsView
) tablet events doesn't comes. They comes to QApplication::eventFilter
fine, but doesn't comes to view. They comes to QMainWindow
as mouseEvents
.
If i set parent to 0, tablet events delivers fine.
The 1st receiver of tablet event is QMainWindow.
I see that inside qt_mac_handleTabletEvent
:
QWidget *qwidget = [theView qt_qwidget];
QWidget *widgetToGetMouse = qwidget;
And then:
`qt_sendSpontaneousEvent(widgetToGetMouse, &qtabletEvent);`
qtabletEvent
- is not accepted event created just before calling sendSpontaneousEvent
.
Then inside QApplication::notify():
QWidget *w = static_cast<QWidget *>(receiver);
QTabletEvent *tablet = static_cast<QTabletEvent*>(e);
QPoint relpos = tablet->pos();
bool eventAccepted = tablet->isAccepted();
while (w) {
QTabletEvent te(tablet->type(), relpos, tablet->globalPos(),
tablet->hiResGlobalPos(), tablet->device(), tablet->pointerType(),
tablet->pressure(), tablet->xTilt(), tablet->yTilt(),
tablet->tangentialPressure(), tablet->rotation(), tablet->z(),
tablet->modifiers(), tablet->uniqueId());
te.spont = e->spontaneous();
res = d->notify_helper(w, w == receiver ? tablet : &te);
eventAccepted = ((w == receiver) ? tablet : &te)->isAccepted();
e->spont = false;
if ((res && eventAccepted)
|| w->isWindow()
|| w->testAttribute(Qt::WA_NoMousePropagation))
break;
relpos += w->pos();
w = w->parentWidget();
}
tablet->setAccepted(eventAccepted);
As we can see:
res = d->notify_helper(w, w == receiver ? tablet : &te);
It calls event processing by filters, layouts and then - QMainWindow::tabletEven
t. Default implementation is event->ignore()
.
Since QMainWindow have no Parent, it is all. So tablet event doesn't comes to QMainWindow childs.
Then seems it is QWidget *qwidget = [theView qt_qwidget];
works wrong.
Unfortunately, i can't debug it...
Please give me some hints... i'm stucked...