diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index c35cf6d7992..ef9b2659d23 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -53,7 +53,6 @@ #include #include -#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index 9502a315d8f..3ad9085deab 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -47,7 +47,13 @@ #include #include -static QRegExp whitespaceRegex = QRegExp(QStringLiteral("\\s*")); +static inline bool isWhiteSpace(const QString &s) +{ + for (int i = 0; i < s.size(); ++i) + if (!s.at(i).isSpace()) + return false; + return true; +} static QCocoaWindow *toPlatformWindow(NSWindow *window) { @@ -113,7 +119,7 @@ static QCocoaWindow *toPlatformWindow(NSWindow *window) // Only pop up document path if the filename is non-empty. We allow whitespace, to // allow faking a window icon by setting the file path to a single space character. - return !whitespaceRegex.exactMatch(platformWindow->window()->filePath()); + return !isWhiteSpace(platformWindow->window()->filePath()); } - (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard @@ -127,6 +133,6 @@ static QCocoaWindow *toPlatformWindow(NSWindow *window) // Only allow drag if the filename is non-empty. We allow whitespace, to // allow faking a window icon by setting the file path to a single space. - return !whitespaceRegex.exactMatch(platformWindow->window()->filePath()); + return !isWhiteSpace(platformWindow->window()->filePath()); } @end