Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.9.7, 5.12.0 Beta 4, 5.12, 5.13.2
-
macOS: Mojave 10.14.1 Catalina 10.15.1
-
-
629292321c3678a052d00ace8749bf6ea832d11a (qt/qtbase/5.15)
Description
It is not possible to drag multiple files in macOS Mojave in Qt 5.12
One item is possible to drag, but multiple items not and then dragging is disabled completely for everything.
In my application I can't even drag one item. No drag is initiated. ( works correctly in Qt 5.11.2 )
Example output:
2018-11-21 08:29:58.736 zbug_dnd_mojave_mm[41743:177885] NSException caught 2018-11-21 08:29:58.736 zbug_dnd_mojave_mm[41743:177885] Name: NSGenericException 2018-11-21 08:29:58.736 zbug_dnd_mojave_mm[41743:177885] Reason: There are 2 items on the pasteboard, but 1 drag images. There must be 1 draggingItem per pasteboardItem. QDragManager::drag in possibly invalid state QDragManager::drag in possibly invalid state
#include <QtWidgets> #import "Foundation/Foundation.h" class TreeView : public QTreeView { Q_OBJECT public: void mousePressEvent(QMouseEvent *event) override { auto drag = new QDrag(this); auto *mimeData = new QMimeData(); QList<QUrl> urlList = { QUrl(), QUrl() }; mimeData->setUrls(urlList); drag->setMimeData(mimeData); try { drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction); } catch (NSException *exception) { NSLog( @"NSException caught" ); NSLog( @"Name: %@", exception.name); NSLog( @"Reason: %@", exception.reason ); } } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); auto view = new TreeView; view->setDragEnabled(true); view->show(); return QApplication::exec(); } #include "bug_dnd_mojave.moc"
Official Apple release notes mention this exception in mojave in release notes
I have also this warning messages ( not sure if this can affect dragging problem )
When compiling I have this warnings when linking for all macOS frameworks ( many warnings )
ld: warning: text-based stub file /System/Library/Frameworks//CoreGraphics.framework/Versions/A/CoreGraphics.tbd and library file /System/Library/Frameworks//CoreGraphics.framework/Versions/A/CoreGraphics are out of sync. Falling back to library file for linking.
Reinstalling CommandLineTools does not help
sudo mv /Library/Developer/CommandLineTools /Library/Developer/CommandLineTools.old xcode-select --install sudo rm -rf /Library/Developer/CommandLineTools.old
I have already reported to QBS for Qt 5.11.2 but I have solved this by using different compiler ( default autodetected compiler linked app to 10.14 libs instead of 10.13 libs I guess )
Attachments
For Gerrit Dashboard: QTBUG-71939 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
248051,5 | WIP: QCocoaDrag - fix a broken D&D on macOS Mojave | 5.14 | qt/qtbase | Status: ABANDONED | -2 | 0 |
297952,16 | QCocoaDrag - avoid using the deprecated API if possible | dev | qt/qtbase | Status: MERGED | +2 | 0 |
300996,2 | QCocoaDrag - avoid using the deprecated API if possible | 5.15 | qt/qtbase | Status: MERGED | +2 | 0 |
314614,4 | QCocoaDrag::drag - make sure clipboard is ours and populated | dev | qt/qtbase | Status: MERGED | +2 | 0 |
314796,2 | QCocoaDrag::drag - make sure clipboard is ours and populated | 5.15 | qt/qtbase | Status: MERGED | +2 | 0 |