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

On windows text copied to the clipboard is lost when application quits

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P2: Important P2: Important
    • None
    • 5.3.1
    • GUI: Drag and Drop
    • None
    • Windows 8 64 bit

      On Windows, text copied to the clipboard is lost when application quits. This is a regression from earlier versions of Qt and is probably caused by the fix for https://bugreports.qt-project.org/browse/QTBUG-36958

      Workaround is to subclass QApplication and in the exec() method of the subclass manually call OleFlushClipboard() before returning. Python code demonstrating this follows:

          if iswindows:
              def exec_(self):
                  try:
                      return QApplication.exec_()
                  finally:
                      try:
                          if self.clipboard().ownsClipboard():
                              import ctypes
                              ctypes.WinDLL('ole32.dll').OleFlushClipboard()
                      except Exception:
                          import traceback
                          traceback.print_exc()
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            kovid Kovid Goyal
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes