Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

mouse event not work

$
0
0
Hi! I try to interact with mouse in my custom QQuickItem qmlRegisterType<Book>(uri, 1, 0, “Book”); To do this I implement void Book::mousePressEvent(QMouseEvent *event) But it never fires. I found maskedmousearea example. And it also not fires this events!! I found http://qt-project.org/forums/viewthread/24934/ and inside QQuickView I can catch this events, but when I propogate it directly to my item it never fires there: QPoint pos = event->pos(); QQuickItem *child = this->rootObject()->childAt(pos.x(), pos.y()); Book *item = qobject_cast<Book *>(child); if (item){ QMouseEvent *itemEvent=new QMouseEvent(event->type(),item->mapFromScene(event->globalPos()),event->button(),event->buttons(),event->modifiers()); QCoreApplication::sendEvent(item,itemEvent); }

Viewing all articles
Browse latest Browse all 4972

Trending Articles