Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unable to handle Mouse Events in both QML and C++
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 3.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Satmosc
    wrote on last edited by
    #1

    "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,

    M.Hatami
    To the Rationalism

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Satmosc
      wrote on last edited by
      #2

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

      M.Hatami
      To the Rationalism

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Satmosc
        wrote on last edited by
        #3

        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;
        

        }@

        M.Hatami
        To the Rationalism

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved