commit 0dc400a7e189dae2543149d12b1ebe4585e34a05
parent a9ea3928e4283da55543bd58ec634c6df9c7df78
Author: Matt Keeter <matt.j.keeter@gmail.com>
Date: Fri, 14 Mar 2014 10:31:43 -0400
Adding event for mac open event
Diffstat:
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/app.cpp b/src/app.cpp
@@ -1,3 +1,6 @@
+#include <QDebug>
+#include <QFileOpenEvent>
+
#include "app.h"
#include "window.h"
@@ -6,3 +9,15 @@ App::App(int argc, char *argv[]) :
{
window->show();
}
+
+bool App::event(QEvent* e)
+{
+ if (e->type() == QEvent::FileOpen)
+ {
+ qDebug() << static_cast<QFileOpenEvent*>(e)->file();
+ }
+ else
+ {
+ return QApplication::event(e);
+ }
+}
diff --git a/src/app.h b/src/app.h
@@ -10,13 +10,10 @@ class App : public QApplication
Q_OBJECT
public:
explicit App(int argc, char *argv[]);
-
-signals:
-
-public slots:
-
+protected:
+ bool event(QEvent* e);
private:
- Window* window;
+ Window* const window;
};