Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-16823

QWidget: leave event is not received when hovering a qpushbutton whilst a qdrag object that was created in mousePressEvent exists

    XMLWordPrintable

Details

    Description

      void TestAppT::mousePressEvent(QMouseEvent *event)
      {   
          QMainWindow::mousePressEvent(event);
          
      	// This is literally copied verbatim from the Qt drag-drop docs
      	if (event->button() == Qt::LeftButton )
      	{   
              drag = new QDrag(this);
              QMimeData *mimeData = new QMimeData();
      	    mimeData->setText("Hello!");
      	    drag->setMimeData(mimeData);
              dropAction = drag->exec(); 
              qDebug() << dropAction;
              
      	}  
      }
      

      The attached example can be used to demonstrate the bug. Hover over the main window, left-click the mouse and keeping the left mouse pressed, move the mouse cursor onto the desktop. Release the left mouse and then hover over either or both of the QPushButtons on the main window. The pushbutton hover-highlighting appears but persists indefinitely or until the buttons are pressed again.

      I've reproduced this on Windows 7.

      If QT_USE_NATIVE_WINDOWS=1 is added to the environment, the bug disappears. Enable alien widget debugging in qmainwindow.cpp by uncommenting
      #define ALIEN_DEBUG. You should see that multiple enter/leave events are generated when hovering over either of the pushbuttons.

      Attachments

        1. TestApp.zip
          15 kB
          Matthew Cattell
        For Gerrit Dashboard: QTBUG-16823
        # Subject Branch Project Status CR V

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            cattell Matthew Cattell (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes