Unable to handle Mouse Events in both QML and C++



  • "QmlMinimizedTransperentBug.zip...":http://209.190.27.10/qt/QmlMinimizedTransperentBug.zip

    -I have a Test Proggy that I started from an other program to test a known bug in QT.
    I see that when I capture mouse events in C++ (QWidget) then the Mouse events are so slow in QML side....

    Also , I have a Resize pattern on the right side of my test program. I can resize for once and then the program do not work at. all
    I already uploaded a copy of the file in my test ftp... please check if you can help....

    I used mouse move events
    @
    void MainView::mouseMoveEvent(QMouseEvent *event)
    {
    if(event->button() & Qt::LeftButton)
    {
    QObject *_Obj=this->rootObject();

        _Obj->setProperty("textMouse","Global : Mouse X:"+QString::number(event->globalX())+
                      "   Mouse Y:"+QString::number(event->globalY()));
        _Obj->setProperty("textMouse1","Local : Mouse X:"+QString::number(event->pos().x())+
                          "   Mouse Y:"+QString::number(event->pos().y()));
    
        if(WindowresizeBool==true) {
                            Resizenow(event);
        }
    }
    return;
    

    }

    void MainView::mouseReleaseEvent(QMouseEvent *event)
    {
    if(WindowresizeBool==true) WindowresizeBool=false;
    return;
    }
    --@

    Thanks in advance for helps ...
    Kind Regards,



  • it looks like , QML is not responding to mouse events right after first time I resize the window.!!!



  • Oh My God....
    Lets explain to other developers who are not familiar like me with QT Structure.

    When you re-implement the mouse events , The implementation stops passing the mouse events to QML widget.

    So for example , for mousemoveevent , we pass the event to the QDeclarative mouse event (QML side)

    @void MainView::mouseMoveEvent(QMouseEvent *event)
    {
    if(event->buttons()& Qt::LeftButton)
    {
    QObject *_Obj=this->rootObject();

        _Obj->setProperty("textMouse","Global : Mouse X:"+QString::number(event->globalX())+
                      "   Mouse Y:"+QString::number(event->globalY()));
        _Obj->setProperty("textMouse1","Local : Mouse X:"+QString::number(event->pos().x())+
                          "   Mouse Y:"+QString::number(event->pos().y()));
    
        if(WindowresizeBool==true) {
         Resizenow(event);
         event->accept();
        }
    }
    
    QDeclarativeView::mouseMoveEvent(event);
    return;
    

    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.