summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorChristoph Schleifenbaum <christoph.schleifenbaum@kdab.com>2012-04-05 16:31:40 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-11 15:11:20 +0200
commit358fd91951f26cbb552daaf9d28c49429302b6ab (patch)
tree99bfeed60f506670cbb801396861a4188bb3d714 /src/gui
parente3bbfe00d1f71ba21889eec438e9438c0ee35c0a (diff)
Make QFileOpenEvents delivered again.
Create a FileOpenEvent within QWindowSystemInterfacePrivate and handle it in QWindowSystemSystemInterface and QGuiApplication Change-Id: Ie777c923958d83d56e8648c9bfb1f9dcb985654d Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qguiapplication.cpp9
-rw-r--r--src/gui/kernel/qguiapplication_p.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp6
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h11
5 files changed, 29 insertions, 1 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index bdffb985f7..4aa3348653 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1412,6 +1412,15 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
QGuiApplication::sendSpontaneousEvent(e->window.data(), &event);
}
+void QGuiApplicationPrivate::processFileOpenEvent(QWindowSystemInterfacePrivate::FileOpenEvent *e)
+{
+ if (e->fileName.isEmpty())
+ return;
+
+ QFileOpenEvent event(e->fileName);
+ QGuiApplication::sendSpontaneousEvent(qApp, &event);
+}
+
Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k)
{
return qHash(k.device) + k.touchPointId;
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index b7b8afc7ad..ff1a88051c 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -121,6 +121,8 @@ public:
static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e);
+ static void processFileOpenEvent(QWindowSystemInterfacePrivate::FileOpenEvent *e);
+
static QPlatformDragQtResponse processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
static QPlatformDropQtResponse processDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index c3136b0b0a..c011fa4e13 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -520,4 +520,10 @@ bool QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray
return QGuiApplicationPrivate::processNativeEvent(window, eventType, message, result);
}
+void QWindowSystemInterface::handleFileOpenEvent(const QString& fileName)
+{
+ QWindowSystemInterfacePrivate::FileOpenEvent e(fileName);
+ QGuiApplicationPrivate::processWindowSystemEvent(&e);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 7e0ebf0efc..60db085c4d 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -148,6 +148,8 @@ public:
static void handleThemeChange(QWindow *tlw);
+ static void handleFileOpenEvent(const QString& fileName);
+
// For event dispatcher implementations
static bool sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags);
static int windowSystemEventsQueued();
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index c7ad197b3c..f026f1ca33 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -68,7 +68,8 @@ public:
ScreenLogicalDotsPerInch,
ScreenRefreshRate,
ThemeChange,
- Expose
+ Expose,
+ FileOpen
};
class WindowSystemEvent {
@@ -257,6 +258,14 @@ public:
QRegion region;
};
+ class FileOpenEvent : public WindowSystemEvent {
+ public:
+ FileOpenEvent(const QString& fileName)
+ : WindowSystemEvent(FileOpen), fileName(fileName)
+ { }
+ QString fileName;
+ };
+
static QList<WindowSystemEvent *> windowSystemEventQueue;
static QMutex queueMutex;