Adding event for mac open event
This commit is contained in:
parent
a9ea3928e4
commit
0dc400a7e1
2 changed files with 18 additions and 6 deletions
15
src/app.cpp
15
src/app.cpp
|
@ -1,3 +1,6 @@
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QFileOpenEvent>
|
||||||
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
|
@ -6,3 +9,15 @@ App::App(int argc, char *argv[]) :
|
||||||
{
|
{
|
||||||
window->show();
|
window->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool App::event(QEvent* e)
|
||||||
|
{
|
||||||
|
if (e->type() == QEvent::FileOpen)
|
||||||
|
{
|
||||||
|
qDebug() << static_cast<QFileOpenEvent*>(e)->file();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QApplication::event(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -10,13 +10,10 @@ class App : public QApplication
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit App(int argc, char *argv[]);
|
explicit App(int argc, char *argv[]);
|
||||||
|
protected:
|
||||||
signals:
|
bool event(QEvent* e);
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Window* window;
|
Window* const window;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue