summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-03-15 14:35:41 +0100
committerLars Knoll <lars.knoll@qt.io>2020-03-15 15:06:40 +0100
commitcb8eb0f86c1bbdfbd6cfa789e7596a0e05d7fe66 (patch)
treebaaca190aea13b6e010ad76bf9afbf470771367f /src/plugins/platforms
parentfed4d6d78d6c5d754b40d396e34edd8011afcad7 (diff)
Get rid of QRegExp usage in the cocoa plugin
Change-Id: I9789e1637a17809082458e946fa7c49ab9269537 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm1
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.mm12
2 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index c35cf6d799..ef9b2659d2 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -53,7 +53,6 @@
#include <QtGui/private/qcoregraphics_p.h>
#include <QtCore/QDebug>
-#include <QtCore/QRegExp>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
index 9502a315d8..3ad9085dea 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
@@ -47,7 +47,13 @@
#include <qpa/qplatformscreen.h>
#include <qpa/qwindowsysteminterface.h>
-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