Skip to content
Permalink
Browse files

Try to implement openFileExplorerAndSelectFile for OSX

  • Loading branch information
nyalldawson committed Jul 31, 2018
1 parent 762099b commit f0043d6b8668666b9e3442eb0b6039b6b0b08afb
Showing with 8 additions and 0 deletions.
  1. +1 −0 src/native/mac/qgsmacnative.h
  2. +7 −0 src/native/mac/qgsmacnative.mm
@@ -27,6 +27,7 @@ class NATIVE_EXPORT QgsMacNative : public QgsNative

virtual const char *currentAppLocalizedName();
void currentAppActivateIgnoringOtherApps() override;
void openFileExplorerAndSelectFile( const QString &path ) override;
};

#endif // QGSMACNATIVE_H
@@ -34,3 +34,10 @@
[[NSRunningApplication currentApplication] activateWithOptions:
(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];
}

void openFileExplorerAndSelectFile( const QString &path )
{
NSString* pathStr = [[NSString alloc] initWithUTF8String:path.toUtf8().data()];
NSArray *fileURLs = [NSArray arrayWithObjects:pathStr, /* ... */ nil];
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs];
}

0 comments on commit f0043d6

Please sign in to comment.
You can’t perform that action at this time.