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

It would be nice to have cancelDragDrop function in QGuiApplication

    XMLWordPrintable

Details

    • 6f65ddbc217a8c82b091d31e88faf3dc23baa13b (qtbase/dev, 23.10.2015, 5.7)

    Description

      It would be nice to have means to programmatically cancel the drag and drop action on Windows. Now it is only possible to do in Windows specified way by pressing Esc key.

      Use case: Cancel touch initiated drags when user taps 2nd finger to do a gesture.

      The suggestion is to implement QGuiApplication::cancelDragDrop(), which triggers a flag denoting the cancellation. And then the flag will be checked in QWindowsOleDropSource::QueryContinueDrag() function, for example, in the following way:

      QGuiApplication::processEvents(); 
      
      // now that we are in a dragevent loop, we need to query our application if the operation needs to be canceled. 
      if (QGuiApplication::dragDropCancelled) { // will autoreset! 
      hr = ResultFromScode(DRAGDROP_S_CANCEL); 
      break; 
      } 
      

      Attachments

        Activity

          People

            kleint Friedemann Kleint
            qtcomsupport Qt Support
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: