[Feature request] receive QFileOpenEvent on MAC OS X

edited January 2013 in General
Hi Matthias,

would it be hard to implement the QFileOpenEvent described at

http://doc.qt.digia.com/qq/qq18-macfeatures.html#newevents

for MAC OS X ?

It would allow to double click gds files from finder and have klayout opening it, maybe in a new few if klayout is already open.

Thanks,

Hannes

Comments

  • edited November -1

    Hi Hannes,

    surely that is possible, but lacking MacOS hardware I will not be able to test it (unless someone gets Apple to spend a tiny fraction of it's record revenue to sponsor some MacOS box ... :-) ).

    As I understand, for QFileOpenEvent there is nothing like the usual, event-specific callbacks like in QWidget, so the following seems to be required:

    • A QApplication subclass needs to be written that reimplements the "event" method
    • This object must be instantiated instead of QApplication in lay::Application's constructor
    • This implementation of "event" must check for QFileOpenEvent type events
    • If such an event is encountered, it must check whether the given URL is a "file" URL and reject other URL's because access through other protocols is not supported yet
    • "file" type URL's must call lay::MainWindow::instance->load_layout(file_path) in order to open the file

    Parts of this code must be wrapped in "#if defined ... #endif" clauses such that they will not be compiled when QFileOpenEvent is not available (in particular for Qt versions <4.6).

    I don't know whether it is helpful if such a change goes into the codebase untested.

    BTW: drag and drop is already implemented and available on all platforms.

    Best regards,

    Matthias

  • edited November -1
    Hi Matthias,

    thanks, I'll see to it and convince Apple.

    Best regards,
    Hannes
Sign In or Register to comment.