Compare commits
2 Commits
macos
...
64c4d2e064
Author | SHA1 | Date | |
---|---|---|---|
64c4d2e064 | |||
e64b871a2f |
1
.github/workflows/macos.yml
vendored
1
.github/workflows/macos.yml
vendored
@ -13,6 +13,7 @@ jobs:
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: '6.8.1'
|
||||
modules: 'qtimageformats'
|
||||
- name: Run a qt project
|
||||
run: |
|
||||
cmake . -Bbuild
|
||||
|
@ -212,7 +212,7 @@ elseif (APPLE)
|
||||
# See https://cmake.org/cmake/help/v3.15/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.html
|
||||
set_target_properties(${EXE_NAME} PROPERTIES
|
||||
MACOSX_BUNDLE TRUE
|
||||
MACOSX_BUNDLE_INFO_PLIST dist/MacOSXBundleInfo.plist.in
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/dist/MacOSXBundleInfo.plist.in
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "Pineapple Pictures"
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER net.blumia.pineapple-pictures
|
||||
MACOSX_BUNDLE_ICON_FILE app-icon.icns # contains the .icns file name, *without* the path.
|
||||
|
@ -160,6 +160,10 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
installResizeCapture(m_graphicsView->viewport());
|
||||
installResizeCapture(m_gv);
|
||||
installResizeCapture(m_gv->viewport());
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
qApp->installEventFilter(this);
|
||||
#endif // Q_OS_MACOS
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -653,6 +657,19 @@ QSize MainWindow::sizeHint() const
|
||||
return QSize(710, 530);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
Q_UNUSED(obj);
|
||||
if (event->type() == QEvent::FileOpen) {
|
||||
QFileOpenEvent *fileOpenEvent = static_cast<QFileOpenEvent *>(event);
|
||||
showUrls({fileOpenEvent->url()});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
void MainWindow::on_actionOpen_triggered()
|
||||
{
|
||||
QStringList picturesLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
|
||||
|
@ -77,6 +77,9 @@ protected slots:
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const override;
|
||||
#ifdef Q_OS_MACOS
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
private slots:
|
||||
void on_actionOpen_triggered();
|
||||
|
2
dist/MacOSXBundleInfo.plist.in
vendored
2
dist/MacOSXBundleInfo.plist.in
vendored
@ -30,8 +30,6 @@
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<!-- JPEG -->
|
||||
|
Reference in New Issue
Block a user