diff options
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 4 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview_dragging.mm | 40 |
2 files changed, 18 insertions, 26 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 52ae3ae1ec..cb6bc4c16a 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -123,7 +123,6 @@ QString m_composingText; QPointer<QObject> m_composingFocusObject; bool m_sendKeyEvent; - QStringList *currentCustomDragTypes; bool m_dontOverrideCtrlLMB; bool m_sendUpAsRightButton; Qt::KeyboardModifiers currentWheelModifiers; @@ -153,7 +152,6 @@ m_glContext = nullptr; m_shouldSetGLContextinDrawRect = false; #endif - currentCustomDragTypes = nullptr; m_sendUpAsRightButton = false; m_inputSource = nil; m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self]; @@ -216,8 +214,6 @@ [[NSNotificationCenter defaultCenter] removeObserver:self]; [m_mouseMoveHelper release]; - delete currentCustomDragTypes; - [super dealloc]; } diff --git a/src/plugins/platforms/cocoa/qnsview_dragging.mm b/src/plugins/platforms/cocoa/qnsview_dragging.mm index e61329f169..1c38c5326c 100644 --- a/src/plugins/platforms/cocoa/qnsview_dragging.mm +++ b/src/plugins/platforms/cocoa/qnsview_dragging.mm @@ -44,28 +44,24 @@ -(void)registerDragTypes { QMacAutoReleasePool pool; - QStringList customTypes = qt_mac_enabledDraggedTypes(); - if (currentCustomDragTypes == 0 || *currentCustomDragTypes != customTypes) { - if (currentCustomDragTypes == 0) - currentCustomDragTypes = new QStringList(); - *currentCustomDragTypes = customTypes; - NSString * const mimeTypeGeneric = @"com.trolltech.qt.MimeTypeName"; - NSMutableArray<NSString *> *supportedTypes = [NSMutableArray<NSString *> arrayWithArray:@[ - NSColorPboardType, - NSFilenamesPboardType, NSStringPboardType, - NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType, - NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType, - NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType, - NSRTFDPboardType, NSHTMLPboardType, - NSURLPboardType, NSPDFPboardType, NSVCardPboardType, - NSFilesPromisePboardType, NSInkTextPboardType, - NSMultipleTextSelectionPboardType, mimeTypeGeneric]]; - // Add custom types supported by the application. - for (int i = 0; i < customTypes.size(); i++) { - [supportedTypes addObject:customTypes[i].toNSString()]; - } - [self registerForDraggedTypes:supportedTypes]; - } + + NSString * const mimeTypeGeneric = @"com.trolltech.qt.MimeTypeName"; + NSMutableArray<NSString *> *supportedTypes = [NSMutableArray<NSString *> arrayWithArray:@[ + NSColorPboardType, + NSFilenamesPboardType, NSStringPboardType, + NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType, + NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType, + NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType, + NSRTFDPboardType, NSHTMLPboardType, + NSURLPboardType, NSPDFPboardType, NSVCardPboardType, + NSFilesPromisePboardType, NSInkTextPboardType, + NSMultipleTextSelectionPboardType, mimeTypeGeneric]]; + + // Add custom types supported by the application. + for (const QString &customType : qt_mac_enabledDraggedTypes()) + [supportedTypes addObject:customType.toNSString()]; + + [self registerForDraggedTypes:supportedTypes]; } static QWindow *findEventTargetWindow(QWindow *candidate) |