Qt World Summit: Register Today!

Mouse event not work

  • 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());

Log in to reply