Pasting Graphics From Word for Mac into Qt
-
In summary, copying a picture on Word for Mac (2011 tested) and then pasting through QClipboard fails. This is not strictly a bug in Qt or Word. I am looking for ANY advice on where to go with this issue.
Qt (4.7.4 and 4.8.0 tested) removes support for the com.apple.pict clipboard format as it is apparently not supported on 64 bit versions of Mac OS. Based on my reading, this is a correct decision.
Most applications seem to place a variety of picture formats on the clipboard including things like public.tiff. Unfortunately, Word for Mac does not - it only puts com.apple.pict. What it puts is valid, as other applications can paste it. Qt apps, however, look at the format and say "I don't know what to do". This means that
QImage image = QApplication::clipboard()->image();
returns a null image even when one is there.
My understanding is that MacOS will accept com.apple.pict formats and silently changes them to a TIFF format internally. MacOS does not, however, update the UTI and still reports the data as com.apple.pict. I have not been able to confirm this.
Creating my own QMacPasteboardMime type would solve the issue but I have had trouble - copying the examples buried in qmime_mac.cpp does not help as many of the symbols are not accessible. I initially tried to subclass QMacPasteboardMimeTiff and just change the format names - but again the QMacPasteboardMimeTiff class is not externally accessible.
Any ideas welcome!
-
I understood your question, but i don't have a Mac to test your case...
Btw you can look at:
const QMimeData * QClipboard::mimeData ( Mode mode = Clipboard ) const
and
"QMimeData Class Reference":http://qt-project.org/doc/qt-4.7/QMimeData.html
bq. On Windows, the MIME format does not always map directly to the clipboard formats. Qt provides QWindowsMime to map clipboard formats to open-standard MIME formats. Similarly, the QMacPasteboardMime maps MIME to Mac flavors.