summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/kernel.pri28
-rw-r--r--src/gui/kernel/qclipboard.cpp4
-rw-r--r--src/gui/kernel/qclipboard.h5
-rw-r--r--src/gui/kernel/qclipboard_qpa.cpp4
-rw-r--r--src/gui/kernel/qcursor.cpp4
-rw-r--r--src/gui/kernel/qcursor.h5
-rw-r--r--src/gui/kernel/qcursor_p.h4
-rw-r--r--src/gui/kernel/qcursor_qpa.cpp4
-rw-r--r--src/gui/kernel/qdnd.cpp4
-rw-r--r--src/gui/kernel/qdnd_p.h4
-rw-r--r--src/gui/kernel/qdrag.cpp4
-rw-r--r--src/gui/kernel/qdrag.h5
-rw-r--r--src/gui/kernel/qevent.cpp22
-rw-r--r--src/gui/kernel/qevent.h45
-rw-r--r--src/gui/kernel/qevent_p.h4
-rw-r--r--src/gui/kernel/qgenericplugin_qpa.cpp4
-rw-r--r--src/gui/kernel/qgenericplugin_qpa.h7
-rw-r--r--src/gui/kernel/qgenericpluginfactory_qpa.cpp4
-rw-r--r--src/gui/kernel/qgenericpluginfactory_qpa.h5
-rw-r--r--src/gui/kernel/qguiapplication.cpp176
-rw-r--r--src/gui/kernel/qguiapplication.h16
-rw-r--r--src/gui/kernel/qguiapplication_p.h14
-rw-r--r--src/gui/kernel/qguivariant.cpp38
-rw-r--r--src/gui/kernel/qinputmethod.cpp (renamed from src/gui/kernel/qinputpanel.cpp)141
-rw-r--r--src/gui/kernel/qinputmethod.h134
-rw-r--r--src/gui/kernel/qinputmethod_p.h83
-rw-r--r--src/gui/kernel/qinputpanel.h85
-rw-r--r--src/gui/kernel/qinputpanel_p.h33
-rw-r--r--src/gui/kernel/qkeymapper.cpp4
-rw-r--r--src/gui/kernel/qkeymapper_p.h4
-rw-r--r--src/gui/kernel/qkeymapper_qpa.cpp4
-rw-r--r--src/gui/kernel/qkeysequence.cpp208
-rw-r--r--src/gui/kernel/qkeysequence.h14
-rw-r--r--src/gui/kernel/qkeysequence_p.h4
-rw-r--r--src/gui/kernel/qopenglcontext.cpp88
-rw-r--r--src/gui/kernel/qopenglcontext.h19
-rw-r--r--src/gui/kernel/qopenglcontext_p.h28
-rw-r--r--src/gui/kernel/qpalette.cpp4
-rw-r--r--src/gui/kernel/qpalette.h5
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.cpp4
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.h5
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.cpp4
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.h5
-rw-r--r--src/gui/kernel/qplatformdialoghelper_qpa.cpp556
-rw-r--r--src/gui/kernel/qplatformdialoghelper_qpa.h314
-rw-r--r--src/gui/kernel/qplatformdrag_qpa.h5
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.cpp32
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.h5
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.cpp36
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.h13
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_qpa.cpp4
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_qpa_p.h5
-rw-r--r--src/gui/kernel/qplatformintegrationplugin_qpa.cpp4
-rw-r--r--src/gui/kernel/qplatformintegrationplugin_qpa.h5
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.cpp51
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.h8
-rw-r--r--src/gui/kernel/qplatformopenglcontext_qpa.cpp16
-rw-r--r--src/gui/kernel/qplatformopenglcontext_qpa.h8
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.cpp33
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.h8
-rw-r--r--src/gui/kernel/qplatformscreen_qpa_p.h4
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp212
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache_qpa.h97
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.cpp8
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.h11
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.cpp12
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.h16
-rw-r--r--src/gui/kernel/qplatformthemefactory_qpa.cpp4
-rw-r--r--src/gui/kernel/qplatformthemefactory_qpa_p.h5
-rw-r--r--src/gui/kernel/qplatformthemeplugin_qpa.cpp4
-rw-r--r--src/gui/kernel/qplatformthemeplugin_qpa.h5
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp35
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.h8
-rw-r--r--src/gui/kernel/qscreen.cpp117
-rw-r--r--src/gui/kernel/qscreen.h23
-rw-r--r--src/gui/kernel/qscreen_p.h13
-rw-r--r--src/gui/kernel/qsessionmanager.h5
-rw-r--r--src/gui/kernel/qsessionmanager_qpa.cpp4
-rw-r--r--src/gui/kernel/qshortcutmap.cpp4
-rw-r--r--src/gui/kernel/qshortcutmap_p.h4
-rw-r--r--src/gui/kernel/qstylehints.cpp4
-rw-r--r--src/gui/kernel/qstylehints.h5
-rw-r--r--src/gui/kernel/qsurface.cpp51
-rw-r--r--src/gui/kernel/qsurface.h30
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp4
-rw-r--r--src/gui/kernel/qsurfaceformat.h5
-rw-r--r--src/gui/kernel/qt_gui_pch.h4
-rw-r--r--src/gui/kernel/qtouchdevice.cpp14
-rw-r--r--src/gui/kernel/qtouchdevice.h5
-rw-r--r--src/gui/kernel/qtouchdevice_p.h5
-rw-r--r--src/gui/kernel/qwindow.cpp173
-rw-r--r--src/gui/kernel/qwindow.h21
-rw-r--r--src/gui/kernel/qwindow_p.h11
-rw-r--r--src/gui/kernel/qwindowdefs.h5
-rw-r--r--src/gui/kernel/qwindowdefs_win.h5
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp28
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h7
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h5
98 files changed, 2620 insertions, 742 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index bf552c9991..7b01ba14cd 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -21,9 +21,6 @@ HEADERS += \
kernel/qplatformthemefactory_qpa_p.h \
kernel/qplatformthemeplugin_qpa.h \
kernel/qplatformwindow_qpa.h \
- kernel/qplatformopenglcontext_qpa.h \
- kernel/qopenglcontext.h \
- kernel/qopenglcontext_p.h \
kernel/qplatformcursor_qpa.h \
kernel/qplatformclipboard_qpa.h \
kernel/qplatformnativeinterface_qpa.h \
@@ -41,6 +38,8 @@ HEADERS += \
kernel/qdnd_p.h \
kernel/qevent.h \
kernel/qevent_p.h \
+ kernel/qinputmethod.h \
+ kernel/qinputmethod_p.h \
kernel/qinputpanel.h \
kernel/qinputpanel_p.h \
kernel/qkeysequence.h \
@@ -54,7 +53,9 @@ HEADERS += \
kernel/qscreen_p.h \
kernel/qstylehints.h \
kernel/qtouchdevice.h \
- kernel/qtouchdevice_p.h
+ kernel/qtouchdevice_p.h \
+ kernel/qplatformsharedgraphicscache_qpa.h \
+ kernel/qplatformdialoghelper_qpa.h
SOURCES += \
kernel/qclipboard_qpa.cpp \
@@ -71,8 +72,6 @@ SOURCES += \
kernel/qplatformthemefactory_qpa.cpp \
kernel/qplatformthemeplugin_qpa.cpp \
kernel/qplatformwindow_qpa.cpp \
- kernel/qplatformopenglcontext_qpa.cpp \
- kernel/qopenglcontext.cpp \
kernel/qplatformcursor_qpa.cpp \
kernel/qplatformclipboard_qpa.cpp \
kernel/qplatformnativeinterface_qpa.cpp \
@@ -87,7 +86,7 @@ SOURCES += \
kernel/qdrag.cpp \
kernel/qdnd.cpp \
kernel/qevent.cpp \
- kernel/qinputpanel.cpp \
+ kernel/qinputmethod.cpp \
kernel/qkeysequence.cpp \
kernel/qkeymapper.cpp \
kernel/qkeymapper_qpa.cpp \
@@ -96,6 +95,19 @@ SOURCES += \
kernel/qscreen.cpp \
kernel/qshortcutmap.cpp \
kernel/qstylehints.cpp \
- kernel/qtouchdevice.cpp
+ kernel/qtouchdevice.cpp \
+ kernel/qplatformsharedgraphicscache_qpa.cpp \
+ kernel/qplatformdialoghelper_qpa.cpp
+
+contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, egl) {
+ HEADERS += \
+ kernel/qplatformopenglcontext_qpa.h \
+ kernel/qopenglcontext.h \
+ kernel/qopenglcontext_p.h
+
+ SOURCES += \
+ kernel/qplatformopenglcontext_qpa.cpp \
+ kernel/qopenglcontext.cpp
+}
win32:HEADERS+=kernel/qwindowdefs_win.h
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 341b042328..8e881aabc7 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index b909889815..5a251dd0ef 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_CLIPBOARD
diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp
index edcf21babc..ec940385b8 100644
--- a/src/gui/kernel/qclipboard_qpa.cpp
+++ b/src/gui/kernel/qclipboard_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index bd327e1eb1..77eb1e1e9c 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 7437da4aba..00b709b308 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QVariant;
diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h
index a904260388..8623c22200 100644
--- a/src/gui/kernel/qcursor_p.h
+++ b/src/gui/kernel/qcursor_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp
index 6a12f977d3..7ba2e1c580 100644
--- a/src/gui/kernel/qcursor_qpa.cpp
+++ b/src/gui/kernel/qcursor_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 4010fd73ff..b9f0fe4f5b 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index 47018edde8..857be34d10 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 284b1e5c1b..694b12a180 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index ccadd8f1cc..0a1ddff2d9 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_DRAGANDDROP
class QMimeData;
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 61ccaa5cfd..543f5453ff 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1510,7 +1510,7 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
Cursor attributes and render them as specified.
\endlist
- \sa QInputContext
+ \sa QInputMethod
*/
/*!
@@ -1872,14 +1872,13 @@ QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const
\sa pos() globalPos() device() pressure() xTilt() yTilt() uniqueId(), rotation(), tangentialPressure(), z()
*/
-QTabletEvent::QTabletEvent(Type type, const QPoint &pos, const QPoint &globalPos,
- const QPointF &hiResGlobalPos, int device, int pointerType,
+QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalPos,
+ int device, int pointerType,
qreal pressure, int xTilt, int yTilt, qreal tangentialPressure,
qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID)
: QInputEvent(type, keyState),
mPos(pos),
mGPos(globalPos),
- mHiResGlobalPos(hiResGlobalPos),
mDev(device),
mPointerType(pointerType),
mXT(xTilt),
@@ -2208,7 +2207,7 @@ QDragMoveEvent::~QDragMoveEvent()
The states of the mouse buttons and keyboard modifiers at the time of
the drop are specified by \a buttons and \a modifiers.
*/ // ### pos is in which coordinate system?
-QDropEvent::QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
+QDropEvent::QDropEvent(const QPointF& pos, Qt::DropActions actions, const QMimeData *data,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
: QEvent(type), p(pos), mouseState(buttons),
modState(modifiers), act(actions),
@@ -2743,7 +2742,7 @@ QShowEvent::~QShowEvent()
This event is only used to notify the application of a request.
It may be safely ignored.
- \note This class is currently supported for Mac OS X and Symbian only.
+ \note This class is currently supported for Mac OS X only.
*/
QFileOpenEventPrivate::~QFileOpenEventPrivate()
@@ -2807,8 +2806,6 @@ QUrl QFileOpenEvent::url() const
This is necessary as some files cannot be opened by name, but require specific
information stored in this event.
- For example, if this QFileOpenEvent contains a request to open a Symbian data caged file,
- the QFile could only be opened from the Symbian RFile used in the construction of this event.
\since 4.8
*/
@@ -3570,9 +3567,8 @@ QTouchEvent::TouchPoint::~TouchPoint()
/*!
Returns the id number of this touch point.
- Id numbers are globally sequential, starting at zero, meaning the
- first touch point in the application has id 0, the second has id 1,
- and so on.
+ Do not assume that id numbers start at zero or that they are sequential.
+ Such an assumption is often false due to the way the underlying drivers work.
*/
int QTouchEvent::TouchPoint::id() const
{
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index a59b178cec..93dea41de9 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -61,7 +61,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QAction;
#ifndef QT_NO_GESTURES
@@ -183,21 +182,27 @@ public:
enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse,
XFreeEraser /*internal*/, RotationStylus };
enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
- QTabletEvent(Type t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos,
+ QTabletEvent(Type t, const QPointF &pos, const QPointF &globalPos,
int device, int pointerType, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z,
Qt::KeyboardModifiers keyState, qint64 uniqueID);
~QTabletEvent();
- inline const QPoint &pos() const { return mPos; }
- inline const QPoint &globalPos() const { return mGPos; }
- inline const QPointF &hiResGlobalPos() const { return mHiResGlobalPos; }
- inline int x() const { return mPos.x(); }
- inline int y() const { return mPos.y(); }
- inline int globalX() const { return mGPos.x(); }
- inline int globalY() const { return mGPos.y(); }
- inline qreal hiResGlobalX() const { return mHiResGlobalPos.x(); }
- inline qreal hiResGlobalY() const { return mHiResGlobalPos.y(); }
+ inline const QPoint pos() const { return mPos.toPoint(); }
+ inline const QPoint globalPos() const { return mGPos.toPoint(); }
+#if QT_DEPRECATED_SINCE(5,0)
+ QT_DEPRECATED inline const QPointF &hiResGlobalPos() const { return mPos; }
+#endif
+
+ inline const QPointF &posF() const { return mPos; }
+ inline const QPointF &globalPosF() const { return mGPos; }
+
+ inline int x() const { return qRound(mPos.x()); }
+ inline int y() const { return qRound(mPos.y()); }
+ inline int globalX() const { return qRound(mGPos.x()); }
+ inline int globalY() const { return qRound(mGPos.y()); }
+ inline qreal hiResGlobalX() const { return mGPos.x(); }
+ inline qreal hiResGlobalY() const { return mGPos.y(); }
inline TabletDevice device() const { return TabletDevice(mDev); }
inline PointerType pointerType() const { return PointerType(mPointerType); }
inline qint64 uniqueId() const { return mUnique; }
@@ -209,8 +214,7 @@ public:
inline int yTilt() const { return mYT; }
protected:
- QPoint mPos, mGPos;
- QPointF mHiResGlobalPos;
+ QPointF mPos, mGPos;
int mDev, mPointerType, mXT, mYT, mZ;
qreal mPress, mTangential, mRot;
qint64 mUnique;
@@ -477,11 +481,12 @@ class QMimeData;
class Q_GUI_EXPORT QDropEvent : public QEvent
{
public:
- QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
+ QDropEvent(const QPointF& pos, Qt::DropActions actions, const QMimeData *data,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop);
~QDropEvent();
- inline const QPoint &pos() const { return p; }
+ inline const QPoint pos() const { return p.toPoint(); }
+ inline const QPointF &posF() const { return p; }
inline Qt::MouseButtons mouseButtons() const { return mouseState; }
inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; }
@@ -497,7 +502,7 @@ public:
protected:
friend class QApplication;
- QPoint p;
+ QPointF p;
Qt::MouseButtons mouseState;
Qt::KeyboardModifiers modState;
Qt::DropActions act;
@@ -759,10 +764,12 @@ public:
friend class QApplicationPrivate;
};
+#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED enum DeviceType {
TouchScreen,
TouchPad
};
+#endif
QTouchEvent(QEvent::Type eventType,
QTouchDevice *device = 0,
@@ -773,7 +780,9 @@ public:
inline QWindow *window() const { return _window; }
inline QObject *target() const { return _target; }
+#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); }
+#endif
inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
inline QTouchDevice *device() const { return _device; }
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 6dff55ca14..3f354c14e4 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qgenericplugin_qpa.cpp b/src/gui/kernel/qgenericplugin_qpa.cpp
index 23733e3ea9..493fc770b5 100644
--- a/src/gui/kernel/qgenericplugin_qpa.cpp
+++ b/src/gui/kernel/qgenericplugin_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qgenericplugin_qpa.h b/src/gui/kernel/qgenericplugin_qpa.h
index 196304d2a4..0b74250170 100644
--- a/src/gui/kernel/qgenericplugin_qpa.h
+++ b/src/gui/kernel/qgenericplugin_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_LIBRARY
@@ -60,7 +59,7 @@ QT_MODULE(Gui)
virtual QObject* create(const QString &name, const QString &spec) = 0;
};
-#define QGenericPluginFactoryInterface_iid "com.trolltech.Qt.QGenericPluginFactoryInterface"
+#define QGenericPluginFactoryInterface_iid "org.qt-project.Qt.QGenericPluginFactoryInterface"
Q_DECLARE_INTERFACE(QGenericPluginFactoryInterface, QGenericPluginFactoryInterface_iid)
class Q_GUI_EXPORT QGenericPlugin : public QObject, public QGenericPluginFactoryInterface
diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
index 4735604837..d4a7a9c20e 100644
--- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp
+++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.h b/src/gui/kernel/qgenericpluginfactory_qpa.h
index 2d1550ffac..a7c227f44a 100644
--- a/src/gui/kernel/qgenericpluginfactory_qpa.h
+++ b/src/gui/kernel/qgenericpluginfactory_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QString;
class QObject;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index f92e66b38e..b1cbb5fcae 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,6 +54,7 @@
#include <QtCore/private/qabstracteventdispatcher_p.h>
#include <QtCore/qmutex.h>
#include <QtCore/private/qthread_p.h>
+#include <QtCore/qdir.h>
#include <QtDebug>
#include <qpalette.h>
#include <qscreen.h>
@@ -107,13 +108,12 @@ int QGuiApplicationPrivate::mousePressX = 0;
int QGuiApplicationPrivate::mousePressY = 0;
int QGuiApplicationPrivate::mouse_double_click_distance = 5;
-bool QGuiApplicationPrivate::quitOnLastWindowClosed = true;
-
static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
static bool force_reverse = false;
QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0;
QTouchDevice *QGuiApplicationPrivate::m_fakeTouchDevice = 0;
+int QGuiApplicationPrivate::m_fakeMouseSourcePointId = 0;
#ifndef QT_NO_CLIPBOARD
QClipboard *QGuiApplicationPrivate::qt_clipboard = 0;
@@ -124,7 +124,7 @@ QList<QScreen *> QGuiApplicationPrivate::screen_list;
QWindowList QGuiApplicationPrivate::window_list;
QWindow *QGuiApplicationPrivate::focus_window = 0;
-Q_GLOBAL_STATIC(QMutex, applicationFontMutex)
+static QBasicMutex applicationFontMutex;
QFont *QGuiApplicationPrivate::app_font = 0;
extern void qRegisterGuiVariant();
@@ -184,7 +184,7 @@ QGuiApplication::~QGuiApplication()
QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags)
: QCoreApplicationPrivate(argc, argv, flags),
styleHints(0),
- inputPanel(0)
+ inputMethod(0)
{
self = this;
application_type = QCoreApplication::GuiClient;
@@ -195,11 +195,56 @@ QWindow *QGuiApplication::focusWindow()
return QGuiApplicationPrivate::focus_window;
}
-QWindowList QGuiApplication::topLevelWindows()
+/*!
+ \fn QGuiApplication::focusObjectChanged(QObject *focusObject)
+
+ This signal is emitted when final receiver of events tied to focus is changed.
+ \sa focusObject()
+*/
+
+/*!
+ Returns the QObject in currently active window that will be final receiver of events
+ tied focus, such as key events.
+ */
+QObject *QGuiApplication::focusObject()
+{
+ if (focusWindow())
+ return focusWindow()->focusObject();
+ return 0;
+}
+
+/*!
+ \fn QGuiApplication::allWindows()
+
+ Returns a list of all the windows in the application.
+
+ The list is empty if there are no windows.
+
+ \sa topLevelWindows()
+ */
+QWindowList QGuiApplication::allWindows()
{
return QGuiApplicationPrivate::window_list;
}
+/*!
+ \fn QGuiApplication::topLevelWindows()
+
+ Returns a list of the top-level windows in the application.
+
+ \sa allWindows()
+ */
+QWindowList QGuiApplication::topLevelWindows()
+{
+ const QWindowList &list = QGuiApplicationPrivate::window_list;
+ QWindowList topLevelWindows;
+ for (int i = 0; i < list.size(); i++) {
+ if (!list.at(i)->parent())
+ topLevelWindows.prepend(list.at(i));
+ }
+ return topLevelWindows;
+}
+
QScreen *QGuiApplication::primaryScreen()
{
if (QGuiApplicationPrivate::screen_list.isEmpty())
@@ -340,8 +385,9 @@ void QGuiApplicationPrivate::createPlatformIntegration()
// TODO (msorvig): Create proper cross-platform solution for loading
// deployed platform plugins
#ifdef Q_OS_MAC
- if (platformPluginPath.isEmpty()) {
- platformPluginPath = QCoreApplication::applicationDirPath() + QLatin1String("../Plugins/");
+ const QString bundlePluginPath = QCoreApplication::applicationDirPath() + QLatin1String("../Plugins/");
+ if (platformPluginPath.isEmpty() && QDir(bundlePluginPath).exists()) {
+ platformPluginPath = bundlePluginPath;
}
#endif
@@ -437,8 +483,6 @@ void QGuiApplicationPrivate::init()
if (platform_integration == 0)
createPlatformIntegration();
- init_plugins(pluginList);
-
// Set up which span functions should be used in raster engine...
qInitDrawhelperAsm();
// and QImage conversion functions
@@ -454,6 +498,8 @@ void QGuiApplicationPrivate::init()
qRegisterGuiVariant();
is_app_running = true;
+ init_plugins(pluginList);
+ QWindowSystemInterface::sendWindowSystemEvents(QCoreApplicationPrivate::eventDispatcher, QEventLoop::AllEvents);
}
QGuiApplicationPrivate::~QGuiApplicationPrivate()
@@ -465,6 +511,8 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
delete generic_plugin_list.at(i);
generic_plugin_list.clear();
+ delete app_font;
+ app_font = 0;
QFont::cleanup();
#ifndef QT_NO_CURSOR
@@ -476,7 +524,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
cleanupThreadData();
delete styleHints;
- delete inputPanel;
+ delete inputMethod;
delete platform_integration;
platform_integration = 0;
@@ -552,6 +600,11 @@ bool QGuiApplication::compressEvent(QEvent *event, QObject *receiver, QPostEvent
return QCoreApplication::compressEvent(event, receiver, postedEvents);
}
+bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)
+{
+ return window->nativeEvent(eventType, message, result);
+}
+
void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
{
switch(e->type) {
@@ -791,9 +844,13 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
if (previous == QGuiApplicationPrivate::focus_window)
return;
+ QObject *previousFocusObject = previous ? previous->focusObject() : 0;
+
if (previous) {
QFocusEvent focusOut(QEvent::FocusOut);
QCoreApplication::sendSpontaneousEvent(previous, &focusOut);
+ QObject::disconnect(previous, SIGNAL(focusObjectChanged(QObject*)),
+ qApp, SIGNAL(focusObjectChanged(QObject*)));
} else {
QEvent appActivate(QEvent::ApplicationActivate);
qApp->sendSpontaneousEvent(qApp, &appActivate);
@@ -802,6 +859,8 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
if (QGuiApplicationPrivate::focus_window) {
QFocusEvent focusIn(QEvent::FocusIn);
QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
+ QObject::connect(QGuiApplicationPrivate::focus_window, SIGNAL(focusObjectChanged(QObject*)),
+ qApp, SIGNAL(focusObjectChanged(QObject*)));
} else {
QEvent appActivate(QEvent::ApplicationDeactivate);
qApp->sendSpontaneousEvent(qApp, &appActivate);
@@ -809,6 +868,9 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
if (self)
self->notifyActiveWindowChange(previous);
+
+ if (previousFocusObject != qApp->focusObject())
+ emit qApp->focusObjectChanged(qApp->focusObject());
}
void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse)
@@ -1036,11 +1098,22 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
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);
+ QList<QTouchEvent::TouchPoint> touchPoints = touchEvent.touchPoints();
+ if (eventType == QEvent::TouchBegin)
+ m_fakeMouseSourcePointId = touchPoints.first().id();
+
+ for (int i = 0; i < touchPoints.count(); ++i) {
+ const QTouchEvent::TouchPoint &touchPoint = touchPoints.at(i);
+ if (touchPoint.id() == m_fakeMouseSourcePointId) {
+ QWindowSystemInterfacePrivate::MouseEvent fake(w, e->timestamp,
+ touchPoint.pos(),
+ touchPoint.screenPos(),
+ b, e->modifiers);
+ fake.synthetic = true;
+ processMouseEvent(&fake);
+ break;
+ }
+ }
}
}
}
@@ -1066,11 +1139,16 @@ void QGuiApplicationPrivate::reportScreenOrientationChange(QWindowSystemInterfac
return;
QScreen *s = e->screen.data();
- s->d_func()->currentOrientation = e->orientation;
+ s->d_func()->orientation = e->orientation;
- emit s->currentOrientationChanged(s->currentOrientation());
+ reportScreenOrientationChange(s);
+}
- QScreenOrientationChangeEvent event(s, s->currentOrientation());
+void QGuiApplicationPrivate::reportScreenOrientationChange(QScreen *s)
+{
+ emit s->orientationChanged(s->orientation());
+
+ QScreenOrientationChangeEvent event(s, s->orientation());
QCoreApplication::sendEvent(QCoreApplication::instance(), &event);
}
@@ -1086,6 +1164,10 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate:
QScreen *s = e->screen.data();
s->d_func()->geometry = e->geometry;
+ Qt::ScreenOrientation primaryOrientation = s->primaryOrientation();
+ Qt::ScreenOrientation orientation = s->orientation();
+ s->d_func()->updatePrimaryOrientation();
+
emit s->sizeChanged(s->size());
emit s->geometryChanged(s->geometry());
emit s->physicalDotsPerInchXChanged(s->physicalDotsPerInchX());
@@ -1093,6 +1175,12 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate:
emit s->physicalDotsPerInchChanged(s->physicalDotsPerInch());
emit s->availableSizeChanged(s->availableSize());
emit s->availableGeometryChanged(s->availableGeometry());
+
+ if (s->primaryOrientation() != primaryOrientation)
+ emit s->primaryOrientationChanged(s->primaryOrientation());
+
+ if (s->orientation() != orientation)
+ reportScreenOrientationChange(s);
}
void QGuiApplicationPrivate::reportAvailableGeometryChange(
@@ -1241,7 +1329,7 @@ void QGuiApplication::setPalette(const QPalette &pal)
QFont QGuiApplication::font()
{
- QMutexLocker locker(applicationFontMutex());
+ QMutexLocker locker(&applicationFontMutex);
if (!QGuiApplicationPrivate::app_font)
QGuiApplicationPrivate::app_font =
new QFont(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFont());
@@ -1250,7 +1338,7 @@ QFont QGuiApplication::font()
void QGuiApplication::setFont(const QFont &font)
{
- QMutexLocker locker(applicationFontMutex());
+ QMutexLocker locker(&applicationFontMutex);
if (!QGuiApplicationPrivate::app_font)
QGuiApplicationPrivate::app_font = new QFont(font);
else
@@ -1300,14 +1388,14 @@ void QGuiApplicationPrivate::notifyActiveWindowChange(QWindow *)
void QGuiApplication::setQuitOnLastWindowClosed(bool quit)
{
- QGuiApplicationPrivate::quitOnLastWindowClosed = quit;
+ QCoreApplication::setQuitLockEnabled(quit);
}
bool QGuiApplication::quitOnLastWindowClosed()
{
- return QGuiApplicationPrivate::quitOnLastWindowClosed;
+ return QCoreApplication::isQuitLockEnabled();
}
@@ -1315,11 +1403,6 @@ bool QGuiApplication::quitOnLastWindowClosed()
void QGuiApplicationPrivate::emitLastWindowClosed()
{
if (qGuiApp && qGuiApp->d_func()->in_exec) {
- if (QGuiApplicationPrivate::quitOnLastWindowClosed) {
- // get ready to quit, this event might be removed if the
- // event loop is re-entered, however
- QGuiApplication::postEvent(qApp, new QEvent(QEvent::Quit));
- }
emit qGuiApp->lastWindowClosed();
}
}
@@ -1491,12 +1574,17 @@ QStyleHints *QGuiApplication::styleHints() const
\sa QInputPanel
*/
-QInputPanel *QGuiApplication::inputPanel() const
+QInputMethod *QGuiApplication::inputMethod() const
{
Q_D(const QGuiApplication);
- if (!d->inputPanel)
- const_cast<QGuiApplicationPrivate *>(d)->inputPanel = new QInputPanel();
- return d->inputPanel;
+ if (!d->inputMethod)
+ const_cast<QGuiApplicationPrivate *>(d)->inputMethod = new QInputMethod();
+ return d->inputMethod;
+}
+
+QInputPanel *QGuiApplication::inputPanel() const
+{
+ return inputMethod();
}
@@ -1521,28 +1609,6 @@ uint QGuiApplicationPrivate::currentKeyPlatform()
}
/*!
- \since 4.2
- \obsolete
-
- Returns the current keyboard input locale. Replaced with QInputPanel::locale()
-*/
-QLocale QGuiApplication::keyboardInputLocale()
-{
- return qApp ? qApp->inputPanel()->locale() : QLocale::c();
-}
-
-/*!
- \since 4.2
- \obsolete
-
- Returns the current keyboard input direction. Replaced with QInputPanel::inputDirection()
-*/
-Qt::LayoutDirection QGuiApplication::keyboardInputDirection()
-{
- return qApp ? qApp->inputPanel()->inputDirection() : Qt::LeftToRight;
-}
-
-/*!
\since 4.5
\fn void QGuiApplication::fontDatabaseChanged()
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index dd7b1f8806..75046d8767 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -44,6 +44,7 @@
#include <QtCore/qcoreapplication.h>
#include <QtGui/qwindowdefs.h>
+#include <QtGui/qinputpanel.h>
#include <QtCore/qlocale.h>
#include <QtCore/qpoint.h>
#include <QtCore/qsize.h>
@@ -52,14 +53,12 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QGuiApplicationPrivate;
class QPlatformNativeInterface;
class QPalette;
class QScreen;
class QStyleHints;
-class QInputPanel;
#if defined(qApp)
#undef qApp
@@ -82,6 +81,7 @@ public:
QGuiApplication(int &argc, char **argv, int = ApplicationFlags);
virtual ~QGuiApplication();
+ static QWindowList allWindows();
static QWindowList topLevelWindows();
static QWindow *topLevelAt(const QPoint &pos);
@@ -89,6 +89,7 @@ public:
static QT_DEPRECATED QWindow *activeWindow() { return focusWindow(); }
#endif
static QWindow *focusWindow();
+ static QObject *focusObject();
static QScreen *primaryScreen();
static QList<QScreen *> screens();
@@ -119,11 +120,9 @@ public:
static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; }
static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
- QT_DEPRECATED static QLocale keyboardInputLocale();
- QT_DEPRECATED static Qt::LayoutDirection keyboardInputDirection();
-
QStyleHints *styleHints() const;
- QInputPanel *inputPanel() const;
+ QT_DEPRECATED QInputPanel *inputPanel() const;
+ QInputMethod *inputMethod() const;
static QPlatformNativeInterface *platformNativeInterface();
@@ -137,6 +136,7 @@ Q_SIGNALS:
void fontDatabaseChanged();
void screenAdded(QScreen *screen);
void lastWindowClosed();
+ void focusObjectChanged(QObject *focusObject);
protected:
bool event(QEvent *);
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 9c965cd109..d9444ebe95 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -59,7 +59,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate
{
@@ -96,7 +95,6 @@ public:
KB_KDE = 8,
KB_Gnome = 16,
KB_CDE = 32,
- KB_S60 = 64,
KB_All = 0xffff
};
@@ -122,6 +120,7 @@ public:
static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e);
+ static void reportScreenOrientationChange(QScreen *screen);
static void reportScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e);
static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e);
@@ -135,6 +134,8 @@ public:
static Qt::DropAction processDrag(QWindow *w, QMimeData *dropData, const QPoint &p);
static Qt::DropAction processDrop(QWindow *w, QMimeData *dropData, const QPoint &p);
+ static bool processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result);
+
static inline Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
{
if (!(alignment & Qt::AlignHorizontal_Mask))
@@ -180,9 +181,7 @@ public:
static QFont *app_font;
QStyleHints *styleHints;
- QInputPanel *inputPanel;
-
- static bool quitOnLastWindowClosed;
+ QInputMethod *inputMethod;
static QList<QObject *> generic_plugin_list;
#ifndef QT_NO_SHORTCUT
@@ -206,6 +205,7 @@ private:
static QGuiApplicationPrivate *self;
static QTouchDevice *m_fakeTouchDevice;
+ static int m_fakeMouseSourcePointId;
};
Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 532a5353e2..8378650dcb 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -99,46 +99,46 @@ Q_CORE_EXPORT const QVariant::Handler *qcoreVariantHandler();
namespace {
template<typename T>
-struct TypeDefiniton {
+struct TypeDefinition {
static const bool IsAvailable = true;
};
// Ignore these types, as incomplete
#ifdef QT_NO_GEOM_VARIANT
-template<> struct TypeDefiniton<QRect> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QRectF> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QSize> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QSizeF> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QLine> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QLineF> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QPoint> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QPointF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QRect> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QRectF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QSize> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QSizeF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QLine> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QLineF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QPoint> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QPointF> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_SHORTCUT
-template<> struct TypeDefiniton<QKeySequence> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QKeySequence> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_CURSOR
-template<> struct TypeDefiniton<QCursor> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QCursor> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_MATRIX4X4
-template<> struct TypeDefiniton<QMatrix4x4> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QMatrix4x4> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_VECTOR2D
-template<> struct TypeDefiniton<QVector2D> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QVector2D> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_VECTOR3D
-template<> struct TypeDefiniton<QVector3D> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QVector3D> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_VECTOR4D
-template<> struct TypeDefiniton<QVector4D> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QVector4D> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_QUATERNION
-template<> struct TypeDefiniton<QQuaternion> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QQuaternion> { static const bool IsAvailable = false; };
#endif
struct GuiTypesFilter {
template<typename T>
struct Acceptor {
- static const bool IsAccepted = QTypeModuleInfo<T>::IsGui && TypeDefiniton<T>::IsAvailable;
+ static const bool IsAccepted = QTypeModuleInfo<T>::IsGui && TypeDefinition<T>::IsAvailable;
};
};
} // namespace used to hide TypeDefinition
diff --git a/src/gui/kernel/qinputpanel.cpp b/src/gui/kernel/qinputmethod.cpp
index d6dd55b651..de00396e40 100644
--- a/src/gui/kernel/qinputpanel.cpp
+++ b/src/gui/kernel/qinputmethod.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,45 +34,51 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <qinputpanel.h>
-#include <private/qinputpanel_p.h>
+#include <qinputmethod.h>
+#include <private/qinputmethod_p.h>
+#include <qguiapplication.h>
+#include <qtimer.h>
QT_BEGIN_NAMESPACE
/*!
\internal
*/
-QInputPanel::QInputPanel()
- : QObject(*new QInputPanelPrivate)
+QInputMethod::QInputMethod()
+ : QObject(*new QInputMethodPrivate)
{
+ // might be instantiated before QGuiApplication is fully done, need to connect later
+ QTimer::singleShot(0, this, SLOT(q_connectFocusObject()));
}
/*!
\internal
*/
-QInputPanel::~QInputPanel()
+QInputMethod::~QInputMethod()
{
}
/*!
- \class QInputPanel
- \brief The QInputPanel class provides access to the active text input method.
+ \class QInputMethod
+ \brief The QInputMethod class provides access to the active text input method.
- QInputPanel is used by the text editors for integrating to the platform text input
+ QInputMethod is used by the text editors for integrating to the platform text input
methods and more commonly by application views for querying various text input method-related
information like virtual keyboard visibility and keyboard dimensions.
- Qt Quick also provides access to QInputPanel in QML through \l{QmlGlobalQtObject}{Qt global object}
+ Qt Quick also provides access to QInputMethod in QML through \l{QmlGlobalQtObject}{Qt global object}
as \c Qt.application.inputPanel property.
*/
/*!
- \property QInputPanel::inputItem
+ \property QInputMethod::inputItem
\brief Focused item that accepts text input
+ \obsolete
Input item is set and unset by the focused window. In QML Scene Graph this is done by
QQuickCanvas and the input item is either TextInput or TextEdit element. Any QObject can
@@ -82,15 +87,15 @@ QInputPanel::~QInputPanel()
\sa inputItemTransform, inputWindow, QInputMethodQueryEvent, QInputMethodEvent
*/
-QObject *QInputPanel::inputItem() const
+QObject *QInputMethod::inputItem() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
return d->inputItem.data();
}
-void QInputPanel::setInputItem(QObject *inputItem)
+void QInputMethod::setInputItem(QObject *inputItem)
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
if (d->inputItem.data() == inputItem)
return;
@@ -101,8 +106,10 @@ void QInputPanel::setInputItem(QObject *inputItem)
/*!
Returns the currently focused window containing the input item.
+
+ \obsolete
*/
-QWindow *QInputPanel::inputWindow() const
+QWindow *QInputMethod::inputWindow() const
{
return qApp->activeWindow();
}
@@ -110,9 +117,9 @@ QWindow *QInputPanel::inputWindow() const
/*!
Returns the transformation from input item coordinates to the window coordinates.
*/
-QTransform QInputPanel::inputItemTransform() const
+QTransform QInputMethod::inputItemTransform() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
return d->inputItemTransform;
}
@@ -121,9 +128,9 @@ QTransform QInputPanel::inputItemTransform() const
Item transform needs to be updated by the focused window like QQuickCanvas whenever
item is moved inside the scene.
*/
-void QInputPanel::setInputItemTransform(const QTransform &transform)
+void QInputMethod::setInputItemTransform(const QTransform &transform)
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
if (d->inputItemTransform == transform)
return;
@@ -132,15 +139,15 @@ void QInputPanel::setInputItemTransform(const QTransform &transform)
}
/*!
- \property QInputPanel::cursorRectangle
+ \property QInputMethod::cursorRectangle
\brief Input item's cursor rectangle in window coordinates.
Cursor rectangle is often used by various text editing controls
like text prediction popups for following the text being typed.
*/
-QRectF QInputPanel::cursorRectangle() const
+QRectF QInputMethod::cursorRectangle() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
if (!d->inputItem)
return QRectF();
@@ -155,12 +162,12 @@ QRectF QInputPanel::cursorRectangle() const
}
/*!
- \property QInputPanel::keyboardRectangle
+ \property QInputMethod::keyboardRectangle
\brief Virtual keyboard's geometry in window coordinates.
*/
-QRectF QInputPanel::keyboardRectangle() const
+QRectF QInputMethod::keyboardRectangle() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->keyboardRect();
@@ -176,9 +183,9 @@ QRectF QInputPanel::keyboardRectangle() const
function, keyboard should automatically open when
the text editor gains focus.
*/
-void QInputPanel::show()
+void QInputMethod::show()
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
ic->showInputPanel();
@@ -191,26 +198,26 @@ void QInputPanel::show()
keyboard should automatically close when the text editor loses
focus, for example when the parent view is closed.
*/
-void QInputPanel::hide()
+void QInputMethod::hide()
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
ic->hideInputPanel();
}
/*!
- \property QInputPanel::visible
+ \property QInputMethod::visible
\brief Virtual keyboard's visibility on the screen
- Input panel visibility remains false for devices
+ Input method visibility remains false for devices
with no virtual keyboards.
\sa show(), hide()
*/
-bool QInputPanel::visible() const
+bool QInputMethod::visible() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->isInputPanelVisible();
@@ -223,13 +230,13 @@ bool QInputPanel::visible() const
\sa show(), hide()
*/
-void QInputPanel::setVisible(bool visible)
+void QInputMethod::setVisible(bool visible)
{
visible ? show() : hide();
}
/*!
- \property QInputPanel::animating
+ \property QInputMethod::animating
\brief True when the virtual keyboard is being opened or closed.
Animating is false when keyboard is fully open or closed.
@@ -238,9 +245,9 @@ void QInputPanel::setVisible(bool visible)
false keyboard is being closed.
*/
-bool QInputPanel::isAnimating() const
+bool QInputMethod::isAnimating() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->isAnimating();
@@ -248,12 +255,12 @@ bool QInputPanel::isAnimating() const
}
/*!
- \property QInputPanel::locale
+ \property QInputMethod::locale
\brief Current input locale.
*/
-QLocale QInputPanel::locale() const
+QLocale QInputMethod::locale() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->locale();
@@ -261,12 +268,12 @@ QLocale QInputPanel::locale() const
}
/*!
- \property QInputPanel::inputDirection
+ \property QInputMethod::inputDirection
\brief Current input direction.
*/
-Qt::LayoutDirection QInputPanel::inputDirection() const
+Qt::LayoutDirection QInputMethod::inputDirection() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->inputDirection();
@@ -284,12 +291,12 @@ Qt::LayoutDirection QInputPanel::inputDirection() const
to change as well. The attributes that often change together with cursor position
have been grouped in Qt::ImQueryInput value for convenience.
*/
-void QInputPanel::update(Qt::InputMethodQueries queries)
+void QInputMethod::update(Qt::InputMethodQueries queries)
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
- if (!d->inputItem)
- return;
+ if (queries & Qt::ImEnabled)
+ d->q_checkFocusObject(qApp->focusObject());
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
@@ -305,9 +312,9 @@ void QInputPanel::update(Qt::InputMethodQueries queries)
Input method resets automatically when the focused editor changes.
*/
-void QInputPanel::reset()
+void QInputMethod::reset()
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
ic->reset();
@@ -321,9 +328,9 @@ void QInputPanel::reset()
interrupts the text composing needs to flush the composing state by calling the
commit() function, for example when the cursor is moved elsewhere.
*/
-void QInputPanel::commit()
+void QInputMethod::commit()
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
ic->commit();
@@ -334,14 +341,36 @@ void QInputPanel::commit()
the user. Input methods often use this information to offer more word
suggestions to the user.
*/
-void QInputPanel::invokeAction(Action a, int cursorPosition)
+void QInputMethod::invokeAction(Action a, int cursorPosition)
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
ic->invokeAction(a, cursorPosition);
}
+// temporary handlers for updating focus item based on application focus
+void QInputMethodPrivate::q_connectFocusObject()
+{
+ Q_Q(QInputMethod);
+ QObject::connect(qApp, SIGNAL(focusObjectChanged(QObject*)),
+ q, SLOT(q_checkFocusObject(QObject*)));
+ q_checkFocusObject(qApp->focusObject());
+}
+
+void QInputMethodPrivate::q_checkFocusObject(QObject *object)
+{
+ Q_Q(QInputMethod);
+
+ bool enabled = false;
+ if (object) {
+ QInputMethodQueryEvent query(Qt::ImEnabled);
+ QGuiApplication::sendEvent(object, &query);
+ enabled = query.value(Qt::ImEnabled).toBool();
+ }
+ q->setInputItem(enabled ? object : 0);
+}
+
QT_END_NAMESPACE
-#include "moc_qinputpanel.cpp"
+#include "moc_qinputmethod.cpp"
diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h
new file mode 100644
index 0000000000..0acddc05e2
--- /dev/null
+++ b/src/gui/kernel/qinputmethod.h
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 QINPUTMETHOD_H
+#define QINPUTMETHOD_H
+
+#include <QtCore/qobject.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QInputMethodPrivate;
+class QWindow;
+class QRectF;
+class QTransform;
+
+class Q_GUI_EXPORT QInputMethod : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QInputMethod)
+ Q_PROPERTY(QObject *inputItem READ inputItem WRITE setInputItem NOTIFY inputItemChanged)
+ Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
+ 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:
+ QT_DEPRECATED QObject *inputItem() const;
+ QT_DEPRECATED void setInputItem(QObject *inputItemChanged);
+
+ // the window containing the editor
+ QT_DEPRECATED QWindow *inputWindow() const;
+
+ QTransform inputItemTransform() const;
+ void setInputItemTransform(const QTransform &transform);
+
+ // in window coordinates
+ QRectF cursorRectangle() const; // ### what if we have rotations for the item?
+
+ // keyboard geometry in window coords
+ QRectF keyboardRectangle() const;
+
+ enum Action {
+ Click,
+ ContextMenu
+ };
+
+ bool visible() const;
+ void setVisible(bool visible);
+
+ bool isAnimating() const;
+
+ QLocale locale() const;
+ Qt::LayoutDirection inputDirection() const;
+
+public Q_SLOTS:
+ void show();
+ void hide();
+
+ void update(Qt::InputMethodQueries queries);
+ void reset();
+ void commit();
+
+ void invokeAction(Action a, int cursorPosition);
+
+Q_SIGNALS:
+ void inputItemChanged();
+ void cursorRectangleChanged();
+ void keyboardRectangleChanged();
+ void visibleChanged();
+ void animatingChanged();
+ void localeChanged();
+ void inputDirectionChanged(Qt::LayoutDirection newDirection);
+
+private:
+ friend class QGuiApplication;
+ friend class QGuiApplicationPrivate;
+ friend class QPlatformInputContext;
+ QInputMethod();
+ ~QInputMethod();
+
+ Q_PRIVATE_SLOT(d_func(), void q_connectFocusObject())
+ Q_PRIVATE_SLOT(d_func(), void q_checkFocusObject(QObject* object))
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h
new file mode 100644
index 0000000000..862764d1bc
--- /dev/null
+++ b/src/gui/kernel/qinputmethod_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 QINPUTMETHOD_P_H
+#define QINPUTMETHOD_P_H
+
+#include <qinputmethod.h>
+#include <private/qobject_p.h>
+#include <QtCore/QWeakPointer>
+#include <QTransform>
+#include <qplatforminputcontext_qpa.h>
+#include <private/qguiapplication_p.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QInputMethodPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QInputMethod)
+
+public:
+ inline QInputMethodPrivate() : testContext(0)
+ {}
+ QPlatformInputContext *platformInputContext() const
+ {
+ return testContext ? testContext : QGuiApplicationPrivate::platformIntegration()->inputContext();
+ }
+ static inline QInputMethodPrivate *get(QInputMethod *inputMethod)
+ {
+ return inputMethod->d_func();
+ }
+ void q_connectFocusObject();
+ void q_checkFocusObject(QObject *object);
+
+ QTransform inputItemTransform;
+ QWeakPointer<QObject> inputItem;
+ QPlatformInputContext *testContext;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/gui/kernel/qinputpanel.h b/src/gui/kernel/qinputpanel.h
index c33bd13451..95be71d7b5 100644
--- a/src/gui/kernel/qinputpanel.h
+++ b/src/gui/kernel/qinputpanel.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -42,87 +42,16 @@
#ifndef QINPUTPANEL_H
#define QINPUTPANEL_H
-#include <QtCore/qobject.h>
+#include <QtGui/qinputmethod.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-
-class QInputPanelPrivate;
-class QWindow;
-class QRectF;
-class QTransform;
-
-class Q_GUI_EXPORT QInputPanel : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QInputPanel)
- Q_PROPERTY(QObject *inputItem READ inputItem WRITE setInputItem NOTIFY inputItemChanged)
- Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
- 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:
- QObject *inputItem() const;
- void setInputItem(QObject *inputItemChanged);
-
- // the window containing the editor
- QWindow *inputWindow() const;
-
- QTransform inputItemTransform() const;
- void setInputItemTransform(const QTransform &transform);
-
- // in window coordinates
- QRectF cursorRectangle() const; // ### what if we have rotations for the item?
-
- // keyboard geometry in window coords
- QRectF keyboardRectangle() const;
-
- enum Action {
- Click,
- ContextMenu
- };
-
- bool visible() const;
- void setVisible(bool visible);
-
- bool isAnimating() const;
-
- QLocale locale() const;
- Qt::LayoutDirection inputDirection() const;
-
-public Q_SLOTS:
- void show();
- void hide();
-
- void update(Qt::InputMethodQueries queries);
- void reset();
- void commit();
-
- void invokeAction(Action a, int cursorPosition);
-
-Q_SIGNALS:
- void inputItemChanged();
- void cursorRectangleChanged();
- void keyboardRectangleChanged();
- void visibleChanged();
- void animatingChanged();
- void localeChanged();
- void inputDirectionChanged(Qt::LayoutDirection newDirection);
-
-private:
- friend class QGuiApplication;
- friend class QGuiApplicationPrivate;
- friend class QPlatformInputContext;
- QInputPanel();
- ~QInputPanel();
-};
+#if 0
+#pragma qt_class(QInputPanel)
+#endif
+#define QInputPanel QInputMethod
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qinputpanel_p.h b/src/gui/kernel/qinputpanel_p.h
index f30c8a1b80..a4f24505c6 100644
--- a/src/gui/kernel/qinputpanel_p.h
+++ b/src/gui/kernel/qinputpanel_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -42,35 +42,16 @@
#ifndef QINPUTPANEL_P_H
#define QINPUTPANEL_P_H
-#include <qinputpanel.h>
-#include <private/qobject_p.h>
-#include <QtCore/QWeakPointer>
-#include <QTransform>
-#include <qplatforminputcontext_qpa.h>
-#include <private/qguiapplication_p.h>
+#include <private/qinputmethod_p.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QInputPanelPrivate : public QObjectPrivate
-{
-public:
- inline QInputPanelPrivate() : testContext(0)
- {}
- QPlatformInputContext *platformInputContext() const
- {
- return testContext ? testContext : QGuiApplicationPrivate::platformIntegration()->inputContext();
- }
- static inline QInputPanelPrivate *get(QInputPanel *inputPanel)
- {
- return inputPanel->d_func();
- }
-
- QTransform inputItemTransform;
- QWeakPointer<QObject> inputItem;
- QPlatformInputContext *testContext;
-};
+#if 0
+#pragma qt_class(QInputPanelPrivate)
+#endif
+#define QInputPanelPrivate QInputMethodPrivate
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp
index a411ee5904..9085579856 100644
--- a/src/gui/kernel/qkeymapper.cpp
+++ b/src/gui/kernel/qkeymapper.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index bf19f1d80a..a09cdd1244 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qkeymapper_qpa.cpp b/src/gui/kernel/qkeymapper_qpa.cpp
index fd04ff234c..8f029c9110 100644
--- a/src/gui/kernel/qkeymapper_qpa.cpp
+++ b/src/gui/kernel/qkeymapper_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 986701bd7b..021135b6fe 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -224,72 +224,72 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
corresponds to the \key Control keys.
\table
- \header \i StandardKey \i Windows \i Mac OS X \i KDE \i GNOME \i S60
- \row \i HelpContents \i F1 \i Ctrl+? \i F1 \i F1 \i F2
- \row \i WhatsThis \i Shift+F1 \i Shift+F1 \i Shift+F1 \i Shift+F1 \i Shift+F1
- \row \i Open \i Ctrl+O \i Ctrl+O \i Ctrl+O \i Ctrl+O \i (none)
- \row \i Close \i Ctrl+F4, Ctrl+W \i Ctrl+W, Ctrl+F4 \i Ctrl+W \i Ctrl+W \i (none)
- \row \i Save \i Ctrl+S \i Ctrl+S \i Ctrl+S \i Ctrl+S \i (none)
- \row \i Quit \i \i Ctrl+Q \i Qtrl+Q \i Qtrl+Q \i (none)
- \row \i SaveAs \i \i Ctrl+Shift+S \i \i Ctrl+Shift+S \i (none)
- \row \i New \i Ctrl+N \i Ctrl+N \i Ctrl+N \i Ctrl+N \i (none)
- \row \i Delete \i Del \i Del, Meta+D \i Del, Ctrl+D \i Del, Ctrl+D \i Del
- \row \i Cut \i Ctrl+X, Shift+Del \i Ctrl+X \i Ctrl+X, F20, Shift+Del \i Ctrl+X, F20, Shift+Del \i Ctrl+X
- \row \i Copy \i Ctrl+C, Ctrl+Ins \i Ctrl+C \i Ctrl+C, F16, Ctrl+Ins \i Ctrl+C, F16, Ctrl+Ins \i Ctrl+C
- \row \i Paste \i Ctrl+V, Shift+Ins \i Ctrl+V \i Ctrl+V, F18, Shift+Ins \i Ctrl+V, F18, Shift+Ins \i Ctrl+V
- \row \i Preferences \i \i Ctrl+, \i \i \i (none)
- \row \i Undo \i Ctrl+Z, Alt+Backspace \i Ctrl+Z \i Ctrl+Z, F14 \i Ctrl+Z, F14 \i Ctrl+Z
- \row \i Redo \i Ctrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace \i Ctrl+Shift+Z \i Ctrl+Shift+Z \i Ctrl+Shift+Z \i (none)
- \row \i Back \i Alt+Left, Backspace \i Ctrl+[ \i Alt+Left \i Alt+Left \i (none)
- \row \i Forward \i Alt+Right, Shift+Backspace \i Ctrl+] \i Alt+Right \i Alt+Right \i (none)
- \row \i Refresh \i F5 \i F5 \i F5 \i Ctrl+R, F5 \i (none)
- \row \i ZoomIn \i Ctrl+Plus \i Ctrl+Plus \i Ctrl+Plus \i Ctrl+Plus \i (none)
- \row \i ZoomOut \i Ctrl+Minus \i Ctrl+Minus \i Ctrl+Minus \i Ctrl+Minus \i (none)
- \row \i Print \i Ctrl+P \i Ctrl+P \i Ctrl+P \i Ctrl+P \i (none)
- \row \i AddTab \i Ctrl+T \i Ctrl+T \i Ctrl+Shift+N, Ctrl+T \i Ctrl+T \i (none)
- \row \i NextChild \i Ctrl+Tab, Forward, Ctrl+F6 \i Ctrl+}, Forward, Ctrl+Tab \i Ctrl+Tab, Forward, Ctrl+Comma \i Ctrl+Tab, Forward \i (none)
- \row \i PreviousChild \i Ctrl+Shift+Tab, Back, Ctrl+Shift+F6 \i Ctrl+{, Back, Ctrl+Shift+Tab \i Ctrl+Shift+Tab, Back, Ctrl+Period \i Ctrl+Shift+Tab, Back \i (none)
- \row \i Find \i Ctrl+F \i Ctrl+F \i Ctrl+F \i Ctrl+F \i (none)
- \row \i FindNext \i F3, Ctrl+G \i Ctrl+G \i F3 \i Ctrl+G, F3 \i (none)
- \row \i FindPrevious \i Shift+F3, Ctrl+Shift+G \i Ctrl+Shift+G \i Shift+F3 \i Ctrl+Shift+G, Shift+F3 \i (none)
- \row \i Replace \i Ctrl+H \i (none) \i Ctrl+R \i Ctrl+H \i (none)
- \row \i SelectAll \i Ctrl+A \i Ctrl+A \i Ctrl+A \i Ctrl+A \i (none)
- \row \i Bold \i Ctrl+B \i Ctrl+B \i Ctrl+B \i Ctrl+B \i (none)
- \row \i Italic \i Ctrl+I \i Ctrl+I \i Ctrl+I \i Ctrl+I \i (none)
- \row \i Underline \i Ctrl+U \i Ctrl+U \i Ctrl+U \i Ctrl+U \i (none)
- \row \i MoveToNextChar \i Right \i Right \i Right \i Right \i Right
- \row \i MoveToPreviousChar \i Left \i Left \i Left \i Left \i Left
- \row \i MoveToNextWord \i Ctrl+Right \i Alt+Right \i Ctrl+Right \i Ctrl+Right \i Ctrl+Right
- \row \i MoveToPreviousWord \i Ctrl+Left \i Alt+Left \i Ctrl+Left \i Ctrl+Left \i Ctrl+Left
- \row \i MoveToNextLine \i Down \i Down \i Down \i Down \i Down
- \row \i MoveToPreviousLine \i Up \i Up \i Up \i Up \i Up
- \row \i MoveToNextPage \i PgDown \i PgDown, Alt+PgDown, Meta+Down, Meta+PgDown\i PgDown \i PgDown \i PgDown
- \row \i MoveToPreviousPage \i PgUp \i PgUp, Alt+PgUp, Meta+Up, Meta+PgUp \i PgUp \i PgUp \i PgUp
- \row \i MoveToStartOfLine \i Home \i Ctrl+Left, Meta+Left \i Home \i Home \i Home
- \row \i MoveToEndOfLine \i End \i Ctrl+Right, Meta+Right \i End \i End \i End
- \row \i MoveToStartOfBlock \i (none) \i Alt+Up, Meta+A \i (none) \i (none) \i (none)
- \row \i MoveToEndOfBlock \i (none) \i Alt+Down, Meta+E \i (none) \i (none) \i (none)
- \row \i MoveToStartOfDocument\i Ctrl+Home \i Ctrl+Up, Home \i Ctrl+Home \i Ctrl+Home \i Ctrl+Home
- \row \i MoveToEndOfDocument \i Ctrl+End \i Ctrl+Down, End \i Ctrl+End \i Ctrl+End \i Ctrl+End
- \row \i SelectNextChar \i Shift+Right \i Shift+Right \i Shift+Right \i Shift+Right \i Shift+Right
- \row \i SelectPreviousChar \i Shift+Left \i Shift+Left \i Shift+Left \i Shift+Left \i Shift+Left
- \row \i SelectNextWord \i Ctrl+Shift+Right \i Alt+Shift+Right \i Ctrl+Shift+Right \i Ctrl+Shift+Right \i Ctrl+Shift+Right
- \row \i SelectPreviousWord \i Ctrl+Shift+Left \i Alt+Shift+Left \i Ctrl+Shift+Left \i Ctrl+Shift+Left \i Ctrl+Shift+Left
- \row \i SelectNextLine \i Shift+Down \i Shift+Down \i Shift+Down \i Shift+Down \i Shift+Down
- \row \i SelectPreviousLine \i Shift+Up \i Shift+Up \i Shift+Up \i Shift+Up \i Shift+Up
- \row \i SelectNextPage \i Shift+PgDown \i Shift+PgDown \i Shift+PgDown \i Shift+PgDown \i Shift+PgDown
- \row \i SelectPreviousPage \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp
- \row \i SelectStartOfLine \i Shift+Home \i Ctrl+Shift+Left \i Shift+Home \i Shift+Home \i Shift+Home
- \row \i SelectEndOfLine \i Shift+End \i Ctrl+Shift+Right \i Shift+End \i Shift+End \i Shift+End
- \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up, Meta+Shift+A \i (none) \i (none) \i (none)
- \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down, Meta+Shift+E \i (none) \i (none) \i (none)
- \row \i SelectStartOfDocument\i Ctrl+Shift+Home \i Ctrl+Shift+Up, Shift+Home \i Ctrl+Shift+Home\i Ctrl+Shift+Home \i Ctrl+Shift+Home
- \row \i SelectEndOfDocument \i Ctrl+Shift+End \i Ctrl+Shift+Down, Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End
- \row \i DeleteStartOfWord \i Ctrl+Backspace \i Alt+Backspace \i Ctrl+Backspace \i Ctrl+Backspace \i (none)
- \row \i DeleteEndOfWord \i Ctrl+Del \i (none) \i Ctrl+Del \i Ctrl+Del \i (none)
- \row \i DeleteEndOfLine \i (none) \i (none) \i Ctrl+K \i Ctrl+K \i (none)
- \row \i InsertParagraphSeparator \i Enter \i Enter \i Enter \i Enter \i (none)
- \row \i InsertLineSeparator \i Shift+Enter \i Meta+Enter \i Shift+Enter \i Shift+Enter \i (none)
+ \header \i StandardKey \i Windows \i Mac OS X \i KDE \i GNOME
+ \row \i HelpContents \i F1 \i Ctrl+? \i F1 \i F1
+ \row \i WhatsThis \i Shift+F1 \i Shift+F1 \i Shift+F1 \i Shift+F1
+ \row \i Open \i Ctrl+O \i Ctrl+O \i Ctrl+O \i Ctrl+O
+ \row \i Close \i Ctrl+F4, Ctrl+W \i Ctrl+W, Ctrl+F4 \i Ctrl+W \i Ctrl+W
+ \row \i Save \i Ctrl+S \i Ctrl+S \i Ctrl+S \i Ctrl+S
+ \row \i Quit \i \i Ctrl+Q \i Qtrl+Q \i Qtrl+Q
+ \row \i SaveAs \i \i Ctrl+Shift+S \i \i Ctrl+Shift+S
+ \row \i New \i Ctrl+N \i Ctrl+N \i Ctrl+N \i Ctrl+N
+ \row \i Delete \i Del \i Del, Meta+D \i Del, Ctrl+D \i Del, Ctrl+D
+ \row \i Cut \i Ctrl+X, Shift+Del \i Ctrl+X \i Ctrl+X, F20, Shift+Del \i Ctrl+X, F20, Shift+Del
+ \row \i Copy \i Ctrl+C, Ctrl+Ins \i Ctrl+C \i Ctrl+C, F16, Ctrl+Ins \i Ctrl+C, F16, Ctrl+Ins
+ \row \i Paste \i Ctrl+V, Shift+Ins \i Ctrl+V \i Ctrl+V, F18, Shift+Ins \i Ctrl+V, F18, Shift+Ins
+ \row \i Preferences \i \i Ctrl+, \i \i
+ \row \i Undo \i Ctrl+Z, Alt+Backspace \i Ctrl+Z \i Ctrl+Z, F14 \i Ctrl+Z, F14
+ \row \i Redo \i Ctrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace \i Ctrl+Shift+Z \i Ctrl+Shift+Z \i Ctrl+Shift+Z
+ \row \i Back \i Alt+Left, Backspace \i Ctrl+[ \i Alt+Left \i Alt+Left
+ \row \i Forward \i Alt+Right, Shift+Backspace \i Ctrl+] \i Alt+Right \i Alt+Right
+ \row \i Refresh \i F5 \i F5 \i F5 \i Ctrl+R, F5
+ \row \i ZoomIn \i Ctrl+Plus \i Ctrl+Plus \i Ctrl+Plus \i Ctrl+Plus
+ \row \i ZoomOut \i Ctrl+Minus \i Ctrl+Minus \i Ctrl+Minus \i Ctrl+Minus
+ \row \i Print \i Ctrl+P \i Ctrl+P \i Ctrl+P \i Ctrl+P
+ \row \i AddTab \i Ctrl+T \i Ctrl+T \i Ctrl+Shift+N, Ctrl+T \i Ctrl+T
+ \row \i NextChild \i Ctrl+Tab, Forward, Ctrl+F6 \i Ctrl+}, Forward, Ctrl+Tab \i Ctrl+Tab, Forward, Ctrl+Comma \i Ctrl+Tab, Forward
+ \row \i PreviousChild \i Ctrl+Shift+Tab, Back, Ctrl+Shift+F6 \i Ctrl+{, Back, Ctrl+Shift+Tab \i Ctrl+Shift+Tab, Back, Ctrl+Period \i Ctrl+Shift+Tab, Back
+ \row \i Find \i Ctrl+F \i Ctrl+F \i Ctrl+F \i Ctrl+F
+ \row \i FindNext \i F3, Ctrl+G \i Ctrl+G \i F3 \i Ctrl+G, F3
+ \row \i FindPrevious \i Shift+F3, Ctrl+Shift+G \i Ctrl+Shift+G \i Shift+F3 \i Ctrl+Shift+G, Shift+F3
+ \row \i Replace \i Ctrl+H \i (none) \i Ctrl+R \i Ctrl+H
+ \row \i SelectAll \i Ctrl+A \i Ctrl+A \i Ctrl+A \i Ctrl+A
+ \row \i Bold \i Ctrl+B \i Ctrl+B \i Ctrl+B \i Ctrl+B
+ \row \i Italic \i Ctrl+I \i Ctrl+I \i Ctrl+I \i Ctrl+I
+ \row \i Underline \i Ctrl+U \i Ctrl+U \i Ctrl+U \i Ctrl+U
+ \row \i MoveToNextChar \i Right \i Right \i Right \i Right
+ \row \i MoveToPreviousChar \i Left \i Left \i Left \i Left
+ \row \i MoveToNextWord \i Ctrl+Right \i Alt+Right \i Ctrl+Right \i Ctrl+Right
+ \row \i MoveToPreviousWord \i Ctrl+Left \i Alt+Left \i Ctrl+Left \i Ctrl+Left
+ \row \i MoveToNextLine \i Down \i Down \i Down \i Down
+ \row \i MoveToPreviousLine \i Up \i Up \i Up \i Up
+ \row \i MoveToNextPage \i PgDown \i PgDown, Alt+PgDown, Meta+Down, Meta+PgDown\i PgDown \i PgDown
+ \row \i MoveToPreviousPage \i PgUp \i PgUp, Alt+PgUp, Meta+Up, Meta+PgUp \i PgUp \i PgUp
+ \row \i MoveToStartOfLine \i Home \i Ctrl+Left, Meta+Left \i Home \i Home
+ \row \i MoveToEndOfLine \i End \i Ctrl+Right, Meta+Right \i End \i End
+ \row \i MoveToStartOfBlock \i (none) \i Alt+Up, Meta+A \i (none) \i (none)
+ \row \i MoveToEndOfBlock \i (none) \i Alt+Down, Meta+E \i (none) \i (none)
+ \row \i MoveToStartOfDocument\i Ctrl+Home \i Ctrl+Up, Home \i Ctrl+Home \i Ctrl+Home
+ \row \i MoveToEndOfDocument \i Ctrl+End \i Ctrl+Down, End \i Ctrl+End \i Ctrl+End
+ \row \i SelectNextChar \i Shift+Right \i Shift+Right \i Shift+Right \i Shift+Right
+ \row \i SelectPreviousChar \i Shift+Left \i Shift+Left \i Shift+Left \i Shift+Left
+ \row \i SelectNextWord \i Ctrl+Shift+Right \i Alt+Shift+Right \i Ctrl+Shift+Right \i Ctrl+Shift+Right
+ \row \i SelectPreviousWord \i Ctrl+Shift+Left \i Alt+Shift+Left \i Ctrl+Shift+Left \i Ctrl+Shift+Left
+ \row \i SelectNextLine \i Shift+Down \i Shift+Down \i Shift+Down \i Shift+Down
+ \row \i SelectPreviousLine \i Shift+Up \i Shift+Up \i Shift+Up \i Shift+Up
+ \row \i SelectNextPage \i Shift+PgDown \i Shift+PgDown \i Shift+PgDown \i Shift+PgDown
+ \row \i SelectPreviousPage \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp
+ \row \i SelectStartOfLine \i Shift+Home \i Ctrl+Shift+Left \i Shift+Home \i Shift+Home
+ \row \i SelectEndOfLine \i Shift+End \i Ctrl+Shift+Right \i Shift+End \i Shift+End
+ \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up, Meta+Shift+A \i (none) \i (none)
+ \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down, Meta+Shift+E \i (none) \i (none)
+ \row \i SelectStartOfDocument\i Ctrl+Shift+Home \i Ctrl+Shift+Up, Shift+Home \i Ctrl+Shift+Home\i Ctrl+Shift+Home
+ \row \i SelectEndOfDocument \i Ctrl+Shift+End \i Ctrl+Shift+Down, Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End
+ \row \i DeleteStartOfWord \i Ctrl+Backspace \i Alt+Backspace \i Ctrl+Backspace \i Ctrl+Backspace
+ \row \i DeleteEndOfWord \i Ctrl+Del \i (none) \i Ctrl+Del \i Ctrl+Del
+ \row \i DeleteEndOfLine \i (none) \i (none) \i Ctrl+K \i Ctrl+K
+ \row \i InsertParagraphSeparator \i Enter \i Enter \i Enter \i Enter
+ \row \i InsertLineSeparator \i Shift+Enter \i Meta+Enter \i Shift+Enter \i Shift+Enter
\endtable
Note that, since the key sequences used for the standard shortcuts differ
@@ -646,9 +646,9 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, QGuiApplicationPrivate::KB_All},
{QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, QGuiApplicationPrivate::KB_All},
{QKeySequence::Delete, 1, Qt::Key_Delete, QGuiApplicationPrivate::KB_All},
- {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
+ {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
+ {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, QGuiApplicationPrivate::KB_Mac},
{QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, QGuiApplicationPrivate::KB_All},
{QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, QGuiApplicationPrivate::KB_All},
@@ -657,7 +657,6 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, QGuiApplicationPrivate::KB_All},
{QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, QGuiApplicationPrivate::KB_All},
{QKeySequence::HelpContents, 0, Qt::Key_F1, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
- {QKeySequence::HelpContents, 0, Qt::Key_F2, QGuiApplicationPrivate::KB_S60},
{QKeySequence::FindNext, 0, Qt::Key_F3, QGuiApplicationPrivate::KB_X11},
{QKeySequence::FindNext, 1, Qt::Key_F3, QGuiApplicationPrivate::KB_Win},
{QKeySequence::Refresh, 0, Qt::Key_F5, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
@@ -668,14 +667,13 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::PreviousChild, 0, Qt::Key_Back, QGuiApplicationPrivate::KB_All},
{QKeySequence::NextChild, 0, Qt::Key_Forward, QGuiApplicationPrivate::KB_All},
{QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_Win},
- {QKeySequence::Delete, 0, Qt::SHIFT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_S60},
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, QGuiApplicationPrivate::KB_All},
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, QGuiApplicationPrivate::KB_All},
{QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, //## Check if this should work on mac
- {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
+ {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
+ {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Mac},
{QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_All},
{QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, QGuiApplicationPrivate::KB_All},
@@ -716,7 +714,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, QGuiApplicationPrivate::KB_Mac},
{QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, QGuiApplicationPrivate::KB_All},
- {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_S60},
+ {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QGuiApplicationPrivate::KB_Win},
{QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, QGuiApplicationPrivate::KB_All},
{QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, QGuiApplicationPrivate::KB_Mac},
{QKeySequence::Forward, 1, Qt::CTRL | Qt::Key_BracketRight, QGuiApplicationPrivate::KB_Mac},
@@ -727,15 +725,15 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win},
{QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win},
{QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win},
- {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
- {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
+ {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
+ {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
+ {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac },
{QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac},
{QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac},
{QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac },
- {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
+ {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac},
{QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, QGuiApplicationPrivate::KB_Win},
{QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, QGuiApplicationPrivate::KB_Mac},
@@ -744,17 +742,17 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QGuiApplicationPrivate::KB_Win},
{QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, QGuiApplicationPrivate::KB_KDE},
{QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
+ {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QGuiApplicationPrivate::KB_Mac},
{QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QGuiApplicationPrivate::KB_Mac },//different priority from above
{QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, QGuiApplicationPrivate::KB_X11},
- {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
- {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
- {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
+ {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
+ {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
+ {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac },
{QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac},
- {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60},
+ {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11},
{QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac },
{QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac},
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, QGuiApplicationPrivate::KB_Win},
@@ -1040,7 +1038,7 @@ void QKeySequence::setKey(int key, int index)
Returns the number of keys in the key sequence.
The maximum is 4.
*/
-uint QKeySequence::count() const
+int QKeySequence::count() const
{
if (!d->key[0])
return 0;
@@ -1255,10 +1253,21 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
int lastI = 0;
while ((i = sl.indexOf(QLatin1Char('+'), i + 1)) != -1) {
const QString sub = sl.mid(lastI, i - lastI + 1);
- // Just shortcut the check here if we only have one character.
- // 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) {
+ // If we get here the shortcuts contains at least one '+'. We break up
+ // along the following strategy:
+ // Meta+Ctrl++ ( "Meta+", "Ctrl+", "+" )
+ // Super+Shift+A ( "Super+", "Shift+" )
+ // 4+3+2=1 ( "4+", "3+" )
+ // In other words, everything we try to handle HAS to be a modifier
+ // except for a single '+' at the end of the string.
+
+ // Only '+' can have length 1.
+ if (sub.length() == 1) {
+ // Make sure we only encounter a single '+' at the end of the accel
+ if (accel.lastIndexOf(QLatin1Char('+')) != accel.length()-1)
+ return Qt::Key_unknown;
+ } else {
+ // Identify the modifier
bool validModifier = false;
for (int j = 0; j < modifs.size(); ++j) {
const QModifKeyName &mkf = modifs.at(j);
@@ -1268,9 +1277,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
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;
}
@@ -1478,7 +1485,8 @@ QKeySequence::SequenceMatch QKeySequence::matches(const QKeySequence &seq) const
}
-/*!
+/*! \fn QKeySequence::operator QString() const
+
\obsolete
Use toString() instead.
@@ -1487,10 +1495,6 @@ QKeySequence::SequenceMatch QKeySequence::matches(const QKeySequence &seq) const
calling toString(QKeySequence::NativeText). Note that the
result is not platform independent.
*/
-QKeySequence::operator QString() const
-{
- return QKeySequence::toString(QKeySequence::NativeText);
-}
/*!
Returns the key sequence as a QVariant
@@ -1500,18 +1504,12 @@ QKeySequence::operator QVariant() const
return QVariant(QVariant::KeySequence, this);
}
-/*!
+/*! \fn QKeySequence::operator int () const
+
\obsolete
For backward compatibility: returns the first keycode
as integer. If the key sequence is empty, 0 is returned.
*/
-QKeySequence::operator int () const
-{
- if (1 <= count())
- return d->key[0];
- return 0;
-}
-
/*!
Returns a reference to the element at position \a index in the key
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 1127e8afca..d1e7d06653 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_SHORTCUT
@@ -154,7 +153,7 @@ public:
QKeySequence(StandardKey key);
~QKeySequence();
- uint count() const; // ### Qt 5: return 'int'
+ int count() const;
bool isEmpty() const;
enum SequenceMatch {
@@ -170,10 +169,11 @@ public:
static QKeySequence mnemonic(const QString &text);
static QList<QKeySequence> keyBindings(StandardKey key);
- // ### Qt 5: kill 'operator QString' - it's evil
- operator QString() const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED operator QString() const { return toString(QKeySequence::NativeText); }
+ QT_DEPRECATED operator int() const { if (1 <= count()) return operator [](0); return 0; }
+#endif
operator QVariant() const;
- operator int() const;
int operator[](uint i) const;
QKeySequence &operator=(const QKeySequence &other);
#ifdef Q_COMPILER_RVALUE_REFS
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index 57f6e1927f..68cbb8778b 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 93a4b3582b..1b6d1d34c4 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -68,6 +68,11 @@ public:
static QThreadStorage<QGuiGLThreadContext *> qwindow_context_storage;
+#ifndef QT_NO_DEBUG
+QHash<QOpenGLContext *, bool> QOpenGLContextPrivate::makeCurrentTracker;
+QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex;
+#endif
+
void QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context)
{
QGuiGLThreadContext *threadContext = qwindow_context_storage.localData();
@@ -163,6 +168,8 @@ bool QOpenGLContext::create()
Q_D(QOpenGLContext);
d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this);
+ if (!d->platformGLContext)
+ return false;
d->platformGLContext->setContext(this);
if (!d->platformGLContext->isSharing())
d->shareContext = 0;
@@ -204,6 +211,10 @@ void QOpenGLContext::destroy()
QOpenGLContext::~QOpenGLContext()
{
destroy();
+
+#ifndef QT_NO_DEBUG
+ QOpenGLContextPrivate::cleanMakeCurrentTracker(this);
+#endif
}
/*!
@@ -230,6 +241,29 @@ QOpenGLFunctions *QOpenGLContext::functions() const
}
/*!
+ Call this to get the default framebuffer object for the current surface.
+
+ On some platforms the default framebuffer object depends on the surface being rendered to,
+ and might be different from 0. Thus, instead of calling glBindFramebuffer(0), you should
+ call glBindFramebuffer(ctx->defaultFramebufferObject()) if you want your application to
+ work across different Qt platforms.
+
+ If you use the glBindFramebuffer() in QOpenGLFunctions you do not have to worry about this,
+ as it automatically binds the current context's defaultFramebufferObject() when 0 is passed.
+*/
+GLuint QOpenGLContext::defaultFramebufferObject() const
+{
+ if (!isValid())
+ return 0;
+
+ Q_D(const QOpenGLContext);
+ if (!d->surface || !d->surface->surfaceHandle())
+ return 0;
+
+ return d->platformGLContext->defaultFramebufferObject(d->surface->surfaceHandle());
+}
+
+/*!
If surface is 0 this is equivalent to calling doneCurrent().
Do not call this function from a different thread than the one the QOpenGLContext instance lives in. If
@@ -254,12 +288,22 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
if (!surface->surfaceHandle())
return false;
+ if (surface->surfaceType() != QSurface::OpenGLSurface) {
+ qWarning() << "QOpenGLContext::makeBuffers() called with non-opengl surface";
+ return false;
+ }
+
+
if (d->platformGLContext->makeCurrent(surface->surfaceHandle())) {
QOpenGLContextPrivate::setCurrentContext(this);
d->surface = surface;
d->shareGroup->d_func()->deletePendingResources(this);
+#ifndef QT_NO_DEBUG
+ QOpenGLContextPrivate::toggleMakeCurrentTracker(this, true);
+#endif
+
return true;
}
@@ -294,6 +338,17 @@ QSurface *QOpenGLContext::surface() const
}
+/*!
+ Swap the back and front buffers of the given surface.
+
+ Call this to finish a frame of OpenGL rendering, and make sure to
+ call makeCurrent() again before you begin a new frame.
+
+ If you have bound a non-default framebuffer object, you need to
+ use bindDefaultFramebufferObject() to make sure that the default
+ framebuffer object is bound before calling swapBuffers(), as
+ some Qt platforms assume that the default framebuffer object is bound.
+*/
void QOpenGLContext::swapBuffers(QSurface *surface)
{
Q_D(QOpenGLContext);
@@ -305,9 +360,34 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
return;
}
+ if (surface->surfaceType() != QSurface::OpenGLSurface) {
+ qWarning() << "QOpenGLContext::swapBuffers() called with non-opengl surface";
+ return;
+ }
+
QPlatformSurface *surfaceHandle = surface->surfaceHandle();
- if (surfaceHandle)
- d->platformGLContext->swapBuffers(surfaceHandle);
+ if (!surfaceHandle)
+ return;
+
+#if !defined(QT_NO_DEBUG)
+ if (currentContext() != this)
+ qWarning() << "QOpenGLContext::swapBuffers() called with non-current surface";
+ else if (!QOpenGLContextPrivate::toggleMakeCurrentTracker(this, false))
+ qWarning() << "QOpenGLContext::swapBuffers() called without corresponding makeCurrent()";
+
+#ifndef GL_FRAMEBUFFER_BINDING
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#endif
+
+ GLint framebufferBinding = 0;
+ glGetIntegerv(GL_FRAMEBUFFER_BINDING, &framebufferBinding);
+
+ GLint platformFramebuffer = GLint(d->platformGLContext->defaultFramebufferObject(surfaceHandle));
+ if (framebufferBinding != platformFramebuffer)
+ qWarning() << "QOpenGLContext::swapBuffers() called with non-default framebuffer object bound";
+#endif
+
+ d->platformGLContext->swapBuffers(surfaceHandle);
}
QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName)
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index a8ac39c7d5..52f94a8a10 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -42,18 +42,25 @@
#ifndef QOPENGLCONTEXT_H
#define QOPENGLCONTEXT_H
+#ifndef QT_NO_OPENGL
+
#include <QtCore/qnamespace.h>
#include <QtCore/QObject>
#include <QtCore/QScopedPointer>
#include <QtGui/QSurfaceFormat>
+#ifdef __GLEW_H__
+#warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined
+#warning To use GLEW with Qt, do not include <qopengl.h> or <QOpenGLFunctions> after glew.h
+#endif
+
+#include <QtGui/qopengl.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-
class QOpenGLContextPrivate;
class QOpenGLContextGroupPrivate;
class QOpenGLFunctions;
@@ -102,6 +109,8 @@ public:
QOpenGLContextGroup *shareGroup() const;
QScreen *screen() const;
+ GLuint defaultFramebufferObject() const;
+
bool makeCurrent(QSurface *surface);
void doneCurrent();
@@ -146,4 +155,6 @@ QT_END_NAMESPACE
QT_END_HEADER
+#endif // QT_NO_OPENGL
+
#endif // QGUIGLCONTEXT_H
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 7040b883bf..7b4e880ade 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -47,11 +47,14 @@
#include <private/qobject_p.h>
#include <qmutex.h>
+#ifndef QT_NO_DEBUG
+#include <QtCore/QHash>
+#endif
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QOpenGLFunctions;
class QOpenGLContext;
@@ -186,7 +189,6 @@ public:
, surface(0)
, functions(0)
, current_fbo(0)
- , default_fbo(0)
, workaround_brokenFBOReadBack(false)
, workaround_brokenTexSubImage(false)
, active_engine(0)
@@ -211,7 +213,6 @@ public:
QOpenGLFunctions *functions;
GLuint current_fbo;
- GLuint default_fbo;
bool workaround_brokenFBOReadBack;
bool workaround_brokenTexSubImage;
@@ -221,6 +222,23 @@ public:
static void setCurrentContext(QOpenGLContext *context);
int maxTextureSize() const { return 1024; }
+
+#if !defined(QT_NO_DEBUG)
+ static bool toggleMakeCurrentTracker(QOpenGLContext *context, bool value)
+ {
+ QMutexLocker locker(&makeCurrentTrackerMutex);
+ bool old = makeCurrentTracker.value(context, false);
+ makeCurrentTracker.insert(context, value);
+ return old;
+ }
+ static void cleanMakeCurrentTracker(QOpenGLContext *context)
+ {
+ QMutexLocker locker(&makeCurrentTrackerMutex);
+ makeCurrentTracker.remove(context);
+ }
+ static QHash<QOpenGLContext *, bool> makeCurrentTracker;
+ static QMutex makeCurrentTrackerMutex;
+#endif
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 2dd2ef00c5..627731ff20 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index d47854df07..cc710fa67a 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPalettePrivate;
class QVariant;
diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp
index 4d8d65de0a..9e0c60b3f6 100644
--- a/src/gui/kernel/qplatformclipboard_qpa.cpp
+++ b/src/gui/kernel/qplatformclipboard_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h
index 643733fdf7..4dd672b21e 100644
--- a/src/gui/kernel/qplatformclipboard_qpa.h
+++ b/src/gui/kernel/qplatformclipboard_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class Q_GUI_EXPORT QPlatformClipboard
{
diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp
index a3824381d3..fd7bcdcf18 100644
--- a/src/gui/kernel/qplatformcursor_qpa.cpp
+++ b/src/gui/kernel/qplatformcursor_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtOpenVG module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h
index a2026425db..a8cbb282fa 100644
--- a/src/gui/kernel/qplatformcursor_qpa.h
+++ b/src/gui/kernel/qplatformcursor_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtOpenVG module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
// Cursor graphics management
class Q_GUI_EXPORT QPlatformCursorImage {
diff --git a/src/gui/kernel/qplatformdialoghelper_qpa.cpp b/src/gui/kernel/qplatformdialoghelper_qpa.cpp
new file mode 100644
index 0000000000..385484828a
--- /dev/null
+++ b/src/gui/kernel/qplatformdialoghelper_qpa.cpp
@@ -0,0 +1,556 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qplatformdialoghelper_qpa.h"
+
+#include <QtCore/QVariant>
+#include <QtCore/QSharedData>
+#include <QtCore/QSettings>
+#include <QtCore/QHash>
+#include <QtCore/QUrl>
+#include <QtGui/QColor>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QPlatformDialogHelper
+ \since 5.0
+ \internal
+ \brief The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
+
+*/
+
+/*!
+ \enum QPlatformDialogHelper::StyleHint
+
+ This enum type specifies platform-specific style hints.
+
+ \value SnapToDefaultButton Snap the mouse to the center of the default
+ button. There is corresponding system
+ setting on Windows.
+
+ \sa styleHint()
+*/
+
+QPlatformDialogHelper::QPlatformDialogHelper()
+{
+}
+
+QPlatformDialogHelper::~QPlatformDialogHelper()
+{
+}
+
+QVariant QPlatformDialogHelper::styleHint(StyleHint hint) const
+{
+ return QPlatformDialogHelper::defaultStyleHint(hint);
+}
+
+QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHint hint)
+{
+ switch (hint) {
+ case QPlatformDialogHelper::SnapToDefaultButton:
+ return QVariant(false);
+ }
+ return QVariant();
+}
+
+void QPlatformDialogHelper::emitLaunchNativeAppModalPanel()
+{
+ emit launchNativeAppModalPanel();
+}
+
+// Font dialog
+
+class QFontDialogOptionsPrivate : public QSharedData
+{
+public:
+ QFontDialogOptionsPrivate() : options(0) {}
+
+ QFontDialogOptions::FontDialogOptions options;
+ QString windowTitle;
+};
+
+QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate)
+{
+}
+
+QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d)
+{
+}
+
+QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs)
+{
+ if (this != &rhs)
+ d = rhs.d;
+ return *this;
+}
+
+QFontDialogOptions::~QFontDialogOptions()
+{
+}
+
+QString QFontDialogOptions::windowTitle() const
+{
+ return d->windowTitle;
+}
+
+void QFontDialogOptions::setWindowTitle(const QString &title)
+{
+ d->windowTitle = title;
+}
+
+void QFontDialogOptions::setOption(QFontDialogOptions::FontDialogOption option, bool on)
+{
+ if (!(d->options & option) != !on)
+ setOptions(d->options ^ option);
+}
+
+bool QFontDialogOptions::testOption(QFontDialogOptions::FontDialogOption option) const
+{
+ return d->options & option;
+}
+
+void QFontDialogOptions::setOptions(FontDialogOptions options)
+{
+ if (options != d->options)
+ d->options = options;
+}
+
+QFontDialogOptions::FontDialogOptions QFontDialogOptions::options() const
+{
+ return d->options;
+}
+
+const QSharedPointer<QFontDialogOptions> &QPlatformFontDialogHelper::options() const
+{
+ return m_options;
+}
+
+void QPlatformFontDialogHelper::setOptions(const QSharedPointer<QFontDialogOptions> &options)
+{
+ m_options = options;
+}
+
+// Color dialog
+
+class QColorDialogStaticData
+{
+public:
+ enum { CustomColorCount = 16, StandardColorCount = 6 * 8 };
+
+ QColorDialogStaticData();
+ inline void readSettings();
+ inline void writeSettings() const;
+
+ QRgb customRgb[CustomColorCount];
+ QRgb standardRgb[StandardColorCount];
+ bool customSet;
+};
+
+QColorDialogStaticData::QColorDialogStaticData() : customSet(false)
+{
+ int i = 0;
+ for (int g = 0; g < 4; ++g)
+ for (int r = 0; r < 4; ++r)
+ for (int b = 0; b < 3; ++b)
+ standardRgb[i++] = qRgb(r * 255 / 3, g * 255 / 3, b * 255 / 2);
+ qFill(customRgb, customRgb + CustomColorCount, 0xffffffff);
+ readSettings();
+}
+
+void QColorDialogStaticData::readSettings()
+{
+#ifndef QT_NO_SETTINGS
+ const QSettings settings(QSettings::UserScope, QStringLiteral("Trolltech"));
+ for (int i = 0; i < int(CustomColorCount); ++i) {
+ const QVariant v = settings.value(QStringLiteral("Qt/customColors/") + QString::number(i));
+ if (v.isValid())
+ customRgb[i] = v.toUInt();
+ }
+#endif
+}
+
+void QColorDialogStaticData::writeSettings() const
+{
+#ifndef QT_NO_SETTINGS
+ if (!customSet) {
+ QSettings settings(QSettings::UserScope, QStringLiteral("Trolltech"));
+ for (int i = 0; i < int(CustomColorCount); ++i)
+ settings.setValue(QStringLiteral("Qt/customColors/") + QString::number(i), customRgb[i]);
+ }
+#endif
+}
+
+Q_GLOBAL_STATIC(QColorDialogStaticData, qColorDialogStaticData)
+
+class QColorDialogOptionsPrivate : public QSharedData
+{
+public:
+ QColorDialogOptionsPrivate() : options(0) {}
+ // Write out settings around destruction of dialogs
+ ~QColorDialogOptionsPrivate() { qColorDialogStaticData()->writeSettings(); }
+
+ QColorDialogOptions::ColorDialogOptions options;
+ QString windowTitle;
+};
+
+QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate)
+{
+}
+
+QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d)
+{
+}
+
+QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs)
+{
+ if (this != &rhs)
+ d = rhs.d;
+ return *this;
+}
+
+QColorDialogOptions::~QColorDialogOptions()
+{
+}
+
+QString QColorDialogOptions::windowTitle() const
+{
+ return d->windowTitle;
+}
+
+void QColorDialogOptions::setWindowTitle(const QString &title)
+{
+ d->windowTitle = title;
+}
+
+void QColorDialogOptions::setOption(QColorDialogOptions::ColorDialogOption option, bool on)
+{
+ if (!(d->options & option) != !on)
+ setOptions(d->options ^ option);
+}
+
+bool QColorDialogOptions::testOption(QColorDialogOptions::ColorDialogOption option) const
+{
+ return d->options & option;
+}
+
+void QColorDialogOptions::setOptions(ColorDialogOptions options)
+{
+ if (options != d->options)
+ d->options = options;
+}
+
+QColorDialogOptions::ColorDialogOptions QColorDialogOptions::options() const
+{
+ return d->options;
+}
+
+int QColorDialogOptions::customColorCount()
+{
+ return QColorDialogStaticData::CustomColorCount;
+}
+
+QRgb QColorDialogOptions::customColor(int index)
+{
+ if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount))
+ return qRgb(255, 255, 255);
+ return qColorDialogStaticData()->customRgb[index];
+}
+
+QRgb *QColorDialogOptions::customColors()
+{
+ return qColorDialogStaticData()->customRgb;
+}
+
+void QColorDialogOptions::setCustomColor(int index, QRgb color)
+{
+ if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount))
+ return;
+ qColorDialogStaticData()->customSet;
+ qColorDialogStaticData()->customRgb[index] = color;
+}
+
+QRgb *QColorDialogOptions::standardColors()
+{
+ return qColorDialogStaticData()->standardRgb;
+}
+
+QRgb QColorDialogOptions::standardColor(int index)
+{
+ if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
+ return qRgb(255, 255, 255);
+ return qColorDialogStaticData()->standardRgb[index];
+}
+
+void QColorDialogOptions::setStandardColor(int index, QRgb color)
+{
+ if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
+ return;
+ qColorDialogStaticData()->standardRgb[index] = color;
+}
+
+const QSharedPointer<QColorDialogOptions> &QPlatformColorDialogHelper::options() const
+{
+ return m_options;
+}
+
+void QPlatformColorDialogHelper::setOptions(const QSharedPointer<QColorDialogOptions> &options)
+{
+ m_options = options;
+}
+
+// File dialog
+
+class QFileDialogOptionsPrivate : public QSharedData
+{
+public:
+ QFileDialogOptionsPrivate() : options(0),
+ viewMode(QFileDialogOptions::Detail),
+ fileMode(QFileDialogOptions::AnyFile),
+ acceptMode(QFileDialogOptions::AcceptOpen),
+ filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs)
+ {}
+
+ QFileDialogOptions::FileDialogOptions options;
+ QString windowTitle;
+
+ QFileDialogOptions::ViewMode viewMode;
+ QFileDialogOptions::FileMode fileMode;
+ QFileDialogOptions::AcceptMode acceptMode;
+ QString labels[QFileDialogOptions::DialogLabelCount];
+ QDir::Filters filters;
+ QList<QUrl> sidebarUrls;
+ QStringList nameFilters;
+ QString defaultSuffix;
+ QStringList history;
+ QString initialDirectory;
+ QString initiallySelectedNameFilter;
+ QStringList initiallySelectedFiles;
+};
+
+QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate)
+{
+}
+
+QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d)
+{
+}
+
+QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs)
+{
+ if (this != &rhs)
+ d = rhs.d;
+ return *this;
+}
+
+QFileDialogOptions::~QFileDialogOptions()
+{
+}
+
+QString QFileDialogOptions::windowTitle() const
+{
+ return d->windowTitle;
+}
+
+void QFileDialogOptions::setWindowTitle(const QString &title)
+{
+ d->windowTitle = title;
+}
+
+void QFileDialogOptions::setOption(QFileDialogOptions::FileDialogOption option, bool on)
+{
+ if (!(d->options & option) != !on)
+ setOptions(d->options ^ option);
+}
+
+bool QFileDialogOptions::testOption(QFileDialogOptions::FileDialogOption option) const
+{
+ return d->options & option;
+}
+
+void QFileDialogOptions::setOptions(FileDialogOptions options)
+{
+ if (options != d->options)
+ d->options = options;
+}
+
+QFileDialogOptions::FileDialogOptions QFileDialogOptions::options() const
+{
+ return d->options;
+}
+
+QDir::Filters QFileDialogOptions::filter() const
+{
+ return d->filters;
+}
+
+void QFileDialogOptions::setFilter(QDir::Filters filters)
+{
+ d->filters = filters;
+}
+
+void QFileDialogOptions::setViewMode(QFileDialogOptions::ViewMode mode)
+{
+ d->viewMode = mode;
+}
+
+QFileDialogOptions::ViewMode QFileDialogOptions::viewMode() const
+{
+ return d->viewMode;
+}
+
+void QFileDialogOptions::setFileMode(QFileDialogOptions::FileMode mode)
+{
+ d->fileMode = mode;
+}
+
+QFileDialogOptions::FileMode QFileDialogOptions::fileMode() const
+{
+ return d->fileMode;
+}
+
+void QFileDialogOptions::setAcceptMode(QFileDialogOptions::AcceptMode mode)
+{
+ d->acceptMode = mode;
+}
+
+QFileDialogOptions::AcceptMode QFileDialogOptions::acceptMode() const
+{
+ return d->acceptMode;
+}
+
+void QFileDialogOptions::setSidebarUrls(const QList<QUrl> &urls)
+{
+ d->sidebarUrls = urls;
+}
+
+QList<QUrl> QFileDialogOptions::sidebarUrls() const
+{
+ return d->sidebarUrls;
+}
+
+void QFileDialogOptions::setNameFilters(const QStringList &filters)
+{
+ d->nameFilters = filters;
+}
+
+QStringList QFileDialogOptions::nameFilters() const
+{
+ return d->nameFilters;
+}
+
+void QFileDialogOptions::setDefaultSuffix(const QString &suffix)
+{
+ d->defaultSuffix = suffix;
+}
+
+QString QFileDialogOptions::defaultSuffix() const
+{
+ return d->defaultSuffix;
+}
+
+void QFileDialogOptions::setHistory(const QStringList &paths)
+{
+ d->history = paths;
+}
+
+QStringList QFileDialogOptions::history() const
+{
+ return d->history;
+}
+
+void QFileDialogOptions::setLabelText(QFileDialogOptions::DialogLabel label, const QString &text)
+{
+ if (label >= 0 && label < DialogLabelCount)
+ d->labels[label] = text;
+}
+
+QString QFileDialogOptions::labelText(QFileDialogOptions::DialogLabel label) const
+{
+ return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString();
+}
+
+bool QFileDialogOptions::isLabelExplicitlySet(DialogLabel label)
+{
+ return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty();
+}
+
+QString QFileDialogOptions::initialDirectory() const
+{
+ return d->initialDirectory;
+}
+
+void QFileDialogOptions::setInitialDirectory(const QString &directory)
+{
+ d->initialDirectory = directory;
+}
+
+QString QFileDialogOptions::initiallySelectedNameFilter() const
+{
+ return d->initiallySelectedNameFilter;
+}
+
+void QFileDialogOptions::setInitiallySelectedNameFilter(const QString &filter)
+{
+ d->initiallySelectedNameFilter = filter;
+}
+
+QStringList QFileDialogOptions::initiallySelectedFiles() const
+{
+ return d->initiallySelectedFiles;
+}
+
+void QFileDialogOptions::setInitiallySelectedFiles(const QStringList &files)
+{
+ d->initiallySelectedFiles = files;
+}
+
+const QSharedPointer<QFileDialogOptions> &QPlatformFileDialogHelper::options() const
+{
+ return m_options;
+}
+
+void QPlatformFileDialogHelper::setOptions(const QSharedPointer<QFileDialogOptions> &options)
+{
+ m_options = options;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformdialoghelper_qpa.h b/src/gui/kernel/qplatformdialoghelper_qpa.h
new file mode 100644
index 0000000000..5fdffae5cb
--- /dev/null
+++ b/src/gui/kernel/qplatformdialoghelper_qpa.h
@@ -0,0 +1,314 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 QPLATFORMDIALOGHELPER_H
+#define QPLATFORMDIALOGHELPER_H
+
+#include <QtCore/QtGlobal>
+#include <QtCore/QObject>
+#include <QtCore/QList>
+#include <QtCore/QSharedDataPointer>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QDir>
+#include <QtGui/QRgb>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+
+class QString;
+class QColor;
+class QFont;
+class QWindow;
+class QVariant;
+class QUrl;
+class QColorDialogOptionsPrivate;
+class QFontDialogOptionsPrivate;
+class QFileDialogOptionsPrivate;
+
+class Q_GUI_EXPORT QPlatformDialogHelper : public QObject
+{
+ Q_OBJECT
+public:
+ enum StyleHint {
+ SnapToDefaultButton
+ };
+ enum DialogCode { Rejected, Accepted };
+ enum ShowFlag {
+ ShowModal = 0x00000001
+ };
+
+ Q_DECLARE_FLAGS(ShowFlags, ShowFlag)
+
+ QPlatformDialogHelper();
+ virtual ~QPlatformDialogHelper();
+
+ virtual QVariant styleHint(StyleHint hint) const;
+
+ virtual void platformNativeDialogModalHelp() = 0;
+ virtual void _q_platformRunNativeAppModalPanel() = 0;
+
+ virtual void deleteNativeDialog_sys() = 0;
+ virtual bool show_sys(ShowFlags showFlags,
+ Qt::WindowFlags windowFlags,
+ QWindow *parent) = 0;
+ virtual void hide_sys() = 0;
+
+ virtual DialogCode dialogResultCode_sys() = 0;
+
+ static QVariant defaultStyleHint(QPlatformDialogHelper::StyleHint hint);
+
+Q_SIGNALS:
+ void launchNativeAppModalPanel();
+ void accept();
+ void reject();
+
+protected Q_SLOTS:
+ void emitLaunchNativeAppModalPanel();
+};
+
+class Q_GUI_EXPORT QColorDialogOptions
+{
+public:
+ enum ColorDialogOption {
+ ShowAlphaChannel = 0x00000001,
+ NoButtons = 0x00000002,
+ DontUseNativeDialog = 0x00000004
+ };
+
+ Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption)
+
+ QColorDialogOptions();
+ QColorDialogOptions(const QColorDialogOptions &rhs);
+ QColorDialogOptions &operator=(const QColorDialogOptions &rhs);
+ ~QColorDialogOptions();
+
+ QString windowTitle() const;
+ void setWindowTitle(const QString &);
+
+ void setOption(ColorDialogOption option, bool on = true);
+ bool testOption(ColorDialogOption option) const;
+ void setOptions(ColorDialogOptions options);
+ ColorDialogOptions options() const;
+
+ static int customColorCount();
+ static QRgb customColor(int index);
+ static QRgb *customColors();
+ static void setCustomColor(int index, QRgb color);
+
+ static QRgb *standardColors();
+ static QRgb standardColor(int index);
+ static void setStandardColor(int index, QRgb color);
+
+private:
+ QSharedDataPointer<QColorDialogOptionsPrivate> d;
+};
+
+class Q_GUI_EXPORT QPlatformColorDialogHelper : public QPlatformDialogHelper
+{
+ Q_OBJECT
+public:
+ const QSharedPointer<QColorDialogOptions> &options() const;
+ void setOptions(const QSharedPointer<QColorDialogOptions> &options);
+
+ virtual void setCurrentColor_sys(const QColor &) = 0;
+ virtual QColor currentColor_sys() const = 0;
+
+Q_SIGNALS:
+ void currentColorChanged(const QColor &color);
+ void colorSelected(const QColor &color);
+
+private:
+ QSharedPointer<QColorDialogOptions> m_options;
+};
+
+class Q_GUI_EXPORT QFontDialogOptions
+{
+public:
+ enum FontDialogOption {
+ NoButtons = 0x00000001,
+ DontUseNativeDialog = 0x00000002
+ };
+
+ Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption)
+
+ QFontDialogOptions();
+ QFontDialogOptions(const QFontDialogOptions &rhs);
+ QFontDialogOptions &operator=(const QFontDialogOptions &rhs);
+ ~QFontDialogOptions();
+
+ QString windowTitle() const;
+ void setWindowTitle(const QString &);
+
+ void setOption(FontDialogOption option, bool on = true);
+ bool testOption(FontDialogOption option) const;
+ void setOptions(FontDialogOptions options);
+ FontDialogOptions options() const;
+
+private:
+ QSharedDataPointer<QFontDialogOptionsPrivate> d;
+};
+
+class Q_GUI_EXPORT QPlatformFontDialogHelper : public QPlatformDialogHelper
+{
+ Q_OBJECT
+public:
+ virtual void setCurrentFont_sys(const QFont &) = 0;
+ virtual QFont currentFont_sys() const = 0;
+
+ const QSharedPointer<QFontDialogOptions> &options() const;
+ void setOptions(const QSharedPointer<QFontDialogOptions> &options);
+
+Q_SIGNALS:
+ void currentFontChanged(const QFont &font);
+ void fontSelected(const QFont &font);
+
+private:
+ QSharedPointer<QFontDialogOptions> m_options;
+};
+
+class Q_GUI_EXPORT QFileDialogOptions
+{
+public:
+ enum ViewMode { Detail, List };
+ enum FileMode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly };
+ enum AcceptMode { AcceptOpen, AcceptSave };
+ enum DialogLabel { LookIn, FileName, FileType, Accept, Reject, DialogLabelCount };
+
+ enum FileDialogOption
+ {
+ ShowDirsOnly = 0x00000001,
+ DontResolveSymlinks = 0x00000002,
+ DontConfirmOverwrite = 0x00000004,
+ DontUseSheet = 0x00000008,
+ DontUseNativeDialog = 0x00000010,
+ ReadOnly = 0x00000020,
+ HideNameFilterDetails = 0x00000040
+ };
+ Q_DECLARE_FLAGS(FileDialogOptions, FileDialogOption)
+
+ QFileDialogOptions();
+ QFileDialogOptions(const QFileDialogOptions &rhs);
+ QFileDialogOptions &operator=(const QFileDialogOptions &rhs);
+ ~QFileDialogOptions();
+
+ QString windowTitle() const;
+ void setWindowTitle(const QString &);
+
+ void setOption(FileDialogOption option, bool on = true);
+ bool testOption(FileDialogOption option) const;
+ void setOptions(FileDialogOptions options);
+ FileDialogOptions options() const;
+
+ QDir::Filters filter() const;
+ void setFilter(QDir::Filters filters);
+
+ void setViewMode(ViewMode mode);
+ ViewMode viewMode() const;
+
+ void setFileMode(FileMode mode);
+ FileMode fileMode() const;
+
+ void setAcceptMode(AcceptMode mode);
+ AcceptMode acceptMode() const;
+
+ void setSidebarUrls(const QList<QUrl> &urls);
+ QList<QUrl> sidebarUrls() const;
+
+ void setNameFilters(const QStringList &filters);
+ QStringList nameFilters() const;
+
+ void setDefaultSuffix(const QString &suffix);
+ QString defaultSuffix() const;
+
+ void setHistory(const QStringList &paths);
+ QStringList history() const;
+
+ void setLabelText(DialogLabel label, const QString &text);
+ QString labelText(DialogLabel label) const;
+ bool isLabelExplicitlySet(DialogLabel label);
+
+ QString initialDirectory() const;
+ void setInitialDirectory(const QString &);
+
+ QString initiallySelectedNameFilter() const;
+ void setInitiallySelectedNameFilter(const QString &);
+
+ QStringList initiallySelectedFiles() const;
+ void setInitiallySelectedFiles(const QStringList &);
+
+private:
+ QSharedDataPointer<QFileDialogOptionsPrivate> d;
+};
+
+class Q_GUI_EXPORT QPlatformFileDialogHelper : public QPlatformDialogHelper
+{
+ Q_OBJECT
+public:
+ virtual bool defaultNameFilterDisables() const = 0;
+ virtual void setDirectory_sys(const QString &directory) = 0;
+ virtual QString directory_sys() const = 0;
+ virtual void selectFile_sys(const QString &filename) = 0;
+ virtual QStringList selectedFiles_sys() const = 0;
+ virtual void setFilter_sys() = 0;
+ virtual void selectNameFilter_sys(const QString &filter) = 0;
+ virtual QString selectedNameFilter_sys() const = 0;
+
+ const QSharedPointer<QFileDialogOptions> &options() const;
+ void setOptions(const QSharedPointer<QFileDialogOptions> &options);
+
+Q_SIGNALS:
+ void fileSelected(const QString &file);
+ void filesSelected(const QStringList &files);
+ void currentChanged(const QString &path);
+ void directoryEntered(const QString &directory);
+ void filterSelected(const QString &filter);
+
+private:
+ QSharedPointer<QFileDialogOptions> m_options;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QPLATFORMDIALOGHELPER_H
diff --git a/src/gui/kernel/qplatformdrag_qpa.h b/src/gui/kernel/qplatformdrag_qpa.h
index fb71f29de9..0c215071d3 100644
--- a/src/gui/kernel/qplatformdrag_qpa.h
+++ b/src/gui/kernel/qplatformdrag_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QMimeData;
class QMouseEvent;
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.cpp b/src/gui/kernel/qplatforminputcontext_qpa.cpp
index 1e82507653..ee18f3ebd1 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.cpp
+++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE
QPlatformInputContext provides an interface the actual input methods
can derive from by reimplementing methods.
- \sa QInputPanel
+ \sa QInputMethod
*/
/*!
@@ -94,7 +94,7 @@ bool QPlatformInputContext::isValid() const
}
/*!
- Method to be called when input method needs to be reset. Called by QInputPanel::reset().
+ Method to be called when input method needs to be reset. Called by QInputMethod::reset().
No further QInputMethodEvents should be sent as response.
*/
void QPlatformInputContext::reset()
@@ -106,7 +106,7 @@ void QPlatformInputContext::commit()
}
/*!
- Notification on editor updates. Called by QInputPanel::update().
+ Notification on editor updates. Called by QInputMethod::update().
*/
void QPlatformInputContext::update(Qt::InputMethodQueries)
{
@@ -117,12 +117,12 @@ void QPlatformInputContext::update(Qt::InputMethodQueries)
the user. Input methods often use this information to offer more word
suggestions to the user.
*/
-void QPlatformInputContext::invokeAction(QInputPanel::Action action, int cursorPosition)
+void QPlatformInputContext::invokeAction(QInputMethod::Action action, int cursorPosition)
{
Q_UNUSED(cursorPosition)
// Default behavior for simple ephemeral input contexts. Some
// complex input contexts should not be reset here.
- if (action == QInputPanel::Click)
+ if (action == QInputMethod::Click)
reset();
}
@@ -148,17 +148,17 @@ QRectF QPlatformInputContext::keyboardRect() const
}
/*!
- Active QPlatformInputContext is responsible for providing keyboardRectangle property to QInputPanel.
+ Active QPlatformInputContext is responsible for providing keyboardRectangle property to QInputMethod.
In addition of providing the value in keyboardRect function, it also needs to call this emit
function whenever the property changes.
*/
void QPlatformInputContext::emitKeyboardRectChanged()
{
- emit qApp->inputPanel()->keyboardRectangleChanged();
+ emit qApp->inputMethod()->keyboardRectangleChanged();
}
/*!
- This function can be reimplemented to return true whenever input panel is animating
+ This function can be reimplemented to return true whenever input method is animating
shown or hidden. Default implementation returns false.
*/
bool QPlatformInputContext::isAnimating() const
@@ -167,13 +167,13 @@ bool QPlatformInputContext::isAnimating() const
}
/*!
- Active QPlatformInputContext is responsible for providing animating property to QInputPanel.
+ Active QPlatformInputContext is responsible for providing animating property to QInputMethod.
In addition of providing the value in isAnimation function, it also needs to call this emit
function whenever the property changes.
*/
void QPlatformInputContext::emitAnimatingChanged()
{
- emit qApp->inputPanel()->animatingChanged();
+ emit qApp->inputMethod()->animatingChanged();
}
/*!
@@ -199,13 +199,13 @@ bool QPlatformInputContext::isInputPanelVisible() const
}
/*!
- Active QPlatformInputContext is responsible for providing visible property to QInputPanel.
+ Active QPlatformInputContext is responsible for providing visible property to QInputMethod.
In addition of providing the value in isInputPanelVisible function, it also needs to call this emit
function whenever the property changes.
*/
void QPlatformInputContext::emitInputPanelVisibleChanged()
{
- emit qApp->inputPanel()->visibleChanged();
+ emit qApp->inputMethod()->visibleChanged();
}
QLocale QPlatformInputContext::locale() const
@@ -215,7 +215,7 @@ QLocale QPlatformInputContext::locale() const
void QPlatformInputContext::emitLocaleChanged()
{
- emit qApp->inputPanel()->localeChanged();
+ emit qApp->inputMethod()->localeChanged();
}
Qt::LayoutDirection QPlatformInputContext::inputDirection() const
@@ -225,7 +225,7 @@ Qt::LayoutDirection QPlatformInputContext::inputDirection() const
void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection)
{
- emit qApp->inputPanel()->inputDirectionChanged(newDirection);
+ emit qApp->inputMethod()->inputDirectionChanged(newDirection);
}
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext_qpa.h
index 463238f336..77c3811d95 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.h
+++ b/src/gui/kernel/qplatforminputcontext_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QWindow;
class QMouseEvent;
diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp
index 23ecf3add4..e867e4e588 100644
--- a/src/gui/kernel/qplatformintegration_qpa.cpp
+++ b/src/gui/kernel/qplatformintegration_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -172,6 +172,27 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const
*/
/*!
+ \enum QPlatformIntegration::Capability
+
+ Capabilities are used to determing specific features of a platform integration
+
+ \value ThreadedPixmaps The platform uses a pixmap implementation that is reentrant
+ and can be used from multiple threads, like the raster paint engine and QImage based
+ pixmaps.
+
+ \value OpenGL The platform supports OpenGL
+
+ \value ThreadedOpenGL The platform supports using OpenGL outside the GUI thread.
+
+ \value SharedGraphicsCache The platform supports a shared graphics cache
+
+ \value BufferQueueingOpenGL The OpenGL implementation on the platform will queue
+ up buffers when swapBuffers() is called and block only when its buffer pipeline
+ is full, rather than block immediately.
+ */
+
+
+/*!
\fn QAbstractEventDispatcher *QPlatformIntegration::guiThreadEventDispatcher() const = 0
@@ -202,6 +223,17 @@ QPlatformOpenGLContext *QPlatformIntegration::createPlatformOpenGLContext(QOpenG
}
/*!
+ Factory function for QPlatformSharedGraphicsCache. This function will return 0 if the platform
+ integration does not support any shared graphics cache mechanism for the given \a cacheId.
+*/
+QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphicsCache(const char *cacheId) const
+{
+ qWarning("This plugin does not support createPlatformSharedGraphicsBuffer for cacheId: %s!",
+ cacheId);
+ return 0;
+}
+
+/*!
Returns the platforms input context.
The default implementation returns 0, implying no input method support.
diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h
index 3975d82288..efaf495b81 100644
--- a/src/gui/kernel/qplatformintegration_qpa.h
+++ b/src/gui/kernel/qplatformintegration_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPlatformWindow;
class QWindow;
@@ -65,6 +64,8 @@ class QAbstractEventDispatcher;
class QPlatformInputContext;
class QPlatformAccessibility;
class QPlatformTheme;
+class QPlatformDialogHelper;
+class QPlatformSharedGraphicsCache;
class Q_GUI_EXPORT QPlatformIntegration
{
@@ -72,7 +73,10 @@ public:
enum Capability {
ThreadedPixmaps = 1,
OpenGL = 2,
- ThreadedOpenGL = 3
+ ThreadedOpenGL = 3,
+ SharedGraphicsCache = 4,
+ BufferQueueingOpenGL = 5
+
};
virtual ~QPlatformIntegration() { }
@@ -83,6 +87,7 @@ public:
virtual QPlatformWindow *createPlatformWindow(QWindow *window) const = 0;
virtual QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const = 0;
virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
+ virtual QPlatformSharedGraphicsCache *createPlatformSharedGraphicsCache(const char *cacheId) const;
// Event dispatcher:
virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const = 0;
diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
index 7f2260b5f6..a84c243355 100644
--- a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
+++ b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
index 189b352139..4aae7898fa 100644
--- a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
+++ b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -59,7 +59,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPlatformIntegration;
diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
index a57b980ea3..7bd1caa1d3 100644
--- a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
+++ b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.h b/src/gui/kernel/qplatformintegrationplugin_qpa.h
index f53d66d1c8..84c2567bbd 100644
--- a/src/gui/kernel/qplatformintegrationplugin_qpa.h
+++ b/src/gui/kernel/qplatformintegrationplugin_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,7 +60,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPlatformIntegration;
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
index f9ddd1f72a..7237849011 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -106,4 +106,51 @@ void QPlatformNativeInterface::setWindowProperty(QPlatformWindow *window, const
Q_UNUSED(value);
}
+/*!
+ \typedef QPlatformNativeInterface::EventFilter
+ \since 5.0
+
+ A function with the following signature that can be used as an
+ event filter:
+
+ \code
+ bool myEventFilter(void *message, long *result);
+ \endcode
+
+ \sa setEventFilter()
+*/
+
+/*!
+ \fn EventFilter QPlatformNativeInterface::setEventFilter(const QByteArray &eventType, EventFilter filter)
+ \since 5.0
+
+ Replaces the event filter function for the native interface with
+ \a filter and returns the pointer to the replaced event filter
+ function. Only the current event filter function is called. If you
+ want to use both filter functions, save the replaced EventFilter
+ in a place where you can call it from.
+
+ The event filter function set here is called for all messages
+ received from the platform if they are given type \eventType.
+ It is \i not called for messages that are not meant for Qt objects.
+
+ The type of event is specific to the platform plugin chosen at run-time.
+
+ The event filter function should return \c true if the message should
+ be filtered, (i.e. stopped). It should return \c false to allow
+ processing the message to continue.
+
+ By default, no event filter function is set. For example, this function
+ returns a null EventFilter the first time it is called.
+
+ \note The filter function here receives native messages,
+ for example, MSG or XEvent structs. It is called by the platform plugin.
+*/
+QPlatformNativeInterface::EventFilter QPlatformNativeInterface::setEventFilter(const QByteArray &eventType, QPlatformNativeInterface::EventFilter filter)
+{
+ Q_UNUSED(eventType);
+ Q_UNUSED(filter);
+ return 0;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h
index 47e2f82810..b25ebf0fe9 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.h
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QOpenGLContext;
class QWindow;
@@ -70,6 +69,9 @@ public:
virtual QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const;
virtual void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value);
+ typedef bool (*EventFilter)(void *message, long *result);
+ virtual EventFilter setEventFilter(const QByteArray &eventType, EventFilter filter);
+
Q_SIGNALS:
void windowPropertyChanged(QPlatformWindow *window, const QString &propertyName);
};
diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.cpp b/src/gui/kernel/qplatformopenglcontext_qpa.cpp
index 7c5e8245df..33adc26482 100644
--- a/src/gui/kernel/qplatformopenglcontext_qpa.cpp
+++ b/src/gui/kernel/qplatformopenglcontext_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,12 +34,15 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qplatformopenglcontext_qpa.h"
+#include <QOpenGLFunctions>
+
QT_BEGIN_NAMESPACE
/*!
@@ -94,6 +96,16 @@ QPlatformOpenGLContext::~QPlatformOpenGLContext()
{
}
+/*!
+ Reimplement in subclass if your platform uses framebuffer objects for surfaces.
+
+ The default implementation returns 0.
+*/
+GLuint QPlatformOpenGLContext::defaultFramebufferObject(QPlatformSurface *) const
+{
+ return 0;
+}
+
QOpenGLContext *QPlatformOpenGLContext::context() const
{
Q_D(const QPlatformOpenGLContext);
diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.h b/src/gui/kernel/qplatformopenglcontext_qpa.h
index ac5cf969d9..17d4e96f8e 100644
--- a/src/gui/kernel/qplatformopenglcontext_qpa.h
+++ b/src/gui/kernel/qplatformopenglcontext_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -45,12 +45,12 @@
#include <QtCore/qnamespace.h>
#include <QtGui/qsurfaceformat.h>
#include <QtGui/qwindow.h>
+#include <QtGui/qopengl.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPlatformOpenGLContextPrivate;
@@ -65,6 +65,8 @@ public:
virtual void swapBuffers(QPlatformSurface *surface) = 0;
+ virtual GLuint defaultFramebufferObject(QPlatformSurface *surface) const;
+
virtual bool makeCurrent(QPlatformSurface *surface) = 0;
virtual void doneCurrent() = 0;
diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp
index 26c685ff1a..b8f1430d1b 100644
--- a/src/gui/kernel/qplatformscreen_qpa.cpp
+++ b/src/gui/kernel/qplatformscreen_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -160,36 +160,15 @@ QDpi QPlatformScreen::logicalDpi() const
}
/*!
- Reimplement this function in subclass to return the primary orientation
- of the screen, i.e. the orientation the display controller or equivalent
- expects.
-
- The default implementation returns Qt::PortraitOrientation if the
- geometry's height is greater or Qt::LandscapeOrientation if the geometry's
- width is greater.
-*/
-Qt::ScreenOrientation QPlatformScreen::primaryOrientation() const
-{
- return geometry().height() > geometry().width() ? Qt::PortraitOrientation :
- Qt::LandscapeOrientation;
-}
-
-/*!
Reimplement this function in subclass to return the current orientation
of the screen, for example based on accelerometer data to determine
- the physical screen orientation.
-
- The current orientation is only a hint to the application saying
- what the preferred application orientation should be, the application
- is free to limit itself to a certain set of supported orientations.
-
- The default implementation returns the same as primaryOrientation().
+ the device orientation.
- \sa primaryOrientation()
+ The default implementation returns Qt::PrimaryOrientation.
*/
-Qt::ScreenOrientation QPlatformScreen::currentOrientation() const
+Qt::ScreenOrientation QPlatformScreen::orientation() const
{
- return primaryOrientation();
+ return Qt::PrimaryOrientation;
}
QPlatformScreen * QPlatformScreen::platformScreenForWindow(const QWindow *window)
diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h
index 586a29279c..e4b9b762b1 100644
--- a/src/gui/kernel/qplatformscreen_qpa.h
+++ b/src/gui/kernel/qplatformscreen_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -58,7 +58,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPlatformBackingStore;
class QPlatformOpenGLContext;
@@ -99,8 +98,7 @@ public:
virtual QSizeF physicalSize() const;
virtual QDpi logicalDpi() const;
- virtual Qt::ScreenOrientation currentOrientation() const;
- virtual Qt::ScreenOrientation primaryOrientation() const;
+ virtual Qt::ScreenOrientation orientation() const;
virtual QWindow *topLevelAt(const QPoint &point) const;
virtual QList<QPlatformScreen *> virtualSiblings() const;
diff --git a/src/gui/kernel/qplatformscreen_qpa_p.h b/src/gui/kernel/qplatformscreen_qpa_p.h
index 67c222bdf3..ced66be8d7 100644
--- a/src/gui/kernel/qplatformscreen_qpa_p.h
+++ b/src/gui/kernel/qplatformscreen_qpa_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp b/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp
new file mode 100644
index 0000000000..539bb1458f
--- /dev/null
+++ b/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qplatformsharedgraphicscache_qpa.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QPlatformSharedGraphicsCache
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+ \brief The QPlatformSharedGraphicsCache is an abstraction of a cross-process graphics cache.
+
+ If supported, it is possible to retrieve a QPlatformSharedGraphicsCache object from the
+ platform integration. This is typically used to store graphical items which should be shared
+ between several processes.
+
+ Items are requested from the cache by calling requestItems(). If the cache contains the
+ requested items in the requested cache, the itemsAvailable() signal is emitted with the ID of
+ the graphical buffer and each item's coordinates inside the buffer. Before requesting items
+ from a cache, the user must call ensureCacheInitialized() to set the correct parameters for
+ the cache.
+
+ If the cache does not yet contain the requested items, it will emit a similar itemsMissing()
+ signal. The client can then call updateItems() with rasterizations of the items and they will be
+ entered into the shared cache. As the items are rendered into the cache, itemsAvailable() signals
+ will be emitted for each of the items which have previously been requested and which have not
+ yet been reported as ready.
+*/
+
+/*!
+ \enum BufferType
+
+ Defines how the type of buffer required to contain a cache.
+
+ \value OpenGLTexture The buffer will be allocated in graphics memory, and an OpenGL texture
+ for a buffer belonging to the cache can be requested using
+ textureIdForBuffer().
+*/
+
+/*!
+ \enum PixelFormat
+
+ Defines the pixel format of a cache.
+
+ \value Alpha8 The cache will use 8 bits to represent the alpha value of each pixel. If an
+ OpenGL texture is created for a buffer belong to the cache, it will have the
+ pixel format GL_ALPHA.
+*/
+
+/*!
+ \fn void ensureCacheInitialized(const QByteArray &cacheId, BufferType bufferType, PixelFormat pixelFormat)
+
+ Initializes a cache named \a cacheId if it has not yet been initialized. The \a bufferType and
+ \a pixelFormat gives the format of the buffers that will be used to contain the items in the
+ cache. If a cache with the same \a cacheId has previously been initialized, the call will be
+ ignored. The cache will keep its previously set buffer type and pixel format.
+*/
+
+/*!
+ \fn void QPlatformSharedGraphicsCache::requestItems(const QByteArray &cacheId, const QVector<quint32> &itemIds)
+
+ Requests all the items in \a itemIds from the cache with the name \a cacheId.
+
+ If any or all of the items are available in the cache, one or more itemsAvailable() signals will be
+ emitted corresponding to the items. If the cache does not contain all of the items in question,
+ then an itemsMissing() signal will be emitted corresponding to the missing items. The user
+ is at this point expected to call insertItems() to insert the missing items into the cache. If
+ the inserted items have previously been requested by the user, at which point an itemsAvailable()
+ signal will be emitted corresponding to the items.
+
+ Before requesting items from a cache, the user must call ensureCacheInitialized() with the
+ correct parameters for the cache.
+*/
+
+/*!
+ \fn void QPlatformSharedGraphicsCache::insertItems(const QByteArray &cacheId, const QVector<quint32> &itemIds, const QVector<QImage> &items)
+
+ Inserts the items in \a itemIds into the cache named \a cacheId. The appearance of
+ each item is stored in \a items. The format of the QImage objects is expected to match the
+ pixel format of the cache as it was initialized in ensureCacheInitialized().
+
+ When the items have been successfully entered into the cache, one or more itemsAvailable() signals
+ will be emitted for the items.
+
+ If the cache already contains the items, the behavior is implementation-specific. The
+ implementation may choose to ignore the items or it may overwrite the existing instances in
+ the cache. Either way, itemsAvailable() signals corresponding to the inserted items will be
+ emitted.
+*/
+
+/*!
+ \fn void QPlatformSharedGraphicsCache::releaseItems(const QByteArray &cacheId, const QVector<quint32> &itemIds)
+
+ Releases the reference to the items in \a itemIds from the cache named \a cacheId. This should
+ only be called when all references to the items have been released by the user, and they are no
+ longer needed.
+*/
+
+/*!
+ \fn void itemsMissing(const QByteArray &cacheId, const QVector<quint32> *itemIds)
+
+ This signal is emitted when requestItems() has been called for one or more items in the
+ cache named \a cacheId which are not yet available in the cache. The user is then expected to
+ call insertItems() to update the cache with the respective items, at which point they will
+ become available to all clients of the shared cache.
+
+ The vector \a itemIds contains the IDs of the items that need to be inserted into the cache.
+
+ \sa itemsAvailable(), insertItems(), requestItems()
+*/
+
+/*!
+ \fn void itemsAvailable(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize, const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer)
+
+ This signal can be emitted at any time when either requestItems() or insertItems() has been
+ called by the application for one or more items in the cache named \a cacheId, as long as
+ releaseItems() has not subsequently been called for the same items. It instructs the application
+ on where to find the items that have been entered into the cache. When the application receives
+ a buffer, it is expected to reference it using referenceBuffer() on it if it keeps a reference
+ to the buffer.
+
+ The \a bufferId is an ID for the buffer that contains the items. The \a bufferId can be
+ converted to a format usable by the application depending on which format it was given at
+ initialization. If it is a OpenGLTexture, its texture ID can be requested using the
+ textureIdForBuffer() function. The dimensions of the buffer are given by \a bufferSize.
+
+ The items provided by the cache are identified in the \a itemIds vector. The
+ \a positionsInBuffer vector contains the locations inside the buffer of each item. Each entry in
+ \a positionsInBuffer corresponds to an item in \a itemIds.
+
+ The buffer and the items' locations within the buffer can be considered valid until an
+ itemsInvalidated() signal has been emitted for the items, or until releaseItems() is called
+ for the items.
+
+ \sa itemsMissing(), requestItems(), bufferType()
+*/
+
+/*!
+ \fn void itemsUpdated(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize, const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer)
+
+ This signal is similar in usage to the itemsAvailable() signal, but will be emitted when
+ the location of a previously requested or inserted item has been updated. The application
+ must update its data for the respective items and release any references to old buffers held
+ by the items.
+
+ If the application no longer holds any references to previously referenced items in a given
+ cache, it should call releaseItems() for these items, at which point it will no longer receive
+ any itemsUpdated() signal for these items.
+
+ \sa requestItems(), insertItems(), itemsAvailable()
+*/
+
+/*!
+ \fn void itemsInvalidated(const QByteArray &cacheId, const QVector<quint32> &itemIds)
+
+ This signal is emitted when the items given by \a itemIds in the cache named \a cacheId have
+ been removed from the cache and the previously reported information about them is considered
+ invalid. It will only be emitted for items for which a buffer has previously been identified
+ through the itemsAvailable() signal (either as response to a requestItems() call or an
+ insertItems() call.)
+
+ The application is expected to throw away information about the items in the \a itemIds array
+ and drop any references it might have to the memory held by the buffer. If the items are still
+ required by the application, it can re-commit them to the cache using the insertItems() function.
+
+ If the application no longer holds any references to previously referenced items in a given
+ cache, it should call releaseItems() for these items, at which point it will no longer receive
+ any itemsInvalidated() signal for these items.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
new file mode 100644
index 0000000000..d59cd7c3c8
--- /dev/null
+++ b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 QPLATFORMSHAREDGRAPHICSCACHE_QPA_H
+#define QPLATFORMSHAREDGRAPHICSCACHE_QPA_H
+
+#include <QtCore/qobject.h>
+#include <QtGui/qimage.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class Q_GUI_EXPORT QPlatformSharedGraphicsCache: public QObject
+{
+ Q_OBJECT
+public:
+ enum PixelFormat
+ {
+ Alpha8
+ };
+
+ enum BufferType
+ {
+ OpenGLTexture
+ };
+
+ QPlatformSharedGraphicsCache(QObject *parent = 0) : QObject(parent) {}
+
+ Q_INVOKABLE virtual void ensureCacheInitialized(const QByteArray &cacheId, BufferType bufferType,
+ PixelFormat pixelFormat) = 0;
+
+ Q_INVOKABLE virtual void requestItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) = 0;
+ Q_INVOKABLE virtual void insertItems(const QByteArray &cacheId,
+ const QVector<quint32> &itemIds,
+ const QVector<QImage> &items) = 0;
+ Q_INVOKABLE virtual void releaseItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) = 0;
+
+ virtual void serializeBuffer(void *bufferId, QByteArray *serializedData, int *fileDescriptor) const = 0;
+ virtual uint textureIdForBuffer(void *bufferId) = 0;
+ virtual void referenceBuffer(void *bufferId) = 0;
+ virtual bool dereferenceBuffer(void *bufferId) = 0;
+
+Q_SIGNALS:
+ void itemsMissing(const QByteArray &cacheId, const QVector<quint32> &itemIds);
+ void itemsAvailable(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize,
+ const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer);
+ void itemsInvalidated(const QByteArray &cacheId, const QVector<quint32> &itemIds);
+ void itemsUpdated(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize,
+ const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer);
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QPLATFORMSHAREDGRAPHICSCACHE_QPA_H
diff --git a/src/gui/kernel/qplatformsurface_qpa.cpp b/src/gui/kernel/qplatformsurface_qpa.cpp
index 3347f7984f..aeb73da2a3 100644
--- a/src/gui/kernel/qplatformsurface_qpa.cpp
+++ b/src/gui/kernel/qplatformsurface_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -43,12 +43,12 @@
QT_BEGIN_NAMESPACE
-QSurface::SurfaceType QPlatformSurface::surfaceType() const
+QSurface::SurfaceClass QPlatformSurface::surfaceClass() const
{
return m_type;
}
-QPlatformSurface::QPlatformSurface(QSurface::SurfaceType type) : m_type(type)
+QPlatformSurface::QPlatformSurface(QSurface::SurfaceClass type) : m_type(type)
{
}
diff --git a/src/gui/kernel/qplatformsurface_qpa.h b/src/gui/kernel/qplatformsurface_qpa.h
index 7ceb39f049..af23ad3a85 100644
--- a/src/gui/kernel/qplatformsurface_qpa.h
+++ b/src/gui/kernel/qplatformsurface_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,19 +50,18 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class Q_GUI_EXPORT QPlatformSurface
{
public:
virtual QSurfaceFormat format() const = 0;
- QSurface::SurfaceType surfaceType() const;
+ QSurface::SurfaceClass surfaceClass() const;
private:
- QPlatformSurface(QSurface::SurfaceType type);
+ QPlatformSurface(QSurface::SurfaceClass type);
- QSurface::SurfaceType m_type;
+ QSurface::SurfaceClass m_type;
friend class QPlatformWindow;
};
diff --git a/src/gui/kernel/qplatformtheme_qpa.cpp b/src/gui/kernel/qplatformtheme_qpa.cpp
index 22d4452f4e..d2ff804ddf 100644
--- a/src/gui/kernel/qplatformtheme_qpa.cpp
+++ b/src/gui/kernel/qplatformtheme_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -83,15 +83,15 @@ QPlatformMenuBar *QPlatformTheme::createPlatformMenuBar(QMenuBar *menuBar) const
return 0;
}
-bool QPlatformTheme::usePlatformNativeDialog(const QDialog *dialog) const
+bool QPlatformTheme::usePlatformNativeDialog(DialogType type) const
{
- Q_UNUSED(dialog);
+ Q_UNUSED(type);
return false;
}
-QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(QDialog *dialog) const
+QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(DialogType type) const
{
- Q_UNUSED(dialog);
+ Q_UNUSED(type);
return 0;
}
diff --git a/src/gui/kernel/qplatformtheme_qpa.h b/src/gui/kernel/qplatformtheme_qpa.h
index c3e5b677a2..2b87e63287 100644
--- a/src/gui/kernel/qplatformtheme_qpa.h
+++ b/src/gui/kernel/qplatformtheme_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,14 +48,12 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QMenu;
class QMenuBar;
class QPlatformMenu;
class QPlatformMenuBar;
class QPlatformDialogHelper;
-class QDialog;
class QVariant;
class Q_GUI_EXPORT QPlatformTheme
@@ -67,11 +65,17 @@ public:
MaximumScrollBarDragDistance
};
+ enum DialogType {
+ FileDialog,
+ ColorDialog,
+ FontDialog
+ };
+
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 bool usePlatformNativeDialog(DialogType type) const;
+ virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const;
virtual QVariant themeHint(ThemeHint hint) const;
};
diff --git a/src/gui/kernel/qplatformthemefactory_qpa.cpp b/src/gui/kernel/qplatformthemefactory_qpa.cpp
index c278f41411..c023a73e7e 100644
--- a/src/gui/kernel/qplatformthemefactory_qpa.cpp
+++ b/src/gui/kernel/qplatformthemefactory_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qplatformthemefactory_qpa_p.h b/src/gui/kernel/qplatformthemefactory_qpa_p.h
index 71987aa723..4d659812dc 100644
--- a/src/gui/kernel/qplatformthemefactory_qpa_p.h
+++ b/src/gui/kernel/qplatformthemefactory_qpa_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -59,7 +59,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPlatformTheme;
diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.cpp b/src/gui/kernel/qplatformthemeplugin_qpa.cpp
index c51d4e9fc5..8383c9b948 100644
--- a/src/gui/kernel/qplatformthemeplugin_qpa.cpp
+++ b/src/gui/kernel/qplatformthemeplugin_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.h b/src/gui/kernel/qplatformthemeplugin_qpa.h
index 89348deae0..fb4f9f9b7c 100644
--- a/src/gui/kernel/qplatformthemeplugin_qpa.h
+++ b/src/gui/kernel/qplatformthemeplugin_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,7 +60,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPlatformTheme;
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index d69cb0e64e..c52a1cf757 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -239,17 +239,42 @@ void QPlatformWindow::requestActivateWindow()
}
/*!
- Set the orientation of the platform window's contents.
+ Handle changes to the orientation of the platform window's contents.
This is a hint to the window manager in case it needs to display
additional content like popups, dialogs, status bars, or similar
in relation to the window.
- \sa QWindow::setOrientation()
+ \sa QWindow::reportContentOrientationChange()
+*/
+void QPlatformWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
+{
+ Q_UNUSED(orientation);
+}
+
+/*!
+ Request a different orientation of the platform window.
+
+ This tells the window manager how the window wants to be rotated in order
+ to be displayed, and how input events should be translated.
+
+ As an example, a portrait compositor might rotate the window by 90 degrees,
+ if the window is in landscape. It will also rotate input coordinates from
+ portrait to landscape such that top right in portrait gets mapped to top
+ left in landscape.
+
+ If the implementation doesn't support the requested orientation it should
+ signal this by returning an actual supported orientation.
+
+ If the implementation doesn't support rotating the window at all it should
+ return Qt::PrimaryOrientation, this is also the default value.
+
+ \sa QWindow::requestWindowOrientation()
*/
-void QPlatformWindow::setOrientation(Qt::ScreenOrientation orientation)
+Qt::ScreenOrientation QPlatformWindow::requestWindowOrientation(Qt::ScreenOrientation orientation)
{
Q_UNUSED(orientation);
+ return Qt::PrimaryOrientation;
}
bool QPlatformWindow::setKeyboardGrabEnabled(bool grab)
diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h
index 7605a5a4aa..88bf633425 100644
--- a/src/gui/kernel/qplatformwindow_qpa.h
+++ b/src/gui/kernel/qplatformwindow_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPlatformScreen;
class QPlatformWindowPrivate;
@@ -95,7 +94,8 @@ public:
virtual void setOpacity(qreal level);
virtual void requestActivateWindow();
- virtual void setOrientation(Qt::ScreenOrientation orientation);
+ virtual void handleContentOrientationChange(Qt::ScreenOrientation orientation);
+ virtual Qt::ScreenOrientation requestWindowOrientation(Qt::ScreenOrientation orientation);
virtual bool setKeyboardGrabEnabled(bool grab);
virtual bool setMouseGrabEnabled(bool grab);
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index a1ed3014d0..67eb991b19 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -343,35 +343,38 @@ QRect QScreen::availableVirtualGeometry() const
}
/*!
- \property QScreen::primaryOrientation
- \brief the primary screen orientation
+ \property QScreen::orientation
+ \brief the screen orientation
+
+ The screen orientation represents the physical orientation
+ of the display. For example, the screen orientation of a mobile device
+ will change based on the device is being held, and a desktop display
+ might be rotated so that it's in portrait mode.
+
+ Qt::PrimaryOrientation is never returned.
- The primary screen orientation is the orientation that corresponds
- to an un-rotated screen buffer. When the current orientation is equal
- to the primary orientation no rotation needs to be done by the
- application.
+ \sa primaryOrientation(), orientationChanged()
*/
-Qt::ScreenOrientation QScreen::primaryOrientation() const
+Qt::ScreenOrientation QScreen::orientation() const
{
Q_D(const QScreen);
- return d->platformScreen->primaryOrientation();
+ return d->orientation == Qt::PrimaryOrientation ? primaryOrientation() : d->orientation;
}
/*!
\property QScreen::primaryOrientation
- \brief the current screen orientation
+ \brief the primary screen orientation
- The current orientation is a hint to the application saying
- what the preferred application orientation should be, based on the
- current orientation of the physical display and / or other factors.
+ The primary screen orientation is Qt::LandscapeOrientation
+ if the screen geometry's width is greater than or equal to its
+ height, or Qt::PortraitOrientation otherwise.
- \sa primaryOrientation()
- \sa currentOrientationChanged()
+ \sa primaryOrientationChanged()
*/
-Qt::ScreenOrientation QScreen::currentOrientation() const
+Qt::ScreenOrientation QScreen::primaryOrientation() const
{
Q_D(const QScreen);
- return d->currentOrientation;
+ return d->primaryOrientation;
}
// i must be power of two
@@ -393,10 +396,18 @@ static int log2(uint i)
rotation \a a to rotation \a b.
The result will be 0, 90, 180, or 270.
+
+ Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
*/
int QScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
{
- if (a == Qt::UnknownOrientation || b == Qt::UnknownOrientation || a == b)
+ if (a == Qt::PrimaryOrientation)
+ a = primaryOrientation();
+
+ if (b == Qt::PrimaryOrientation)
+ b = primaryOrientation();
+
+ if (a == b)
return 0;
int ia = log2(uint(a));
@@ -420,10 +431,18 @@ int QScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
the resulting transform will be such that the point QPoint(0, 0) is mapped to QPoint(0, w),
and QPoint(h, w) is mapped to QPoint(0, h). Thus, the landscape coordinate system QRect(0, 0, h, w)
is mapped (with a 90 degree rotation) into the portrait coordinate system QRect(0, 0, w, h).
+
+ Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
*/
QTransform QScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target)
{
- if (a == Qt::UnknownOrientation || b == Qt::UnknownOrientation || a == b)
+ if (a == Qt::PrimaryOrientation)
+ a = primaryOrientation();
+
+ if (b == Qt::PrimaryOrientation)
+ b = primaryOrientation();
+
+ if (a == b)
return QTransform();
int angle = angleBetween(a, b);
@@ -453,10 +472,18 @@ QTransform QScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientat
This will flip the x and y dimensions of the rectangle if orientation \a is
Qt::PortraitOrientation or Qt::InvertedPortraitOrientation and orientation \b is
Qt::LandscapeOrientation or Qt::InvertedLandscapeOrientation, or vice versa.
+
+ Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
*/
QRect QScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect)
{
- if (a == Qt::UnknownOrientation || b == Qt::UnknownOrientation || a == b)
+ if (a == Qt::PrimaryOrientation)
+ a = primaryOrientation();
+
+ if (b == Qt::PrimaryOrientation)
+ b = primaryOrientation();
+
+ if (a == b)
return rect;
if ((a == Qt::PortraitOrientation || a == Qt::InvertedPortraitOrientation)
@@ -469,14 +496,50 @@ QRect QScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, cons
}
/*!
- \fn QScreen::currentOrientationChanged(Qt::ScreenOrientation orientation)
+ Convenience function to check if a screen orientation is either portrait
+ or inverted portrait.
- This signal is emitted when the current orientation of the screen
- changes. The current orientation is a hint to the application saying
- what the preferred application orientation should be, based on the
- current orientation of the physical display and / or other factors.
+ Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
+*/
+bool QScreen::isPortrait(Qt::ScreenOrientation o)
+{
+ return o == Qt::PortraitOrientation || o == Qt::InvertedPortraitOrientation
+ || (o == Qt::PrimaryOrientation && primaryOrientation() == Qt::PortraitOrientation);
+}
+
+/*!
+ Convenience function to check if a screen orientation is either landscape
+ or inverted landscape.
+
+ Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
+*/
+bool QScreen::isLandscape(Qt::ScreenOrientation o)
+{
+ return o == Qt::LandscapeOrientation || o == Qt::InvertedLandscapeOrientation
+ || (o == Qt::PrimaryOrientation && primaryOrientation() == Qt::LandscapeOrientation);
+}
+
+/*!
+ \fn QScreen::orientationChanged(Qt::ScreenOrientation orientation)
+
+ This signal is emitted when the orientation of the screen
+ changes.
- \sa currentOrientation()
+ \sa orientation()
*/
+/*!
+ \fn QScreen::primaryOrientationChanged(Qt::ScreenOrientation orientation)
+
+ This signal is emitted when the primary orientation of the screen
+ changes.
+
+ \sa primaryOrientation()
+*/
+
+void QScreenPrivate::updatePrimaryOrientation()
+{
+ primaryOrientation = geometry.width() >= geometry.height() ? Qt::LandscapeOrientation : Qt::PortraitOrientation;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 7291e2ad7b..f73cd0836f 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,7 +56,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPlatformScreen;
class QScreenPrivate;
@@ -81,8 +80,8 @@ class Q_GUI_EXPORT QScreen : public QObject
Q_PROPERTY(qreal logicalDotsPerInch READ logicalDotsPerInch NOTIFY logicalDotsPerInchChanged)
Q_PROPERTY(QSize availableSize READ availableSize NOTIFY availableSizeChanged)
Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged)
- Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation CONSTANT)
- Q_PROPERTY(Qt::ScreenOrientation currentOrientation READ currentOrientation NOTIFY currentOrientationChanged)
+ Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ orientation NOTIFY primaryOrientationChanged)
+ Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
public:
QPlatformScreen *handle() const;
@@ -116,11 +115,14 @@ public:
QRect availableVirtualGeometry() const;
Qt::ScreenOrientation primaryOrientation() const;
- Qt::ScreenOrientation currentOrientation() const;
+ Qt::ScreenOrientation orientation() const;
+
+ int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b);
+ QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target);
+ QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect);
- static int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b);
- static QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target);
- static QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect);
+ bool isPortrait(Qt::ScreenOrientation orientation);
+ bool isLandscape(Qt::ScreenOrientation orientation);
Q_SIGNALS:
void sizeChanged(const QSize &size);
@@ -133,7 +135,8 @@ Q_SIGNALS:
void logicalDotsPerInchChanged(qreal dpi);
void availableSizeChanged(const QSize &size);
void availableGeometryChanged(const QRect &rect);
- void currentOrientationChanged(Qt::ScreenOrientation orientation);
+ void primaryOrientationChanged(Qt::ScreenOrientation orientation);
+ void orientationChanged(Qt::ScreenOrientation orientation);
private:
QScreen(QPlatformScreen *screen);
diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h
index 50742c9f6b..c6bf37e87a 100644
--- a/src/gui/kernel/qscreen_p.h
+++ b/src/gui/kernel/qscreen_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -59,13 +59,18 @@ public:
QScreenPrivate(QPlatformScreen *screen)
: platformScreen(screen)
{
- currentOrientation = screen->currentOrientation();
+ orientation = screen->orientation();
geometry = screen->geometry();
availableGeometry = screen->availableGeometry();
logicalDpi = screen->logicalDpi();
+
+ updatePrimaryOrientation();
}
- Qt::ScreenOrientation currentOrientation;
+ void updatePrimaryOrientation();
+
+ Qt::ScreenOrientation orientation;
+ Qt::ScreenOrientation primaryOrientation;
QRect geometry;
QRect availableGeometry;
QDpi logicalDpi;
diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h
index 89c5cf47b6..529b726a5b 100644
--- a/src/gui/kernel/qsessionmanager.h
+++ b/src/gui/kernel/qsessionmanager.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QGuiApplication;
diff --git a/src/gui/kernel/qsessionmanager_qpa.cpp b/src/gui/kernel/qsessionmanager_qpa.cpp
index 9b6ec26ff4..2db2e75de9 100644
--- a/src/gui/kernel/qsessionmanager_qpa.cpp
+++ b/src/gui/kernel/qsessionmanager_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 2bacac9598..a750082219 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index e447507b87..a7918eb239 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index eb0f055270..c98158b6b6 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index 6fa72110fb..0fc7e776b5 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPlatformIntegration;
diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp
index bfdb772cfb..eb2676802b 100644
--- a/src/gui/kernel/qsurface.cpp
+++ b/src/gui/kernel/qsurface.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -43,12 +43,53 @@
QT_BEGIN_NAMESPACE
-QSurface::QSurface(SurfaceType type)
- : m_type(type)
+
+/*!
+ \class QSurface
+ \brief The QSurface class is an abstraction of renderable surfaces in Qt.
+
+ The size of the surface is accessible with the size() function. The rendering
+ specific attributes of the surface are accessible through the format() function.
+ */
+
+
+/*!
+ \enum QSurface::SurfaceClass
+
+ The SurfaceClass enum describes the actual subclass of the surface.
+
+ \value Window The surface is an instance of QWindow.
+ */
+
+
+/*!
+ \enum QSurface::SurfaceType
+
+ The SurfaceType enum describes what type of surface the.
+
+ \value RasterSurface The surface is is composed of pixels and can be rendered to using
+ a software rasterizer like Qt's raster paint engine.
+ \value OpenGLSurface The surface is an OpenGL compatible surface and can be used
+ in conjunction with QOpenGLContext.
+ */
+
+
+/*!
+ QSize QSurface::size() const
+
+ Returns the size of the surface in pixels.
+ */
+
+
+
+QSurface::QSurface(SurfaceClass type)
+ : m_type(type), m_reserved(0)
{
}
-QSurface::SurfaceType QSurface::surfaceType() const
+
+
+QSurface::SurfaceClass QSurface::surfaceClass() const
{
return m_type;
}
diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h
index fba1690af4..a8900fde33 100644
--- a/src/gui/kernel/qsurface.h
+++ b/src/gui/kernel/qsurface.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -45,34 +45,46 @@
#include <QtCore/qnamespace.h>
#include <QtGui/qsurfaceformat.h>
+#include <QtCore/qsize.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPlatformSurface;
+class QSurfacePrivate;
+
class Q_GUI_EXPORT QSurface
{
public:
- enum SurfaceType {
+ enum SurfaceClass {
Window
};
+ enum SurfaceType {
+ RasterSurface,
+ OpenGLSurface
+ };
+
virtual ~QSurface();
- SurfaceType surfaceType() const;
+ SurfaceClass surfaceClass() const;
virtual QSurfaceFormat format() const = 0;
virtual QPlatformSurface *surfaceHandle() const = 0;
-private:
- QSurface(SurfaceType type);
+ virtual SurfaceType surfaceType() const = 0;
+
+ virtual QSize size() const = 0;
+
+protected:
+ QSurface(SurfaceClass type);
- SurfaceType m_type;
+ SurfaceClass m_type;
- friend class QWindow;
+ QSurfacePrivate *m_reserved;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index 39b2d491a3..b97852dc1d 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index 3d3bfeb30b..6daa08095e 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -47,7 +47,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QOpenGLContext;
class QSurfaceFormatPrivate;
diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h
index 98a516f54e..ba708f4d69 100644
--- a/src/gui/kernel/qt_gui_pch.h
+++ b/src/gui/kernel/qt_gui_pch.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
index b8d4d01655..b0543819df 100644
--- a/src/gui/kernel/qtouchdevice.cpp
+++ b/src/gui/kernel/qtouchdevice.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -177,11 +177,11 @@ void QTouchDevice::setName(const QString &name)
typedef QList<QTouchDevice *> TouchDevices;
Q_GLOBAL_STATIC(TouchDevices, deviceList)
-Q_GLOBAL_STATIC(QMutex, devicesMutex)
+static QBasicMutex devicesMutex;
static void cleanupDevicesList()
{
- QMutexLocker lock(devicesMutex());
+ QMutexLocker lock(&devicesMutex);
qDeleteAll(*deviceList());
deviceList()->clear();
}
@@ -193,7 +193,7 @@ static void cleanupDevicesList()
*/
QList<const QTouchDevice *> QTouchDevice::devices()
{
- QMutexLocker lock(devicesMutex());
+ QMutexLocker lock(&devicesMutex);
QList<QTouchDevice *> *devList = deviceList();
QList<const QTouchDevice *> constDevList;
for (int i = 0, count = devList->count(); i != count; ++i)
@@ -206,7 +206,7 @@ QList<const QTouchDevice *> QTouchDevice::devices()
*/
bool QTouchDevicePrivate::isRegistered(QTouchDevice *dev)
{
- QMutexLocker lock(devicesMutex());
+ QMutexLocker lock(&devicesMutex);
return deviceList()->contains(dev);
}
@@ -215,7 +215,7 @@ bool QTouchDevicePrivate::isRegistered(QTouchDevice *dev)
*/
void QTouchDevicePrivate::registerDevice(QTouchDevice *dev)
{
- QMutexLocker lock(devicesMutex());
+ QMutexLocker lock(&devicesMutex);
if (deviceList()->isEmpty())
qAddPostRoutine(cleanupDevicesList);
deviceList()->append(dev);
diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h
index 6efa7814c9..3023a1759a 100644
--- a/src/gui/kernel/qtouchdevice.h
+++ b/src/gui/kernel/qtouchdevice.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QTouchDevicePrivate;
diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h
index c37e4a8bf5..4697a85e58 100644
--- a/src/gui/kernel/qtouchdevice_p.h
+++ b/src/gui/kernel/qtouchdevice_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QTouchDevicePrivate
{
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 97c6b0cbc9..4436884359 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -43,8 +43,10 @@
#include "qplatformwindow_qpa.h"
#include "qsurfaceformat.h"
+#ifndef QT_NO_OPENGL
#include "qplatformopenglcontext_qpa.h"
#include "qopenglcontext.h"
+#endif
#include "qscreen.h"
#include "qwindow_p.h"
@@ -60,7 +62,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QWindow
- \brief The QWindow class encapsulates an independent windw in a Windowing System.
+ \brief The QWindow class encapsulates an independent window in a Windowing System.
A window that is supplied a parent become a native child window of
their parent window.
@@ -70,8 +72,24 @@ QT_BEGIN_NAMESPACE
to support double and triple buffering. To release a windows memory
resources, the destroy() function.
- */
-
+ \section1 Window and content orientation
+
+ QWindow has reportContentOrientationChange() and
+ requestWindowOrientation() that can be used to specify the
+ layout of the window contents in relation to the screen. The
+ window orientation determines the actual buffer layout of the
+ window, and the windowing system uses this value to rotate the
+ window before it ends up on the display, and to ensure that input
+ coordinates are in the correct coordinate space relative to the
+ application.
+
+ On the other hand, the content orientation is simply a hint to the
+ windowing system about which orientation the window contents are in.
+ It's useful when you wish to keep the same buffer layout, but rotate
+ the contents instead, especially when doing rotation animations
+ between different orientations. The windowing system might use this
+ value to determine the layout of system popups or dialogs.
+*/
QWindow::QWindow(QScreen *targetScreen)
: QObject(*new QWindowPrivate(), 0)
, QSurface(QSurface::Window)
@@ -147,6 +165,14 @@ void QWindow::setVisible(bool visible)
return;
d->visible = visible;
emit visibleChanged(visible);
+ if (QCoreApplication::instance() && !transientParent()) {
+ QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance()));
+ if (visible) {
+ applicationPrivate->ref();
+ } else {
+ applicationPrivate->deref();
+ }
+ }
if (!d->platformWindow)
create();
@@ -373,42 +399,86 @@ bool QWindow::isActive() const
}
/*!
- Returns the window's currently set orientation.
+ Reports that the orientation of the window's contents have changed.
+
+ This is a hint to the window manager in case it needs to display
+ additional content like popups, dialogs, status bars, or similar
+ in relation to the window.
- The default value is Qt::UnknownOrientation.
+ The recommended orientation is QScreen::orientation() but
+ an application doesn't have to support all possible orientations,
+ and thus can opt to ignore the current screen orientation.
- \sa setOrientation(), QScreen::currentOrientation()
+ The difference between the window and the content orientation
+ determines how much to rotate the content by. QScreen::angleBetween(),
+ QScreen::transformBetween(), and QScreen::mapBetween() can be used
+ to compute the necessary transform.
+
+ \sa requestWindowOrientation(), QScreen::orientation()
*/
-Qt::ScreenOrientation QWindow::orientation() const
+void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation)
+{
+ Q_D(QWindow);
+ if (d->contentOrientation == orientation)
+ return;
+ if (!d->platformWindow)
+ create();
+ Q_ASSERT(d->platformWindow);
+ d->contentOrientation = orientation;
+ d->platformWindow->handleContentOrientationChange(orientation);
+ emit contentOrientationChanged(orientation);
+}
+
+/*!
+ Returns the actual content orientation.
+
+ This is the last value set with reportContentOrientationChange(). It defaults
+ to Qt::PrimaryOrientation.
+*/
+Qt::ScreenOrientation QWindow::contentOrientation() const
{
Q_D(const QWindow);
- return d->orientation;
+ return d->contentOrientation;
}
/*!
- Set the orientation of the window's contents.
+ Requests the given window orientation.
- This is a hint to the window manager in case it needs to display
- additional content like popups, dialogs, status bars, or similar
- in relation to the window.
+ The window orientation specifies how the window should be rotated
+ by the window manager in order to be displayed. Input events will
+ be correctly mapped to the given orientation.
- The recommended orientation is QScreen::currentOrientation() but
- an application doesn't have to support all possible orientations,
- and thus can opt to ignore the current screen orientation.
+ The return value is false if the system doesn't support the given
+ orientation (for example when requesting a portrait orientation
+ on a device that only handles landscape buffers, typically a desktop
+ system).
+
+ If the return value is false, call windowOrientation() to get the actual
+ supported orientation.
- \sa QScreen::currentOrientation()
+ \sa windowOrientation(), reportContentOrientationChange(), QScreen::orientation()
*/
-void QWindow::setOrientation(Qt::ScreenOrientation orientation)
+bool QWindow::requestWindowOrientation(Qt::ScreenOrientation orientation)
{
Q_D(QWindow);
- if (orientation == d->orientation)
- return;
+ if (!d->platformWindow)
+ create();
+ Q_ASSERT(d->platformWindow);
+ d->windowOrientation = d->platformWindow->requestWindowOrientation(orientation);
+ return d->windowOrientation == orientation;
+}
- d->orientation = orientation;
- if (d->platformWindow) {
- d->platformWindow->setOrientation(orientation);
- }
- emit orientationChanged(orientation);
+/*!
+ Returns the actual window orientation.
+
+ The default value is Qt::PrimaryOrientation.
+
+ \sa requestWindowOrientation()
+*/
+Qt::ScreenOrientation QWindow::windowOrientation() const
+{
+ Q_D(const QWindow);
+ return d->windowOrientation;
}
Qt::WindowState QWindow::windowState() const
@@ -437,7 +507,19 @@ void QWindow::setWindowState(Qt::WindowState state)
void QWindow::setTransientParent(QWindow *parent)
{
Q_D(QWindow);
+
+ QWindow *previousParent = d->transientParent;
+
d->transientParent = parent;
+
+ if (QCoreApplication::instance() && d->visible) {
+ QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance()));
+ if (parent && !previousParent) {
+ applicationPrivate->deref();
+ } else if (!parent && previousParent) {
+ applicationPrivate->ref();
+ }
+ }
}
QWindow *QWindow::transientParent() const
@@ -735,6 +817,13 @@ QAccessibleInterface *QWindow::accessibleRoot() const
}
/*!
+ \fn QWindow::focusObjectChanged(QObject *focusObject)
+
+ This signal is emitted when final receiver of events tied to focus is changed.
+ \sa focusObject()
+*/
+
+/*!
Returns the QObject that will be the final receiver of events tied focus, such
as key events.
*/
@@ -783,8 +872,28 @@ void QWindow::showNormal()
bool QWindow::close()
{
- //should we have close?
- qDebug() << "unimplemented:" << __FILE__ << __LINE__;
+ Q_D(QWindow);
+
+ // Do not close non top level windows
+ if (parent())
+ return false;
+
+ if (QGuiApplicationPrivate::focus_window == this)
+ QGuiApplicationPrivate::focus_window = 0;
+
+ QObjectList childrenWindows = children();
+ for (int i = 0; i < childrenWindows.size(); i++) {
+ QObject *object = childrenWindows.at(i);
+ if (object->isWindowType()) {
+ QWindow *w = static_cast<QWindow*>(object);
+ QGuiApplicationPrivate::window_list.removeAll(w);
+ w->destroy();
+ }
+ }
+
+ QGuiApplicationPrivate::window_list.removeAll(this);
+ destroy();
+ d->maybeQuitOnLastWindowClosed();
return true;
}
@@ -946,6 +1055,14 @@ void QWindow::touchEvent(QTouchEvent *ev)
ev->ignore();
}
+bool QWindow::nativeEvent(const QByteArray &eventType, void *message, long *result)
+{
+ Q_UNUSED(eventType);
+ Q_UNUSED(message);
+ Q_UNUSED(result);
+ return false;
+}
+
/*!
\fn QPoint QWindow::mapToGlobal(const QPoint &pos) const
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 4d161658c6..98b468b142 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -57,7 +57,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QWindowPrivate;
@@ -91,10 +90,9 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged)
Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
- Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
+ Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged)
public:
- enum SurfaceType { RasterSurface, OpenGLSurface };
QWindow(QScreen *screen = 0);
QWindow(QWindow *parent);
@@ -133,8 +131,11 @@ public:
bool isActive() const;
- Qt::ScreenOrientation orientation() const;
- void setOrientation(Qt::ScreenOrientation orientation);
+ void reportContentOrientationChange(Qt::ScreenOrientation orientation);
+ Qt::ScreenOrientation contentOrientation() const;
+
+ bool requestWindowOrientation(Qt::ScreenOrientation orientation);
+ Qt::ScreenOrientation windowOrientation() const;
Qt::WindowState windowState() const;
void setWindowState(Qt::WindowState state);
@@ -252,16 +253,15 @@ Q_SIGNALS:
void screenChanged(QScreen *screen);
void xChanged(int arg);
-
void yChanged(int arg);
void widthChanged(int arg);
-
void heightChanged(int arg);
void visibleChanged(bool arg);
+ void contentOrientationChanged(Qt::ScreenOrientation orientation);
- void orientationChanged(Qt::ScreenOrientation arg);
+ void focusObjectChanged(QObject *object);
private Q_SLOTS:
void screenDestroyed(QObject *screen);
@@ -287,6 +287,7 @@ protected:
virtual void wheelEvent(QWheelEvent *);
#endif
virtual void touchEvent(QTouchEvent *);
+ virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result);
QWindow(QWindowPrivate &dd, QWindow *parent);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index d3b6868aa5..7f3958b3ff 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#define QWINDOWSIZE_MAX ((1<<24)-1)
@@ -76,7 +75,8 @@ public:
, windowState(Qt::WindowNoState)
, resizeEventPending(true)
, positionPolicy(WindowFrameExclusive)
- , orientation(Qt::UnknownOrientation)
+ , contentOrientation(Qt::PrimaryOrientation)
+ , windowOrientation(Qt::PrimaryOrientation)
, maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX)
, modality(Qt::NonModal)
, transientParent(0)
@@ -111,7 +111,8 @@ public:
Qt::WindowState windowState;
bool resizeEventPending;
PositionPolicy positionPolicy;
- Qt::ScreenOrientation orientation;
+ Qt::ScreenOrientation contentOrientation;
+ Qt::ScreenOrientation windowOrientation;
QSize minimumSize;
QSize maximumSize;
diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h
index 3366606036..82cce0394b 100644
--- a/src/gui/kernel/qwindowdefs.h
+++ b/src/gui/kernel/qwindowdefs.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
// Class forward definitions
diff --git a/src/gui/kernel/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h
index 2db1a4649f..2dad28cf45 100644
--- a/src/gui/kernel/qwindowdefs_win.h
+++ b/src/gui/kernel/qwindowdefs_win.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 4a7ebd1c0c..ae94b75076 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,6 +60,17 @@ QMutex QWindowSystemInterfacePrivate::queueMutex;
extern QPointer<QWindow> qt_last_mouse_receiver;
+/*!
+ \class QWindowSystemInterface
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+ \brief The QWindowSystemInterface provides an event queue for the QPA platform.
+
+ The platform plugins call the various functions to notify about events. The events are queued
+ until sendWindowSystemEvents() is called by the event dispatcher.
+*/
void QWindowSystemInterface::handleEnterEvent(QWindow *tlw)
{
@@ -379,4 +390,17 @@ Qt::DropAction QWindowSystemInterface::handleDrop(QWindow *w, QMimeData *dropDat
return QGuiApplicationPrivate::processDrop(w, dropData, p);
}
+/*!
+ \fn static QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)
+ \brief Passes a native event identified by \a eventType to the \a window.
+
+ \note This function can only be called from the GUI thread.
+ \sa QPlatformNativeInterface::setEventFilter()
+*/
+
+bool QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)
+{
+ return QGuiApplicationPrivate::processNativeEvent(window, eventType, message, result);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 4a17fb9035..b99363eda7 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,7 +60,6 @@ QT_BEGIN_NAMESPACE
class QMimeData;
class QTouchDevice;
-QT_MODULE(Gui)
class Q_GUI_EXPORT QWindowSystemInterface
{
@@ -121,6 +120,8 @@ public:
static Qt::DropAction handleDrag(QWindow *w, QMimeData *dropData, const QPoint &p);
static Qt::DropAction handleDrop(QWindow *w, QMimeData *dropData, const QPoint &p);
+ static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result);
+
// Changes to the screen
static void handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation newOrientation);
static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index b5614eb38e..0bd9ba017a 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -73,6 +73,7 @@ public:
public:
explicit WindowSystemEvent(EventType t)
: type(t), synthetic(false) { }
+ virtual ~WindowSystemEvent() { }
EventType type;
bool synthetic;
};