Answer the question
In order to leave comments, you need to log in
Qt 4.8.0 MacOS. TabletEvent not coming to QGraphicsView if the latter has a Parent
Actually here. On Qt 4.7.3 there is no problem.
No problem under Windows and Linux. Only for Mac.
I can’t upgrade to 4.8.3 (this is the company’s policy). By the way, does it work there?
Wacom pen and touch tablet.
My arrangement is this: mainWindow has a centralWidget, in which the controlContainerWidget is located, in it is a QStackedLayout, and there are already several widgets in it + here is a QGraphicsView.
If you give the view parent 0 and pull it out of the layout, the tablet events reach as they should. Those. the problem is clearly within Qt.
I catch events in QApplication:: eventFilter without problems. But then the definition of the widget is crooked inside the Qt implementation and tabletEvent is replaced by mouseEvent.
As a crutch - called the handler of the tablet event of the view. But of course there is a drawback - there can be a widget on top of the view. Even inside her. And then the implementation should be from Qt. But how to determine the widget under the cursor?
QApplication. or 0 if you click on the view.
Here is where it works in Qt:
QWidget *QWidget::find(WId id)
{
return QWidgetPrivate::mapper? QWidgetPrivate::mapper->value(id, 0): 0;
}
There is an id in the hash, but the required object is not returned from the hash of objects by id. The view is simply not there. There is a QStackedLayout in the hash, I think this is the problem.
I understood if mainwindow or centralwidget were returned, but 0 is returned. It turns out that the mechanism is useless with layouts.
And it also works under windows. Didn't check on line. It's under my virtual machine.
I got stuck… tell me where to dig?
Answer the question
In order to leave comments, you need to log in
I solved the problem anyway.
I had to redefine the main window base class event handler, define the event type there, see who is under the mouse, and if the scene objects or the scene, then return true and then the standard handler in Qt guts calls the tablet event and everything works.
Kostyyyyl :(
And manually there is an opportunity to roll patches on raw Qt or not?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question