mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-22 07:04:17 +02:00
8d76354647
Root cause (see issue #218 discussion): - QETApp::eventFiltrer (Q_OS_DARWIN) was correct in intent but never actually installed as an event filter anywhere, and its name didn't match the QObject::eventFilter virtual signature, so even if it had been installed it would never have been invoked as an override. Confirmed dead code. - main.cpp instead routed Finder's QFileOpenEvent through MacOSXOpenEvent -> SingleApplication::sendMessage(), which is the secondary-to-primary IPC channel. Called from within the primary instance itself, sendMessage() fails silently and the file path is dropped, which is exactly what double-click does (Finder doesn't spawn a secondary process, the running instance receives the FileOpen event directly). - openFiles() takes a QETArguments, not a QStringList. The dead code's openFiles(QStringList() << filename) only worked via an untested implicit QStringList -> QList<QString> -> QETArguments conversion chain. Fix: - Rename eventFiltrer -> eventFilter (qetapp.h/.cpp) so it's a proper override of QObject::eventFilter, and make it public so main.cpp can install it on QApplication. - Build the QETArguments explicitly instead of relying on implicit conversion. - main.cpp: drop MacOSXOpenEvent entirely (include + instantiation), install qetapp as the Q_OS_MACOS event filter on app right after QETApp qetapp; is constructed and before app.exec(). No race window: the event loop hasn't started, so no QFileOpenEvent can be delivered before the filter is installed. QETArguments::handleFileArgument() already sorts files by extension (.elmt, titleblock, else project) and openFiles() already fans out to openProjectFiles()/openElementFiles()/openTitleBlockTemplateFiles() accordingly, so this single fix covers .qet, .elmt and .titleblock double-click/drag-to-dock on macOS, not just .qet. SingleApplication's sendMessage/receivedMessage flow (used for CLI args on all platforms) is untouched; this only touches the Q_OS_MACOS block, so there is no behavior change on Windows/Linux. Follow-up (not included here): the macOS Info.plist (misc/Info.plist) has an empty CFBundleShortVersionString, which may affect macOS's willingness to retain file associations across app updates.