PDA

View Full Version : QFileOpenEvent on Gnome



patrik08
2nd November 2007, 10:24
I find a way to open file, by drag file to application icon (or taskbar) on Mac is QFileOpenEvent ,
is a long way see http://wiki.qtcentre.org/index.php?title=Opening_documents_in_the_Mac_OSX_F inder
but its can run.. file extension must having on xml plist,
on window arguments list from int main(int argc, char *argv[]) .... can run.
An now how i can drag file to apps icon to open on Gnome Linux?
Is here other file event? Arguments list not respond.

On Gnome i find only ChSciTE that i can drag file to icon to open.! is here other QT apps wo run by drag file to icon on Gnome?




class AwesomeApplication : public QApplication
{
Q_OBJECT
public:
...
protected:
bool event(QEvent *);
...
private:
void loadFile(const QString &fileName);
};

bool AwesomeApplication::event(QEvent *event)
{
switch (event->type()) {
case QEvent::FileOpen:
loadFile(static_cast<QFileOpenEvent *>(
event)->file());
return true;
default:
return QApplication::event(event);
}
}


The problem file:
https://wysiwyg-edit.svn.sourceforge.net/svnroot/wysiwyg-edit/fop_miniscribus/src/main.cpp

wysota
11th November 2007, 22:28
FileOpen event is only accessible on MacOS. If you drop something on an application icon, the application should be ran and passed the file path as the parameter, provided that your system is configured properly. I don't know if that is the case on your system :)