summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/kernel.pri2
-rw-r--r--src/gui/kernel/qclipboard.cpp2
-rw-r--r--src/gui/kernel/qclipboard.h2
-rw-r--r--src/gui/kernel/qclipboard_qpa.cpp2
-rw-r--r--src/gui/kernel/qcursor.cpp12
-rw-r--r--src/gui/kernel/qcursor.h7
-rw-r--r--src/gui/kernel/qcursor_p.h2
-rw-r--r--src/gui/kernel/qcursor_qpa.cpp2
-rw-r--r--src/gui/kernel/qdnd.cpp2
-rw-r--r--src/gui/kernel/qdnd_p.h2
-rw-r--r--src/gui/kernel/qdrag.cpp2
-rw-r--r--src/gui/kernel/qdrag.h2
-rw-r--r--src/gui/kernel/qevent.cpp86
-rw-r--r--src/gui/kernel/qevent.h17
-rw-r--r--src/gui/kernel/qevent_p.h2
-rw-r--r--src/gui/kernel/qgenericplugin_qpa.cpp2
-rw-r--r--src/gui/kernel/qgenericplugin_qpa.h2
-rw-r--r--src/gui/kernel/qgenericpluginfactory_qpa.cpp2
-rw-r--r--src/gui/kernel/qgenericpluginfactory_qpa.h2
-rw-r--r--src/gui/kernel/qguiapplication.cpp155
-rw-r--r--src/gui/kernel/qguiapplication.h8
-rw-r--r--src/gui/kernel/qguiapplication_p.h23
-rw-r--r--src/gui/kernel/qguivariant.cpp164
-rw-r--r--src/gui/kernel/qinputpanel.cpp32
-rw-r--r--src/gui/kernel/qinputpanel.h11
-rw-r--r--src/gui/kernel/qinputpanel_p.h2
-rw-r--r--src/gui/kernel/qkeymapper.cpp2
-rw-r--r--src/gui/kernel/qkeymapper_p.h2
-rw-r--r--src/gui/kernel/qkeymapper_qpa.cpp2
-rw-r--r--src/gui/kernel/qkeysequence.cpp17
-rw-r--r--src/gui/kernel/qkeysequence.h2
-rw-r--r--src/gui/kernel/qkeysequence_p.h2
-rw-r--r--src/gui/kernel/qopenglcontext.cpp17
-rw-r--r--src/gui/kernel/qopenglcontext.h7
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qpalette.cpp11
-rw-r--r--src/gui/kernel/qpalette.h6
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.h2
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.h2
-rw-r--r--src/gui/kernel/qplatformdrag_qpa.h2
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.cpp24
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.h7
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.cpp16
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.h6
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_qpa_p.h2
-rw-r--r--src/gui/kernel/qplatformintegrationplugin_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformintegrationplugin_qpa.h2
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.h2
-rw-r--r--src/gui/kernel/qplatformopenglcontext_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformopenglcontext_qpa.h2
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.cpp11
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.h4
-rw-r--r--src/gui/kernel/qplatformscreen_qpa_p.h74
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.h2
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.cpp43
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.h11
-rw-r--r--src/gui/kernel/qplatformthemefactory_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformthemefactory_qpa_p.h2
-rw-r--r--src/gui/kernel/qplatformthemeplugin_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformthemeplugin_qpa.h2
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.h2
-rw-r--r--src/gui/kernel/qscreen.cpp40
-rw-r--r--src/gui/kernel/qscreen.h3
-rw-r--r--src/gui/kernel/qscreen_p.h80
-rw-r--r--src/gui/kernel/qsessionmanager.h2
-rw-r--r--src/gui/kernel/qsessionmanager_qpa.cpp2
-rw-r--r--src/gui/kernel/qshortcutmap.cpp2
-rw-r--r--src/gui/kernel/qshortcutmap_p.h2
-rw-r--r--src/gui/kernel/qstylehints.cpp12
-rw-r--r--src/gui/kernel/qstylehints.h4
-rw-r--r--src/gui/kernel/qsurface.cpp2
-rw-r--r--src/gui/kernel/qsurface.h2
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp2
-rw-r--r--src/gui/kernel/qsurfaceformat.h2
-rw-r--r--src/gui/kernel/qt_gui_pch.h2
-rw-r--r--src/gui/kernel/qtouchdevice.cpp2
-rw-r--r--src/gui/kernel/qtouchdevice.h2
-rw-r--r--src/gui/kernel/qtouchdevice_p.h2
-rw-r--r--src/gui/kernel/qwindow.cpp111
-rw-r--r--src/gui/kernel/qwindow.h8
-rw-r--r--src/gui/kernel/qwindow_p.h2
-rw-r--r--src/gui/kernel/qwindowdefs.h2
-rw-r--r--src/gui/kernel/qwindowdefs_win.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp68
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h17
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h28
92 files changed, 799 insertions, 457 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 57ed3a983a..bf552c9991 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -13,6 +13,7 @@ HEADERS += \
kernel/qplatformintegration_qpa.h \
kernel/qplatformdrag_qpa.h \
kernel/qplatformscreen_qpa.h \
+ kernel/qplatformscreen_qpa_p.h \
kernel/qplatforminputcontext_qpa.h \
kernel/qplatformintegrationfactory_qpa_p.h \
kernel/qplatformintegrationplugin_qpa.h \
@@ -50,6 +51,7 @@ HEADERS += \
kernel/qsessionmanager.h \
kernel/qwindowdefs.h \
kernel/qscreen.h \
+ kernel/qscreen_p.h \
kernel/qstylehints.h \
kernel/qtouchdevice.h \
kernel/qtouchdevice_p.h
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 970d365af8..341b042328 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index 6902a1362b..b909889815 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp
index 737b2131c0..edcf21babc 100644
--- a/src/gui/kernel/qclipboard_qpa.cpp
+++ b/src/gui/kernel/qclipboard_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index faa9500f9f..bd327e1eb1 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -49,6 +49,7 @@
#include <qdatastream.h>
#include <qvariant.h>
#include <private/qcursor_p.h>
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -564,6 +565,15 @@ QCursor::operator QVariant() const
{
return QVariant(QVariant::Cursor, this);
}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QCursor &c)
+{
+ dbg.nospace() << "QCursor(Qt::CursorShape(" << c.shape() << "))";
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
#endif // QT_NO_CURSOR
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 584aff42d3..7437da4aba 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -126,6 +126,11 @@ private:
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &outS, const QCursor &cursor);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &inS, QCursor &cursor);
#endif
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QCursor &);
+#endif
+
#endif // QT_NO_CURSOR
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h
index 71a07cca49..a904260388 100644
--- a/src/gui/kernel/qcursor_p.h
+++ b/src/gui/kernel/qcursor_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp
index 7b3059e1df..6a12f977d3 100644
--- a/src/gui/kernel/qcursor_qpa.cpp
+++ b/src/gui/kernel/qcursor_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 4edcfa886f..4010fd73ff 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index 548e3d2e77..47018edde8 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 399c467643..284b1e5c1b 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index b590c4f015..ccadd8f1cc 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 035f1b2666..61ccaa5cfd 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -941,15 +941,6 @@ QFocusEvent::~QFocusEvent()
{
}
-// ### Qt 5: remove
-/*!
- \internal
- */
-Qt::FocusReason QFocusEvent::reason()
-{
- return m_reason;
-}
-
/*!
Returns the reason for this focus event.
*/
@@ -3232,13 +3223,6 @@ QClipboardEvent::~QClipboardEvent()
Returns the key sequence that triggered the event.
*/
-// ### Qt 5: remove
-/*!
- \fn const QKeySequence &QShortcutEvent::key()
-
- \internal
-*/
-
/*!
\fn int QShortcutEvent::shortcutId() const
@@ -3248,14 +3232,6 @@ QClipboardEvent::~QClipboardEvent()
\sa QShortcut::id()
*/
-// ### Qt 5: remove
-/*!
- \fn int QShortcutEvent::shortcutId()
- \overload
-
- \internal
-*/
-
/*!
\fn bool QShortcutEvent::isAmbiguous() const
@@ -3265,13 +3241,6 @@ QClipboardEvent::~QClipboardEvent()
\sa QShortcut::activatedAmbiguously()
*/
-// ### Qt 5: remove
-/*!
- \fn bool QShortcutEvent::isAmbiguous()
-
- \internal
-*/
-
/*!
\class QWindowStateChangeEvent
\ingroup events
@@ -3354,7 +3323,7 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
\section1 Event Delivery and Propagation
- By default, QWidget::event() translates the first non-primary touch point in a QTouchEvent into
+ By default, QGuiApplication translates the first touch point in a QTouchEvent into
a QMouseEvent. This makes it possible to enable touch events on existing widgets that do not
normally handle QTouchEvent. See below for information on some special considerations needed
when doing this.
@@ -3392,17 +3361,12 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
This makes it possible for sibling widgets to handle touch events independently while making
sure that the sequence of QTouchEvents is always correct.
- \section1 Mouse Events and the Primary Touch Point
+ \section1 Mouse Events and Touch Event synthesizing
- QTouchEvent delivery is independent from that of QMouseEvent. On some windowing systems, mouse
- events are also sent for the \l{QTouchEvent::TouchPoint::isPrimary()}{primary touch point}.
- This means it is possible for your widget to receive both QTouchEvent and QMouseEvent for the
- same user interaction point. You can use the QTouchEvent::TouchPoint::isPrimary() function to
- identify the primary touch point.
-
- Note that on some systems, it is possible to receive touch events without a primary touch
- point. All this means is that there will be no mouse event generated for the touch points in
- the QTouchEvent.
+ QTouchEvent delivery is independent from that of QMouseEvent. The application flags
+ Qt::AA_SynthesizeTouchForUnhandledMouseEvents and Qt::AA_SynthesizeMouseForUnhandledTouchEvents
+ can be used to enable or disable automatic synthesizing of touch events to mouse events and
+ mouse events to touch events.
\section1 Caveats
@@ -3441,9 +3405,6 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
\value TouchPointMoved The touch point moved.
\value TouchPointStationary The touch point did not move.
\value TouchPointReleased The touch point was released.
-
- \omitvalue TouchPointStateMask
- \omitvalue TouchPointPrimary
*/
/*! \enum QTouchEvent::DeviceType
@@ -3467,7 +3428,8 @@ QTouchEvent::QTouchEvent(QEvent::Type eventType,
Qt::TouchPointStates touchPointStates,
const QList<QTouchEvent::TouchPoint> &touchPoints)
: QInputEvent(eventType, modifiers),
- _widget(0),
+ _window(0),
+ _target(0),
_device(device),
_touchPointStates(touchPointStates),
_touchPoints(touchPoints)
@@ -3479,11 +3441,6 @@ QTouchEvent::QTouchEvent(QEvent::Type eventType,
QTouchEvent::~QTouchEvent()
{ }
-/*! \fn QWidget *QTouchEvent::widget() const
-
- Returns the widget on which the event occurred.
-*/
-
/*! \fn QWindow *QTouchEvent::window() const
Returns the window on which the event occurred. Useful for doing
@@ -3492,6 +3449,12 @@ QTouchEvent::~QTouchEvent()
touch event.
*/
+/*! \fn QObject *QTouchEvent::target() const
+
+ Returns the target object within the window on which the event occurred.
+ This is typically a QWidget or a QQuickItem. May be 0 when no specific target is available.
+*/
+
/*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const
Returns the touch device Type, which is of type \l {QTouchEvent::DeviceType} {DeviceType}.
@@ -3521,18 +3484,18 @@ QTouchEvent::~QTouchEvent()
Returns the touch device from which this touch event originates.
*/
-/*! \fn void QTouchEvent::setWidget(QWidget *widget)
+/*! \fn void QTouchEvent::setWindow(QWindow *window)
\internal
- Sets the widget for this event.
+ Sets the window for this event.
*/
-/*! \fn void QTouchEvent::setWindow(QWindow *window)
+/*! \fn void QTouchEvent::setTarget(QObject *target)
\internal
- Sets the window for this event.
+ Sets the target within the window (typically a widget) for this event.
*/
/*! \fn void QTouchEvent::setTouchPointStates(Qt::TouchPointStates touchPointStates)
@@ -3621,16 +3584,7 @@ int QTouchEvent::TouchPoint::id() const
*/
Qt::TouchPointState QTouchEvent::TouchPoint::state() const
{
- return Qt::TouchPointState(int(d->state) & Qt::TouchPointStateMask);
-}
-
-/*!
- Returns true if this touch point is the primary touch point. The primary touch point is the
- point for which the windowing system generates mouse events.
-*/
-bool QTouchEvent::TouchPoint::isPrimary() const
-{
- return (d->state & Qt::TouchPointPrimary) != 0;
+ return Qt::TouchPointState(int(d->state));
}
/*!
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 6a0442509c..a59b178cec 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -266,7 +266,6 @@ public:
inline bool gotFocus() const { return type() == FocusIn; }
inline bool lostFocus() const { return type() == FocusOut; }
- Qt::FocusReason reason();
Qt::FocusReason reason() const;
private:
@@ -639,11 +638,8 @@ public:
QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false);
~QShortcutEvent();
- inline const QKeySequence &key() { return sequence; }
inline const QKeySequence &key() const { return sequence; }
- inline int shortcutId() { return sid; }
inline int shortcutId() const { return sid; }
- inline bool isAmbiguous() { return ambig; }
inline bool isAmbiguous() const { return ambig; }
protected:
QKeySequence sequence;
@@ -694,7 +690,7 @@ public:
{
public:
enum InfoFlag {
- Pen = 0x0001
+ Pen = 0x0001
};
Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
@@ -705,7 +701,6 @@ public:
int id() const;
Qt::TouchPointState state() const;
- bool isPrimary() const;
QPointF pos() const;
QPointF startPos() const;
@@ -776,23 +771,23 @@ public:
const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
~QTouchEvent();
- inline QWidget *widget() const { return _widget; }
inline QWindow *window() const { return _window; }
+ inline QObject *target() const { return _target; }
QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); }
inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
inline QTouchDevice *device() const { return _device; }
// internal
- inline void setWidget(QWidget *awidget) { _widget = awidget; }
inline void setWindow(QWindow *awindow) { _window = awindow; }
+ inline void setTarget(QObject *atarget) { _target = atarget; }
inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
- inline void setDevice(QTouchDevice *device) { _device = device; }
+ inline void setDevice(QTouchDevice *adevice) { _device = adevice; }
protected:
- QWidget *_widget;
QWindow *_window;
+ QObject *_target;
QTouchDevice *_device;
Qt::TouchPointStates _touchPointStates;
QList<QTouchEvent::TouchPoint> _touchPoints;
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 1eee92d176..6dff55ca14 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericplugin_qpa.cpp b/src/gui/kernel/qgenericplugin_qpa.cpp
index e7b65b730e..23733e3ea9 100644
--- a/src/gui/kernel/qgenericplugin_qpa.cpp
+++ b/src/gui/kernel/qgenericplugin_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericplugin_qpa.h b/src/gui/kernel/qgenericplugin_qpa.h
index c4dd5a9df0..196304d2a4 100644
--- a/src/gui/kernel/qgenericplugin_qpa.h
+++ b/src/gui/kernel/qgenericplugin_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
index 7c0975ac1d..4735604837 100644
--- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp
+++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.h b/src/gui/kernel/qgenericpluginfactory_qpa.h
index 2359de9aa9..2d1550ffac 100644
--- a/src/gui/kernel/qgenericpluginfactory_qpa.h
+++ b/src/gui/kernel/qgenericpluginfactory_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 6d5e210e82..f92e66b38e 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -57,6 +57,7 @@
#include <QtDebug>
#include <qpalette.h>
#include <qscreen.h>
+#include <private/qscreen_p.h>
#include <QtGui/QPlatformIntegration>
#include <QtGui/QGenericPluginFactory>
@@ -68,7 +69,6 @@
#include <QWindowSystemInterface>
#include "private/qwindowsysteminterface_qpa_p.h"
#include "private/qwindow_p.h"
-#include "private/qkeymapper_p.h"
#include "private/qcursor_p.h"
#include "private/qdnd_p.h"
#include <private/qplatformthemefactory_qpa_p.h>
@@ -113,6 +113,7 @@ static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
static bool force_reverse = false;
QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0;
+QTouchDevice *QGuiApplicationPrivate::m_fakeTouchDevice = 0;
#ifndef QT_NO_CLIPBOARD
QClipboard *QGuiApplicationPrivate::qt_clipboard = 0;
@@ -186,6 +187,7 @@ QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags
inputPanel(0)
{
self = this;
+ application_type = QCoreApplication::GuiClient;
}
QWindow *QGuiApplication::focusWindow()
@@ -333,6 +335,16 @@ void QGuiApplicationPrivate::createPlatformIntegration()
// Load the platform integration
QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
+
+ // On Mac, look inside the application bundle for the platform plugin.
+ // TODO (msorvig): Create proper cross-platform solution for loading
+ // deployed platform plugins
+#ifdef Q_OS_MAC
+ if (platformPluginPath.isEmpty()) {
+ platformPluginPath = QCoreApplication::applicationDirPath() + QLatin1String("../Plugins/");
+ }
+#endif
+
QByteArray platformName;
#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
platformName = QT_QPA_DEFAULT_PLATFORM_NAME;
@@ -678,7 +690,38 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
cursors.at(i).data()->pointerEvent(ev);
#endif
QGuiApplication::sendSpontaneousEvent(window, &ev);
- return;
+ if (!e->synthetic && !ev.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) {
+ if (!m_fakeTouchDevice) {
+ m_fakeTouchDevice = new QTouchDevice;
+ QWindowSystemInterface::registerTouchDevice(m_fakeTouchDevice);
+ }
+ QList<QWindowSystemInterface::TouchPoint> points;
+ QWindowSystemInterface::TouchPoint point;
+ point.id = 1;
+ point.area = QRectF(globalPoint.x() - 2, globalPoint.y() - 2, 4, 4);
+
+ // only translate left button related events to
+ // avoid strange touch event sequences when several
+ // buttons are pressed
+ if (type == QEvent::MouseButtonPress && button == Qt::LeftButton) {
+ point.state = Qt::TouchPointPressed;
+ } else if (type == QEvent::MouseButtonRelease && button == Qt::LeftButton) {
+ point.state = Qt::TouchPointReleased;
+ } else if (type == QEvent::MouseMove && (buttons & Qt::LeftButton)) {
+ point.state = Qt::TouchPointMoved;
+ } else {
+ return;
+ }
+
+ points << point;
+
+ QEvent::Type type;
+ QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::convertTouchPoints(points, &type);
+
+ QWindowSystemInterfacePrivate::TouchEvent fake(window, e->timestamp, type, m_fakeTouchDevice, touchPoints, e->modifiers);
+ fake.synthetic = true;
+ processTouchEvent(&fake);
+ }
}
}
@@ -742,9 +785,6 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le
void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e)
{
- if (!e->activated)
- return;
-
QWindow *previous = QGuiApplicationPrivate::focus_window;
QGuiApplicationPrivate::focus_window = e->activated.data();
@@ -754,10 +794,18 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
if (previous) {
QFocusEvent focusOut(QEvent::FocusOut);
QCoreApplication::sendSpontaneousEvent(previous, &focusOut);
+ } else {
+ QEvent appActivate(QEvent::ApplicationActivate);
+ qApp->sendSpontaneousEvent(qApp, &appActivate);
}
- QFocusEvent focusIn(QEvent::FocusIn);
- QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
+ if (QGuiApplicationPrivate::focus_window) {
+ QFocusEvent focusIn(QEvent::FocusIn);
+ QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
+ } else {
+ QEvent appActivate(QEvent::ApplicationDeactivate);
+ qApp->sendSpontaneousEvent(qApp, &appActivate);
+ }
if (self)
self->notifyActiveWindowChange(previous);
@@ -822,6 +870,18 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
QGuiApplication::sendSpontaneousEvent(e->window.data(), &event);
}
+Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k)
+{
+ return qHash(k.device) + k.touchPointId;
+}
+
+Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,
+ const QGuiApplicationPrivate::ActiveTouchPointsKey &b)
+{
+ return a.device == b.device
+ && a.touchPointId == b.touchPointId;
+}
+
void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e)
{
QWindow *window = e->window.data();
@@ -839,13 +899,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
// update state
QWeakPointer<QWindow> w;
QTouchEvent::TouchPoint previousTouchPoint;
+ ActiveTouchPointsKey touchInfoKey(e->device, touchPoint.id());
+ ActiveTouchPointsValue &touchInfo = d->activeTouchPoints[touchInfoKey];
switch (touchPoint.state()) {
case Qt::TouchPointPressed:
if (e->device->type() == QTouchDevice::TouchPad) {
// on touch-pads, send all touch points to the same widget
- w = d->windowForTouchPointId.isEmpty()
+ w = d->activeTouchPoints.isEmpty()
? QWeakPointer<QWindow>()
- : d->windowForTouchPointId.constBegin().value();
+ : d->activeTouchPoints.constBegin().value().window;
}
if (!w) {
@@ -857,7 +919,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
w = window;
}
- d->windowForTouchPointId[touchPoint.id()] = w;
+ touchInfo.window = w;
touchPoint.d->startScreenPos = touchPoint.screenPos();
touchPoint.d->lastScreenPos = touchPoint.screenPos();
touchPoint.d->startNormalizedPos = touchPoint.normalizedPos();
@@ -865,14 +927,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
if (touchPoint.pressure() < qreal(0.))
touchPoint.d->pressure = qreal(1.);
- d->appCurrentTouchPoints.insert(touchPoint.id(), touchPoint);
+ touchInfo.touchPoint = touchPoint;
break;
case Qt::TouchPointReleased:
- w = d->windowForTouchPointId.take(touchPoint.id());
+ w = touchInfo.window;
if (!w)
continue;
- previousTouchPoint = d->appCurrentTouchPoints.take(touchPoint.id());
+
+ previousTouchPoint = touchInfo.touchPoint;
touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
touchPoint.d->startPos = previousTouchPoint.startPos();
@@ -881,14 +944,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos();
if (touchPoint.pressure() < qreal(0.))
touchPoint.d->pressure = qreal(0.);
+
break;
default:
- w = d->windowForTouchPointId.value(touchPoint.id());
+ w = touchInfo.window;
if (!w)
continue;
- Q_ASSERT(d->appCurrentTouchPoints.contains(touchPoint.id()));
- previousTouchPoint = d->appCurrentTouchPoints.value(touchPoint.id());
+
+ previousTouchPoint = touchInfo.touchPoint;
touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
touchPoint.d->startPos = previousTouchPoint.startPos();
@@ -901,7 +965,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
// Stationary points might not be delivered down to the receiving item
// and get their position transformed, keep the old values instead.
if (touchPoint.state() != Qt::TouchPointStationary)
- d->appCurrentTouchPoints[touchPoint.id()] = touchPoint;
+ touchInfo.touchPoint = touchPoint;
break;
}
@@ -914,8 +978,6 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
StatesAndTouchPoints &maskAndPoints = windowsNeedingEvents[w.data()];
maskAndPoints.first |= touchPoint.state();
- if (touchPoint.isPrimary())
- maskAndPoints.first |= Qt::TouchPointPrimary;
maskAndPoints.second.append(touchPoint);
}
@@ -928,7 +990,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
QWindow *w = it.key();
QEvent::Type eventType;
- switch (it.value().first & Qt::TouchPointStateMask) {
+ switch (it.value().first) {
case Qt::TouchPointPressed:
eventType = QEvent::TouchBegin;
break;
@@ -969,6 +1031,28 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
}
QGuiApplication::sendSpontaneousEvent(w, &touchEvent);
+ if (!e->synthetic && !touchEvent.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) {
+ // exclude touchpads as those generate their own mouse events
+ if (touchEvent.device()->type() != QTouchDevice::TouchPad) {
+ Qt::MouseButtons b = eventType == QEvent::TouchEnd ? Qt::NoButton : Qt::LeftButton;
+
+ const QTouchEvent::TouchPoint &touchPoint = touchEvent.touchPoints().first();
+
+ QWindowSystemInterfacePrivate::MouseEvent fake(w, e->timestamp, touchPoint.pos(), touchPoint.screenPos(), b, e->modifiers);
+ fake.synthetic = true;
+ processMouseEvent(&fake);
+ }
+ }
+ }
+
+ // Remove released points from the hash table only after the event is
+ // delivered. When the receiver is a widget, QApplication will access
+ // activeTouchPoints during delivery and therefore nothing can be removed
+ // before sending the event.
+ for (int i = 0; i < e->points.count(); ++i) {
+ QTouchEvent::TouchPoint touchPoint = e->points.at(i);
+ if (touchPoint.state() == Qt::TouchPointReleased)
+ d->activeTouchPoints.remove(ActiveTouchPointsKey(e->device, touchPoint.id()));
}
}
@@ -982,6 +1066,8 @@ void QGuiApplicationPrivate::reportScreenOrientationChange(QWindowSystemInterfac
return;
QScreen *s = e->screen.data();
+ s->d_func()->currentOrientation = e->orientation;
+
emit s->currentOrientationChanged(s->currentOrientation());
QScreenOrientationChangeEvent event(s, s->currentOrientation());
@@ -998,6 +1084,7 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate:
return;
QScreen *s = e->screen.data();
+ s->d_func()->geometry = e->geometry;
emit s->sizeChanged(s->size());
emit s->geometryChanged(s->geometry());
@@ -1019,6 +1106,7 @@ void QGuiApplicationPrivate::reportAvailableGeometryChange(
return;
QScreen *s = e->screen.data();
+ s->d_func()->availableGeometry = e->availableGeometry;
emit s->availableSizeChanged(s->availableSize());
emit s->availableGeometryChanged(s->availableGeometry());
@@ -1034,6 +1122,7 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa
return;
QScreen *s = e->screen.data();
+ s->d_func()->logicalDpi = QDpi(e->dpiX, e->dpiY);
emit s->logicalDotsPerInchXChanged(s->logicalDotsPerInchX());
emit s->logicalDotsPerInchYChanged(s->logicalDotsPerInchY());
@@ -1140,6 +1229,16 @@ QPalette QGuiApplication::palette()
return *QGuiApplicationPrivate::app_pal;
}
+void QGuiApplication::setPalette(const QPalette &pal)
+{
+ if (QGuiApplicationPrivate::app_pal && pal.isCopyOf(*QGuiApplicationPrivate::app_pal))
+ return;
+ if (!QGuiApplicationPrivate::app_pal)
+ QGuiApplicationPrivate::app_pal = new QPalette(pal);
+ else
+ *QGuiApplicationPrivate::app_pal = pal;
+}
+
QFont QGuiApplication::font()
{
QMutexLocker locker(applicationFontMutex());
@@ -1423,26 +1522,24 @@ uint QGuiApplicationPrivate::currentKeyPlatform()
/*!
\since 4.2
+ \obsolete
- Returns the current keyboard input locale.
+ Returns the current keyboard input locale. Replaced with QInputPanel::locale()
*/
QLocale QGuiApplication::keyboardInputLocale()
{
- if (!QGuiApplicationPrivate::checkInstance("keyboardInputLocale"))
- return QLocale::c();
- return qt_keymapper_private()->keyboardInputLocale;
+ return qApp ? qApp->inputPanel()->locale() : QLocale::c();
}
/*!
\since 4.2
+ \obsolete
- Returns the current keyboard input direction.
+ Returns the current keyboard input direction. Replaced with QInputPanel::inputDirection()
*/
Qt::LayoutDirection QGuiApplication::keyboardInputDirection()
{
- if (!QGuiApplicationPrivate::checkInstance("keyboardInputDirection"))
- return Qt::LeftToRight;
- return qt_keymapper_private()->keyboardInputDirection;
+ return qApp ? qApp->inputPanel()->inputDirection() : Qt::LeftToRight;
}
/*!
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 1afbf17cf7..dd7b1f8806 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -108,6 +108,7 @@ public:
#endif
static QPalette palette();
+ static void setPalette(const QPalette &pal);
static Qt::KeyboardModifiers keyboardModifiers();
static Qt::MouseButtons mouseButtons();
@@ -118,9 +119,8 @@ public:
static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; }
static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
- // ### move to QInputPanel
- static QLocale keyboardInputLocale();
- static Qt::LayoutDirection keyboardInputDirection();
+ QT_DEPRECATED static QLocale keyboardInputLocale();
+ QT_DEPRECATED static Qt::LayoutDirection keyboardInputDirection();
QStyleHints *styleHints() const;
QInputPanel *inputPanel() const;
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 9c8a2ca642..9c965cd109 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -189,15 +189,30 @@ public:
QShortcutMap shortcutMap;
#endif
+ struct ActiveTouchPointsKey {
+ ActiveTouchPointsKey(QTouchDevice *dev, int id) : device(dev), touchPointId(id) { }
+ QTouchDevice *device;
+ int touchPointId;
+ };
+ struct ActiveTouchPointsValue {
+ QWeakPointer<QWindow> window;
+ QWeakPointer<QObject> target;
+ QTouchEvent::TouchPoint touchPoint;
+ };
+ QHash<ActiveTouchPointsKey, ActiveTouchPointsValue> activeTouchPoints;
+
private:
void init();
static QGuiApplicationPrivate *self;
-
- QMap<int, QWeakPointer<QWindow> > windowForTouchPointId;
- QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints;
+ static QTouchDevice *m_fakeTouchDevice;
};
+Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);
+
+Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,
+ const QGuiApplicationPrivate::ActiveTouchPointsKey &b);
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 3b60f29e83..532a5353e2 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -79,6 +79,7 @@
#include "qstringlist.h"
#include "qurl.h"
#include "qlocale.h"
+#include "quuid.h"
#ifndef QT_NO_GEOM_VARIANT
#include "qsize.h"
@@ -94,8 +95,6 @@
QT_BEGIN_NAMESPACE
-Q_GUI_EXPORT const QVariant::Handler *qt_widgets_variant_handler = 0;
-
Q_CORE_EXPORT const QVariant::Handler *qcoreVariantHandler();
namespace {
@@ -136,53 +135,35 @@ template<> struct TypeDefiniton<QVector4D> { static const bool IsAvailable = fal
template<> struct TypeDefiniton<QQuaternion> { static const bool IsAvailable = false; };
#endif
-struct CoreAndGuiTypesFilter {
+struct GuiTypesFilter {
template<typename T>
struct Acceptor {
- static const bool IsAccepted = (QTypeModuleInfo<T>::IsCore || QTypeModuleInfo<T>::IsGui) && TypeDefiniton<T>::IsAvailable;
+ static const bool IsAccepted = QTypeModuleInfo<T>::IsGui && TypeDefiniton<T>::IsAvailable;
};
};
-} // namespace
+} // namespace used to hide TypeDefinition
+namespace {
static void construct(QVariant::Private *x, const void *copy)
{
const int type = x->type;
- QVariantConstructor<CoreAndGuiTypesFilter> constructor(x, copy);
- QMetaTypeSwitcher::switcher<void>(constructor, type, 0);
-
- // FIXME This is an ugly hack if QVariantConstructor fails to build a value it constructs an invalid type
- if (Q_UNLIKELY(x->type == QVariant::Invalid)) {
- if (type == 62) {
- // small 'trick' to let a QVariant(Qt::blue) create a variant
- // of type QColor
- // TODO Get rid of this hack.
- x->type = QVariant::Color;
- QColor color(*reinterpret_cast<const Qt::GlobalColor *>(copy));
- v_construct<QColor>(x, &color);
- return;
- }
- if (type == QVariant::Icon || type == QVariant::SizePolicy) {
- // TODO we need to clean up variant handlers, so they are replacament, not extension
- x->type = type;
- if (qt_widgets_variant_handler) {
- qt_widgets_variant_handler->construct(x, copy);
- }
- }
+ if (Q_UNLIKELY(type == 62)) {
+ // small 'trick' to let a QVariant(Qt::blue) create a variant
+ // of type QColor
+ // TODO Get rid of this hack.
+ x->type = QVariant::Color;
+ QColor color(*reinterpret_cast<const Qt::GlobalColor *>(copy));
+ v_construct<QColor>(x, &color);
+ return;
}
+ QVariantConstructor<GuiTypesFilter> constructor(x, copy);
+ QMetaTypeSwitcher::switcher<void>(constructor, type, 0);
}
static void clear(QVariant::Private *d)
{
- const int type = d->type;
- if (type == QVariant::Icon || type == QVariant::SizePolicy) {
- // TODO we need to clean up variant handlers, so they are replacament, not extension
- if (qt_widgets_variant_handler) {
- qt_widgets_variant_handler->clear(d);
- return;
- }
- }
- QVariantDestructor<CoreAndGuiTypesFilter> destructor(d);
- QMetaTypeSwitcher::switcher<void>(destructor, type, 0);
+ QVariantDestructor<GuiTypesFilter> destructor(d);
+ QMetaTypeSwitcher::switcher<void>(destructor, d->type, 0);
}
// This class is a hack that customizes access to QPolygon
@@ -200,7 +181,7 @@ public:
};
static bool isNull(const QVariant::Private *d)
{
- QGuiVariantIsNull<CoreAndGuiTypesFilter> isNull(d);
+ QGuiVariantIsNull<GuiTypesFilter> isNull(d);
return QMetaTypeSwitcher::switcher<bool>(isNull, d->type, 0);
}
@@ -215,11 +196,6 @@ public:
template<typename T>
bool delegate(const T *p)
{
- if (Q_UNLIKELY(Base::m_a->type == QVariant::Icon || Base::m_a->type == QVariant::SizePolicy)) {
- // TODO we need to clean up variant handlers, so they are replacament, not extension
- if (Q_LIKELY(qt_widgets_variant_handler))
- return qt_widgets_variant_handler->compare(Base::m_a, Base::m_b);
- }
return Base::delegate(p);
}
bool delegate(const QPixmap*)
@@ -241,7 +217,7 @@ public:
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
{
- QGuiVariantComparator<CoreAndGuiTypesFilter> comparator(a, b);
+ QGuiVariantComparator<GuiTypesFilter> comparator(a, b);
return QMetaTypeSwitcher::switcher<bool>(comparator, a->type, 0);
}
@@ -369,90 +345,9 @@ static bool convert(const QVariant::Private *d, QVariant::Type t,
#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
static void streamDebug(QDebug dbg, const QVariant &v)
{
- switch(v.type()) {
- case QVariant::Cursor:
-#ifndef QT_NO_CURSOR
-// dbg.nospace() << qvariant_cast<QCursor>(v); //FIXME
-#endif
- break;
- case QVariant::Bitmap:
-// dbg.nospace() << qvariant_cast<QBitmap>(v); //FIXME
- break;
- case QVariant::Polygon:
- dbg.nospace() << qvariant_cast<QPolygon>(v);
- break;
- case QVariant::Region:
- dbg.nospace() << qvariant_cast<QRegion>(v);
- break;
- case QVariant::Font:
-// dbg.nospace() << qvariant_cast<QFont>(v); //FIXME
- break;
- case QVariant::Matrix:
- dbg.nospace() << qvariant_cast<QMatrix>(v);
- break;
- case QVariant::Transform:
- dbg.nospace() << qvariant_cast<QTransform>(v);
- break;
- case QVariant::Pixmap:
-// dbg.nospace() << qvariant_cast<QPixmap>(v); //FIXME
- break;
- case QVariant::Image:
-// dbg.nospace() << qvariant_cast<QImage>(v); //FIXME
- break;
- case QVariant::Brush:
- dbg.nospace() << qvariant_cast<QBrush>(v);
- break;
- case QVariant::Color:
- dbg.nospace() << qvariant_cast<QColor>(v);
- break;
- case QVariant::Palette:
-// dbg.nospace() << qvariant_cast<QPalette>(v); //FIXME
- break;
-#ifndef QT_NO_ICON
- case QVariant::Icon:
-// dbg.nospace() << qvariant_cast<QIcon>(v); // FIXME
- break;
-#endif
- case QVariant::SizePolicy:
-// dbg.nospace() << qvariant_cast<QSizePolicy>(v); //FIXME
- break;
-#ifndef QT_NO_SHORTCUT
- case QVariant::KeySequence:
- dbg.nospace() << qvariant_cast<QKeySequence>(v);
- break;
-#endif
- case QVariant::Pen:
- dbg.nospace() << qvariant_cast<QPen>(v);
- break;
-#ifndef QT_NO_MATRIX4X4
- case QVariant::Matrix4x4:
- dbg.nospace() << qvariant_cast<QMatrix4x4>(v);
- break;
-#endif
-#ifndef QT_NO_VECTOR2D
- case QVariant::Vector2D:
- dbg.nospace() << qvariant_cast<QVector2D>(v);
- break;
-#endif
-#ifndef QT_NO_VECTOR3D
- case QVariant::Vector3D:
- dbg.nospace() << qvariant_cast<QVector3D>(v);
- break;
-#endif
-#ifndef QT_NO_VECTOR4D
- case QVariant::Vector4D:
- dbg.nospace() << qvariant_cast<QVector4D>(v);
- break;
-#endif
-#ifndef QT_NO_QUATERNION
- case QVariant::Quaternion:
- dbg.nospace() << qvariant_cast<QQuaternion>(v);
- break;
-#endif
- default:
- qcoreVariantHandler()->debugStream(dbg, v);
- break;
- }
+ QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
+ QVariantDebugStream<GuiTypesFilter> stream(dbg, d);
+ QMetaTypeSwitcher::switcher<void>(stream, d->type, 0);
}
#endif
@@ -474,29 +369,28 @@ const QVariant::Handler qt_gui_variant_handler = {
#endif
};
-extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeGuiHelper;
-
#define QT_IMPL_METATYPEINTERFACE_GUI_TYPES(MetaTypeName, MetaTypeId, RealName) \
- QMetaTypeInterface(static_cast<RealName*>(0)),
+ QT_METATYPE_INTERFACE_INIT(RealName),
static const QMetaTypeInterface qVariantGuiHelper[] = {
QT_FOR_EACH_STATIC_GUI_CLASS(QT_IMPL_METATYPEINTERFACE_GUI_TYPES)
};
#undef QT_IMPL_METATYPEINTERFACE_GUI_TYPES
+} // namespace used to hide QVariant handler
+
+extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeGuiHelper;
-static const QVariant::Handler *qt_guivariant_last_handler = 0;
void qRegisterGuiVariant()
{
- qt_guivariant_last_handler = QVariant::handler;
- QVariant::handler = &qt_gui_variant_handler;
+ QVariantPrivate::registerHandler(QModulesPrivate::Gui, &qt_gui_variant_handler);
qMetaTypeGuiHelper = qVariantGuiHelper;
}
Q_CONSTRUCTOR_FUNCTION(qRegisterGuiVariant)
void qUnregisterGuiVariant()
{
- QVariant::handler = qt_guivariant_last_handler;
+ QVariantPrivate::unregisterHandler(QModulesPrivate::Gui);
qMetaTypeGuiHelper = 0;
}
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiVariant)
diff --git a/src/gui/kernel/qinputpanel.cpp b/src/gui/kernel/qinputpanel.cpp
index d6d58bf1c5..d6dd55b651 100644
--- a/src/gui/kernel/qinputpanel.cpp
+++ b/src/gui/kernel/qinputpanel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -158,9 +158,9 @@ QRectF QInputPanel::cursorRectangle() const
\property QInputPanel::keyboardRectangle
\brief Virtual keyboard's geometry in window coordinates.
*/
-QRectF QInputPanel::keyboardRectangle()
+QRectF QInputPanel::keyboardRectangle() const
{
- Q_D(QInputPanel);
+ Q_D(const QInputPanel);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->keyboardRect();
@@ -248,6 +248,32 @@ bool QInputPanel::isAnimating() const
}
/*!
+ \property QInputPanel::locale
+ \brief Current input locale.
+*/
+QLocale QInputPanel::locale() const
+{
+ Q_D(const QInputPanel);
+ QPlatformInputContext *ic = d->platformInputContext();
+ if (ic)
+ return ic->locale();
+ return QLocale::c();
+}
+
+/*!
+ \property QInputPanel::inputDirection
+ \brief Current input direction.
+*/
+Qt::LayoutDirection QInputPanel::inputDirection() const
+{
+ Q_D(const QInputPanel);
+ QPlatformInputContext *ic = d->platformInputContext();
+ if (ic)
+ return ic->inputDirection();
+ return Qt::LeftToRight;
+}
+
+/*!
Called by the input item to inform the platform input methods when there has been
state changes in editor's input method query attributes. When calling the function
\a queries parameter has to be used to tell what has changes, which input method
diff --git a/src/gui/kernel/qinputpanel.h b/src/gui/kernel/qinputpanel.h
index 4edc902104..c33bd13451 100644
--- a/src/gui/kernel/qinputpanel.h
+++ b/src/gui/kernel/qinputpanel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -64,6 +64,8 @@ class Q_GUI_EXPORT QInputPanel : public QObject
Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged)
Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged)
+ Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged)
+ Q_PROPERTY(Qt::LayoutDirection inputDirection READ inputDirection NOTIFY inputDirectionChanged)
Q_ENUMS(Action)
public:
@@ -80,7 +82,7 @@ public:
QRectF cursorRectangle() const; // ### what if we have rotations for the item?
// keyboard geometry in window coords
- QRectF keyboardRectangle();
+ QRectF keyboardRectangle() const;
enum Action {
Click,
@@ -92,6 +94,9 @@ public:
bool isAnimating() const;
+ QLocale locale() const;
+ Qt::LayoutDirection inputDirection() const;
+
public Q_SLOTS:
void show();
void hide();
@@ -108,6 +113,8 @@ Q_SIGNALS:
void keyboardRectangleChanged();
void visibleChanged();
void animatingChanged();
+ void localeChanged();
+ void inputDirectionChanged(Qt::LayoutDirection newDirection);
private:
friend class QGuiApplication;
diff --git a/src/gui/kernel/qinputpanel_p.h b/src/gui/kernel/qinputpanel_p.h
index 6fcf2d7243..f30c8a1b80 100644
--- a/src/gui/kernel/qinputpanel_p.h
+++ b/src/gui/kernel/qinputpanel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp
index 4ee7d66dd8..a411ee5904 100644
--- a/src/gui/kernel/qkeymapper.cpp
+++ b/src/gui/kernel/qkeymapper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index 1fada6f59a..bf19f1d80a 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeymapper_qpa.cpp b/src/gui/kernel/qkeymapper_qpa.cpp
index 13c6d6c28b..fd04ff234c 100644
--- a/src/gui/kernel/qkeymapper_qpa.cpp
+++ b/src/gui/kernel/qkeymapper_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 6ea502b70b..986701bd7b 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1259,13 +1259,20 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
// Rational: A modifier will contain the name AND +, so longer than 1, a length of 1 is just
// the remaining part of the shortcut (ei. The 'C' in "Ctrl+C"), so no need to check that.
if (sub.length() > 1) {
+ bool validModifier = false;
for (int j = 0; j < modifs.size(); ++j) {
const QModifKeyName &mkf = modifs.at(j);
if (sub == mkf.name) {
ret |= mkf.qt_key;
+ validModifier = true;
break; // Shortcut, since if we find an other it would/should just be a dup
}
}
+ // We couldn't match the string with a modifier. This is only
+ // possible if this part is the key. The key is never followed by a
+ // '+'. And if the key is '+' the if() above would have skipped it.
+ if (!validModifier)
+ return Qt::Key_unknown;
}
lastI = i + 1;
}
@@ -1309,6 +1316,9 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
if (found)
break;
}
+ // We couldn't translate the key.
+ if (!found)
+ return Qt::Key_unknown;
}
return ret;
}
@@ -1335,6 +1345,11 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
{
bool nativeText = (format == QKeySequence::NativeText);
QString s;
+
+ // Handle -1 (Invalid Key) and Qt::Key_unknown gracefully
+ if (key == -1 || key == Qt::Key_unknown)
+ return s;
+
#if defined(Q_OS_MAC)
if (nativeText) {
// On Mac OS X the order (by default) is Meta, Alt, Shift, Control.
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 31cec17fb1..1127e8afca 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index 7fa98dd5eb..57f6e1927f 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 6a9cb43028..93a4b3582b 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -174,6 +174,8 @@ bool QOpenGLContext::create()
void QOpenGLContext::destroy()
{
Q_D(QOpenGLContext);
+ if (d->platformGLContext)
+ emit aboutToBeDestroyed();
if (QOpenGLContext::currentContext() == this)
doneCurrent();
if (d->shareGroup)
@@ -186,6 +188,17 @@ void QOpenGLContext::destroy()
}
/*!
+ \fn void QOpenGLContext::aboutToBeDestroyed()
+
+ This signal is emitted before the underlying native OpenGL context is
+ destroyed, such that users may clean up OpenGL resources that might otherwise
+ be left dangling in the case of shared OpenGL contexts.
+
+ If you wish to make the context current in order to do clean-up, make sure to
+ only connect to the signal using a direct connection.
+*/
+
+/*!
If this is the current context for the thread, doneCurrent is called
*/
QOpenGLContext::~QOpenGLContext()
@@ -297,7 +310,7 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
d->platformGLContext->swapBuffers(surfaceHandle);
}
-void (*QOpenGLContext::getProcAddress(const QByteArray &procName)) ()
+QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName)
{
Q_D(QOpenGLContext);
if (!d->platformGLContext)
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index b5a19a0ebc..a8ac39c7d5 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -106,7 +106,7 @@ public:
void doneCurrent();
void swapBuffers(QSurface *surface);
- void (*getProcAddress(const QByteArray &procName)) ();
+ QFunctionPointer getProcAddress(const QByteArray &procName);
QSurface *surface() const;
@@ -118,6 +118,9 @@ public:
QOpenGLFunctions *functions() const;
+Q_SIGNALS:
+ void aboutToBeDestroyed();
+
private:
friend class QGLContext;
friend class QOpenGLContextResourceBase;
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index aff1042c5b..7040b883bf 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 893cc5eff6..2dd2ef00c5 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,6 +43,7 @@
#include "qguiapplication.h"
#include "qdatastream.h"
#include "qvariant.h"
+#include "qdebug.h"
QT_BEGIN_NAMESPACE
@@ -1081,4 +1082,12 @@ void QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBru
setBrush(cg, ToolTipText, toolTipText);
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QPalette &)
+{
+ dbg.nospace() << "QPalette()";
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index dd59d121a0..d47854df07 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -190,6 +190,10 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &ds, const QPalette &p);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &ds, QPalette &p);
#endif // QT_NO_DATASTREAM
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QPalette &);
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp
index c7c779e4eb..4d8d65de0a 100644
--- a/src/gui/kernel/qplatformclipboard_qpa.cpp
+++ b/src/gui/kernel/qplatformclipboard_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h
index fc0505b87e..643733fdf7 100644
--- a/src/gui/kernel/qplatformclipboard_qpa.h
+++ b/src/gui/kernel/qplatformclipboard_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp
index 752de18969..a3824381d3 100644
--- a/src/gui/kernel/qplatformcursor_qpa.cpp
+++ b/src/gui/kernel/qplatformcursor_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h
index da3c4752a0..a2026425db 100644
--- a/src/gui/kernel/qplatformcursor_qpa.h
+++ b/src/gui/kernel/qplatformcursor_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformdrag_qpa.h b/src/gui/kernel/qplatformdrag_qpa.h
index 0b65174f71..fb71f29de9 100644
--- a/src/gui/kernel/qplatformdrag_qpa.h
+++ b/src/gui/kernel/qplatformdrag_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.cpp b/src/gui/kernel/qplatforminputcontext_qpa.cpp
index bc0bcf8f4f..1e82507653 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.cpp
+++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,6 +42,7 @@
#include <qplatforminputcontext_qpa.h>
#include <qguiapplication.h>
#include <QRect>
+#include "private/qkeymapper_p.h"
QT_BEGIN_NAMESPACE
@@ -207,4 +208,25 @@ void QPlatformInputContext::emitInputPanelVisibleChanged()
emit qApp->inputPanel()->visibleChanged();
}
+QLocale QPlatformInputContext::locale() const
+{
+ return qt_keymapper_private()->keyboardInputLocale;
+}
+
+void QPlatformInputContext::emitLocaleChanged()
+{
+ emit qApp->inputPanel()->localeChanged();
+}
+
+Qt::LayoutDirection QPlatformInputContext::inputDirection() const
+{
+ return qt_keymapper_private()->keyboardInputDirection;
+}
+
+void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection)
+{
+ emit qApp->inputPanel()->inputDirectionChanged(newDirection);
+}
+
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext_qpa.h
index 76aa122720..463238f336 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.h
+++ b/src/gui/kernel/qplatforminputcontext_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -77,6 +77,11 @@ public:
virtual void hideInputPanel();
virtual bool isInputPanelVisible() const;
void emitInputPanelVisibleChanged();
+
+ virtual QLocale locale() const;
+ void emitLocaleChanged();
+ virtual Qt::LayoutDirection inputDirection() const;
+ void emitInputDirectionChanged(Qt::LayoutDirection newDirection);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp
index 956180c728..23ecf3add4 100644
--- a/src/gui/kernel/qplatformintegration_qpa.cpp
+++ b/src/gui/kernel/qplatformintegration_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -46,6 +46,7 @@
#include <QtGui/QPlatformAccessibility>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qpixmap_raster_p.h>
+#include <QtGui/private/qplatformscreen_qpa_p.h>
#include <private/qdnd_p.h>
QT_BEGIN_NAMESPACE
@@ -227,12 +228,16 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return 1000;
case KeyboardInputInterval:
return 400;
+ case KeyboardAutoRepeatRate:
+ return 30;
case MouseDoubleClickInterval:
return 400;
case StartDragDistance:
return 10;
case StartDragTime:
return 500;
+ case ShowIsFullScreen:
+ return false;
}
return 0;
@@ -251,11 +256,10 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
*/
void QPlatformIntegration::screenAdded(QPlatformScreen *ps)
{
- QScreen *screen = ps ? ps->screen() : 0;
- if (screen && !QGuiApplicationPrivate::screen_list.contains(screen)) {
- QGuiApplicationPrivate::screen_list << screen;
- emit qGuiApp->screenAdded(screen);
- }
+ QScreen *screen = new QScreen(ps);
+ ps->d_func()->screen = screen;
+ QGuiApplicationPrivate::screen_list << screen;
+ emit qGuiApp->screenAdded(screen);
}
class QPlatformTheme *QPlatformIntegration::platformTheme() const
diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h
index d5eb14bc50..3975d82288 100644
--- a/src/gui/kernel/qplatformintegration_qpa.h
+++ b/src/gui/kernel/qplatformintegration_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -106,7 +106,9 @@ public:
KeyboardInputInterval,
MouseDoubleClickInterval,
StartDragDistance,
- StartDragTime
+ StartDragTime,
+ KeyboardAutoRepeatRate,
+ ShowIsFullScreen
};
virtual QVariant styleHint(StyleHint hint) const;
diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
index c40494c408..7f2260b5f6 100644
--- a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
+++ b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
index 5ffdf85425..189b352139 100644
--- a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
+++ b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
index 0181b98ad7..a57b980ea3 100644
--- a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
+++ b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.h b/src/gui/kernel/qplatformintegrationplugin_qpa.h
index b397f56d7c..f53d66d1c8 100644
--- a/src/gui/kernel/qplatformintegrationplugin_qpa.h
+++ b/src/gui/kernel/qplatformintegrationplugin_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
index 5c1f8458db..f9ddd1f72a 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h
index bfcf78813b..47e2f82810 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.h
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.cpp b/src/gui/kernel/qplatformopenglcontext_qpa.cpp
index e764419825..7c5e8245df 100644
--- a/src/gui/kernel/qplatformopenglcontext_qpa.cpp
+++ b/src/gui/kernel/qplatformopenglcontext_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.h b/src/gui/kernel/qplatformopenglcontext_qpa.h
index 1b3bfc9a34..ac5cf969d9 100644
--- a/src/gui/kernel/qplatformopenglcontext_qpa.h
+++ b/src/gui/kernel/qplatformopenglcontext_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp
index 3fdb809137..26c685ff1a 100644
--- a/src/gui/kernel/qplatformscreen_qpa.cpp
+++ b/src/gui/kernel/qplatformscreen_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,23 +42,18 @@
#include "qplatformscreen_qpa.h"
#include <QtGui/qguiapplication.h>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qplatformscreen_qpa_p.h>
#include <QtGui/qplatformintegration_qpa.h>
#include <QtGui/qscreen.h>
#include <QtGui/qwindow.h>
QT_BEGIN_NAMESPACE
-class QPlatformScreenPrivate
-{
-public:
- QScreen *screen;
-};
-
QPlatformScreen::QPlatformScreen()
: d_ptr(new QPlatformScreenPrivate)
{
Q_D(QPlatformScreen);
- d->screen = new QScreen(this);
+ d->screen = 0;
}
QPlatformScreen::~QPlatformScreen()
diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h
index 64115a6cd5..586a29279c 100644
--- a/src/gui/kernel/qplatformscreen_qpa.h
+++ b/src/gui/kernel/qplatformscreen_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -120,6 +120,8 @@ protected:
private:
Q_DISABLE_COPY(QPlatformScreen)
+
+ friend class QPlatformIntegration;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformscreen_qpa_p.h b/src/gui/kernel/qplatformscreen_qpa_p.h
new file mode 100644
index 0000000000..67c222bdf3
--- /dev/null
+++ b/src/gui/kernel/qplatformscreen_qpa_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMSCREEN_QPA_P_H
+#define QPLATFORMSCREEN_QPA_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QScreen;
+
+class QPlatformScreenPrivate
+{
+public:
+ QScreen *screen;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QPLATFORMSCREEN_QPA_P_H
diff --git a/src/gui/kernel/qplatformsurface_qpa.cpp b/src/gui/kernel/qplatformsurface_qpa.cpp
index dcfd201ea3..3347f7984f 100644
--- a/src/gui/kernel/qplatformsurface_qpa.cpp
+++ b/src/gui/kernel/qplatformsurface_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformsurface_qpa.h b/src/gui/kernel/qplatformsurface_qpa.h
index 76b564de25..7ceb39f049 100644
--- a/src/gui/kernel/qplatformsurface_qpa.h
+++ b/src/gui/kernel/qplatformsurface_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformtheme_qpa.cpp b/src/gui/kernel/qplatformtheme_qpa.cpp
index c887d78edb..22d4452f4e 100644
--- a/src/gui/kernel/qplatformtheme_qpa.cpp
+++ b/src/gui/kernel/qplatformtheme_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -41,8 +41,36 @@
#include "qplatformtheme_qpa.h"
+#include <QtCore/QVariant>
+
QT_BEGIN_NAMESPACE
+/*!
+ \class QPlatformTheme
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+ \brief The QPlatformTheme class allows customizing the UI based on themes.
+
+*/
+
+/*!
+ \enum QPlatformTheme::ThemeHint
+
+ This enum describes the available theme hints.
+
+ \value TextCursorWidth (int) Determines the width of the text cursor.
+
+ \value DropShadow (bool) Determines whether the drop shadow effect for
+ tooltips or whatsthis is enabled.
+
+ \value MaximumScrollBarDragDistance (int) Determines the value returned by
+ QStyle::pixelMetric(PM_MaximumDragDistance)
+
+ \sa themeHint(), QStyle::pixelMetric()
+*/
+
QPlatformMenu *QPlatformTheme::createPlatformMenu(QMenu *menu) const
{
Q_UNUSED(menu);
@@ -67,4 +95,17 @@ QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(QDialog *dialo
return 0;
}
+QVariant QPlatformTheme::themeHint(ThemeHint hint) const
+{
+ switch (hint) {
+ case TextCursorWidth:
+ return QVariant(1);
+ case DropShadow:
+ return QVariant(false);
+ case MaximumScrollBarDragDistance:
+ return QVariant(-1);
+ }
+ return QVariant();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformtheme_qpa.h b/src/gui/kernel/qplatformtheme_qpa.h
index 2090ce37e1..c3e5b677a2 100644
--- a/src/gui/kernel/qplatformtheme_qpa.h
+++ b/src/gui/kernel/qplatformtheme_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -56,15 +56,24 @@ class QPlatformMenu;
class QPlatformMenuBar;
class QPlatformDialogHelper;
class QDialog;
+class QVariant;
class Q_GUI_EXPORT QPlatformTheme
{
public:
+ enum ThemeHint {
+ TextCursorWidth,
+ DropShadow,
+ MaximumScrollBarDragDistance
+ };
+
virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const;
virtual QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const;
virtual bool usePlatformNativeDialog(const QDialog *dialog = 0) const;
virtual QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const;
+
+ virtual QVariant themeHint(ThemeHint hint) const;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformthemefactory_qpa.cpp b/src/gui/kernel/qplatformthemefactory_qpa.cpp
index 87f96762c2..c278f41411 100644
--- a/src/gui/kernel/qplatformthemefactory_qpa.cpp
+++ b/src/gui/kernel/qplatformthemefactory_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformthemefactory_qpa_p.h b/src/gui/kernel/qplatformthemefactory_qpa_p.h
index b65e6e197a..71987aa723 100644
--- a/src/gui/kernel/qplatformthemefactory_qpa_p.h
+++ b/src/gui/kernel/qplatformthemefactory_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.cpp b/src/gui/kernel/qplatformthemeplugin_qpa.cpp
index e17e36fc3d..c51d4e9fc5 100644
--- a/src/gui/kernel/qplatformthemeplugin_qpa.cpp
+++ b/src/gui/kernel/qplatformthemeplugin_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.h b/src/gui/kernel/qplatformthemeplugin_qpa.h
index 0df9a8842d..89348deae0 100644
--- a/src/gui/kernel/qplatformthemeplugin_qpa.h
+++ b/src/gui/kernel/qplatformthemeplugin_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index 90fdec69f0..d69cb0e64e 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h
index c6b5bb80ea..7605a5a4aa 100644
--- a/src/gui/kernel/qplatformwindow_qpa.h
+++ b/src/gui/kernel/qplatformwindow_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 8a35ce6b8f..a1ed3014d0 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -40,23 +40,13 @@
****************************************************************************/
#include "qscreen.h"
+#include "qscreen_p.h"
#include "qplatformscreen_qpa.h"
#include <QtCore/private/qobject_p.h>
QT_BEGIN_NAMESPACE
-class QScreenPrivate : public QObjectPrivate
-{
-public:
- QScreenPrivate(QPlatformScreen *screen)
- : platformScreen(screen)
- {
- }
-
- QPlatformScreen *platformScreen;
-};
-
/*!
\class QScreen
\brief The QScreen class is used to query screen properties.
@@ -119,7 +109,7 @@ int QScreen::depth() const
QSize QScreen::size() const
{
Q_D(const QScreen);
- return d->platformScreen->geometry().size();
+ return d->geometry.size();
}
/*!
@@ -184,7 +174,7 @@ qreal QScreen::physicalDotsPerInch() const
qreal QScreen::logicalDotsPerInchX() const
{
Q_D(const QScreen);
- return d->platformScreen->logicalDpi().first;
+ return d->logicalDpi.first;
}
/*!
@@ -198,7 +188,7 @@ qreal QScreen::logicalDotsPerInchX() const
qreal QScreen::logicalDotsPerInchY() const
{
Q_D(const QScreen);
- return d->platformScreen->logicalDpi().second;
+ return d->logicalDpi.second;
}
/*!
@@ -216,7 +206,7 @@ qreal QScreen::logicalDotsPerInchY() const
qreal QScreen::logicalDotsPerInch() const
{
Q_D(const QScreen);
- QDpi dpi = d->platformScreen->logicalDpi();
+ QDpi dpi = d->logicalDpi;
return (dpi.first + dpi.second) * qreal(0.5);
}
@@ -246,7 +236,7 @@ QSizeF QScreen::physicalSize() const
QSize QScreen::availableSize() const
{
Q_D(const QScreen);
- return d->platformScreen->availableGeometry().size();
+ return d->availableGeometry.size();
}
/*!
@@ -259,7 +249,7 @@ QSize QScreen::availableSize() const
QRect QScreen::geometry() const
{
Q_D(const QScreen);
- return d->platformScreen->geometry();
+ return d->geometry;
}
/*!
@@ -272,7 +262,7 @@ QRect QScreen::geometry() const
QRect QScreen::availableGeometry() const
{
Q_D(const QScreen);
- return d->platformScreen->availableGeometry();
+ return d->availableGeometry;
}
/*!
@@ -315,10 +305,9 @@ QSize QScreen::virtualSize() const
*/
QRect QScreen::virtualGeometry() const
{
- Q_D(const QScreen);
QRect result;
- foreach (QPlatformScreen *platformScreen, d->platformScreen->virtualSiblings())
- result |= platformScreen->geometry();
+ foreach (QScreen *screen, virtualSiblings())
+ result |= screen->geometry();
return result;
}
@@ -347,10 +336,9 @@ QSize QScreen::availableVirtualSize() const
*/
QRect QScreen::availableVirtualGeometry() const
{
- Q_D(const QScreen);
QRect result;
- foreach (QPlatformScreen *platformScreen, d->platformScreen->virtualSiblings())
- result |= platformScreen->availableGeometry();
+ foreach (QScreen *screen, virtualSiblings())
+ result |= screen->availableGeometry();
return result;
}
@@ -383,7 +371,7 @@ Qt::ScreenOrientation QScreen::primaryOrientation() const
Qt::ScreenOrientation QScreen::currentOrientation() const
{
Q_D(const QScreen);
- return d->platformScreen->currentOrientation();
+ return d->currentOrientation;
}
// i must be power of two
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 6fc97c1799..7291e2ad7b 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -140,6 +140,7 @@ private:
Q_DISABLE_COPY(QScreen)
friend class QGuiApplicationPrivate;
+ friend class QPlatformIntegration;
friend class QPlatformScreen;
};
diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h
new file mode 100644
index 0000000000..50742c9f6b
--- /dev/null
+++ b/src/gui/kernel/qscreen_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCREEN_P_H
+#define QSCREEN_P_H
+
+#include <QtGui/qscreen.h>
+#include <QtGui/qplatformscreen_qpa.h>
+
+#include <QtCore/private/qobject_p.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QScreenPrivate : public QObjectPrivate
+{
+public:
+ QScreenPrivate(QPlatformScreen *screen)
+ : platformScreen(screen)
+ {
+ currentOrientation = screen->currentOrientation();
+ geometry = screen->geometry();
+ availableGeometry = screen->availableGeometry();
+ logicalDpi = screen->logicalDpi();
+ }
+
+ Qt::ScreenOrientation currentOrientation;
+ QRect geometry;
+ QRect availableGeometry;
+ QDpi logicalDpi;
+
+ QPlatformScreen *platformScreen;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QSCREEN_P_H
diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h
index 31a26c1582..89c5cf47b6 100644
--- a/src/gui/kernel/qsessionmanager.h
+++ b/src/gui/kernel/qsessionmanager.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsessionmanager_qpa.cpp b/src/gui/kernel/qsessionmanager_qpa.cpp
index 7ade0df3a8..9b6ec26ff4 100644
--- a/src/gui/kernel/qsessionmanager_qpa.cpp
+++ b/src/gui/kernel/qsessionmanager_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 64b0aa1741..2bacac9598 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index 28c37f9a2e..e447507b87 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 7585d23558..eb0f055270 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -76,9 +76,19 @@ int QStyleHints::keyboardInputInterval() const
return hint(QPlatformIntegration::KeyboardInputInterval).toInt();
}
+int QStyleHints::keyboardAutoRepeatRate() const
+{
+ return hint(QPlatformIntegration::KeyboardAutoRepeatRate).toInt();
+}
+
int QStyleHints::cursorFlashTime() const
{
return hint(QPlatformIntegration::CursorFlashTime).toInt();
}
+bool QStyleHints::showIsFullScreen() const
+{
+ return hint(QPlatformIntegration::ShowIsFullScreen).toBool();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index bcc9b589e2..6fa72110fb 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,7 +60,9 @@ public:
int startDragDistance() const;
int startDragTime() const;
int keyboardInputInterval() const;
+ int keyboardAutoRepeatRate() const;
int cursorFlashTime() const;
+ bool showIsFullScreen() const;
private:
friend class QGuiApplication;
QStyleHints();
diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp
index 871b765bfd..bfdb772cfb 100644
--- a/src/gui/kernel/qsurface.cpp
+++ b/src/gui/kernel/qsurface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h
index a6c8745a7a..fba1690af4 100644
--- a/src/gui/kernel/qsurface.h
+++ b/src/gui/kernel/qsurface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index b200cdb113..39b2d491a3 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index cdbd50740b..3d3bfeb30b 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h
index 3cb527d0b1..98a516f54e 100644
--- a/src/gui/kernel/qt_gui_pch.h
+++ b/src/gui/kernel/qt_gui_pch.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
index abf1acc310..b8d4d01655 100644
--- a/src/gui/kernel/qtouchdevice.cpp
+++ b/src/gui/kernel/qtouchdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h
index 496bb7a522..6efa7814c9 100644
--- a/src/gui/kernel/qtouchdevice.h
+++ b/src/gui/kernel/qtouchdevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h
index f782d1585d..c37e4a8bf5 100644
--- a/src/gui/kernel/qtouchdevice_p.h
+++ b/src/gui/kernel/qtouchdevice_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 55329f56bd..97c6b0cbc9 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,6 +54,8 @@
#include <QtCore/QDebug>
+#include <QStyleHints>
+
QT_BEGIN_NAMESPACE
/*!
@@ -741,30 +743,42 @@ QObject *QWindow::focusObject() const
return const_cast<QWindow *>(this);
}
+void QWindow::show()
+{
+ if (qApp->styleHints()->showIsFullScreen())
+ showFullScreen();
+ else
+ showNormal();
+}
+
+void QWindow::hide()
+{
+ setVisible(false);
+}
void QWindow::showMinimized()
{
setWindowState(Qt::WindowMinimized);
- show();
+ setVisible(true);
}
void QWindow::showMaximized()
{
setWindowState(Qt::WindowMaximized);
- show();
+ setVisible(true);
}
void QWindow::showFullScreen()
{
setWindowState(Qt::WindowFullScreen);
- show();
+ setVisible(true);
requestActivateWindow();
}
void QWindow::showNormal()
{
setWindowState(Qt::WindowNoState);
- show();
+ setVisible(true);
}
bool QWindow::close()
@@ -774,72 +788,83 @@ bool QWindow::close()
return true;
}
-void QWindow::exposeEvent(QExposeEvent *)
+void QWindow::exposeEvent(QExposeEvent *ev)
{
+ ev->ignore();
}
-void QWindow::moveEvent(QMoveEvent *)
+void QWindow::moveEvent(QMoveEvent *ev)
{
+ ev->ignore();
}
-void QWindow::resizeEvent(QResizeEvent *)
+void QWindow::resizeEvent(QResizeEvent *ev)
{
+ ev->ignore();
}
-void QWindow::showEvent(QShowEvent *)
+void QWindow::showEvent(QShowEvent *ev)
{
+ ev->ignore();
}
-void QWindow::hideEvent(QHideEvent *)
+void QWindow::hideEvent(QHideEvent *ev)
{
+ ev->ignore();
}
-bool QWindow::event(QEvent *event)
+bool QWindow::event(QEvent *ev)
{
- switch (event->type()) {
+ switch (ev->type()) {
case QEvent::MouseMove:
- mouseMoveEvent(static_cast<QMouseEvent*>(event));
+ mouseMoveEvent(static_cast<QMouseEvent*>(ev));
break;
case QEvent::MouseButtonPress:
- mousePressEvent(static_cast<QMouseEvent*>(event));
+ mousePressEvent(static_cast<QMouseEvent*>(ev));
break;
case QEvent::MouseButtonRelease:
- mouseReleaseEvent(static_cast<QMouseEvent*>(event));
+ mouseReleaseEvent(static_cast<QMouseEvent*>(ev));
break;
case QEvent::MouseButtonDblClick:
- mouseDoubleClickEvent(static_cast<QMouseEvent*>(event));
+ mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev));
+ break;
+
+ case QEvent::TouchBegin:
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
+ touchEvent(static_cast<QTouchEvent *>(ev));
break;
case QEvent::Move:
- moveEvent(static_cast<QMoveEvent*>(event));
+ moveEvent(static_cast<QMoveEvent*>(ev));
break;
case QEvent::Resize:
- resizeEvent(static_cast<QResizeEvent*>(event));
+ resizeEvent(static_cast<QResizeEvent*>(ev));
break;
case QEvent::KeyPress:
- keyPressEvent(static_cast<QKeyEvent *>(event));
+ keyPressEvent(static_cast<QKeyEvent *>(ev));
break;
case QEvent::KeyRelease:
- keyReleaseEvent(static_cast<QKeyEvent *>(event));
+ keyReleaseEvent(static_cast<QKeyEvent *>(ev));
break;
case QEvent::FocusIn:
- focusInEvent(static_cast<QFocusEvent *>(event));
+ focusInEvent(static_cast<QFocusEvent *>(ev));
break;
case QEvent::FocusOut:
- focusOutEvent(static_cast<QFocusEvent *>(event));
+ focusOutEvent(static_cast<QFocusEvent *>(ev));
break;
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
- wheelEvent(static_cast<QWheelEvent*>(event));
+ wheelEvent(static_cast<QWheelEvent*>(ev));
break;
#endif
@@ -852,62 +877,74 @@ bool QWindow::event(QEvent *event)
break; }
case QEvent::Expose:
- exposeEvent(static_cast<QExposeEvent *>(event));
+ exposeEvent(static_cast<QExposeEvent *>(ev));
break;
case QEvent::Show:
- showEvent(static_cast<QShowEvent *>(event));
+ showEvent(static_cast<QShowEvent *>(ev));
break;
case QEvent::Hide:
- hideEvent(static_cast<QHideEvent *>(event));
+ hideEvent(static_cast<QHideEvent *>(ev));
break;
default:
- return QObject::event(event);
+ return QObject::event(ev);
}
return true;
}
-void QWindow::keyPressEvent(QKeyEvent *)
+void QWindow::keyPressEvent(QKeyEvent *ev)
{
+ ev->ignore();
}
-void QWindow::keyReleaseEvent(QKeyEvent *)
+void QWindow::keyReleaseEvent(QKeyEvent *ev)
{
+ ev->ignore();
}
-void QWindow::focusInEvent(QFocusEvent *)
+void QWindow::focusInEvent(QFocusEvent *ev)
{
+ ev->ignore();
}
-void QWindow::focusOutEvent(QFocusEvent *)
+void QWindow::focusOutEvent(QFocusEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mousePressEvent(QMouseEvent *)
+void QWindow::mousePressEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mouseReleaseEvent(QMouseEvent *)
+void QWindow::mouseReleaseEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mouseDoubleClickEvent(QMouseEvent *)
+void QWindow::mouseDoubleClickEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mouseMoveEvent(QMouseEvent *)
+void QWindow::mouseMoveEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
#ifndef QT_NO_WHEELEVENT
-void QWindow::wheelEvent(QWheelEvent *)
+void QWindow::wheelEvent(QWheelEvent *ev)
{
+ ev->ignore();
}
#endif //QT_NO_WHEELEVENT
-
+void QWindow::touchEvent(QTouchEvent *ev)
+{
+ ev->ignore();
+}
/*!
\fn QPoint QWindow::mapToGlobal(const QPoint &pos) const
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 11ff6b101d..4d161658c6 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,6 +72,7 @@ class QMouseEvent;
#ifndef QT_NO_WHEELEVENT
class QWheelEvent;
#endif
+class QTouchEvent;
class QPlatformSurface;
class QPlatformWindow;
@@ -208,8 +209,8 @@ public:
public Q_SLOTS:
void setVisible(bool visible);
- inline void show() { setVisible(true); }
- inline void hide() { setVisible(false); }
+ void show();
+ void hide();
void showMinimized();
void showMaximized();
@@ -285,6 +286,7 @@ protected:
#ifndef QT_NO_WHEELEVENT
virtual void wheelEvent(QWheelEvent *);
#endif
+ virtual void touchEvent(QTouchEvent *);
QWindow(QWindowPrivate &dd, QWindow *parent);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index ee91b61cf1..d3b6868aa5 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h
index b77ec0b2f3..3366606036 100644
--- a/src/gui/kernel/qwindowdefs.h
+++ b/src/gui/kernel/qwindowdefs.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h
index 2bf9c8e672..2db1a4649f 100644
--- a/src/gui/kernel/qwindowdefs_win.h
+++ b/src/gui/kernel/qwindowdefs_win.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 016446780b..4a7ebd1c0c 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -219,38 +219,26 @@ void QWindowSystemInterface::registerTouchDevice(QTouchDevice *device)
QTouchDevicePrivate::registerDevice(device);
}
-void QWindowSystemInterface::handleTouchEvent(QWindow *w, QEvent::Type type, QTouchDevice *device,
- const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods)
+void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device,
+ const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTouchEvent(w, time, type, device, points, mods);
+ handleTouchEvent(w, time, device, points, mods);
}
-void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEvent::Type type,
- QTouchDevice *device,
- const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods)
+QList<QTouchEvent::TouchPoint> QWindowSystemInterfacePrivate::convertTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points, QEvent::Type *type)
{
- if (!points.size()) // Touch events must have at least one point
- return;
-
- if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
- return;
-
QList<QTouchEvent::TouchPoint> touchPoints;
Qt::TouchPointStates states;
QTouchEvent::TouchPoint p;
- QList<struct TouchPoint>::const_iterator point = points.constBegin();
- QList<struct TouchPoint>::const_iterator end = points.constEnd();
+ QList<QWindowSystemInterface::TouchPoint>::const_iterator point = points.constBegin();
+ QList<QWindowSystemInterface::TouchPoint>::const_iterator end = points.constEnd();
while (point != end) {
p.setId(point->id);
p.setPressure(point->pressure);
states |= point->state;
- Qt::TouchPointStates state = point->state;
- if (point->isPrimary) {
- state |= Qt::TouchPointPrimary;
- }
- p.setState(state);
+ p.setState(point->state);
const QPointF screenPos = point->area.center();
p.setScreenPos(screenPos);
@@ -268,36 +256,60 @@ void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEv
++point;
}
+ // Determine the event type based on the combined point states.
+ if (type) {
+ *type = QEvent::TouchUpdate;
+ if (states == Qt::TouchPointPressed)
+ *type = QEvent::TouchBegin;
+ else if (states == Qt::TouchPointReleased)
+ *type = QEvent::TouchEnd;
+ }
+
+ return touchPoints;
+}
+
+void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QTouchDevice *device,
+ const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
+{
+ if (!points.size()) // Touch events must have at least one point
+ return;
+
+ if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
+ return;
+
+ QEvent::Type type;
+ QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::convertTouchPoints(points, &type);
+
QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, device, touchPoints, mods);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation orientation)
{
QWindowSystemInterfacePrivate::ScreenOrientationEvent *e =
- new QWindowSystemInterfacePrivate::ScreenOrientationEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenOrientationEvent(screen, orientation);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen, const QRect &geometry)
{
QWindowSystemInterfacePrivate::ScreenGeometryEvent *e =
- new QWindowSystemInterfacePrivate::ScreenGeometryEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenGeometryEvent(screen, geometry);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenAvailableGeometryChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenAvailableGeometryChange(QScreen *screen, const QRect &availableGeometry)
{
QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e =
- new QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent(screen, availableGeometry);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal dpiX, qreal dpiY)
{
QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e =
- new QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent(screen, dpiX, dpiY);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 423281955c..4a17fb9035 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -86,9 +86,8 @@ public:
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
struct TouchPoint {
- TouchPoint() : id(0), isPrimary(false), pressure(0), state(Qt::TouchPointStationary), flags(0) { }
+ TouchPoint() : id(0), pressure(0), state(Qt::TouchPointStationary), flags(0) { }
int id; // for application use
- bool isPrimary; // for application use
QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1)
QRectF area; // the touched area, centered at position in screen coordinates
qreal pressure; // 0 to 1
@@ -99,9 +98,9 @@ public:
};
static void registerTouchDevice(QTouchDevice *device);
- static void handleTouchEvent(QWindow *w, QEvent::Type type, QTouchDevice *device,
+ static void handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
- static void handleTouchEvent(QWindow *w, ulong timestamp, QEvent::Type type, QTouchDevice *device,
+ static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void handleGeometryChange(QWindow *w, const QRect &newRect);
@@ -123,10 +122,10 @@ public:
static Qt::DropAction handleDrop(QWindow *w, QMimeData *dropData, const QPoint &p);
// Changes to the screen
- static void handleScreenOrientationChange(QScreen *screen);
- static void handleScreenGeometryChange(QScreen *screen);
- static void handleScreenAvailableGeometryChange(QScreen *screen);
- static void handleScreenLogicalDotsPerInchChange(QScreen *screen);
+ static void handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation newOrientation);
+ static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry);
+ static void handleScreenAvailableGeometryChange(QScreen *screen, const QRect &newAvailableGeometry);
+ static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY);
// For event dispatcher implementations
static bool sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index 5580104c3b..b5614eb38e 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,8 +72,9 @@ public:
class WindowSystemEvent {
public:
explicit WindowSystemEvent(EventType t)
- : type(t) { }
+ : type(t), synthetic(false) { }
EventType type;
+ bool synthetic;
};
class CloseEvent : public WindowSystemEvent {
@@ -197,30 +198,35 @@ public:
class ScreenOrientationEvent : public WindowSystemEvent {
public:
- ScreenOrientationEvent(QScreen *s)
- : WindowSystemEvent(ScreenOrientation), screen(s) { }
+ ScreenOrientationEvent(QScreen *s, Qt::ScreenOrientation o)
+ : WindowSystemEvent(ScreenOrientation), screen(s), orientation(o) { }
QWeakPointer<QScreen> screen;
+ Qt::ScreenOrientation orientation;
};
class ScreenGeometryEvent : public WindowSystemEvent {
public:
- ScreenGeometryEvent(QScreen *s)
- : WindowSystemEvent(ScreenGeometry), screen(s) { }
+ ScreenGeometryEvent(QScreen *s, const QRect &g)
+ : WindowSystemEvent(ScreenGeometry), screen(s), geometry(g) { }
QWeakPointer<QScreen> screen;
+ QRect geometry;
};
class ScreenAvailableGeometryEvent : public WindowSystemEvent {
public:
- ScreenAvailableGeometryEvent(QScreen *s)
- : WindowSystemEvent(ScreenAvailableGeometry), screen(s) { }
+ ScreenAvailableGeometryEvent(QScreen *s, const QRect &g)
+ : WindowSystemEvent(ScreenAvailableGeometry), screen(s), availableGeometry(g) { }
QWeakPointer<QScreen> screen;
+ QRect availableGeometry;
};
class ScreenLogicalDotsPerInchEvent : public WindowSystemEvent {
public:
- ScreenLogicalDotsPerInchEvent(QScreen *s)
- : WindowSystemEvent(ScreenLogicalDotsPerInch), screen(s) { }
+ ScreenLogicalDotsPerInchEvent(QScreen *s, qreal dx, qreal dy)
+ : WindowSystemEvent(ScreenLogicalDotsPerInch), screen(s), dpiX(dx), dpiY(dy) { }
QWeakPointer<QScreen> screen;
+ qreal dpiX;
+ qreal dpiY;
};
class MapEvent : public WindowSystemEvent {
@@ -256,6 +262,8 @@ public:
static void queueWindowSystemEvent(WindowSystemEvent *ev);
static QTime eventTime;
+
+ static QList<QTouchEvent::TouchPoint> convertTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points, QEvent::Type *type);
};
QT_END_HEADER