QFileOpenEvent
-
hi
i want open a file, double clicking on an file in the Finder on OS X
in mac 'QApplication::arguments()' don't work!
i need a good example for QFileOpenEvent -
Hi,
Because as the name suggests it's an event. The file name is not added to the argument list. First thing, did you configure your application to handle files opened that way ?
-
Hi,
Because as the name suggests it's an event. The file name is not added to the argument list. First thing, did you configure your application to handle files opened that way ?
-
Please share your .plist file
-
That looks OK. You should have the event sent to your application if you e.g. drop a supported file on the Dock Icon of your application.
-
That looks OK. You should have the event sent to your application if you e.g. drop a supported file on the Dock Icon of your application.
-
QFileOpenEvent.
class MyApplication : public QApplication { public: MyApplication(int &argc, char **argv, int flags = ApplicationFlags) : QApplication(argc, argv, flags) { } bool event(QEvent *event) { if (event->type() == QEvent::FileOpen) { QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(event); qDebug() << "File open" << openEvent->file(); } return QApplication::event(event); } };
Use it in place of QApplication.