summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/kernel.pri60
-rw-r--r--src/gui/kernel/qaction.cpp115
-rw-r--r--src/gui/kernel/qaction.h40
-rw-r--r--src/gui/kernel/qaction_p.h33
-rw-r--r--src/gui/kernel/qactiongroup.cpp46
-rw-r--r--src/gui/kernel/qactiongroup.h30
-rw-r--r--src/gui/kernel/qapplication.cpp522
-rw-r--r--src/gui/kernel/qapplication.h67
-rw-r--r--src/gui/kernel/qapplication_mac.mm172
-rw-r--r--src/gui/kernel/qapplication_p.h109
-rw-r--r--src/gui/kernel/qapplication_qws.cpp95
-rw-r--r--src/gui/kernel/qapplication_s60.cpp1926
-rw-r--r--src/gui/kernel/qapplication_win.cpp498
-rw-r--r--src/gui/kernel/qapplication_x11.cpp241
-rw-r--r--src/gui/kernel/qboxlayout.cpp64
-rw-r--r--src/gui/kernel/qboxlayout.h30
-rw-r--r--src/gui/kernel/qclipboard.cpp38
-rw-r--r--src/gui/kernel/qclipboard.h30
-rw-r--r--src/gui/kernel/qclipboard_mac.cpp32
-rw-r--r--src/gui/kernel/qclipboard_p.h30
-rw-r--r--src/gui/kernel/qclipboard_qws.cpp30
-rw-r--r--src/gui/kernel/qclipboard_s60.cpp266
-rw-r--r--src/gui/kernel/qclipboard_win.cpp34
-rw-r--r--src/gui/kernel/qclipboard_x11.cpp65
-rw-r--r--src/gui/kernel/qcocoaapplication_mac.mm33
-rw-r--r--src/gui/kernel/qcocoaapplication_mac_p.h30
-rw-r--r--src/gui/kernel/qcocoaapplicationdelegate_mac.mm65
-rw-r--r--src/gui/kernel/qcocoaapplicationdelegate_mac_p.h31
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac.mm42
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac_p.h30
-rw-r--r--src/gui/kernel/qcocoapanel_mac.mm170
-rw-r--r--src/gui/kernel/qcocoapanel_mac_p.h34
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h319
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm292
-rw-r--r--src/gui/kernel/qcocoaview_mac_p.h34
-rw-r--r--src/gui/kernel/qcocoawindow_mac.mm170
-rw-r--r--src/gui/kernel/qcocoawindow_mac_p.h41
-rw-r--r--src/gui/kernel/qcocoawindowcustomthemeframe_mac.mm30
-rw-r--r--src/gui/kernel/qcocoawindowcustomthemeframe_mac_p.h30
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac.mm77
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac_p.h33
-rw-r--r--src/gui/kernel/qcursor.cpp35
-rw-r--r--src/gui/kernel/qcursor.h48
-rw-r--r--src/gui/kernel/qcursor_mac.mm30
-rw-r--r--src/gui/kernel/qcursor_p.h44
-rw-r--r--src/gui/kernel/qcursor_qws.cpp38
-rw-r--r--src/gui/kernel/qcursor_s60.cpp533
-rw-r--r--src/gui/kernel/qcursor_win.cpp40
-rw-r--r--src/gui/kernel/qcursor_x11.cpp33
-rw-r--r--src/gui/kernel/qdesktopwidget.cpp66
-rw-r--r--src/gui/kernel/qdesktopwidget.h36
-rw-r--r--src/gui/kernel/qdesktopwidget.qdoc283
-rw-r--r--src/gui/kernel/qdesktopwidget_mac.mm43
-rw-r--r--src/gui/kernel/qdesktopwidget_mac_p.h30
-rw-r--r--src/gui/kernel/qdesktopwidget_qws.cpp30
-rw-r--r--src/gui/kernel/qdesktopwidget_s60.cpp201
-rw-r--r--src/gui/kernel/qdesktopwidget_win.cpp30
-rw-r--r--src/gui/kernel/qdesktopwidget_x11.cpp41
-rw-r--r--src/gui/kernel/qdnd.cpp30
-rw-r--r--src/gui/kernel/qdnd_mac.mm30
-rw-r--r--src/gui/kernel/qdnd_p.h37
-rw-r--r--src/gui/kernel/qdnd_qws.cpp30
-rw-r--r--src/gui/kernel/qdnd_s60.cpp359
-rw-r--r--src/gui/kernel/qdnd_win.cpp30
-rw-r--r--src/gui/kernel/qdnd_x11.cpp40
-rw-r--r--src/gui/kernel/qdrag.cpp30
-rw-r--r--src/gui/kernel/qdrag.h30
-rw-r--r--src/gui/kernel/qevent.cpp589
-rw-r--r--src/gui/kernel/qevent.h104
-rw-r--r--src/gui/kernel/qevent_p.h59
-rw-r--r--src/gui/kernel/qeventdispatcher_glib_qws.cpp30
-rw-r--r--src/gui/kernel/qeventdispatcher_glib_qws_p.h30
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm104
-rw-r--r--src/gui/kernel/qeventdispatcher_mac_p.h32
-rw-r--r--src/gui/kernel/qeventdispatcher_qws.cpp30
-rw-r--r--src/gui/kernel/qeventdispatcher_qws_p.h30
-rw-r--r--src/gui/kernel/qeventdispatcher_s60.cpp130
-rw-r--r--src/gui/kernel/qeventdispatcher_s60_p.h96
-rw-r--r--src/gui/kernel/qeventdispatcher_x11.cpp32
-rw-r--r--src/gui/kernel/qeventdispatcher_x11_p.h30
-rw-r--r--src/gui/kernel/qformlayout.cpp43
-rw-r--r--src/gui/kernel/qformlayout.h30
-rw-r--r--src/gui/kernel/qgesture.cpp798
-rw-r--r--src/gui/kernel/qgesture.h222
-rw-r--r--src/gui/kernel/qgesture_p.h139
-rw-r--r--src/gui/kernel/qgesturemanager.cpp716
-rw-r--r--src/gui/kernel/qgesturemanager_p.h149
-rw-r--r--src/gui/kernel/qgesturerecognizer.cpp230
-rw-r--r--src/gui/kernel/qgesturerecognizer.h98
-rw-r--r--src/gui/kernel/qgridlayout.cpp33
-rw-r--r--src/gui/kernel/qgridlayout.h30
-rw-r--r--src/gui/kernel/qguieventdispatcher_glib.cpp32
-rw-r--r--src/gui/kernel/qguieventdispatcher_glib_p.h30
-rw-r--r--src/gui/kernel/qguifunctions_wince.cpp52
-rw-r--r--src/gui/kernel/qguifunctions_wince.h30
-rw-r--r--src/gui/kernel/qguiplatformplugin.cpp298
-rw-r--r--src/gui/kernel/qguiplatformplugin_p.h126
-rw-r--r--src/gui/kernel/qguivariant.cpp30
-rw-r--r--src/gui/kernel/qkde.cpp63
-rw-r--r--src/gui/kernel/qkde_p.h39
-rw-r--r--src/gui/kernel/qkeymapper.cpp31
-rw-r--r--src/gui/kernel/qkeymapper_mac.cpp40
-rw-r--r--src/gui/kernel/qkeymapper_p.h40
-rw-r--r--src/gui/kernel/qkeymapper_qws.cpp30
-rw-r--r--src/gui/kernel/qkeymapper_s60.cpp247
-rw-r--r--src/gui/kernel/qkeymapper_win.cpp68
-rw-r--r--src/gui/kernel/qkeymapper_x11.cpp318
-rw-r--r--src/gui/kernel/qkeymapper_x11_p.cpp30
-rw-r--r--src/gui/kernel/qkeysequence.cpp433
-rw-r--r--src/gui/kernel/qkeysequence.h42
-rw-r--r--src/gui/kernel/qkeysequence_p.h30
-rw-r--r--src/gui/kernel/qlayout.cpp77
-rw-r--r--src/gui/kernel/qlayout.h33
-rw-r--r--src/gui/kernel/qlayout_p.h30
-rw-r--r--src/gui/kernel/qlayoutengine.cpp30
-rw-r--r--src/gui/kernel/qlayoutengine_p.h30
-rw-r--r--src/gui/kernel/qlayoutitem.cpp33
-rw-r--r--src/gui/kernel/qlayoutitem.h30
-rw-r--r--src/gui/kernel/qmacdefines_mac.h30
-rw-r--r--src/gui/kernel/qmacgesturerecognizer_mac.mm262
-rw-r--r--src/gui/kernel/qmacgesturerecognizer_mac_p.h102
-rw-r--r--src/gui/kernel/qmime.cpp30
-rw-r--r--src/gui/kernel/qmime.h30
-rw-r--r--src/gui/kernel/qmime_mac.cpp46
-rw-r--r--src/gui/kernel/qmime_win.cpp32
-rw-r--r--src/gui/kernel/qmotifdnd_x11.cpp30
-rw-r--r--src/gui/kernel/qmultitouch_mac.mm31
-rw-r--r--src/gui/kernel/qmultitouch_mac_p.h30
-rw-r--r--src/gui/kernel/qnsframeview_mac_p.h30
-rw-r--r--src/gui/kernel/qnsthemeframe_mac_p.h32
-rw-r--r--src/gui/kernel/qnstitledframe_mac_p.h30
-rw-r--r--src/gui/kernel/qole_win.cpp30
-rw-r--r--src/gui/kernel/qpalette.cpp34
-rw-r--r--src/gui/kernel/qpalette.h30
-rw-r--r--src/gui/kernel/qsessionmanager.h30
-rw-r--r--src/gui/kernel/qsessionmanager_qws.cpp30
-rw-r--r--src/gui/kernel/qshortcut.cpp32
-rw-r--r--src/gui/kernel/qshortcut.h30
-rw-r--r--src/gui/kernel/qshortcutmap.cpp39
-rw-r--r--src/gui/kernel/qshortcutmap_p.h33
-rw-r--r--src/gui/kernel/qsizepolicy.h46
-rw-r--r--src/gui/kernel/qsizepolicy.qdoc521
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp304
-rw-r--r--src/gui/kernel/qsoftkeymanager_p.h109
-rw-r--r--src/gui/kernel/qsound.cpp35
-rw-r--r--src/gui/kernel/qsound.h30
-rw-r--r--src/gui/kernel/qsound_mac.mm30
-rw-r--r--src/gui/kernel/qsound_p.h30
-rw-r--r--src/gui/kernel/qsound_qws.cpp36
-rw-r--r--src/gui/kernel/qsound_s60.cpp224
-rw-r--r--src/gui/kernel/qsound_win.cpp30
-rw-r--r--src/gui/kernel/qsound_x11.cpp30
-rw-r--r--src/gui/kernel/qstackedlayout.cpp32
-rw-r--r--src/gui/kernel/qstackedlayout.h30
-rw-r--r--src/gui/kernel/qstandardgestures.cpp817
-rw-r--r--src/gui/kernel/qstandardgestures.h126
-rw-r--r--src/gui/kernel/qstandardgestures_p.h114
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm96
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h35
-rw-r--r--src/gui/kernel/qt_gui_pch.h30
-rw-r--r--src/gui/kernel/qt_mac.cpp49
-rw-r--r--src/gui/kernel/qt_mac_p.h30
-rw-r--r--src/gui/kernel/qt_s60_p.h352
-rw-r--r--src/gui/kernel/qt_x11_p.h35
-rw-r--r--src/gui/kernel/qtooltip.cpp40
-rw-r--r--src/gui/kernel/qtooltip.h30
-rw-r--r--src/gui/kernel/qwhatsthis.cpp34
-rw-r--r--src/gui/kernel/qwhatsthis.h30
-rw-r--r--src/gui/kernel/qwidget.cpp1245
-rw-r--r--src/gui/kernel/qwidget.h70
-rw-r--r--src/gui/kernel/qwidget_mac.mm221
-rw-r--r--src/gui/kernel/qwidget_p.h269
-rw-r--r--src/gui/kernel/qwidget_qws.cpp68
-rw-r--r--src/gui/kernel/qwidget_s60.cpp1295
-rw-r--r--src/gui/kernel/qwidget_win.cpp149
-rw-r--r--src/gui/kernel/qwidget_wince.cpp80
-rw-r--r--src/gui/kernel/qwidget_x11.cpp164
-rw-r--r--src/gui/kernel/qwidgetaction.cpp39
-rw-r--r--src/gui/kernel/qwidgetaction.h30
-rw-r--r--src/gui/kernel/qwidgetaction_p.h30
-rw-r--r--src/gui/kernel/qwidgetcreate_x11.cpp30
-rw-r--r--src/gui/kernel/qwindowdefs.h35
-rw-r--r--src/gui/kernel/qwindowdefs_win.h30
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win.cpp129
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win_p.h76
-rw-r--r--src/gui/kernel/qx11embed_x11.cpp38
-rw-r--r--src/gui/kernel/qx11embed_x11.h30
-rw-r--r--src/gui/kernel/qx11info_x11.cpp30
-rw-r--r--src/gui/kernel/qx11info_x11.h30
-rw-r--r--src/gui/kernel/symbian.pri7
190 files changed, 17675 insertions, 4995 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index a94c5a323..f2bd2883e 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -7,6 +7,7 @@ PRECOMPILED_HEADER = kernel/qt_gui_pch.h
KERNEL_P= kernel
HEADERS += \
kernel/qaction.h \
+ kernel/qaction_p.h \
kernel/qactiongroup.h \
kernel/qapplication.h \
kernel/qapplication_p.h \
@@ -44,8 +45,11 @@ HEADERS += \
kernel/qkeymapper_p.h \
kernel/qgesture.h \
kernel/qgesture_p.h \
- kernel/qstandardgestures.h \
- kernel/qstandardgestures_p.h
+ kernel/qstandardgestures_p.h \
+ kernel/qgesturerecognizer.h \
+ kernel/qgesturemanager_p.h \
+ kernel/qsoftkeymanager_p.h \
+ kernel/qguiplatformplugin_p.h
SOURCES += \
kernel/qaction.cpp \
@@ -76,11 +80,19 @@ SOURCES += \
kernel/qwidgetaction.cpp \
kernel/qkeymapper.cpp \
kernel/qgesture.cpp \
- kernel/qstandardgestures.cpp
+ kernel/qstandardgestures.cpp \
+ kernel/qgesturerecognizer.cpp \
+ kernel/qgesturemanager.cpp \
+ kernel/qsoftkeymanager.cpp \
+ kernel/qdesktopwidget.cpp \
+ kernel/qguiplatformplugin.cpp
win32 {
DEFINES += QT_NO_DIRECTDRAW
+ HEADERS += \
+ kernel/qwinnativepangesturerecognizer_win_p.h
+
SOURCES += \
kernel/qapplication_win.cpp \
kernel/qclipboard_win.cpp \
@@ -91,11 +103,33 @@ win32 {
kernel/qsound_win.cpp \
kernel/qwidget_win.cpp \
kernel/qole_win.cpp \
- kernel/qkeymapper_win.cpp
+ kernel/qkeymapper_win.cpp \
+ kernel/qwinnativepangesturerecognizer_win.cpp
!contains(DEFINES, QT_NO_DIRECTDRAW):LIBS += ddraw.lib
}
+symbian {
+ SOURCES += \
+ kernel/qapplication_s60.cpp \
+ kernel/qeventdispatcher_s60.cpp \
+ kernel/qwidget_s60.cpp \
+ kernel/qcursor_s60.cpp \
+ kernel/qdesktopwidget_s60.cpp \
+ kernel/qkeymapper_s60.cpp\
+ kernel/qclipboard_s60.cpp\
+ kernel/qdnd_s60.cpp \
+ kernel/qsound_s60.cpp
+
+ HEADERS += \
+ kernel/qt_s60_p.h \
+ kernel/qeventdispatcher_s60_p.h
+ LIBS += -lbafl -lestor
+
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+}
+
+
unix:x11 {
INCLUDEPATH += ../3rdparty/xorg
HEADERS += \
@@ -154,9 +188,8 @@ embedded {
HEADERS += \
kernel/qeventdispatcher_glib_qws_p.h
QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
+ LIBS_PRIVATE +=$$QT_LIBS_GLIB
}
-
-
}
!embedded:!x11:mac {
@@ -172,7 +205,9 @@ embedded {
qcocoaview_mac_p.h \
qcocoaapplication_mac_p.h \
qcocoaapplicationdelegate_mac_p.h \
- qmultitouch_mac_p.h
+ qmacgesturerecognizer_mac_p.h \
+ qmultitouch_mac_p.h \
+ qcocoasharedwindowmethods_mac_p.h
OBJECTIVE_SOURCES += \
kernel/qcursor_mac.mm \
@@ -190,8 +225,9 @@ embedded {
kernel/qt_cocoa_helpers_mac.mm \
kernel/qdesktopwidget_mac.mm \
kernel/qeventdispatcher_mac.mm \
- kernel/qcocoawindowcustomthemeframe_mac.mm \
- kernel/qmultitouch_mac.mm \
+ kernel/qcocoawindowcustomthemeframe_mac.mm \
+ kernel/qmacgesturerecognizer_mac.mm \
+ kernel/qmultitouch_mac.mm
HEADERS += \
kernel/qt_cocoa_helpers_mac_p.h \
@@ -199,10 +235,10 @@ embedded {
kernel/qcocoaapplicationdelegate_mac_p.h \
kernel/qeventdispatcher_mac_p.h
- MENU_NIB.files = mac/qt_menu.nib
- MENU_NIB.path = Resources
+ MENU_NIB.files = mac/qt_menu.nib
+ MENU_NIB.path = Resources
MENU_NIB.version = Versions
- QMAKE_BUNDLE_DATA += MENU_NIB
+ QMAKE_BUNDLE_DATA += MENU_NIB
RESOURCES += mac/macresources.qrc
LIBS_PRIVATE += -framework AppKit
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index 7c343fcd0..3eaf2e1ce 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -81,7 +81,8 @@ static QString qt_strippedText(QString s)
QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0),
visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false),
- menuRole(QAction::TextHeuristicRole), priority(QAction::NormalPriority), iconVisibleInMenu(-1)
+ menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::NoSoftKey),
+ priority(QAction::NormalPriority), iconVisibleInMenu(-1)
{
#ifdef QT3_SUPPORT
static int qt_static_action_id = -1;
@@ -99,6 +100,21 @@ QActionPrivate::~QActionPrivate()
{
}
+bool QActionPrivate::showStatusText(QWidget *widget, const QString &str)
+{
+#ifdef QT_NO_STATUSTIP
+ Q_UNUSED(widget);
+ Q_UNUSED(str);
+#else
+ if(QObject *object = widget ? widget : parent) {
+ QStatusTipEvent tip(str);
+ QApplication::sendEvent(object, &tip);
+ return true;
+ }
+#endif
+ return false;
+}
+
void QActionPrivate::sendDataChanged()
{
Q_Q(QAction);
@@ -182,8 +198,8 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
\brief The QAction class provides an abstract user interface
action that can be inserted into widgets.
- \ingroup application
- \mainclass
+ \ingroup mainwindow-classes
+
\omit
* parent and widget are different
@@ -261,8 +277,33 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
\c{Info.plist} file in the application's bundle (See \l{Deploying an Application on Mac OS X}).
\value PreferencesRole This action should be placed where the "Preferences..." menu item is in the application menu.
\value QuitRole This action should be placed where the Quit menu item is in the application menu.
+
+ Setting this value only has effect on items that are in the immediate menus
+ of the menubar, not the submenus of those menus. For example, if you have
+ File menu in your menubar and the File menu has a submenu, setting the
+ MenuRole for the actions in that submenu have no effect. They will never be moved.
*/
+/*! \since 4.6
+
+ \enum QAction::SoftKeyRole
+
+ This enum describes how an action should be placed in the softkey bar. Currently this enum only
+ has an effect on the Symbian platform.
+
+ \value NoSoftKey This action should not be used as a softkey
+ \value PositiveSoftKey This action is used to describe a softkey with a positive or non-destructive
+ role such as Ok, Select, or Options.
+ \value NegativeSoftKey This action is used to describe a soft ey with a negative or destructive role
+ role such as Cancel, Discard, or Close.
+ \value SelectSoftKey This action is used to describe a role that selects a particular item or widget
+ in the application.
+
+ Actions with a softkey role defined are only visible in the softkey bar when the widget containing
+ the action has focus. If no widget currently has focus, the softkey framework will traverse up the
+ widget parent hierarchy looking for a widget containing softkey actions.
+ */
+
/*!
Constructs an action with \a parent. If \a parent is an action
group the action will be automatically inserted into the group.
@@ -1180,16 +1221,7 @@ QAction::setData(const QVariant &data)
bool
QAction::showStatusText(QWidget *widget)
{
-#ifdef QT_NO_STATUSTIP
- Q_UNUSED(widget);
-#else
- if(QObject *object = widget ? widget : parent()) {
- QStatusTipEvent tip(statusTip());
- QApplication::sendEvent(object, &tip);
- return true;
- }
-#endif
- return false;
+ return d_func()->showStatusText(widget, statusTip());
}
/*!
@@ -1407,6 +1439,33 @@ QAction::MenuRole QAction::menuRole() const
}
/*!
+ \property QAction::softKeyRole
+ \brief the action's softkey role
+ \since 4.6
+
+ This indicates what type of role this action describes in the softkey framework
+ on platforms where such a framework is supported. Currently this is only
+ supported on the Symbian platform.
+
+ The softkey role can be changed any time.
+*/
+void QAction::setSoftKeyRole(SoftKeyRole softKeyRole)
+{
+ Q_D(QAction);
+ if (d->softKeyRole == softKeyRole)
+ return;
+
+ d->softKeyRole = softKeyRole;
+ d->sendDataChanged();
+}
+
+QAction::SoftKeyRole QAction::softKeyRole() const
+{
+ Q_D(const QAction);
+ return d->softKeyRole;
+}
+
+/*!
\property QAction::iconVisibleInMenu
\brief Whether or not an action should show an icon in a menu
\since 4.4
diff --git a/src/gui/kernel/qaction.h b/src/gui/kernel/qaction.h
index 1e799cf42..620ff7eab 100644
--- a/src/gui/kernel/qaction.h
+++ b/src/gui/kernel/qaction.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -67,6 +67,7 @@ class Q_GUI_EXPORT QAction : public QObject
Q_DECLARE_PRIVATE(QAction)
Q_ENUMS(MenuRole)
+ Q_ENUMS(SoftKeyRole)
Q_ENUMS(Priority)
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled)
@@ -85,12 +86,15 @@ class Q_GUI_EXPORT QAction : public QObject
#endif
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY changed)
Q_PROPERTY(MenuRole menuRole READ menuRole WRITE setMenuRole NOTIFY changed)
+ Q_PROPERTY(SoftKeyRole softKeyRole READ softKeyRole WRITE setSoftKeyRole NOTIFY changed)
Q_PROPERTY(bool iconVisibleInMenu READ isIconVisibleInMenu WRITE setIconVisibleInMenu NOTIFY changed)
Q_PROPERTY(Priority priority READ priority WRITE setPriority)
public:
enum MenuRole { NoRole, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole,
AboutRole, PreferencesRole, QuitRole };
+ enum SoftKeyRole {
+ NoSoftKey, PositiveSoftKey, NegativeSoftKey, SelectSoftKey };
enum Priority { LowPriority = 0,
NormalPriority = 128,
HighPriority = 256};
@@ -176,6 +180,9 @@ public:
void setMenuRole(MenuRole menuRole);
MenuRole menuRole() const;
+ void setSoftKeyRole(SoftKeyRole softKeyRole);
+ SoftKeyRole softKeyRole() const;
+
void setIconVisibleInMenu(bool visible);
bool isIconVisibleInMenu() const;
@@ -239,6 +246,9 @@ private:
friend class QMenuBar;
friend class QShortcutMap;
friend class QToolButton;
+#ifdef Q_WS_MAC
+ friend void qt_mac_clear_status_text(QAction *action);
+#endif
};
QT_BEGIN_INCLUDE_NAMESPACE
diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h
index d158e7cad..f7b035b1f 100644
--- a/src/gui/kernel/qaction_p.h
+++ b/src/gui/kernel/qaction_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -75,6 +75,8 @@ public:
QActionPrivate();
~QActionPrivate();
+ bool showStatusText(QWidget *w, const QString &str);
+
QPointer<QActionGroup> group;
QString text;
QString iconText;
@@ -102,6 +104,7 @@ public:
uint separator : 1;
uint fontSet : 1;
QAction::MenuRole menuRole;
+ QAction::SoftKeyRole softKeyRole;
QAction::Priority priority;
int iconVisibleInMenu : 3; // Only has values -1, 0, and 1
QList<QWidget *> widgets;
diff --git a/src/gui/kernel/qactiongroup.cpp b/src/gui/kernel/qactiongroup.cpp
index 5d429e468..8db76e458 100644
--- a/src/gui/kernel/qactiongroup.cpp
+++ b/src/gui/kernel/qactiongroup.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -72,10 +72,16 @@ void QActionGroupPrivate::_q_actionChanged()
Q_Q(QActionGroup);
QAction *action = qobject_cast<QAction*>(q->sender());
Q_ASSERT_X(action != 0, "QWidgetGroup::_q_actionChanged", "internal error");
- if(exclusive && action->isChecked() && action != current) {
- if(current)
- current->setChecked(false);
- current = action;
+ if(exclusive) {
+ if (action->isChecked()) {
+ if (action != current) {
+ if(current)
+ current->setChecked(false);
+ current = action;
+ }
+ } else if (action == current) {
+ current = 0;
+ }
}
}
@@ -100,7 +106,7 @@ void QActionGroupPrivate::_q_actionHovered()
\class QActionGroup
\brief The QActionGroup class groups actions together.
- \ingroup application
+ \ingroup mainwindow-classes
In some situations it is useful to group actions together. For
example, if you have a \gui{Left Align} action, a \gui{Right
diff --git a/src/gui/kernel/qactiongroup.h b/src/gui/kernel/qactiongroup.h
index 3c9d74b8f..b96406a42 100644
--- a/src/gui/kernel/qactiongroup.h
+++ b/src/gui/kernel/qactiongroup.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index df85809ff..c675c9e12 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -75,9 +75,14 @@
#ifdef Q_WS_X11
#include <private/qt_x11_p.h>
+#endif
+
+#if defined(Q_WS_X11) || defined(Q_WS_S60)
#include "qinputcontextfactory.h"
#endif
+#include "qguiplatformplugin_p.h"
+
#include <qthread.h>
#include <private/qthread_p.h>
@@ -91,6 +96,13 @@
#include "qapplication.h"
+#include "qgesture.h"
+#include "private/qgesturemanager_p.h"
+
+#ifndef QT_NO_LIBRARY
+#include "qlibrary.h"
+#endif
+
#ifdef Q_WS_WINCE
#include "qdatetime.h"
#include "qguifunctions_wince.h"
@@ -101,6 +113,10 @@ extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp
#include "qdatetime.h"
+#ifdef QT_MAC_USE_COCOA
+#include <private/qt_cocoa_helpers_mac_p.h>
+#endif
+
//#define ALIEN_DEBUG
static void initResources()
@@ -134,6 +150,8 @@ bool QApplicationPrivate::quitOnLastWindowClosed = true;
#ifdef Q_WS_WINCE
int QApplicationPrivate::autoMaximizeThreshold = -1;
bool QApplicationPrivate::autoSipEnabled = false;
+#else
+bool QApplicationPrivate::autoSipEnabled = true;
#endif
QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type)
@@ -159,6 +177,8 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T
directPainters = 0;
#endif
+ gestureWidget = 0;
+
if (!self)
self = this;
}
@@ -174,9 +194,6 @@ QApplicationPrivate::~QApplicationPrivate()
\brief The QApplication class manages the GUI application's control
flow and main settings.
- \ingroup application
- \mainclass
-
QApplication contains the main event loop, where all events from the window
system and other sources are processed and dispatched. It also handles the
application's initialization, finalization, and provides session
@@ -432,7 +449,12 @@ bool Q_GUI_EXPORT qt_tab_all_widgets = true;
bool qt_in_tab_key_event = false;
int qt_antialiasing_threshold = -1;
static int drag_time = 500;
+#ifdef Q_OS_SYMBIAN
+// The screens are a bit too small to for your thumb when using only 4 pixels drag distance.
+static int drag_distance = 8;
+#else
static int drag_distance = 4;
+#endif
static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
QSize QApplicationPrivate::app_strut = QSize(0,0); // no default application strut
bool QApplicationPrivate::animate_ui = true;
@@ -443,23 +465,31 @@ bool QApplicationPrivate::animate_tooltip = false;
bool QApplicationPrivate::fade_tooltip = false;
bool QApplicationPrivate::animate_toolbox = false;
bool QApplicationPrivate::widgetCount = false;
-#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
-bool QApplicationPrivate::inSizeMove = false;
-#endif
+bool QApplicationPrivate::load_testability = false;
#ifdef QT_KEYPAD_NAVIGATION
-bool QApplicationPrivate::keypadNavigation = false;
+# ifdef Q_OS_SYMBIAN
+Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional;
+# else
+Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadTabOrder;
+# endif
QWidget *QApplicationPrivate::oldEditFocus = 0;
#endif
bool qt_tabletChokeMouse = false;
static bool force_reverse = false;
-static inline bool isAlien(QWidget *widget)
+inline bool QApplicationPrivate::isAlien(QWidget *widget)
{
if (!widget)
return false;
-#ifdef Q_WS_MAC // Fake alien behavior on the Mac :)
+#if defined(Q_WS_MAC) // Fake alien behavior on the Mac :)
return !widget->isWindow() && widget->window()->testAttribute(Qt::WA_DontShowOnScreen);
+#elif defined(Q_WS_QWS)
+ return !widget->isWindow()
+# ifdef Q_BACKINGSTORE_SUBSURFACES
+ && !(widget->d_func()->maybeTopData() && widget->d_func()->maybeTopData()->windowSurface)
+# endif
+ ;
#else
return !widget->internalWinId();
#endif
@@ -539,6 +569,8 @@ void QApplicationPrivate::process_cmdline()
QApplication::setLayoutDirection(Qt::RightToLeft);
} else if (qstrcmp(arg, "-widgetcount") == 0) {
widgetCount = true;
+ } else if (qstrcmp(arg, "-testability") == 0) {
+ load_testability = true;
} else if (arg == "-graphicssystem" && i < argc-1) {
graphics_system_name = QString::fromLocal8Bit(argv[++i]);
} else {
@@ -741,6 +773,27 @@ void QApplicationPrivate::construct(
extern void qt_gui_eval_init(uint);
qt_gui_eval_init(application_type);
#endif
+
+#ifndef QT_NO_LIBRARY
+ if(load_testability) {
+ QLibrary testLib(QLatin1String("qttestability"));
+ if (testLib.load()) {
+ typedef void (*TasInitialize)(void);
+ TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
+ if (initFunction) {
+ initFunction();
+ } else {
+ qCritical("Library qttestability resolve failed!");
+ }
+ } else {
+ qCritical("Library qttestability load failed!");
+ }
+ }
+
+ //make sure the plugin is loaded
+ if (qt_is_gui_used)
+ qt_guiPlatformPlugin();
+#endif
}
#if defined(Q_WS_X11)
@@ -835,7 +888,7 @@ extern int qUnregisterGuiStateMachine();
void QApplicationPrivate::initialize()
{
QWidgetPrivate::mapper = new QWidgetMapper;
- QWidgetPrivate::uncreatedWidgets = new QWidgetSet;
+ QWidgetPrivate::allWidgets = new QWidgetSet;
if (qt_appType != QApplication::Tty)
(void) QApplication::style(); // trigger creation of application style
// trigger registering of QVariant's GUI types
@@ -869,7 +922,7 @@ void QApplicationPrivate::initialize()
// Set up which span functions should be used in raster engine...
qInitDrawhelperAsm();
-
+
#if !defined(Q_WS_X11) && !defined(Q_WS_QWS)
// initialize the graphics system - on X11 this is initialized inside
// qt_init() in qapplication_x11.cpp because of several reasons.
@@ -877,14 +930,11 @@ void QApplicationPrivate::initialize()
graphics_system = QGraphicsSystemFactory::create(graphics_system_name);
#endif
#ifndef QT_NO_WHEELEVENT
-#ifdef QT_MAC_USE_COCOA
- QApplicationPrivate::wheel_scroll_lines = 1;
-#else
QApplicationPrivate::wheel_scroll_lines = 3;
#endif
-#endif
- initializeMultitouch();
+ if (qt_is_gui_used)
+ initializeMultitouch();
}
/*!
@@ -968,34 +1018,25 @@ QApplication::~QApplication()
d->eventDispatcher->closingDown();
d->eventDispatcher = 0;
+ QApplicationPrivate::is_app_closing = true;
+ QApplicationPrivate::is_app_running = false;
delete qt_desktopWidget;
qt_desktopWidget = 0;
- QApplicationPrivate::is_app_closing = true;
- QApplicationPrivate::is_app_running = false;
#ifndef QT_NO_CLIPBOARD
delete qt_clipboard;
qt_clipboard = 0;
#endif
- // delete widget mapper
- if (QWidgetPrivate::mapper) {
- QWidgetMapper * myMapper = QWidgetPrivate::mapper;
- QWidgetPrivate::mapper = 0;
- for (QWidgetMapper::Iterator it = myMapper->begin(); it != myMapper->end(); ++it) {
- register QWidget *w = *it;
- if (!w->parent()) // window
- w->destroy(true, true);
- }
- delete myMapper;
- }
+ delete QWidgetPrivate::mapper;
+ QWidgetPrivate::mapper = 0;
- // delete uncreated widgets
- if (QWidgetPrivate::uncreatedWidgets) {
- QWidgetSet *mySet = QWidgetPrivate::uncreatedWidgets;
- QWidgetPrivate::uncreatedWidgets = 0;
- for (QWidgetSet::Iterator it = mySet->begin(); it != mySet->end(); ++it) {
+ // delete all widgets
+ if (QWidgetPrivate::allWidgets) {
+ QWidgetSet *mySet = QWidgetPrivate::allWidgets;
+ QWidgetPrivate::allWidgets = 0;
+ for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) {
register QWidget *w = *it;
if (!w->parent()) // window
w->destroy(true, true);
@@ -1148,6 +1189,7 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
|| event->type() == QEvent::Resize
|| event->type() == QEvent::Move
|| event->type() == QEvent::LanguageChange
+ || event->type() == QEvent::UpdateSoftKeys
|| event->type() == QEvent::InputMethod)) {
for (int i = 0; i < postedEvents->size(); ++i) {
const QPostEvent &cur = postedEvents->at(i);
@@ -1165,6 +1207,8 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
((QMoveEvent *)(cur.event))->p = ((QMoveEvent *)event)->p;
} else if (cur.event->type() == QEvent::LanguageChange) {
;
+ } else if (cur.event->type() == QEvent::UpdateSoftKeys) {
+ ;
} else if ( cur.event->type() == QEvent::InputMethod ) {
*(QInputMethodEvent *)(cur.event) = *(QInputMethodEvent *)event;
} else {
@@ -1218,11 +1262,15 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
\since 4.5
\brief toggles automatic SIP (software input panel) visibility
- \bold{The auto SIP property is only available as part of Qt for Windows CE.}
-
Set this property to \c true to automatically display the SIP when entering
widgets that accept keyboard input. This property only affects widgets with
- the WA_InputMethodEnabled attribute set.
+ the WA_InputMethodEnabled attribute set, and is typically used to launch
+ a virtual keyboard on devices which have very few or no keys.
+
+ \bold{ The property only has an effect on platforms which use software input
+ panels, such as Windows CE and Symbian.}
+
+ The default is platform dependent.
*/
#ifdef Q_WS_WINCE
@@ -1235,6 +1283,7 @@ int QApplication::autoMaximizeThreshold() const
{
return QApplicationPrivate::autoMaximizeThreshold;
}
+#endif
void QApplication::setAutoSipEnabled(const bool enabled)
{
@@ -1245,7 +1294,6 @@ bool QApplication::autoSipEnabled() const
{
return QApplicationPrivate::autoSipEnabled;
}
-#endif
#ifndef QT_NO_STYLE_STYLESHEET
@@ -1909,34 +1957,7 @@ void QApplicationPrivate::setSystemFont(const QFont &font)
*/
QString QApplicationPrivate::desktopStyleKey()
{
-QString desktopstyle;
-#if defined(Q_WS_WIN) && defined(Q_WS_WINCE)
- if (qt_wince_is_smartphone() || qt_wince_is_pocket_pc())
- desktopstyle = QLatin1String("WindowsMobile");
- else
- desktopstyle = QLatin1String("WindowsCE");
-
-#elif defined(Q_WS_WIN)
- if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
- desktopstyle = QLatin1String("WindowsVista");
- else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
- desktopstyle = QLatin1String("WindowsXP");
- else
- desktopstyle = QLatin1String("Windows"); // default styles for Windows
-#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS)
- desktopstyle = QLatin1String("CDE"); // default style for X11 on Solaris
-#elif defined(Q_WS_X11) && defined(Q_OS_IRIX)
- desktopstyle = QLatin1String("SGI"); // default style for X11 on IRIX
-#elif defined(Q_WS_QWS)
- desktopstyle = QLatin1String("Plastique"); // default style for X11 and small devices
-#elif defined(Q_WS_X11)
- desktopstyle = QApplicationPrivate::x11_desktop_style(); // default runtime dependant style for X11
-#elif defined(Q_WS_MAC)
- desktopstyle = QLatin1String("Macintosh"); // default style for all Mac's
-#endif
- return desktopstyle;
+ return qt_guiPlatformPlugin()->styleName();
}
/*!
@@ -2011,12 +2032,9 @@ QWidgetList QApplication::topLevelWidgets()
QWidgetList QApplication::allWidgets()
{
- QWidgetList list;
- if (QWidgetPrivate::mapper)
- list += QWidgetPrivate::mapper->values();
- if (QWidgetPrivate::uncreatedWidgets)
- list += QWidgetPrivate::uncreatedWidgets->toList();
- return list;
+ if (QWidgetPrivate::allWidgets)
+ return QWidgetPrivate::allWidgets->toList();
+ return QWidgetList();
}
/*!
@@ -2054,7 +2072,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
}
QWidget *prev = focus_widget;
focus_widget = focus;
-
+#ifndef QT_NO_IM
if (prev && ((reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason
&& prev->testAttribute(Qt::WA_InputMethodEnabled))
// Do reset the input context, in case the new focus widget won't accept keyboard input
@@ -2067,6 +2085,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
qic->setFocusWidget(0);
}
}
+#endif //QT_NO_IM
if(focus_widget)
focus_widget->d_func()->setFocus_sys();
@@ -2081,6 +2100,16 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
prev->setEditFocus(false);
}
#endif
+#ifndef QT_NO_IM
+ if (focus) {
+ QInputContext *prevIc;
+ prevIc = prev->inputContext();
+ if (prevIc && prevIc != focus->inputContext()) {
+ QEvent closeSIPEvent(QEvent::CloseSoftwareInputPanel);
+ QApplication::sendEvent(prev, &closeSIPEvent);
+ }
+ }
+#endif
QFocusEvent out(QEvent::FocusOut, reason);
QPointer<QWidget> that = prev;
QApplication::sendEvent(prev, &out);
@@ -2088,12 +2117,14 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
QApplication::sendEvent(that->style(), &out);
}
if(focus && QApplicationPrivate::focus_widget == focus) {
+#ifndef QT_NO_IM
if (focus->testAttribute(Qt::WA_InputMethodEnabled)) {
QInputContext *qic = focus->inputContext();
if (qic && focus->testAttribute(Qt::WA_WState_Created)
&& focus->isEnabled())
qic->setFocusWidget(focus);
}
+#endif //QT_NO_IM
QFocusEvent in(QEvent::FocusIn, reason);
QPointer<QWidget> that = focus;
QApplication::sendEvent(focus, &in);
@@ -2454,6 +2485,7 @@ void QApplication::setActiveWindow(QWidget* act)
/*!internal
* Helper function that returns the new focus widget, but does not set the focus reason.
* Returns 0 if a new focus widget could not be found.
+ * Shared with QGraphicsProxyWidgetPrivate::findFocusChild()
*/
QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next)
{
@@ -2494,12 +2526,6 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
Creates the proper Enter/Leave event when widget \a enter is entered and
widget \a leave is left.
*/
-#if defined(Q_WS_WIN)
- extern void qt_win_set_cursor(QWidget *, bool);
-#elif defined(Q_WS_X11)
- extern void qt_x11_enforce_cursor(QWidget *, bool);
-#endif
-
void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) {
#if 0
if (leave) {
@@ -2615,7 +2641,10 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) {
if (!isAlien(w))
break;
if (w->testAttribute(Qt::WA_SetCursor)) {
- parentOfLeavingCursor = w->parentWidget();
+ QWidget *parent = w->parentWidget();
+ while (parent && parent->d_func()->data.in_destructor)
+ parent = parent->parentWidget();
+ parentOfLeavingCursor = parent;
//continue looping, we need to find the downest alien widget with a cursor.
// (downest on the screen)
}
@@ -2649,6 +2678,8 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) {
qt_win_set_cursor(cursorWidget, true);
#elif defined(Q_WS_X11)
qt_x11_enforce_cursor(cursorWidget, true);
+#elif defined(Q_WS_S60)
+ qt_symbian_set_cursor(cursorWidget, true);
#endif
}
}
@@ -2953,7 +2984,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event,
return result;
}
-#if defined(Q_WS_WIN) || defined(Q_WS_X11)
+#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS)
/*
This function should only be called when the widget changes visibility, i.e.
when the \a widget is shown, hidden or deleted. This function does nothing
@@ -2965,9 +2996,13 @@ extern QWidget *qt_button_down;
void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget)
{
#ifndef QT_NO_CURSOR
+#ifdef Q_WS_QWS
+ if (!widget || widget->isWindow())
+ return;
+#else
if (!widget || widget->internalWinId() || widget->isWindow())
return;
-
+#endif
const bool widgetInShow = widget->isVisible() && !widget->data->in_destructor;
if (!widgetInShow && widget != qt_last_mouse_receiver)
return; // Widget was not under the cursor when it was hidden/deleted.
@@ -3005,7 +3040,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget)
qt_button_down = 0;
// Send enter/leave events followed by a mouse move on the entered widget.
- QMouseEvent e(QEvent::MouseMove, pos, globalPos, Qt::NoButton, mouse_buttons, modifier_buttons);
+ QMouseEvent e(QEvent::MouseMove, pos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
sendMouseEvent(widgetUnderCursor, &e, widgetUnderCursor, tlw, &qt_button_down, qt_last_mouse_receiver);
#endif // QT_NO_CURSOR
}
@@ -3480,6 +3515,15 @@ void QApplication::changeOverrideCursor(const QCursor &cursor)
if (qApp->d_func()->cursor_list.isEmpty())
return;
qApp->d_func()->cursor_list.removeFirst();
+#ifdef QT_MAC_USE_COCOA
+ // We use native NSCursor stacks in Cocoa. The currentCursor is the
+ // top of this stack. So to avoid flickering of cursor, we have to
+ // change the cusor instead of pop-ing the existing OverrideCursor
+ // and pushing the new one.
+ qApp->d_func()->cursor_list.prepend(cursor);
+ qt_cocoaChangeOverrideCursor(cursor);
+ return;
+#endif
setOverrideCursor(cursor);
}
#endif
@@ -3583,6 +3627,18 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
#endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT
}
+ // walk through parents and check for gestures
+ if (qt_gestureManager) {
+ if (receiver->isWidgetType()) {
+ if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
+ return true;
+ } else if (QGesture *gesture = qobject_cast<QGesture *>(receiver)) {
+ if (qt_gestureManager->filterEvent(gesture, e))
+ return true;
+ }
+ }
+
+
// User input and window activation makes tooltips sleep
switch (e->type()) {
case QEvent::Wheel:
@@ -3595,6 +3651,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
d->toolTipFallAsleep.stop();
+ // fall-through
case QEvent::Leave:
d->toolTipWakeUp.stop();
default:
@@ -3710,6 +3767,14 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
QPoint relpos = mouse->pos();
if (e->spontaneous()) {
+#ifndef QT_NO_IM
+ QInputContext *ic = w->inputContext();
+ if (ic
+ && w->testAttribute(Qt::WA_InputMethodEnabled)
+ && ic->filterEvent(mouse))
+ return true;
+#endif
+
if (e->type() == QEvent::MouseButtonPress) {
QApplicationPrivate::giveFocusAccordingToFocusPolicy(w,
Qt::ClickFocus,
@@ -4041,13 +4106,36 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
} else if (widget->isWindow() || widget->testAttribute(Qt::WA_NoMousePropagation)) {
break;
}
+ QPoint offset = widget->pos();
widget = widget->parentWidget();
- d->updateTouchPointsForWidget(widget, touchEvent);
+ touchEvent->setWidget(widget);
+ for (int i = 0; i < touchEvent->_touchPoints.size(); ++i) {
+ QTouchEvent::TouchPoint &pt = touchEvent->_touchPoints[i];
+ QRectF rect = pt.rect();
+ rect.moveCenter(offset);
+ pt.d->rect = rect;
+ pt.d->startPos = pt.startPos() + offset;
+ pt.d->lastPos = pt.lastPos() + offset;
+ }
}
touchEvent->setAccepted(eventAccepted);
break;
}
+ case QEvent::RequestSoftwareInputPanel:
+ case QEvent::CloseSoftwareInputPanel:
+#ifndef QT_NO_IM
+ if (receiver->isWidgetType()) {
+ QWidget *w = static_cast<QWidget *>(receiver);
+ QInputContext *ic = w->inputContext();
+ if (ic && ic->filterEvent(e)) {
+ break;
+ }
+ }
+#endif
+ res = d->notify_helper(receiver, e);
+ break;
+
case QEvent::NativeGesture:
{
// only propagate the first gesture event (after the GID_BEGIN)
@@ -4061,6 +4149,71 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
break;
}
+ case QEvent::Gesture:
+ case QEvent::GestureOverride:
+ {
+ if (receiver->isWidgetType()) {
+ QWidget *w = static_cast<QWidget *>(receiver);
+ QGestureEvent *gestureEvent = static_cast<QGestureEvent *>(e);
+ QList<QGesture *> allGestures = gestureEvent->gestures();
+
+ bool eventAccepted = gestureEvent->isAccepted();
+ bool wasAccepted = eventAccepted;
+ while (w) {
+ // send only gestures the widget expects
+ QList<QGesture *> gestures;
+ QWidgetPrivate *wd = w->d_func();
+ for (int i = 0; i < allGestures.size();) {
+ QGesture *g = allGestures.at(i);
+ Qt::GestureType type = g->gestureType();
+ QMap<Qt::GestureType, Qt::GestureFlags>::iterator contextit =
+ wd->gestureContext.find(type);
+ bool deliver = contextit != wd->gestureContext.end() &&
+ (g->state() == Qt::GestureStarted || w == receiver ||
+ (contextit.value() & Qt::ReceivePartialGestures));
+ if (deliver) {
+ allGestures.removeAt(i);
+ gestures.append(g);
+ } else {
+ ++i;
+ }
+ }
+ if (!gestures.isEmpty()) { // we have gestures for this w
+ QGestureEvent ge(gestures);
+ ge.t = gestureEvent->t;
+ ge.spont = gestureEvent->spont;
+ ge.m_accept = wasAccepted;
+ ge.d_func()->accepted = gestureEvent->d_func()->accepted;
+ res = d->notify_helper(w, &ge);
+ gestureEvent->spont = false;
+ eventAccepted = ge.isAccepted();
+ for (int i = 0; i < gestures.size(); ++i) {
+ QGesture *g = gestures.at(i);
+ if ((res && eventAccepted) || (!eventAccepted && ge.isAccepted(g))) {
+ // if the gesture was accepted, mark the target widget for it
+ gestureEvent->d_func()->targetWidgets[g->gestureType()] = w;
+ gestureEvent->setAccepted(g, true);
+ } else if (!eventAccepted && !ge.isAccepted(g)) {
+ // if the gesture was explicitly ignored by the application,
+ // put it back so a parent can get it
+ allGestures.append(g);
+ }
+ }
+ }
+ if (allGestures.isEmpty()) // everything delivered
+ break;
+ if (w->isWindow())
+ break;
+ w = w->parentWidget();
+ }
+ foreach (QGesture *g, allGestures)
+ gestureEvent->setAccepted(g, false);
+ gestureEvent->m_accept = false; // to make sure we check individual gestures
+ } else {
+ res = d->notify_helper(receiver, e);
+ }
+ break;
+ }
default:
res = d->notify_helper(receiver, e);
break;
@@ -4107,9 +4260,6 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
\class QSessionManager
\brief The QSessionManager class provides access to the session manager.
- \ingroup application
- \ingroup environment
-
A session manager in a desktop environment (in which Qt GUI applications
live) keeps track of a session, which is a group of running applications,
each of which has a particular state. The state of an application contains
@@ -4717,31 +4867,104 @@ void QApplicationPrivate::emitLastWindowClosed()
#ifdef QT_KEYPAD_NAVIGATION
/*!
+ Sets the kind of focus navigation Qt should use to \a mode.
+
+ This feature is available in Qt for Embedded Linux, Symbian and Windows CE
+ only.
+
+ \note On Windows CE this feature is disabled by default for touch device
+ mkspecs. To enable keypad navigation, build Qt with
+ QT_KEYPAD_NAVIGATION defined.
+
+ \note On Symbian, setting the mode to Qt::NavigationModeCursorAuto will enable a
+ virtual mouse cursor on non touchscreen devices, which is controlled
+ by the cursor keys if there is no analog pointer device.
+ On other platforms and on touchscreen devices, it has the same
+ meaning as Qt::NavigationModeNone.
+
+ \since 4.6
+
+ \sa keypadNavigationEnabled()
+*/
+void QApplication::setNavigationMode(Qt::NavigationMode mode)
+{
+#ifdef Q_OS_SYMBIAN
+ QApplicationPrivate::setNavigationMode(mode);
+#else
+ QApplicationPrivate::navigationMode = mode;
+#endif
+}
+
+/*!
+ Returns what kind of focus navigation Qt is using.
+
+ This feature is available in Qt for Embedded Linux, Symbian and Windows CE
+ only.
+
+ \note On Windows CE this feature is disabled by default for touch device
+ mkspecs. To enable keypad navigation, build Qt with
+ QT_KEYPAD_NAVIGATION defined.
+
+ \note On Symbian, the default mode is Qt::NavigationModeNone for touch
+ devices, and Qt::NavigationModeKeypadDirectional.
+
+ \since 4.6
+
+ \sa keypadNavigationEnabled()
+*/
+Qt::NavigationMode QApplication::navigationMode()
+{
+ return QApplicationPrivate::navigationMode;
+}
+
+/*!
Sets whether Qt should use focus navigation suitable for use with a
minimal keypad.
- If \a enable is true, Qt::Key_Up and Qt::Key_Down are used to change focus.
+ This feature is available in Qt for Embedded Linux, Symbian and Windows CE
+ only.
- This feature is available in Qt for Embedded Linux only.
+ \note On Windows CE this feature is disabled by default for touch device
+ mkspecs. To enable keypad navigation, build Qt with
+ QT_KEYPAD_NAVIGATION defined.
- \sa keypadNavigationEnabled()
+ \deprecated
+
+ \sa setNavigationMode()
*/
void QApplication::setKeypadNavigationEnabled(bool enable)
{
- QApplicationPrivate::keypadNavigation = enable;
+ if (enable) {
+#ifdef Q_OS_SYMBIAN
+ QApplication::setNavigationMode(Qt::NavigationModeKeypadDirectional);
+#else
+ QApplication::setNavigationMode(Qt::NavigationModeKeypadTabOrder);
+#endif
+ }
+ else {
+ QApplication::setNavigationMode(Qt::NavigationModeNone);
+ }
}
/*!
Returns true if Qt is set to use keypad navigation; otherwise returns
- false. The default is false.
+ false. The default value is true on Symbian, but false on other platforms.
+
+ This feature is available in Qt for Embedded Linux, Symbian and Windows CE
+ only.
- This feature is available in Qt for Embedded Linux only.
+ \note On Windows CE this feature is disabled by default for touch device
+ mkspecs. To enable keypad navigation, build Qt with
+ QT_KEYPAD_NAVIGATION defined.
- \sa setKeypadNavigationEnabled()
+ \deprecated
+
+ \sa navigationMode()
*/
bool QApplication::keypadNavigationEnabled()
{
- return QApplicationPrivate::keypadNavigation;
+ return QApplicationPrivate::navigationMode == Qt::NavigationModeKeypadTabOrder ||
+ QApplicationPrivate::navigationMode == Qt::NavigationModeKeypadDirectional;
}
#endif
@@ -4790,8 +5013,8 @@ bool QApplication::keypadNavigationEnabled()
from two consecutive mouse clicks
The default value on X11 is 400 milliseconds. On Windows and Mac OS, the
- operating system's value is used. However, on Windows, calling this
- function sets the double click interval for all applications.
+ operating system's value is used. However, on Windows and Symbian OS,
+ calling this function sets the double click interval for all applications.
*/
/*!
@@ -4950,8 +5173,7 @@ void QApplication::setInputContext(QInputContext *inputContext)
qWarning("QApplication::setInputContext: called with 0 input context");
return;
}
- if (d->inputContext)
- delete d->inputContext;
+ delete d->inputContext;
d->inputContext = inputContext;
}
@@ -4975,6 +5197,11 @@ QInputContext *QApplication::inputContext() const
qic = QInputContextFactory::create(QLatin1String("xim"), that);
that->d_func()->inputContext = qic;
}
+#elif defined(Q_WS_S60)
+ if (!d->inputContext) {
+ QApplication *that = const_cast<QApplication *>(this);
+ that->d_func()->inputContext = QInputContextFactory::create(QString::fromLatin1("coefep"), that);
+ }
#endif
return d->inputContext;
}
@@ -4992,6 +5219,8 @@ uint QApplicationPrivate::currentPlatform(){
platform |= KB_Gnome;
if (X11->desktopEnvironment == DE_CDE)
platform |= KB_CDE;
+#elif defined(Q_OS_SYMBIAN)
+ platform = KB_S60;
#endif
return platform;
}
@@ -5198,9 +5427,11 @@ void QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEven
const QPointF delta = screenPos - screenPos.toPoint();
rect.moveCenter(widget->mapFromGlobal(screenPos.toPoint()) + delta);
- touchPoint.setRect(rect);
- touchPoint.setStartPos(widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta);
- touchPoint.setLastPos(widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta);
+ touchPoint.d->rect = rect;
+ if (touchPoint.state() == Qt::TouchPointPressed) {
+ touchPoint.d->startPos = widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta;
+ touchPoint.d->lastPos = widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta;
+ }
}
}
@@ -5244,16 +5475,20 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
for (int i = 0; i < touchPoints.count(); ++i) {
QTouchEvent::TouchPoint touchPoint = touchPoints.at(i);
+ // explicitly detach from the original touch point that we got, so even
+ // if the touchpoint structs are reused, we will make a copy that we'll
+ // deliver to the user (which might want to store the struct for later use).
+ touchPoint.d = touchPoint.d->detach();
// update state
- QWidget *widget = 0;
+ QWeakPointer<QWidget> widget;
switch (touchPoint.state()) {
case Qt::TouchPointPressed:
{
if (deviceType == QTouchEvent::TouchPad) {
// on touch-pads, send all touch points to the same widget
widget = d->widgetForTouchPointId.isEmpty()
- ? 0
+ ? QWeakPointer<QWidget>()
: d->widgetForTouchPointId.constBegin().value();
}
@@ -5270,20 +5505,21 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
if (deviceType == QTouchEvent::TouchScreen) {
int closestTouchPointId = d->findClosestTouchPointId(touchPoint.screenPos());
- QWidget *closestWidget = d->widgetForTouchPointId.value(closestTouchPointId);
+ QWidget *closestWidget = d->widgetForTouchPointId.value(closestTouchPointId).data();
if (closestWidget
- && (widget->isAncestorOf(closestWidget) || closestWidget->isAncestorOf(widget))) {
+ && (widget.data()->isAncestorOf(closestWidget) || closestWidget->isAncestorOf(widget.data()))) {
widget = closestWidget;
}
}
d->widgetForTouchPointId[touchPoint.id()] = widget;
- touchPoint.setStartScreenPos(touchPoint.screenPos());
- touchPoint.setLastScreenPos(touchPoint.screenPos());
- touchPoint.setStartNormalizedPos(touchPoint.normalizedPos());
- touchPoint.setLastNormalizedPos(touchPoint.normalizedPos());
+ touchPoint.d->startScreenPos = touchPoint.screenPos();
+ touchPoint.d->lastScreenPos = touchPoint.screenPos();
+ touchPoint.d->startNormalizedPos = touchPoint.normalizedPos();
+ touchPoint.d->lastNormalizedPos = touchPoint.normalizedPos();
if (touchPoint.pressure() < qreal(0.))
- touchPoint.setPressure(qreal(1.));
+ touchPoint.d->pressure = qreal(1.);
+
d->appCurrentTouchPoints.insert(touchPoint.id(), touchPoint);
break;
}
@@ -5294,12 +5530,14 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
continue;
QTouchEvent::TouchPoint previousTouchPoint = d->appCurrentTouchPoints.take(touchPoint.id());
- touchPoint.setStartScreenPos(previousTouchPoint.startScreenPos());
- touchPoint.setLastScreenPos(previousTouchPoint.screenPos());
- touchPoint.setStartNormalizedPos(previousTouchPoint.startNormalizedPos());
- touchPoint.setLastNormalizedPos(previousTouchPoint.normalizedPos());
+ touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
+ touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
+ touchPoint.d->startPos = previousTouchPoint.startPos();
+ touchPoint.d->lastPos = previousTouchPoint.pos();
+ touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos();
+ touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos();
if (touchPoint.pressure() < qreal(0.))
- touchPoint.setPressure(qreal(0.));
+ touchPoint.d->pressure = qreal(0.);
break;
}
default:
@@ -5309,23 +5547,25 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window,
Q_ASSERT(d->appCurrentTouchPoints.contains(touchPoint.id()));
QTouchEvent::TouchPoint previousTouchPoint = d->appCurrentTouchPoints.value(touchPoint.id());
- touchPoint.setStartScreenPos(previousTouchPoint.startScreenPos());
- touchPoint.setLastScreenPos(previousTouchPoint.screenPos());
- touchPoint.setStartNormalizedPos(previousTouchPoint.startNormalizedPos());
- touchPoint.setLastNormalizedPos(previousTouchPoint.normalizedPos());
+ touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
+ touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
+ touchPoint.d->startPos = previousTouchPoint.startPos();
+ touchPoint.d->lastPos = previousTouchPoint.pos();
+ touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos();
+ touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos();
if (touchPoint.pressure() < qreal(0.))
- touchPoint.setPressure(qreal(1.));
+ touchPoint.d->pressure = qreal(1.);
d->appCurrentTouchPoints[touchPoint.id()] = touchPoint;
break;
}
- Q_ASSERT(widget != 0);
+ Q_ASSERT(widget.data() != 0);
// make the *scene* functions return the same as the *screen* functions
- touchPoint.setSceneRect(touchPoint.screenRect());
- touchPoint.setStartScenePos(touchPoint.startScreenPos());
- touchPoint.setLastScenePos(touchPoint.lastScreenPos());
+ touchPoint.d->sceneRect = touchPoint.screenRect();
+ touchPoint.d->startScenePos = touchPoint.startScreenPos();
+ touchPoint.d->lastScenePos = touchPoint.lastScreenPos();
- StatesAndTouchPoints &maskAndPoints = widgetsNeedingEvents[widget];
+ StatesAndTouchPoints &maskAndPoints = widgetsNeedingEvents[widget.data()];
maskAndPoints.first |= touchPoint.state();
if (touchPoint.isPrimary())
maskAndPoints.first |= Qt::TouchPointPrimary;
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index 8d3acae08..e8c128159 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -61,6 +61,10 @@
QT_BEGIN_HEADER
+#if defined(Q_WS_S60)
+class CApaApplication;
+#endif
+
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
@@ -76,6 +80,9 @@ class QLocale;
#if defined(Q_WS_QWS)
class QDecoration;
#endif
+#if defined(Q_OS_SYMBIAN)
+class QSymbianEvent;
+#endif
class QApplication;
class QApplicationPrivate;
@@ -84,6 +91,7 @@ class QApplicationPrivate;
#endif
#define qApp (static_cast<QApplication *>(QCoreApplication::instance()))
+
class Q_GUI_EXPORT QApplication : public QCoreApplication
{
Q_OBJECT
@@ -104,11 +112,16 @@ class Q_GUI_EXPORT QApplication : public QCoreApplication
#endif
#ifdef Q_WS_WINCE
Q_PROPERTY(int autoMaximizeThreshold READ autoMaximizeThreshold WRITE setAutoMaximizeThreshold)
- Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled)
#endif
+ Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled)
public:
enum Type { Tty, GuiClient, GuiServer };
+
+#ifdef Q_WS_S60
+ typedef CApaApplication * (*QS60MainApplicationFactory)();
+#endif
+
#ifndef qdoc
QApplication(int &argc, char **argv, int = QT_VERSION);
QApplication(int &argc, char **argv, bool GUIenabled, int = QT_VERSION);
@@ -117,6 +130,9 @@ public:
QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0, int = QT_VERSION);
QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0, int = QT_VERSION);
#endif
+#if defined(Q_WS_S60)
+ QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int = QT_VERSION);
+#endif
#endif
virtual ~QApplication();
@@ -223,6 +239,10 @@ public:
virtual int x11ClientMessage(QWidget*, XEvent*, bool passive_only);
int x11ProcessEvent(XEvent*);
#endif
+#if defined(Q_OS_SYMBIAN)
+ int symbianProcessEvent(const QSymbianEvent *event);
+ virtual bool symbianEventFilter(const QSymbianEvent *event);
+#endif
#if defined(Q_WS_QWS)
virtual bool qwsEventFilter(QWSEvent *);
int qwsProcessEvent(QWSEvent*);
@@ -239,7 +259,6 @@ public:
void winFocus(QWidget *, bool);
static void winMouseButtonUp();
#endif
-
#ifndef QT_NO_SESSIONMANAGER
// session management
bool isSessionRestored() const;
@@ -262,8 +281,10 @@ public:
static bool quitOnLastWindowClosed();
#ifdef QT_KEYPAD_NAVIGATION
- static void setKeypadNavigationEnabled(bool);
+ static Q_DECL_DEPRECATED void setKeypadNavigationEnabled(bool);
static bool keypadNavigationEnabled();
+ static void setNavigationMode(Qt::NavigationMode mode);
+ static Qt::NavigationMode navigationMode();
#endif
Q_SIGNALS:
@@ -284,9 +305,9 @@ public Q_SLOTS:
#ifdef Q_WS_WINCE
void setAutoMaximizeThreshold(const int threshold);
int autoMaximizeThreshold() const;
+#endif
void setAutoSipEnabled(const bool enabled);
bool autoSipEnabled() const;
-#endif
static void closeAllWindows();
static void aboutQt();
@@ -317,7 +338,7 @@ public:
{ if (replace) changeOverrideCursor(cursor); else setOverrideCursor(cursor); }
# endif
inline static QT3_SUPPORT bool hasGlobalMouseTracking() {return true;}
- inline static QT3_SUPPORT void setGlobalMouseTracking(bool) {};
+ inline static QT3_SUPPORT void setGlobalMouseTracking(bool) {}
inline static QT3_SUPPORT void flushX() { flush(); }
static inline QT3_SUPPORT void setWinStyleHighlightColor(const QColor &c) {
QPalette p(palette());
@@ -327,7 +348,7 @@ public:
static inline QT3_SUPPORT const QColor &winStyleHighlightColor()
{ return palette().color(QPalette::Active, QPalette::Highlight); }
static inline QT3_SUPPORT void setPalette(const QPalette &pal, bool, const char* className = 0)
- { setPalette(pal, className); };
+ { setPalette(pal, className); }
static inline QT3_SUPPORT void setFont(const QFont &font, bool, const char* className = 0)
{ setFont(font, className); }
@@ -345,6 +366,9 @@ public:
QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0);
QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0);
#endif
+#if defined(Q_WS_S60) || defined(qdoc)
+ QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv);
+#endif
#endif
private:
@@ -374,6 +398,7 @@ private:
friend class QDirectPainter;
friend class QDirectPainterPrivate;
#endif
+ friend class QGestureManager;
#if defined(Q_WS_MAC) || defined(Q_WS_X11)
Q_PRIVATE_SLOT(d_func(), void _q_alertTimeOut())
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index 0c1789293..688e51fcf 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -104,6 +104,7 @@
#include "qdir.h"
#include "qdebug.h"
#include "qtimer.h"
+#include "qurl.h"
#include "private/qmacinputcontext_p.h"
#include "private/qpaintengine_mac_p.h"
#include "private/qcursor_p.h"
@@ -203,6 +204,8 @@ static EventHandlerRef tablet_proximity_handler = 0;
static EventHandlerUPP tablet_proximity_UPP = 0;
bool QApplicationPrivate::native_modal_dialog_active;
+Q_GUI_EXPORT bool qt_applefontsmoothing_enabled;
+
/*****************************************************************************
External functions
*****************************************************************************/
@@ -222,6 +225,12 @@ extern bool qt_sendSpontaneousEvent(QObject *obj, QEvent *event); // qapplicatio
void onApplicationWindowChangedActivation( QWidget*widget, bool activated );
void onApplicationChangedActivation( bool activated );
+static void qt_mac_read_fontsmoothing_settings()
+{
+ NSInteger appleFontSmoothing = [[NSUserDefaults standardUserDefaults] integerForKey:@"AppleFontSmoothing"];
+ qt_applefontsmoothing_enabled = (appleFontSmoothing > 0);
+}
+
Q_GUI_EXPORT bool qt_mac_execute_apple_script(const char *script, long script_len, AEDesc *ret) {
OSStatus err;
AEDesc scriptTextDesc;
@@ -958,9 +967,21 @@ struct QMacAppleEventTypeSpec {
AEEventID mac_id;
} app_apple_events[] = {
{ kCoreEventClass, kAEQuitApplication },
- { kCoreEventClass, kAEOpenDocuments }
+ { kCoreEventClass, kAEOpenDocuments },
+ { kInternetEventClass, kAEGetURL },
};
+
#ifndef QT_MAC_USE_COCOA
+
+#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
+enum
+{
+ kEventMouseScroll = 11,
+ kEventParamMouseWheelSmoothVerticalDelta = 'saxy',
+ kEventParamMouseWheelSmoothHorizontalDelta = 'saxx',
+};
+#endif
+
/* watched events */
static EventTypeSpec app_events[] = {
{ kEventClassQt, kEventQtRequestWindowChange },
@@ -972,6 +993,7 @@ static EventTypeSpec app_events[] = {
{ kEventClassWindow, kEventWindowActivated },
{ kEventClassWindow, kEventWindowDeactivated },
+ { kEventClassMouse, kEventMouseScroll },
{ kEventClassMouse, kEventMouseWheelMoved },
{ kEventClassMouse, kEventMouseDown },
{ kEventClassMouse, kEventMouseUp },
@@ -1181,7 +1203,7 @@ void qt_init(QApplicationPrivate *priv, int)
app_proc_ae_handlerUPP = AEEventHandlerUPP(QApplicationPrivate::globalAppleEventProcessor);
for(uint i = 0; i < sizeof(app_apple_events) / sizeof(QMacAppleEventTypeSpec); ++i)
AEInstallEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id,
- app_proc_ae_handlerUPP, SRefCon(qApp), true);
+ app_proc_ae_handlerUPP, SRefCon(qApp), false);
}
if (QApplicationPrivate::app_style) {
@@ -1191,6 +1213,9 @@ void qt_init(QApplicationPrivate *priv, int)
}
if (QApplication::desktopSettingsAware())
QApplicationPrivate::qt_mac_apply_settings();
+
+ qt_mac_read_fontsmoothing_settings();
+
// Cocoa application delegate
#ifdef QT_MAC_USE_COCOA
NSApplication *cocoaApp = [NSApplication sharedApplication];
@@ -1214,6 +1239,10 @@ void qt_init(QApplicationPrivate *priv, int)
[cocoaApp setMenu:[qtMenuLoader menu]];
[newDelegate setMenuLoader:qtMenuLoader];
[qtMenuLoader release];
+
+ NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
+ [eventManager setEventHandler:newDelegate andSelector:@selector(getUrl:withReplyEvent:)
+ forEventClass:kInternetEventClass andEventID:kAEGetURL];
}
#endif
// Register for Carbon tablet proximity events on the event monitor target.
@@ -1639,6 +1668,7 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
case kEventMouseDown: edesc = "MouseButtonPress"; break;
case kEventMouseUp: edesc = "MouseButtonRelease"; break;
case kEventMouseDragged: case kEventMouseMoved: edesc = "MouseMove"; break;
+ case kEventMouseScroll: edesc = "MouseWheelScroll"; break;
case kEventMouseWheelMoved: edesc = "MouseWheelMove"; break;
}
if(ekind == kEventMouseDown || ekind == kEventMouseUp)
@@ -1657,14 +1687,51 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
UInt32 mac_buttons = 0;
GetEventParameter(event, kEventParamMouseChord, typeUInt32, 0,
sizeof(mac_buttons), 0, &mac_buttons);
- buttons = qt_mac_get_buttons(mac_buttons);
- }
- int wheel_delta=0;
- if(ekind == kEventMouseWheelMoved) {
- int mdelt = 0;
- GetEventParameter(event, kEventParamMouseWheelDelta, typeSInt32, 0,
+ if (ekind != kEventMouseWheelMoved)
+ buttons = qt_mac_get_buttons(mac_buttons);
+ else
+ buttons = QApplication::mouseButtons();
+ }
+
+ int wheel_deltaX = 0;
+ int wheel_deltaY = 0;
+ static EventRef compatibilityEvent = 0;
+
+ if (ekind == kEventMouseScroll) {
+ // kEventMouseScroll is the new way of dealing with mouse wheel
+ // events (kEventMouseWheelMoved was the old). kEventMouseScroll results
+ // in much smoother scrolling when using Mighty Mouse or TrackPad. For
+ // compatibility with older applications, carbon will also send us
+ // kEventMouseWheelMoved events if we dont eat this event
+ // (actually two events; one for horizontal and one for vertical).
+ // As a results of this, and to make sure we dont't receive duplicate events,
+ // we try to detect when this happend by checking the 'compatibilityEvent'.
+ SInt32 mdelt = 0;
+ GetEventParameter(event, kEventParamMouseWheelSmoothHorizontalDelta, typeSInt32, 0,
+ sizeof(mdelt), 0, &mdelt);
+ wheel_deltaX = mdelt;
+ mdelt = 0;
+ GetEventParameter(event, kEventParamMouseWheelSmoothVerticalDelta, typeSInt32, 0,
sizeof(mdelt), 0, &mdelt);
- wheel_delta = mdelt * 120;
+ wheel_deltaY = mdelt;
+ GetEventParameter(event, kEventParamEventRef, typeEventRef, 0,
+ sizeof(compatibilityEvent), 0, &compatibilityEvent);
+ } else if (ekind == kEventMouseWheelMoved) {
+ if (event != compatibilityEvent) {
+ compatibilityEvent = 0;
+ int mdelt = 0;
+ GetEventParameter(event, kEventParamMouseWheelDelta, typeSInt32, 0,
+ sizeof(mdelt), 0, &mdelt);
+ EventMouseWheelAxis axis;
+ GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, 0,
+ sizeof(axis), 0, &axis);
+
+ // Remove acceleration, and use either -120 or 120 as delta:
+ if (axis == kEventMouseWheelAxisX)
+ wheel_deltaX = qBound(-120, int(mdelt * 10000), 120);
+ else
+ wheel_deltaY = qBound(-120, int(mdelt * 10000), 120);
+ }
}
Qt::MouseButton button = Qt::NoButton;
@@ -2054,20 +2121,29 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
qt_mac_dblclick.last_button = button;
qt_mac_dblclick.last_time = GetEventTime(event);
}
- if(wheel_delta) {
- EventMouseWheelAxis axis;
- GetEventParameter(event, kEventParamMouseWheelAxis, typeMouseWheelAxis, 0,
- sizeof(axis), 0, &axis);
- QWheelEvent qwe(plocal, p, wheel_delta, buttons, modifiers,
- axis == kEventMouseWheelAxisX ? Qt::Horizontal : Qt::Vertical);
- QApplication::sendSpontaneousEvent(widget, &qwe);
- if(!qwe.isAccepted() && QApplicationPrivate::focus_widget && QApplicationPrivate::focus_widget != widget) {
- QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(p), p,
- wheel_delta, buttons, modifiers,
- axis == kEventMouseWheelAxisX ? Qt::Horizontal : Qt::Vertical);
- QApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2);
- if(!qwe2.isAccepted())
- handled_event = false;
+
+ if (wheel_deltaX || wheel_deltaY) {
+ if (wheel_deltaX) {
+ QWheelEvent qwe(plocal, p, wheel_deltaX, buttons, modifiers, Qt::Horizontal);
+ QApplication::sendSpontaneousEvent(widget, &qwe);
+ if (!qwe.isAccepted() && QApplicationPrivate::focus_widget && QApplicationPrivate::focus_widget != widget) {
+ QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(p), p,
+ wheel_deltaX, buttons, modifiers, Qt::Horizontal);
+ QApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2);
+ if (!qwe2.isAccepted())
+ handled_event = false;
+ }
+ }
+ if (wheel_deltaY) {
+ QWheelEvent qwe(plocal, p, wheel_deltaY, buttons, modifiers, Qt::Vertical);
+ QApplication::sendSpontaneousEvent(widget, &qwe);
+ if (!qwe.isAccepted() && QApplicationPrivate::focus_widget && QApplicationPrivate::focus_widget != widget) {
+ QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(p), p,
+ wheel_deltaY, buttons, modifiers, Qt::Vertical);
+ QApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2);
+ if (!qwe2.isAccepted())
+ handled_event = false;
+ }
}
} else {
#ifdef QMAC_SPEAK_TO_ME
@@ -2130,7 +2206,7 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
plocal.x(), plocal.y(), event_desc, (QWidget*)widget,
widget ? widget->objectName().toLocal8Bit().constData() : "*Unknown*",
widget ? widget->metaObject()->className() : "*Unknown*",
- button, (int)buttons, (int)modifiers, wheel_delta);
+ button, (int)buttons, (int)modifiers, wheel_deltaX);
#endif
} else {
handled_event = false;
@@ -2376,7 +2452,7 @@ OSStatus QApplicationPrivate::globalAppleEventProcessor(const AppleEvent *ae, Ap
switch(aeID) {
case kAEQuitApplication: {
extern bool qt_mac_quit_menu_item_enabled; // qmenu_mac.cpp
- if(!QApplicationPrivate::modalState() && qt_mac_quit_menu_item_enabled) {
+ if (qt_mac_quit_menu_item_enabled) {
QCloseEvent ev;
QApplication::sendSpontaneousEvent(app, &ev);
if(ev.isAccepted()) {
@@ -2410,6 +2486,22 @@ OSStatus QApplicationPrivate::globalAppleEventProcessor(const AppleEvent *ae, Ap
default:
break;
}
+ } else if (aeClass == kInternetEventClass) {
+ switch (aeID) {
+ case kAEGetURL: {
+ char urlData[1024];
+ Size actualSize;
+ if (AEGetParamPtr(ae, keyDirectObject, typeChar, 0, urlData,
+ sizeof(urlData) - 1, &actualSize) == noErr) {
+ urlData[actualSize] = 0;
+ QFileOpenEvent ev(QUrl(QString::fromUtf8(urlData)));
+ QApplication::sendSpontaneousEvent(app, &ev);
+ }
+ break;
+ }
+ default:
+ break;
+ }
}
#ifdef DEBUG_EVENTS
qDebug("Qt: internal: %shandled Apple event! %c%c%c%c %c%c%c%c", handled_event ? "(*)" : "",
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 5d409f47b..14d721500 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -71,6 +71,9 @@
#include "QtGui/qscreen_qws.h"
#include <private/qgraphicssystem_qws_p.h>
#endif
+#ifdef Q_OS_SYMBIAN
+#include <w32std.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -80,7 +83,6 @@ class QGraphicsSystem;
class QInputContext;
class QObject;
class QWidget;
-class QGestureManager;
class QSocketNotifier;
extern bool qt_is_gui_used;
@@ -100,6 +102,7 @@ extern QSysInfo::MacVersion qt_macver;
#if defined(Q_WS_QWS)
class QWSManager;
class QDirectPainter;
+struct QWSServerCleaner { ~QWSServerCleaner(); };
#endif
#ifndef QT_NO_TABLET
@@ -248,18 +251,18 @@ typedef struct tagGESTURECONFIG
#endif // WM_GESTURE
-#endif // Q_WS_WIN
-
-class QPanGesture;
-class QPinchGesture;
-struct QStandardGestures
-{
- QPanGesture *pan;
- QPinchGesture *pinch;
-
- QStandardGestures() : pan(0), pinch(0) { }
-};
+#if defined(Q_WS_WINCE_WM) && defined(QT_WINCE_GESTURES)
+#undef GID_ZOOM
+#define GID_ZOOM 0xf000
+#undef GID_ROTATE
+#define GID_ROTATE 0xf001
+#undef GID_TWOFINGERTAP
+#define GID_TWOFINGERTAP 0xf002
+#undef GID_ROLLOVER
+#define GID_ROLLOVER 0xf003
+#endif
+#endif // Q_WS_WIN
class QScopedLoopLevelCounter
{
@@ -287,7 +290,6 @@ public:
#if defined(Q_WS_X11)
#ifndef QT_NO_SETTINGS
- static QString x11_desktop_style();
static bool x11_apply_settings();
#endif
static void reset_instance_pointer();
@@ -299,8 +301,8 @@ public:
static void emitLastWindowClosed();
#ifdef Q_WS_WINCE
static int autoMaximizeThreshold;
- static bool autoSipEnabled;
#endif
+ static bool autoSipEnabled;
static QString desktopStyleKey();
static QGraphicsSystem *graphicsSystem()
@@ -312,7 +314,6 @@ public:
void createEventDispatcher();
QString appName() const;
-
static void dispatchEnterLeave(QWidget *enter, QWidget *leave);
//modality
@@ -349,6 +350,7 @@ public:
KB_KDE = 8,
KB_Gnome = 16,
KB_CDE = 32,
+ KB_S60 = 64,
KB_All = 0xffff
};
@@ -434,12 +436,10 @@ public:
static bool fade_tooltip;
static bool animate_toolbox;
static bool widgetCount; // Coupled with -widgetcount switch
+ static bool load_testability; // Coupled with -testability switch
#ifdef Q_WS_MAC
static bool native_modal_dialog_active;
#endif
-#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
- static bool inSizeMove;
-#endif
static void setSystemPalette(const QPalette &pal);
static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash);
@@ -461,6 +461,7 @@ public:
#ifdef Q_WS_QWS
QPointer<QWSManager> last_manager;
+ QWSServerCleaner qwsServerCleaner;
# ifndef QT_NO_DIRECTPAINTER
QMap<WId, QDirectPainter *> *directPainters;
# endif
@@ -476,8 +477,8 @@ public:
static int app_compile_version;
#ifdef QT_KEYPAD_NAVIGATION
- static bool keypadNavigation;
static QWidget *oldEditFocus;
+ static Qt::NavigationMode navigationMode;
#endif
#if defined(Q_WS_MAC) || defined(Q_WS_X11)
@@ -494,11 +495,23 @@ public:
static bool sendMouseEvent(QWidget *receiver, QMouseEvent *event, QWidget *alienWidget,
QWidget *native, QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver,
bool spontaneous = true);
-#if defined(Q_WS_WIN) || defined(Q_WS_X11)
+#ifdef Q_OS_SYMBIAN
+ static void setNavigationMode(Qt::NavigationMode mode);
+ static TUint resolveS60ScanCode(TInt scanCode, TUint keysym);
+ QSet<WId> nativeWindows;
+
+ int symbianProcessWsEvent(const TWsEvent *event);
+ int symbianHandleCommand(int command);
+ int symbianResourceChange(int type);
+
+#endif
+#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS)
void sendSyntheticEnterLeave(QWidget *widget);
#endif
- QMap<int, QWidget *> widgetForTouchPointId;
+ QWidget *gestureWidget;
+
+ QMap<int, QWeakPointer<QWidget> > widgetForTouchPointId;
QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints;
static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent);
void initializeMultitouch();
@@ -512,9 +525,6 @@ public:
QTouchEvent::DeviceType deviceType,
const QList<QTouchEvent::TouchPoint> &touchPoints);
- typedef QMap<QWidget*, QStandardGestures> WidgetStandardGesturesMap;
- WidgetStandardGesturesMap widgetGestures;
-
#if defined(Q_WS_WIN)
static PtrRegisterTouchWindow RegisterTouchWindow;
static PtrGetTouchInputInfo GetTouchInputInfo;
@@ -551,23 +561,44 @@ public:
void _q_readRX71MultiTouchEvents();
#endif
+#if defined(Q_WS_S60)
+ int maxTouchPressure;
+ QList<QTouchEvent::TouchPoint> appAllTouchPoints;
+#endif
+
private:
#ifdef Q_WS_QWS
QMap<const QScreen*, QRect> maxWindowRects;
#endif
+#ifdef Q_OS_SYMBIAN
+ static QHash<TInt, TUint> scanCodeCache;
+#endif
+
static QApplicationPrivate *self;
static void giveFocusAccordingToFocusPolicy(QWidget *w,
Qt::FocusPolicy focusPolicy,
Qt::FocusReason focusReason);
static bool shouldSetFocus(QWidget *w, Qt::FocusPolicy policy);
+
+
+ static bool isAlien(QWidget *);
};
Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window,
QTouchEvent::DeviceType deviceType,
const QList<QTouchEvent::TouchPoint> &touchPoints);
+#if defined(Q_WS_WIN)
+ extern void qt_win_set_cursor(QWidget *, bool);
+#elif defined(Q_WS_X11)
+ extern void qt_x11_enforce_cursor(QWidget *, bool);
+ extern void qt_x11_enforce_cursor(QWidget *);
+#elif defined(Q_OS_SYMBIAN)
+ extern void qt_symbian_set_cursor(QWidget *, bool);
+#endif
+
QT_END_NAMESPACE
#endif // QAPPLICATION_P_H
diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp
index f7b7173ab..167beb2ab 100644
--- a/src/gui/kernel/qapplication_qws.cpp
+++ b/src/gui/kernel/qapplication_qws.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -72,6 +72,7 @@
//#include "qwsregionmanager_qws.h"
#include "qwindowsystem_qws.h"
#include "private/qwindowsystem_p.h"
+#include "qdecorationfactory_qws.h"
#include "qwsdisplay_qws.h"
#include "private/qwsdisplay_qws_p.h"
@@ -109,6 +110,8 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <qvfbhdr.h>
+
#ifndef QT_NO_QWS_MULTIPROCESS
#ifdef QT_NO_QSHM
#include <sys/ipc.h>
@@ -122,6 +125,8 @@
#endif
#endif
+QT_BEGIN_NAMESPACE
+
#ifndef QT_NO_DIRECTPAINTER
class QDirectPainter;
extern void qt_directpainter_region(QDirectPainter *dp, const QRegion &alloc, int type);
@@ -161,11 +166,9 @@ int qt_servershmid = -1;
bool qws_overrideCursor = false;
#ifndef QT_NO_QWS_MANAGER
-#include "qdecorationfactory_qws.h"
-QT_BEGIN_NAMESPACE
+extern Q_GUI_EXPORT QWSServer *qwsServer;
-QT_USE_NAMESPACE
static QDecoration *qws_decoration = 0;
#endif
@@ -198,14 +201,9 @@ QString qws_dataDir()
static QString result;
if (!result.isEmpty())
return result;
- QByteArray dataDir;
-#ifdef QT_QWS_TEMP_DIR
- dataDir = QT_QWS_TEMP_DIR;
-#else
- dataDir = "/tmp";
-#endif
- dataDir += "/qtembedded-";
- dataDir += QByteArray::number(qws_display_id);
+ result = QT_VFB_DATADIR(qws_display_id);
+ QByteArray dataDir = result.toLocal8Bit();
+
if (QT_MKDIR(dataDir, 0700)) {
if (errno != EEXIST) {
qFatal("Cannot create Qt for Embedded Linux data directory: %s", dataDir.constData());
@@ -226,16 +224,16 @@ QString qws_dataDir()
if ((buf.st_mode & 0677) != 0600)
qFatal("Qt for Embedded Linux data directory has incorrect permissions: %s", dataDir.constData());
#endif
- dataDir += '/';
- result = QString::fromLocal8Bit(dataDir);
+ result.append("/");
return result;
}
// Get the filename of the pipe Qt for Embedded Linux uses for server/client comms
Q_GUI_EXPORT QString qws_qtePipeFilename()
{
- return (qws_dataDir() + QString::fromLatin1(QTE_PIPE).arg(qws_display_id));
+ qws_dataDir();
+ return QTE_PIPE(qws_display_id);
}
static void setMaxWindowRect(const QRect &rect)
@@ -429,6 +427,7 @@ static QWidget *popupOfPopupButtonFocus = 0;
static bool popupCloseDownMode = false;
static bool popupGrabOk;
static QPointer<QWidget> *mouseInWidget = 0;
+QPointer<QWidget> qt_last_mouse_receiver = 0;
static bool sm_blockUserInput = false; // session management
@@ -496,8 +495,13 @@ QList<QWSCommand*> *qt_get_server_queue()
void qt_server_enqueue(const QWSCommand *command)
{
QWSCommand *copy = QWSCommand::factory(command->type);
- copy->copyFrom(command);
- outgoing.append(copy);
+ QT_TRY {
+ copy->copyFrom(command);
+ outgoing.append(copy);
+ } QT_CATCH(...) {
+ delete copy;
+ QT_RETHROW;
+ }
}
QWSDisplay::Data::Data(QObject* parent, bool singleProcess)
@@ -673,7 +677,7 @@ void QWSDisplay::Data::sendSynchronousCommand(QWSCommand & cmd)
int QWSDisplay::Data::takeId()
{
int unusedIdCount = unused_identifiers.count();
- if (unusedIdCount == 10)
+ if (unusedIdCount <= 10)
create(15);
if (unusedIdCount == 0) {
create(1); // Make sure we have an incoming id to wait for, just in case we're recursive
@@ -2196,6 +2200,8 @@ void qt_init(QApplicationPrivate *priv, int type)
mouse_double_click_distance = read_int_env_var("QWS_DBLCLICK_DISTANCE", 5);
+ priv->inputContext = 0;
+
int flags = 0;
char *p;
int argc = priv->argc;
@@ -2311,7 +2317,7 @@ void qt_init(QApplicationPrivate *priv, int type)
qws_decoration = QApplication::qwsSetDecoration(decoration);
#endif // QT_NO_QWS_MANAGER
#ifndef QT_NO_QWS_INPUTMETHODS
- qApp->setInputContext(new QWSInputContext);
+ qApp->setInputContext(new QWSInputContext(qApp));
#endif
}
@@ -2355,6 +2361,11 @@ void qt_cleanup()
delete mouseInWidget;
mouseInWidget = 0;
+
+#if !defined(QT_NO_IM)
+ delete QApplicationPrivate::inputContext;
+ QApplicationPrivate::inputContext = 0;
+#endif
}
@@ -2364,7 +2375,7 @@ void qt_cleanup()
QString QApplicationPrivate::appName() const // get application name
{
- return ::appName;
+ return QT_PREPEND_NAMESPACE(appName);
}
/*****************************************************************************
@@ -3510,10 +3521,12 @@ bool QETWidget::translateMouseEvent(const QWSMouseEvent *event, int prevstate)
if (widget != (*mouseInWidget)) {
QApplicationPrivate::dispatchEnterLeave(widget, *mouseInWidget);
(*mouseInWidget) = widget;
+ qt_last_mouse_receiver = widget;
}
QApplication::sendSpontaneousEvent(widget, &e);
if (leaveAfterRelease && !QWidget::mouseGrabber()) {
*mouseInWidget = QApplication::widgetAt(globalPos);
+ qt_last_mouse_receiver = *mouseInWidget;
QApplicationPrivate::dispatchEnterLeave(*mouseInWidget, leaveAfterRelease);
leaveAfterRelease = 0;
}
@@ -3558,10 +3571,10 @@ bool QETWidget::translateKeyEvent(const QWSKeyEvent *event, bool grab) /* grab i
#if defined QT3_SUPPORT && !defined(QT_NO_SHORTCUT)
if (type == QEvent::KeyPress && !grab
- && static_cast<QApplicationPrivate*>(qApp->d_ptr)->use_compat()) {
+ && static_cast<QApplicationPrivate*>(qApp->d_ptr.data())->use_compat()) {
// send accel events if the keyboard is not grabbed
QKeyEvent a(type, code, state, text, autor, int(text.length()));
- if (static_cast<QApplicationPrivate*>(qApp->d_ptr)->qt_tryAccelEvent(this, &a))
+ if (static_cast<QApplicationPrivate*>(qApp->d_ptr.data())->qt_tryAccelEvent(this, &a))
return true;
}
#else
@@ -3766,4 +3779,14 @@ void QApplicationPrivate::initializeMultitouch_sys()
void QApplicationPrivate::cleanupMultitouch_sys()
{ }
+/* \internal
+ This is used to clean up the qws server
+ in case the QApplication constructor threw an exception
+*/
+QWSServerCleaner::~QWSServerCleaner()
+{
+ if (qwsServer && qws_single_process)
+ QWSServer::closedown();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
new file mode 100644
index 000000000..ab57c329a
--- /dev/null
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -0,0 +1,1926 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qapplication_p.h"
+#include "qsessionmanager.h"
+#include "qevent.h"
+#include "qsymbianevent.h"
+#include "qeventdispatcher_s60_p.h"
+#include "qwidget.h"
+#include "qdesktopwidget.h"
+#include "private/qbackingstore_p.h"
+#include "qt_s60_p.h"
+#include "private/qevent_p.h"
+#include "qstring.h"
+#include "qdebug.h"
+#include "qimage.h"
+#include "private/qkeymapper_p.h"
+#include "private/qfont_p.h"
+#ifndef QT_NO_STYLE_S60
+#include "private/qs60style_p.h"
+#endif
+#include "private/qwindowsurface_s60_p.h"
+#include "qpaintengine.h"
+#include "private/qmenubar_p.h"
+#include "private/qsoftkeymanager_p.h"
+
+#include "apgwgnam.h" // For CApaWindowGroupName
+#include <MdaAudioTonePlayer.h> // For CMdaAudioToneUtility
+
+#if defined(Q_WS_S60)
+# if !defined(QT_NO_IM)
+# include "qinputcontext.h"
+# include <private/qcoefepinputcontext_p.h>
+# endif
+# include <private/qs60mainapplication_p.h>
+#endif
+
+#include "private/qstylesheetstyle_p.h"
+
+#include <hal.h>
+#include <hal_data.h>
+
+QT_BEGIN_NAMESPACE
+
+#if defined(QT_DEBUG)
+static bool appNoGrab = false; // Grabbing enabled
+#endif
+static bool app_do_modal = false; // modal mode
+Q_GLOBAL_STATIC(QS60Data, qt_s60Data);
+
+extern bool qt_sendSpontaneousEvent(QObject*,QEvent*);
+extern QWidgetList *qt_modal_stack; // stack of modal widgets
+extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
+
+QWidget *qt_button_down = 0; // widget got last button-down
+
+QSymbianControl *QSymbianControl::lastFocusedControl = 0;
+
+QS60Data* qGlobalS60Data()
+{
+ return qt_s60Data();
+}
+
+bool qt_nograb() // application no-grab option
+{
+#if defined(QT_DEBUG)
+ return appNoGrab;
+#else
+ return false;
+#endif
+}
+
+// Modified from http://www3.symbian.com/faq.nsf/0/0F1464EE96E737E780256D5E00503DD1?OpenDocument
+class QS60Beep : public CBase, public MMdaAudioToneObserver
+{
+public:
+ static QS60Beep* NewL(TInt aFrequency, TTimeIntervalMicroSeconds iDuration);
+ void Play();
+ ~QS60Beep();
+private:
+ void ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds iDuration);
+ void MatoPrepareComplete(TInt aError);
+ void MatoPlayComplete(TInt aError);
+private:
+ typedef enum
+ {
+ EBeepNotPrepared,
+ EBeepPrepared,
+ EBeepPlaying
+ } TBeepState;
+private:
+ CMdaAudioToneUtility* iToneUtil;
+ TBeepState iState;
+ TInt iFrequency;
+ TTimeIntervalMicroSeconds iDuration;
+};
+
+static QS60Beep* qt_S60Beep = 0;
+
+QS60Beep::~QS60Beep()
+{
+ if (iToneUtil) {
+ switch (iState) {
+ case EBeepPlaying:
+ iToneUtil->CancelPlay();
+ break;
+ case EBeepNotPrepared:
+ iToneUtil->CancelPrepare();
+ break;
+ }
+ }
+ delete iToneUtil;
+}
+
+QS60Beep* QS60Beep::NewL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
+{
+ QS60Beep* self = new (ELeave) QS60Beep();
+ CleanupStack::PushL(self);
+ self->ConstructL(aFrequency, aDuration);
+ CleanupStack::Pop();
+ return self;
+}
+
+void QS60Beep::ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
+{
+ iToneUtil = CMdaAudioToneUtility::NewL(*this);
+ iState = EBeepNotPrepared;
+ iFrequency = aFrequency;
+ iDuration = aDuration;
+ iToneUtil->PrepareToPlayTone(iFrequency, iDuration);
+}
+
+void QS60Beep::Play()
+{
+ if (iState == EBeepPlaying) {
+ iToneUtil->CancelPlay();
+ iState = EBeepPrepared;
+ }
+
+ iToneUtil->Play();
+ iState = EBeepPlaying;
+}
+
+void QS60Beep::MatoPrepareComplete(TInt aError)
+{
+ if (aError == KErrNone) {
+ iState = EBeepPrepared;
+ Play();
+ }
+}
+
+void QS60Beep::MatoPlayComplete(TInt aError)
+{
+ Q_UNUSED(aError);
+ iState = EBeepPrepared;
+}
+
+
+QHash<TInt, TUint> QApplicationPrivate::scanCodeCache;
+
+static Qt::KeyboardModifiers mapToQtModifiers(TUint s60Modifiers)
+{
+ Qt::KeyboardModifiers result = Qt::NoModifier;
+
+ if (s60Modifiers & EModifierKeypad)
+ result |= Qt::KeypadModifier;
+ if (s60Modifiers & EModifierShift || s60Modifiers & EModifierLeftShift
+ || s60Modifiers & EModifierRightShift)
+ result |= Qt::ShiftModifier;
+ if (s60Modifiers & EModifierCtrl || s60Modifiers & EModifierLeftCtrl
+ || s60Modifiers & EModifierRightCtrl)
+ result |= Qt::ControlModifier;
+ if (s60Modifiers & EModifierAlt || s60Modifiers & EModifierLeftAlt
+ || s60Modifiers & EModifierRightAlt)
+ result |= Qt::AltModifier;
+
+ return result;
+}
+
+static void mapS60MouseEventTypeToQt(QEvent::Type *type, Qt::MouseButton *button, const TPointerEvent *pEvent)
+{
+ switch (pEvent->iType) {
+ case TPointerEvent::EButton1Down:
+ *type = QEvent::MouseButtonPress;
+ *button = Qt::LeftButton;
+ break;
+ case TPointerEvent::EButton1Up:
+ *type = QEvent::MouseButtonRelease;
+ *button = Qt::LeftButton;
+ break;
+ case TPointerEvent::EButton2Down:
+ *type = QEvent::MouseButtonPress;
+ *button = Qt::MidButton;
+ break;
+ case TPointerEvent::EButton2Up:
+ *type = QEvent::MouseButtonRelease;
+ *button = Qt::MidButton;
+ break;
+ case TPointerEvent::EButton3Down:
+ *type = QEvent::MouseButtonPress;
+ *button = Qt::RightButton;
+ break;
+ case TPointerEvent::EButton3Up:
+ *type = QEvent::MouseButtonRelease;
+ *button = Qt::RightButton;
+ break;
+ case TPointerEvent::EDrag:
+ *type = QEvent::MouseMove;
+ *button = Qt::NoButton;
+ break;
+ case TPointerEvent::EMove:
+ // Qt makes no distinction between move and drag
+ *type = QEvent::MouseMove;
+ *button = Qt::NoButton;
+ break;
+ default:
+ *type = QEvent::None;
+ *button = Qt::NoButton;
+ break;
+ }
+ if (pEvent->iModifiers & EModifierDoubleClick){
+ *type = QEvent::MouseButtonDblClick;
+ }
+
+ if (*type == QEvent::MouseButtonPress || *type == QEvent::MouseButtonDblClick)
+ QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons | (*button);
+ else if (*type == QEvent::MouseButtonRelease)
+ QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons &(~(*button));
+
+ QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons & Qt::MouseButtonMask;
+}
+
+//### Can be replaced with CAknLongTapDetector if animation is required.
+//NOTE: if CAknLongTapDetector is used make sure it gets variated out of 3.1 and 3.2,.
+//also MLongTapObserver needs to be changed to MAknLongTapDetectorCallBack if CAknLongTapDetector is used.
+class QLongTapTimer : public CTimer
+{
+public:
+ static QLongTapTimer* NewL(QAbstractLongTapObserver *observer);
+ QLongTapTimer(QAbstractLongTapObserver *observer);
+ void ConstructL();
+public:
+ void PointerEventL(const TPointerEvent &event);
+ void RunL();
+protected:
+private:
+ QAbstractLongTapObserver *m_observer;
+ TPointerEvent m_event;
+ QPoint m_pressedCoordinates;
+ int m_dragDistance;
+};
+
+QLongTapTimer* QLongTapTimer::NewL(QAbstractLongTapObserver *observer)
+{
+ QLongTapTimer* self = new QLongTapTimer(observer);
+ self->ConstructL();
+ return self;
+}
+void QLongTapTimer::ConstructL()
+{
+ CTimer::ConstructL();
+}
+
+QLongTapTimer::QLongTapTimer(QAbstractLongTapObserver *observer):CTimer(CActive::EPriorityHigh)
+{
+ m_observer = observer;
+ m_dragDistance = qApp->startDragDistance();
+ CActiveScheduler::Add(this);
+}
+
+void QLongTapTimer::PointerEventL(const TPointerEvent& event)
+{
+ if ( event.iType == TPointerEvent::EDrag || event.iType == TPointerEvent::EButtonRepeat)
+ {
+ QPoint diff(QPoint(event.iPosition.iX,event.iPosition.iY) - m_pressedCoordinates);
+ if (diff.manhattanLength() < m_dragDistance)
+ return;
+ }
+ Cancel();
+ m_event = event;
+ if (event.iType == TPointerEvent::EButton1Down)
+ {
+ m_pressedCoordinates = QPoint(event.iPosition.iX,event.iPosition.iY);
+ // must be same as KLongTapDelay in aknlongtapdetector.h
+ After(800000);
+ }
+}
+void QLongTapTimer::RunL()
+{
+ if (m_observer)
+ m_observer->HandleLongTapEventL(m_event.iPosition, m_event.iParentPosition);
+}
+
+QSymbianControl::QSymbianControl(QWidget *w)
+ : CCoeControl()
+ , qwidget(w)
+ , m_longTapDetector(0)
+ , m_ignoreFocusChanged(0)
+ , m_symbianPopupIsOpen(0)
+{
+}
+
+void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop)
+{
+ if (!desktop)
+ {
+ if (isWindowOwning or !qwidget->parentWidget())
+ CreateWindowL(S60->windowGroup());
+ else
+ /**
+ * TODO: in order to avoid creating windows for all ancestors of
+ * this widget up to the root window, the parameter passed to
+ * CreateWindowL should be
+ * qwidget->parentWidget()->effectiveWinId(). However, if we do
+ * this, then we need to take care of re-parenting when a window
+ * is created for a widget between this one and the root window.
+ */
+ CreateWindowL(qwidget->parentWidget()->winId());
+
+ // Necessary in order to be able to track the activation status of
+ // the control's window
+ qwidget->d_func()->createExtra();
+
+ SetFocusing(true);
+ m_longTapDetector = QLongTapTimer::NewL(this);
+ }
+}
+
+QSymbianControl::~QSymbianControl()
+{
+ if (S60->curWin == this)
+ S60->curWin = 0;
+ if (!QApplicationPrivate::is_app_closing)
+ setFocusSafely(false);
+ S60->appUi()->RemoveFromStack(this);
+ delete m_longTapDetector;
+}
+
+void QSymbianControl::setWidget(QWidget *w)
+{
+ qwidget = w;
+}
+void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation )
+{
+ QWidget *alienWidget;
+ QPoint widgetPos = QPoint(aPenEventLocation.iX, aPenEventLocation.iY);
+ QPoint globalPos = QPoint(aPenEventScreenLocation.iX,aPenEventScreenLocation.iY);
+ alienWidget = qwidget->childAt(widgetPos);
+ if (!alienWidget)
+ alienWidget = qwidget;
+
+#if !defined(QT_NO_CONTEXTMENU)
+ QContextMenuEvent contextMenuEvent(QContextMenuEvent::Mouse, widgetPos, globalPos, Qt::NoModifier);
+ qt_sendSpontaneousEvent(alienWidget, &contextMenuEvent);
+#endif
+}
+
+#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
+void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent *event)
+{
+ QApplicationPrivate *d = QApplicationPrivate::instance();
+
+ QRect screenGeometry = qApp->desktop()->screenGeometry(qwidget);
+
+ while (d->appAllTouchPoints.count() <= event->PointerNumber())
+ d->appAllTouchPoints.append(QTouchEvent::TouchPoint(d->appAllTouchPoints.count()));
+
+ Qt::TouchPointStates allStates = 0;
+ for (int i = 0; i < d->appAllTouchPoints.count(); ++i) {
+ QTouchEvent::TouchPoint &touchPoint = d->appAllTouchPoints[i];
+
+ if (touchPoint.id() == event->PointerNumber()) {
+ Qt::TouchPointStates state;
+ switch (event->iType) {
+ case TPointerEvent::EButton1Down:
+ case TPointerEvent::EEnterHighPressure:
+ state = Qt::TouchPointPressed;
+ break;
+ case TPointerEvent::EButton1Up:
+ case TPointerEvent::EExitCloseProximity:
+ state = Qt::TouchPointReleased;
+ break;
+ case TPointerEvent::EDrag:
+ state = Qt::TouchPointMoved;
+ break;
+ default:
+ // how likely is this to happen?
+ state = Qt::TouchPointStationary;
+ break;
+ }
+ if (event->PointerNumber() == 0)
+ state |= Qt::TouchPointPrimary;
+ touchPoint.setState(state);
+
+ QPointF screenPos = QPointF(event->iPosition.iX, event->iPosition.iY);
+ touchPoint.setScreenPos(screenPos);
+ touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(),
+ screenPos.y() / screenGeometry.height()));
+
+ touchPoint.setPressure(event->Pressure() / qreal(d->maxTouchPressure));
+ } else if (touchPoint.state() != Qt::TouchPointReleased) {
+ // all other active touch points should be marked as stationary
+ touchPoint.setState(Qt::TouchPointStationary);
+ }
+
+ allStates |= touchPoint.state();
+ }
+
+ if ((allStates & Qt::TouchPointStateMask) == Qt::TouchPointReleased) {
+ // all touch points released
+ d->appAllTouchPoints.clear();
+ }
+
+ QApplicationPrivate::translateRawTouchEvent(qwidget,
+ QTouchEvent::TouchScreen,
+ d->appAllTouchPoints);
+}
+#endif
+
+void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent)
+{
+#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
+ if (pEvent.IsAdvancedPointerEvent()) {
+ const TAdvancedPointerEvent *advancedPointerEvent = pEvent.AdvancedPointerEvent();
+ translateAdvancedPointerEvent(advancedPointerEvent);
+ if (advancedPointerEvent->PointerNumber() != 0) {
+ // only send mouse events for the first touch point
+ return;
+ }
+ }
+#endif
+
+ m_longTapDetector->PointerEventL(pEvent);
+ QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent));
+}
+
+typedef QPair<QWidget*,QMouseEvent> Event;
+
+/*
+ * Helper function called by HandlePointerEvent - separated to keep that function readable
+ */
+static void generateEnterLeaveEvents(QList<Event> &events, QWidget *widgetUnderPointer,
+ QPoint globalPos, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
+{
+ //moved to another widget, create enter and leave events
+ if (S60->lastPointerEventTarget) {
+ QMouseEvent mEventLeave(QEvent::Leave, S60->lastPointerEventTarget->mapFromGlobal(
+ S60->lastCursorPos), S60->lastCursorPos, button, QApplicationPrivate::mouse_buttons,
+ modifiers);
+ events.append(Event(S60->lastPointerEventTarget, mEventLeave));
+ }
+ if (widgetUnderPointer) {
+ QMouseEvent mEventEnter(QEvent::Enter, widgetUnderPointer->mapFromGlobal(globalPos),
+ globalPos, button, QApplicationPrivate::mouse_buttons, modifiers);
+
+ events.append(Event(widgetUnderPointer, mEventEnter));
+#ifndef QT_NO_CURSOR
+ S60->curWin = widgetUnderPointer->effectiveWinId();
+ if (!QApplication::overrideCursor()) {
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ if (S60->brokenPointerCursors)
+ qt_symbian_set_pointer_sprite(widgetUnderPointer->cursor());
+ else
+#endif
+ qt_symbian_setWindowCursor(widgetUnderPointer->cursor(), S60->curWin);
+ }
+#endif
+ }
+}
+
+
+void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
+{
+ QMouseEvent::Type type;
+ Qt::MouseButton button;
+ mapS60MouseEventTypeToQt(&type, &button, &pEvent);
+ Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers);
+
+ if (type == QMouseEvent::None)
+ return;
+
+ // store events for later sending/saving
+ QList<Event > events;
+
+ QPoint widgetPos = QPoint(pEvent.iPosition.iX, pEvent.iPosition.iY);
+ TPoint controlScreenPos = PositionRelativeToScreen();
+ QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos;
+
+ // widgets interested in the event
+ QWidget *widgetUnderPointer = qwidget->childAt(widgetPos);
+ if (!widgetUnderPointer)
+ widgetUnderPointer = qwidget; //i.e. this container widget
+
+ QWidget *widgetWithMouseGrab = QWidget::mouseGrabber();
+
+ // handle auto grab of pointer when pressing / releasing
+ if (!widgetWithMouseGrab && type == QEvent::MouseButtonPress) {
+ //if previously auto-grabbed, generate a fake mouse release (platform bug: mouse release event was lost)
+ if (S60->mousePressTarget) {
+ QMouseEvent mEvent(QEvent::MouseButtonRelease, S60->mousePressTarget->mapFromGlobal(globalPos), globalPos,
+ button, QApplicationPrivate::mouse_buttons, modifiers);
+ events.append(Event(S60->mousePressTarget,mEvent));
+ }
+ //auto grab the mouse
+ widgetWithMouseGrab = S60->mousePressTarget = widgetUnderPointer;
+ widgetWithMouseGrab->grabMouse();
+ }
+ if (widgetWithMouseGrab && widgetWithMouseGrab == S60->mousePressTarget && type == QEvent::MouseButtonRelease) {
+ //release the auto grab - note this release event still goes to the autograb widget
+ S60->mousePressTarget = 0;
+ widgetWithMouseGrab->releaseMouse();
+ }
+
+ QWidget *widgetToReceiveMouseEvent;
+ if (widgetWithMouseGrab)
+ widgetToReceiveMouseEvent = widgetWithMouseGrab;
+ else
+ widgetToReceiveMouseEvent = widgetUnderPointer;
+
+ //queue QEvent::Enter and QEvent::Leave, if the pointer has moved
+ if (widgetUnderPointer != S60->lastPointerEventTarget && (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove))
+ generateEnterLeaveEvents(events, widgetUnderPointer, globalPos, button, modifiers);
+
+ //save global state
+ S60->lastCursorPos = globalPos;
+ S60->lastPointerEventPos = widgetPos;
+ S60->lastPointerEventTarget = widgetUnderPointer;
+
+#if !defined(QT_NO_CURSOR) && !defined(Q_SYMBIAN_FIXED_POINTER_CURSORS)
+ if (S60->brokenPointerCursors)
+ qt_symbian_move_cursor_sprite();
+#endif
+
+ //queue this event.
+ Q_ASSERT(widgetToReceiveMouseEvent);
+ QMouseEvent mEvent(type, widgetToReceiveMouseEvent->mapFromGlobal(globalPos), globalPos,
+ button, QApplicationPrivate::mouse_buttons, modifiers);
+ events.append(Event(widgetToReceiveMouseEvent,mEvent));
+ QEventDispatcherS60 *dispatcher;
+ // It is theoretically possible for someone to install a different event dispatcher.
+ if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(widgetToReceiveMouseEvent->d_func()->threadData->eventDispatcher)) != 0) {
+ if (dispatcher->excludeUserInputEvents()) {
+ for (int i=0;i < events.count();++i)
+ {
+ Event next = events[i];
+ dispatcher->saveInputEvent(this, next.first, new QMouseEvent(next.second));
+ }
+ return;
+ }
+ }
+
+ //send events in the queue
+ for (int i=0;i < events.count();++i)
+ {
+ Event next = events[i];
+ sendMouseEvent(next.first, &(next.second));
+ }
+}
+
+bool QSymbianControl::sendMouseEvent(QWidget *widget, QMouseEvent *mEvent)
+{
+ return qt_sendSpontaneousEvent(widget, mEvent);
+}
+
+TKeyResponse QSymbianControl::OfferKeyEventL(const TKeyEvent& keyEvent, TEventCode type)
+{
+ TKeyResponse r = EKeyWasNotConsumed;
+ QT_TRYCATCH_LEAVING(r = OfferKeyEvent(keyEvent, type));
+ return r;
+}
+
+TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCode type)
+{
+ switch (type) {
+ //case EEventKeyDown: // <-- Intentionally left out. See below.
+ case EEventKeyUp:
+ case EEventKey:
+ {
+ // S60 has a confusing way of delivering key events. There are three types of
+ // events: EKeyEvent, EKeyEventDown and EKeyEventUp. When a key is pressed, the
+ // two first events are generated. When releasing the key, the last one is
+ // generated.
+ // Because S60 does not generate keysyms for EKeyEventDown and EKeyEventUp events,
+ // we need to do some special tricks to map it to the Qt way. First, we completely
+ // discard EKeyEventDown events, since they are redundant. Second, since
+ // EKeyEventUp does not give us a keysym, we need to cache the keysyms from
+ // the EKeyEvent events. This is what resolveS60ScanCode does.
+
+
+ // ### hackish way to send Qt application to background when pressing right softkey
+ /*
+ if( keyEvent.iScanCode == EStdKeyDevice1 ) {
+ S60->window_group->SetOrdinalPosition(-1);
+ qApp->setActiveWindow(0);
+ return EKeyWasNotConsumed;
+ }
+ */
+
+ TUint s60Keysym = QApplicationPrivate::resolveS60ScanCode(keyEvent.iScanCode,
+ keyEvent.iCode);
+ int keyCode;
+ if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) {
+ // Normal characters keys.
+ keyCode = s60Keysym;
+ } else {
+ // Special S60 keys.
+ keyCode = qt_keymapper_private()->mapS60KeyToQt(s60Keysym);
+ }
+
+#ifndef QT_NO_CURSOR
+ if (S60->mouseInteractionEnabled && S60->virtualMouseRequired) {
+ //translate keys to pointer
+ if (keyCode >= Qt::Key_Left && keyCode <= Qt::Key_Down || keyCode == Qt::Key_Select) {
+ /*Explanation about virtualMouseAccel:
+ Tapping an arrow key allows precise pixel positioning
+ Holding an arrow key down, acceleration is applied to allow cursor
+ to be quickly moved to another part of the screen by key repeats.
+ */
+ if (S60->virtualMouseLastKey == keyCode) {
+ S60->virtualMouseAccel *= 2;
+ if (S60->virtualMouseAccel > S60->virtualMouseMaxAccel)
+ S60->virtualMouseAccel = S60->virtualMouseMaxAccel;
+ }
+ else
+ S60->virtualMouseAccel = 1;
+ S60->virtualMouseLastKey = keyCode;
+
+ QPoint pos = QCursor::pos();
+ TPointerEvent fakeEvent;
+ TInt x = pos.x();
+ TInt y = pos.y();
+ if (type == EEventKeyUp) {
+ if (keyCode == Qt::Key_Select)
+ fakeEvent.iType = TPointerEvent::EButton1Up;
+ S60->virtualMouseAccel = 1;
+ S60->virtualMouseLastKey = 0;
+ }
+ else if (type == EEventKey) {
+ switch (keyCode) {
+ case Qt::Key_Left:
+ x -= S60->virtualMouseAccel;
+ fakeEvent.iType = TPointerEvent::EMove;
+ break;
+ case Qt::Key_Right:
+ x += S60->virtualMouseAccel;
+ fakeEvent.iType = TPointerEvent::EMove;
+ break;
+ case Qt::Key_Up:
+ y -= S60->virtualMouseAccel;
+ fakeEvent.iType = TPointerEvent::EMove;
+ break;
+ case Qt::Key_Down:
+ y += S60->virtualMouseAccel;
+ fakeEvent.iType = TPointerEvent::EMove;
+ break;
+ case Qt::Key_Select:
+ fakeEvent.iType = TPointerEvent::EButton1Down;
+ break;
+ }
+ }
+ //clip to screen size (window server allows a sprite hotspot to be outside the screen)
+ if (x < 0)
+ x = 0;
+ else if (x >= S60->screenWidthInPixels)
+ x = S60->screenWidthInPixels - 1;
+ if (y < 0)
+ y = 0;
+ else if (y >= S60->screenHeightInPixels)
+ y = S60->screenHeightInPixels - 1;
+ TPoint epos(x, y);
+ TPoint cpos = epos - PositionRelativeToScreen();
+ fakeEvent.iModifiers = keyEvent.iModifiers;
+ fakeEvent.iPosition = cpos;
+ fakeEvent.iParentPosition = epos;
+ HandlePointerEvent(fakeEvent);
+ return EKeyWasConsumed;
+ }
+ else {
+ S60->virtualMouseLastKey = keyCode;
+ S60->virtualMouseAccel = 1;
+ }
+ }
+#endif
+
+ Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers);
+ QKeyEventEx qKeyEvent(type == EEventKeyUp ? QEvent::KeyRelease : QEvent::KeyPress, keyCode,
+ mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods),
+ (keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers);
+// WId wid = reinterpret_cast<RWindowGroup *>(keyEvent.Handle())->Child();
+// if (!wid)
+// Could happen if window isn't shown yet.
+// return EKeyWasNotConsumed;
+ QWidget *widget;
+ widget = QWidget::keyboardGrabber();
+ if (!widget) {
+ if (QApplicationPrivate::popupWidgets != 0) {
+ widget = QApplication::activePopupWidget()->focusWidget();
+ if (!widget) {
+ widget = QApplication::activePopupWidget();
+ }
+ } else {
+ widget = QApplicationPrivate::focus_widget;
+ if (!widget) {
+ widget = qwidget;
+ }
+ }
+ }
+
+ QEventDispatcherS60 *dispatcher;
+ // It is theoretically possible for someone to install a different event dispatcher.
+ if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(widget->d_func()->threadData->eventDispatcher)) != 0) {
+ if (dispatcher->excludeUserInputEvents()) {
+ dispatcher->saveInputEvent(this, widget, new QKeyEventEx(qKeyEvent));
+ return EKeyWasConsumed;
+ }
+ }
+ return sendKeyEvent(widget, &qKeyEvent);
+ }
+ }
+ return EKeyWasNotConsumed;
+}
+
+void QSymbianControl::sendInputEvent(QWidget *widget, QInputEvent *inputEvent)
+{
+ switch (inputEvent->type()) {
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease:
+ sendKeyEvent(widget, static_cast<QKeyEvent *>(inputEvent));
+ break;
+ case QEvent::MouseButtonDblClick:
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonRelease:
+ case QEvent::MouseMove:
+ sendMouseEvent(widget, static_cast<QMouseEvent *>(inputEvent));
+ break;
+ default:
+ // Shouldn't get here.
+ Q_ASSERT_X(0 == 1, "QSymbianControl::sendInputEvent()", "inputEvent->type() is unknown");
+ break;
+ }
+}
+
+TKeyResponse QSymbianControl::sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent)
+{
+#if !defined(QT_NO_IM) && defined(Q_WS_S60)
+ if (widget && widget->isEnabled() && widget->testAttribute(Qt::WA_InputMethodEnabled)) {
+ QInputContext *qic = widget->inputContext();
+ if (qic && qic->filterEvent(keyEvent))
+ return EKeyWasConsumed;
+ }
+#endif // !defined(QT_NO_IM) && defined(Q_WS_S60)
+
+ if (widget && qt_sendSpontaneousEvent(widget, keyEvent))
+ if (keyEvent->isAccepted())
+ return EKeyWasConsumed;
+
+ return EKeyWasNotConsumed;
+}
+
+#if !defined(QT_NO_IM) && defined(Q_WS_S60)
+TCoeInputCapabilities QSymbianControl::InputCapabilities() const
+{
+ QWidget *w = 0;
+
+ if (qwidget->hasFocus())
+ w = qwidget;
+ else
+ w = qwidget->focusWidget();
+
+ QCoeFepInputContext *ic;
+ if (w && w->isEnabled() && w->testAttribute(Qt::WA_InputMethodEnabled)
+ && (ic = qobject_cast<QCoeFepInputContext *>(w->inputContext()))) {
+ return ic->inputCapabilities();
+ } else {
+ return TCoeInputCapabilities(TCoeInputCapabilities::ENone, 0, 0);
+ }
+}
+#endif
+
+void QSymbianControl::Draw(const TRect& controlRect) const
+{
+ QWindowSurface *surface = qwidget->windowSurface();
+ QPaintEngine *engine = surface ? surface->paintDevice()->paintEngine() : NULL;
+
+ if (!engine)
+ return;
+
+ const bool sendNativePaintEvents = qwidget->d_func()->extraData()->receiveNativePaintEvents;
+ if (sendNativePaintEvents) {
+ const QRect r = qt_TRect2QRect(controlRect);
+ QMetaObject::invokeMethod(qwidget, "beginNativePaintEvent", Qt::DirectConnection, Q_ARG(QRect, r));
+ }
+
+ // Map source rectangle into coordinates of the backing store.
+ const QPoint controlBase(controlRect.iTl.iX, controlRect.iTl.iY);
+ const QPoint backingStoreBase = qwidget->mapTo(qwidget->window(), controlBase);
+ const TRect backingStoreRect(TPoint(backingStoreBase.x(), backingStoreBase.y()), controlRect.Size());
+
+ if (engine->type() == QPaintEngine::Raster) {
+ QS60WindowSurface *s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface());
+ CFbsBitmap *bitmap = s60Surface->symbianBitmap();
+ CWindowGc &gc = SystemGc();
+
+ switch(qwidget->d_func()->extraData()->nativePaintMode) {
+ case QWExtra::Disable:
+ // Do nothing
+ break;
+
+ case QWExtra::Blit:
+ if (qwidget->d_func()->isOpaque)
+ gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+ gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect);
+ break;
+
+ case QWExtra::ZeroFill:
+ if (Window().DisplayMode() == EColor16MA) {
+ gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
+ gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+ gc.SetBrushColor(TRgb::Color16MA(0));
+ gc.Clear(controlRect);
+ } else {
+ gc.SetBrushColor(TRgb(0x000000));
+ gc.Clear(controlRect);
+ };
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ } else {
+ surface->flush(qwidget, QRegion(qt_TRect2QRect(backingStoreRect)), QPoint());
+ }
+
+ if (sendNativePaintEvents) {
+ const QRect r = qt_TRect2QRect(controlRect);
+ // The draw ops aren't actually sent to WSERV until the graphics
+ // context is deactivated, which happens in the function calling
+ // this one. We therefore delay the delivery of endNativePaintEvent,
+ // to ensure that drawing has completed by the time the widget
+ // receives the event. Note that, if the widget needs to ensure
+ // that the draw ops have actually been executed into the output
+ // framebuffer, a call to RWsSession::Flush is required in the
+ // endNativePaintEvent implementation.
+ QMetaObject::invokeMethod(qwidget, "endNativePaintEvent", Qt::QueuedConnection, Q_ARG(QRect, r));
+ }
+}
+
+void QSymbianControl::SizeChanged()
+{
+ CCoeControl::SizeChanged();
+
+ QSize oldSize = qwidget->size();
+ QSize newSize(Size().iWidth, Size().iHeight);
+
+ if (oldSize != newSize) {
+ QRect cr = qwidget->geometry();
+ cr.setSize(newSize);
+ qwidget->data->crect = cr;
+ if (qwidget->isVisible()) {
+ QTLWExtra *tlwExtra = qwidget->d_func()->maybeTopData();
+ bool slowResize = qgetenv("QT_SLOW_TOPLEVEL_RESIZE").toInt();
+ if (!slowResize && tlwExtra)
+ tlwExtra->inTopLevelResize = true;
+ QResizeEvent e(newSize, oldSize);
+ qt_sendSpontaneousEvent(qwidget, &e);
+ if (!qwidget->testAttribute(Qt::WA_StaticContents))
+ qwidget->d_func()->syncBackingStore();
+ if (!slowResize && tlwExtra)
+ tlwExtra->inTopLevelResize = false;
+ }
+ }
+
+ // CCoeControl::SetExtent calls SizeChanged, but does not call
+ // PositionChanged, so we call it here to ensure that the widget's
+ // position is updated.
+ PositionChanged();
+}
+
+void QSymbianControl::PositionChanged()
+{
+ CCoeControl::PositionChanged();
+
+ QPoint oldPos = qwidget->geometry().topLeft();
+ QPoint newPos(Position().iX, Position().iY);
+
+ if (oldPos != newPos) {
+ QRect cr = qwidget->geometry();
+ cr.moveTopLeft(newPos);
+ qwidget->data->crect = cr;
+ QTLWExtra *top = qwidget->d_func()->maybeTopData();
+ if (top)
+ top->normalGeometry = cr;
+ if (qwidget->isVisible()) {
+ QMoveEvent e(newPos, oldPos);
+ qt_sendSpontaneousEvent(qwidget, &e);
+ } else {
+ QMoveEvent * e = new QMoveEvent(newPos, oldPos);
+ QApplication::postEvent(qwidget, e);
+ }
+ }
+}
+
+void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
+{
+ if (m_ignoreFocusChanged)
+ return;
+
+ // Popups never get focused, but still receive the FocusChanged when they are hidden.
+ if (QApplicationPrivate::popupWidgets != 0
+ || (qwidget->windowType() & Qt::Popup) == Qt::Popup)
+ return;
+
+ if (IsFocused() && IsVisible()) {
+ if (m_symbianPopupIsOpen) {
+ QWidget *fw = QApplication::focusWidget();
+ if (fw) {
+ QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason);
+ QCoreApplication::sendEvent(fw, &event);
+ }
+ m_symbianPopupIsOpen = false;
+ }
+
+ QApplication::setActiveWindow(qwidget->window());
+ qwidget->d_func()->setWindowIcon_sys(true);
+ qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle());
+#ifdef Q_WS_S60
+ // If widget is fullscreen, hide status pane and button container
+ // otherwise show them.
+ CEikStatusPane* statusPane = S60->statusPane();
+ CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
+ bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen;
+ if (statusPane && (bool)statusPane->IsVisible() == isFullscreen)
+ statusPane->MakeVisible(!isFullscreen);
+ if (buttonGroup && (bool)buttonGroup->IsVisible() == isFullscreen)
+ buttonGroup->MakeVisible(!isFullscreen);
+#endif
+ } else if (QApplication::activeWindow() == qwidget->window()) {
+ if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) {
+ QWidget *fw = QApplication::focusWidget();
+ if (fw) {
+ QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason);
+ QCoreApplication::sendEvent(fw, &event);
+ }
+ m_symbianPopupIsOpen = true;
+ return;
+ }
+
+ QApplication::setActiveWindow(0);
+ }
+ // else { We don't touch the active window unless we were explicitly activated or deactivated }
+}
+
+void QSymbianControl::HandleResourceChange(int resourceType)
+{
+ switch (resourceType) {
+ case KInternalStatusPaneChange:
+ if (qwidget->isFullScreen()) {
+ SetExtentToWholeScreen();
+ } else if (qwidget->isMaximized()) {
+ TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ SetExtent(r.iTl, r.Size());
+ }
+ if (IsFocused() && IsVisible()) {
+ qwidget->d_func()->setWindowIcon_sys(true);
+ qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle());
+ }
+ break;
+ case KUidValueCoeFontChangeEvent:
+ // font change event
+ break;
+#ifdef Q_WS_S60
+ case KEikDynamicLayoutVariantSwitch:
+ {
+ if (qwidget->isFullScreen()) {
+ SetExtentToWholeScreen();
+ } else if (qwidget->isMaximized()) {
+ TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ SetExtent(r.iTl, r.Size());
+ }
+ break;
+ }
+#endif
+ default:
+ break;
+ }
+
+ CCoeControl::HandleResourceChange(resourceType);
+
+}
+void QSymbianControl::CancelLongTapTimer()
+{
+ m_longTapDetector->Cancel();
+}
+
+TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id)
+{
+ if (id.iUid == ETypeId)
+ return id.MakePtr(this);
+
+ return CCoeControl::MopSupplyObject(id);
+}
+
+void QSymbianControl::setFocusSafely(bool focus)
+{
+ // The stack hack in here is very unfortunate, but it is the only way to ensure proper
+ // focus in Symbian. If this is not executed, the control which happens to be on
+ // the top of the stack may randomly be assigned focus by Symbian, for example
+ // when creating new windows (specifically in CCoeAppUi::HandleStackChanged()).
+ if (focus) {
+ S60->appUi()->RemoveFromStack(this);
+ // Symbian doesn't automatically remove focus from the last focused control, so we need to
+ // remember it and clear focus ourselves.
+ if (lastFocusedControl && lastFocusedControl != this)
+ lastFocusedControl->SetFocus(false);
+ QT_TRAP_THROWING(S60->appUi()->AddToStackL(this,
+ ECoeStackPriorityDefault + 1, ECoeStackFlagStandard)); // Note the + 1
+ lastFocusedControl = this;
+ this->SetFocus(true);
+ } else {
+ S60->appUi()->RemoveFromStack(this);
+ QT_TRAP_THROWING(S60->appUi()->AddToStackL(this,
+ ECoeStackPriorityDefault, ECoeStackFlagStandard));
+ if(this == lastFocusedControl)
+ lastFocusedControl = 0;
+ this->SetFocus(false);
+ }
+}
+
+/*!
+ \typedef QApplication::QS60MainApplicationFactory
+ \since 4.6
+
+ This is a typedef for a pointer to a function with the following
+ signature:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 47
+
+ \sa QApplication::QApplication()
+*/
+
+/*!
+ \since 4.6
+
+ Creates an application using the application factory given in
+ \a factory, and using \a argc command line arguments in \a argv.
+ \a factory can be leaving, but the error will be converted to a
+ standard exception.
+
+ This function is only available on S60.
+*/
+QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv)
+ : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient))
+{
+ Q_D(QApplication);
+ S60->s60ApplicationFactory = factory;
+ d->construct();
+}
+
+QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int _internal)
+ : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient))
+{
+ Q_D(QApplication);
+ S60->s60ApplicationFactory = factory;
+ d->construct();
+ QApplicationPrivate::app_compile_version = _internal;
+}
+
+void qt_init(QApplicationPrivate * /* priv */, int)
+{
+ if (!CCoeEnv::Static()) {
+ // The S60 framework creates a new trap handler which will render any existing traps
+ // invalid as long as it is active. This means that all code in main() that occurs after
+ // the QApplication construction needs to be surrounded by a new trap, despite having
+ // an outer one already. To avoid this, we save the original trap handler here, and set
+ // it back after the S60 framework is constructed. Then we restore it right before the S60
+ // framework destruction.
+ TTrapHandler *origTrapHandler = User::TrapHandler();
+
+ // The S60 framework has not been initalized. We need to do it.
+ TApaApplicationFactory factory(S60->s60ApplicationFactory ?
+ S60->s60ApplicationFactory : newS60Application);
+ CApaCommandLine* commandLine = 0;
+ TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine);
+ // After this construction, CEikonEnv will be available from CEikonEnv::Static().
+ // (much like our qApp).
+ CEikonEnv* coe = new CEikonEnv;
+ //not using QT_TRAP_THROWING, because coe owns the cleanupstack so it can't be pushed there.
+ if(err == KErrNone)
+ TRAP(err, coe->ConstructAppFromCommandLineL(factory,*commandLine));
+ delete commandLine;
+ if(err != KErrNone) {
+ qWarning() << "qt_init: Eikon application construct failed ("
+ << err
+ << "), maybe missing resource file on S60 3.1?";
+ delete coe;
+ qt_symbian_throwIfError(err);
+ }
+
+ S60->s60InstalledTrapHandler = User::SetTrapHandler(origTrapHandler);
+
+ S60->qtOwnsS60Environment = true;
+ } else {
+ S60->qtOwnsS60Environment = false;
+ }
+
+#ifdef QT_NO_DEBUG
+ if (!qgetenv("QT_S60_AUTO_FLUSH_WSERV").isEmpty())
+#endif
+ S60->wsSession().SetAutoFlush(ETrue);
+
+ S60->updateScreenSize();
+
+
+ TDisplayMode mode = S60->screenDevice()->DisplayMode();
+ S60->screenDepth = TDisplayModeUtils::NumDisplayModeBitsPerPixel(mode);
+
+ //NB: RWsSession::GetColorModeList tells you what window modes are supported,
+ //not what bitmap formats.
+ if(QSysInfo::symbianVersion() == QSysInfo::SV_9_2)
+ S60->supportsPremultipliedAlpha = 0;
+ else
+ S60->supportsPremultipliedAlpha = 1;
+
+ RProcess me;
+ TSecureId securId = me.SecureId();
+ S60->uid = securId.operator TUid();
+
+ // enable focus events - used to re-enable mouse after focus changed between mouse and non mouse app,
+ // and for dimming behind modal windows
+ S60->windowGroup().EnableFocusChangeEvents();
+
+ //Check if mouse interaction is supported (either EMouse=1 in the HAL, or EMachineUID is one of the phones known to support this)
+ const TInt KMachineUidSamsungI8510 = 0x2000C51E;
+ // HAL::Get(HALData::EPen, TInt& result) may set 'result' to 1 on some 3.1 systems (e.g. N95).
+ // But we know that S60 systems below 5.0 did not support touch.
+ static const bool touchIsUnsupportedOnSystem =
+ QSysInfo::s60Version() == QSysInfo::SV_S60_3_1
+ || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2;
+ TInt machineUID;
+ TInt mouse;
+ TInt touch;
+ TInt err;
+ err = HAL::Get(HALData::EMouse, mouse);
+ if (err != KErrNone)
+ mouse = 0;
+ err = HAL::Get(HALData::EMachineUid, machineUID);
+ if (err != KErrNone)
+ machineUID = 0;
+ err = HAL::Get(HALData::EPen, touch);
+ if (err != KErrNone || touchIsUnsupportedOnSystem)
+ touch = 0;
+#ifdef __WINS__
+ if(QSysInfo::symbianVersion() <= QSysInfo::SV_9_4) {
+ //for symbian SDK emulator, force values to match typical devices.
+ mouse = 0;
+ touch = touchIsUnsupportedOnSystem ? 0 : 1;
+ }
+#endif
+ if (mouse || machineUID == KMachineUidSamsungI8510) {
+ S60->hasTouchscreen = false;
+ S60->virtualMouseRequired = false;
+ }
+ else if (!touch) {
+ S60->hasTouchscreen = false;
+ S60->virtualMouseRequired = true;
+ }
+ else {
+ S60->hasTouchscreen = true;
+ S60->virtualMouseRequired = false;
+ }
+
+ if (touch) {
+ QApplicationPrivate::navigationMode = Qt::NavigationModeNone;
+ } else {
+ QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional;
+ }
+
+#ifndef QT_NO_CURSOR
+ //Check if window server pointer cursors are supported or not
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ //In generic binary, use the HAL and OS version
+ //Any other known good phones should be added here.
+ if (machineUID == KMachineUidSamsungI8510 || (QSysInfo::symbianVersion() != QSysInfo::SV_9_4
+ && QSysInfo::symbianVersion() != QSysInfo::SV_9_3 && QSysInfo::symbianVersion()
+ != QSysInfo::SV_9_2)) {
+ S60->brokenPointerCursors = false;
+ qt_symbian_setWindowGroupCursor(Qt::ArrowCursor, S60->windowGroup());
+ }
+ else
+ S60->brokenPointerCursors = true;
+#endif
+
+ if (S60->mouseInteractionEnabled) {
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ if (S60->brokenPointerCursors) {
+ qt_symbian_set_pointer_sprite(Qt::ArrowCursor);
+ qt_symbian_show_pointer_sprite();
+ }
+ else
+#endif
+ S60->wsSession().SetPointerCursorMode(EPointerCursorNormal);
+ }
+#endif
+
+ QFont systemFont;
+ systemFont.setFamily(systemFont.defaultFamily());
+ QApplicationPrivate::setSystemFont(systemFont);
+
+/*
+ ### Commented out for now as parameter handling not needed in SOS(yet). Code below will break testlib with -o flag
+ int argc = priv->argc;
+ char **argv = priv->argv;
+
+ // Get command line params
+ int j = argc ? 1 : 0;
+ for (int i=1; i<argc; i++) {
+ if (argv[i] && *argv[i] != '-') {
+ argv[j++] = argv[i];
+ continue;
+ }
+
+#if defined(QT_DEBUG)
+ if (qstrcmp(argv[i], "-nograb") == 0)
+ appNoGrab = !appNoGrab;
+ else
+#endif // QT_DEBUG
+ ;
+ }
+*/
+
+ // Register WId with the metatype system. This is to enable
+ // QWidgetPrivate::create_sys to used delayed slot invokation in order
+ // to destroy WId objects during reparenting.
+ qRegisterMetaType<WId>("WId");
+}
+
+/*****************************************************************************
+ qt_cleanup() - cleans up when the application is finished
+ *****************************************************************************/
+void qt_cleanup()
+{
+ if(qt_S60Beep) {
+ delete qt_S60Beep;
+ qt_S60Beep = 0;
+ }
+ QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles
+// S60 structure and window server session are freed in eventdispatcher destructor as they are needed there
+
+ // It's important that this happens here, before the event dispatcher gets
+ // deleted, because the input context needs the event loop one last time before
+ // it dies.
+ delete QApplicationPrivate::inputContext;
+ QApplicationPrivate::inputContext = 0;
+
+ //Change mouse pointer back
+ S60->wsSession().SetPointerCursorMode(EPointerCursorNone);
+
+ if (S60->qtOwnsS60Environment) {
+ // Restore the S60 framework trap handler. See qt_init().
+ User::SetTrapHandler(S60->s60InstalledTrapHandler);
+
+ CEikonEnv* coe = CEikonEnv::Static();
+ coe->PrepareToExit();
+ // The CEikonEnv itself is destroyed in here.
+ coe->DestroyEnvironment();
+ }
+}
+
+void QApplicationPrivate::initializeWidgetPaletteHash()
+{
+ // TODO: Implement QApplicationPrivate::initializeWidgetPaletteHash()
+ // Possibly a task fot the S60Style guys
+}
+
+void QApplicationPrivate::createEventDispatcher()
+{
+ Q_Q(QApplication);
+ eventDispatcher = new QEventDispatcherS60(q);
+}
+
+QString QApplicationPrivate::appName() const
+{
+ return QCoreApplicationPrivate::appName();
+}
+
+bool QApplicationPrivate::modalState()
+{
+ return app_do_modal;
+}
+
+void QApplicationPrivate::enterModal_sys(QWidget *widget)
+{
+ if (widget) {
+ static_cast<QSymbianControl *>(widget->effectiveWinId())->FadeBehindPopup(ETrue);
+ // Modal partial screen dialogs (like queries) capture pointer events.
+ // ### FixMe: Add specialized behaviour for fullscreen modal dialogs
+ widget->effectiveWinId()->SetGloballyCapturing(ETrue);
+ widget->effectiveWinId()->SetPointerCapture(ETrue);
+ }
+ if (!qt_modal_stack)
+ qt_modal_stack = new QWidgetList;
+ qt_modal_stack->insert(0, widget);
+ app_do_modal = true;
+}
+
+void QApplicationPrivate::leaveModal_sys(QWidget *widget)
+{
+ if (widget) {
+ static_cast<QSymbianControl *>(widget->effectiveWinId())->FadeBehindPopup(EFalse);
+ // ### FixMe: Add specialized behaviour for fullscreen modal dialogs
+ widget->effectiveWinId()->SetGloballyCapturing(EFalse);
+ widget->effectiveWinId()->SetPointerCapture(EFalse);
+ }
+ if (qt_modal_stack && qt_modal_stack->removeAll(widget)) {
+ if (qt_modal_stack->isEmpty()) {
+ delete qt_modal_stack;
+ qt_modal_stack = 0;
+ }
+ }
+ app_do_modal = qt_modal_stack != 0;
+}
+
+void QApplicationPrivate::openPopup(QWidget *popup)
+{
+ if (!QApplicationPrivate::popupWidgets)
+ QApplicationPrivate::popupWidgets = new QWidgetList;
+ QApplicationPrivate::popupWidgets->append(popup);
+
+
+ // Cancel focus widget pointer capture and long tap timer
+ if (QApplication::focusWidget()) {
+ static_cast<QSymbianControl*>(QApplication::focusWidget()->effectiveWinId())->CancelLongTapTimer();
+ QApplication::focusWidget()->effectiveWinId()->SetPointerCapture(false);
+ }
+
+ if (!qt_nograb()) {
+ // Cancel pointer capture and long tap timer for earlier popup
+ int popupCount = QApplicationPrivate::popupWidgets->count();
+ if (popupCount > 1) {
+ QWidget* prevPopup = QApplicationPrivate::popupWidgets->at(popupCount-2);
+ static_cast<QSymbianControl*>(prevPopup->effectiveWinId())->CancelLongTapTimer();
+ prevPopup->effectiveWinId()->SetPointerCapture(false);
+ }
+
+ // Enable pointer capture for this (topmost) popup
+ Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created));
+ WId id = popup->effectiveWinId();
+ id->SetPointerCapture(true);
+ }
+
+ // popups are not focus-handled by the window system (the first
+ // popup grabbed the keyboard), so we have to do that manually: A
+ // new popup gets the focus
+ QWidget *fw = popup->focusWidget();
+ if (fw) {
+ fw->setFocus(Qt::PopupFocusReason);
+ } else if (QApplicationPrivate::popupWidgets->count() == 1) { // this was the first popup
+ fw = QApplication::focusWidget();
+ if (fw) {
+ QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason);
+ q_func()->sendEvent(fw, &e);
+ }
+ }
+}
+
+void QApplicationPrivate::closePopup(QWidget *popup)
+{
+ if (!QApplicationPrivate::popupWidgets)
+ return;
+ QApplicationPrivate::popupWidgets->removeAll(popup);
+
+ // Cancel pointer capture and long tap for this popup
+ WId id = popup->effectiveWinId();
+ id->SetPointerCapture(false);
+ static_cast<QSymbianControl*>(id)->CancelLongTapTimer();
+
+ if (QApplicationPrivate::popupWidgets->isEmpty()) { // this was the last popup
+ delete QApplicationPrivate::popupWidgets;
+ QApplicationPrivate::popupWidgets = 0;
+ if (!qt_nograb()) { // grabbing not disabled
+ Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created));
+ if (QWidgetPrivate::mouseGrabber != 0)
+ QWidgetPrivate::mouseGrabber->grabMouse();
+
+ if (QWidgetPrivate::keyboardGrabber != 0)
+ QWidgetPrivate::keyboardGrabber->grabKeyboard();
+
+ QWidget *fw = QApplicationPrivate::active_window ? QApplicationPrivate::active_window->focusWidget()
+ : q_func()->focusWidget();
+ if (fw) {
+ if (fw != q_func()->focusWidget()) {
+ fw->setFocus(Qt::PopupFocusReason);
+ } else {
+ QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason);
+ q_func()->sendEvent(fw, &e);
+ }
+ }
+ }
+ } else {
+
+ // popups are not focus-handled by the window system (the
+ // first popup grabbed the keyboard), so we have to do that
+ // manually: A popup was closed, so the previous popup gets
+ // the focus.
+ QWidget* aw = QApplicationPrivate::popupWidgets->last();
+ if (QWidget *fw = QApplication::focusWidget()) {
+ QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason);
+ q_func()->sendEvent(fw, &e);
+ }
+
+ // Enable pointer capture for previous popup
+ if (aw) {
+ aw->effectiveWinId()->SetPointerCapture(true);
+ }
+ }
+}
+
+QWidget * QApplication::topLevelAt(QPoint const& point)
+{
+ QWidget *found = 0;
+ int lowestZ = INT_MAX;
+ QWidgetList list = QApplication::topLevelWidgets();
+ for (int i = 0; i < list.count(); ++i) {
+ QWidget *widget = list.at(i);
+ if (widget->isVisible() && !(widget->windowType() == Qt::Desktop)) {
+ Q_ASSERT(widget->testAttribute(Qt::WA_WState_Created));
+ if (widget->geometry().adjusted(0,0,1,1).contains(point)) {
+ // At this point we know there is a Qt widget under the point.
+ // Now we need to make sure it is the top most in the z-order.
+ RDrawableWindow *const window = widget->effectiveWinId()->DrawableWindow();
+ int z = window->OrdinalPosition();
+ if (z < lowestZ) {
+ lowestZ = z;
+ found = widget;
+ }
+ }
+ }
+ }
+ return found;
+}
+
+void QApplication::alert(QWidget * /* widget */, int /* duration */)
+{
+ // TODO: Implement QApplication::alert(QWidget *widget, int duration)
+}
+
+int QApplication::doubleClickInterval()
+{
+ TTimeIntervalMicroSeconds32 us;
+ TInt distance;
+ S60->wsSession().GetDoubleClickSettings(us, distance);
+ return (us.Int() / 1000);
+}
+
+void QApplication::setDoubleClickInterval(int ms)
+{
+ TTimeIntervalMicroSeconds32 newUs( ms * 1000);
+ TTimeIntervalMicroSeconds32 us;
+ TInt distance;
+ S60->wsSession().GetDoubleClickSettings(us, distance);
+ if (us != newUs)
+ S60->wsSession().SetDoubleClick(newUs, distance);
+}
+
+int QApplication::keyboardInputInterval()
+{
+ return QApplicationPrivate::keyboard_input_time;
+}
+
+void QApplication::setKeyboardInputInterval(int ms)
+{
+ QApplicationPrivate::keyboard_input_time = ms;
+}
+
+int QApplication::cursorFlashTime()
+{
+ return QApplicationPrivate::cursor_flash_time;
+}
+
+void QApplication::setCursorFlashTime(int msecs)
+{
+ QApplicationPrivate::cursor_flash_time = msecs;
+}
+
+void QApplication::beep()
+{
+ if (!qt_S60Beep) {
+ TInt frequency = 880;
+ TTimeIntervalMicroSeconds duration(500000);
+ TRAP_IGNORE(qt_S60Beep=QS60Beep::NewL(frequency, duration));
+ }
+ if (qt_S60Beep)
+ qt_S60Beep->Play();
+}
+
+/*!
+ \warning This function is only available on Symbian.
+ \since 4.6
+
+ This function processes an individual Symbian event
+ \a event. It returns 1 if the event was handled, 0 if
+ the \a event was not handled, and -1 if the event was
+ not handled because the event is not known to Qt.
+ */
+
+int QApplication::symbianProcessEvent(const QSymbianEvent *event)
+{
+ Q_D(QApplication);
+
+ QScopedLoopLevelCounter counter(d->threadData);
+
+ QWidget *w = qApp ? qApp->focusWidget() : 0;
+ if (w) {
+ QInputContext *ic = w->inputContext();
+ if (ic && ic->symbianFilterEvent(w, event))
+ return 1;
+ }
+
+ if (symbianEventFilter(event))
+ return 1;
+
+ switch (event->type()) {
+ case QSymbianEvent::WindowServerEvent:
+ return d->symbianProcessWsEvent(event->windowServerEvent());
+ case QSymbianEvent::CommandEvent:
+ return d->symbianHandleCommand(event->command());
+ case QSymbianEvent::ResourceChangeEvent:
+ return d->symbianResourceChange(event->resourceChangeType());
+ default:
+ return -1;
+ }
+}
+
+int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event)
+{
+ // Qt event handling. Handle some events regardless of if the handle is in our
+ // widget map or not.
+ CCoeControl* control = reinterpret_cast<CCoeControl*>(event->Handle());
+ const bool controlInMap = QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control);
+ switch (event->Type()) {
+ case EEventPointerEnter:
+ if (controlInMap)
+ return 1; // Qt::Enter will be generated in HandlePointerL
+ break;
+ case EEventPointerExit:
+ if (controlInMap) {
+ if (S60) {
+ // mouseEvent outside our window, send leave event to last focused widget
+ QMouseEvent mEvent(QEvent::Leave, S60->lastPointerEventPos, S60->lastCursorPos,
+ Qt::NoButton, QApplicationPrivate::mouse_buttons, Qt::NoModifier);
+ if (S60->lastPointerEventTarget)
+ qt_sendSpontaneousEvent(S60->lastPointerEventTarget,&mEvent);
+ S60->lastPointerEventTarget = 0;
+ }
+ return 1;
+ }
+ break;
+ case EEventScreenDeviceChanged:
+ if (S60)
+ S60->updateScreenSize();
+ if (qt_desktopWidget) {
+ QSize oldSize = qt_desktopWidget->size();
+ qt_desktopWidget->data->crect.setWidth(S60->screenWidthInPixels);
+ qt_desktopWidget->data->crect.setHeight(S60->screenHeightInPixels);
+ QResizeEvent e(qt_desktopWidget->size(), oldSize);
+ QApplication::sendEvent(qt_desktopWidget, &e);
+ }
+ return 0; // Propagate to CONE
+ case EEventWindowVisibilityChanged:
+ if (controlInMap) {
+ const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged();
+ QWidget *w = QWidgetPrivate::mapper->value(control);
+ if (!w->d_func()->maybeTopData())
+ break;
+ if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) {
+ delete w->d_func()->topData()->backingStore;
+ w->d_func()->topData()->backingStore = 0;
+ } else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible)
+ && !w->d_func()->maybeBackingStore()) {
+ w->d_func()->topData()->backingStore = new QWidgetBackingStore(w);
+ w->d_func()->invalidateBuffer(w->rect());
+ w->repaint();
+ }
+ return 1;
+ }
+ break;
+ case EEventFocusGained:
+#ifndef QT_NO_CURSOR
+ //re-enable mouse interaction
+ if (S60->mouseInteractionEnabled) {
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ if (S60->brokenPointerCursors)
+ qt_symbian_show_pointer_sprite();
+ else
+#endif
+ S60->wsSession().SetPointerCursorMode(EPointerCursorNormal);
+ }
+#endif
+ break;
+ case EEventFocusLost:
+#ifndef QT_NO_CURSOR
+ //disable mouse as may be moving to application that does not support it
+ if (S60->mouseInteractionEnabled) {
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ if (S60->brokenPointerCursors)
+ qt_symbian_hide_pointer_sprite();
+ else
+#endif
+ S60->wsSession().SetPointerCursorMode(EPointerCursorNone);
+ }
+#endif
+ break;
+ default:
+ break;
+ }
+
+ if (!controlInMap)
+ return -1;
+
+ return 0;
+}
+
+/*!
+ \warning This virtual function is only available on Symbian.
+ \since 4.6
+
+ If you create an application that inherits QApplication and reimplement
+ this function, you get direct access to events that the are received
+ from Symbian. The events are passed in the \a event parameter.
+
+ Return true if you want to stop the event from being processed. Return
+ false for normal event dispatching. The default implementation returns
+ false, and does nothing with \a event.
+ */
+bool QApplication::symbianEventFilter(const QSymbianEvent *event)
+{
+ Q_UNUSED(event);
+ return false;
+}
+
+/*!
+ \warning This function is only available on Symbian.
+ \since 4.6
+
+ Handles \a{command}s which are typically handled by
+ CAknAppUi::HandleCommandL(). Qts Ui integration into Symbian is
+ partially achieved by deriving from CAknAppUi. Currently, exit,
+ menu and softkey commands are handled.
+
+ \sa s60EventFilter(), s60ProcessEvent()
+*/
+int QApplicationPrivate::symbianHandleCommand(int command)
+{
+ Q_Q(QApplication);
+ int ret = 0;
+
+ switch (command) {
+#ifdef Q_WS_S60
+ case EAknSoftkeyExit: {
+ QCloseEvent ev;
+ QApplication::sendSpontaneousEvent(q, &ev);
+ if (ev.isAccepted()) {
+ q->quit();
+ ret = 1;
+ }
+ break;
+ }
+#endif
+ case EEikCmdExit:
+ q->quit();
+ ret = 1;
+ break;
+ default:
+ bool handled = QSoftKeyManager::handleCommand(command);
+ if (handled)
+ ret = 1;
+#ifdef Q_WS_S60
+ else
+ ret = QMenuBarPrivate::symbianCommands(command);
+#endif
+ break;
+ }
+
+ return ret;
+}
+
+/*!
+ \warning This function is only available on Symbian.
+ \since 4.6
+
+ Handles the resource change specified by \a type.
+
+ Currently, KEikDynamicLayoutVariantSwitch and
+ KAknsMessageSkinChange are handled.
+ */
+int QApplicationPrivate::symbianResourceChange(int type)
+{
+ int ret = 0;
+
+ switch (type) {
+#ifdef Q_WS_S60
+ case KEikDynamicLayoutVariantSwitch:
+ {
+ if (S60)
+ S60->updateScreenSize();
+
+#ifndef QT_NO_STYLE_S60
+ QS60Style *s60Style = 0;
+
+#ifndef QT_NO_STYLE_STYLESHEET
+ QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle*>(QApplication::style());
+ if (proxy)
+ s60Style = qobject_cast<QS60Style*>(proxy->baseStyle());
+ else
+#endif
+ s60Style = qobject_cast<QS60Style*>(QApplication::style());
+
+ if (s60Style) {
+ s60Style->d_func()->handleDynamicLayoutVariantSwitch();
+ ret = 1;
+ }
+#endif
+ }
+ break;
+
+#ifndef QT_NO_STYLE_S60
+ case KAknsMessageSkinChange:
+ if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style())) {
+ s60Style->d_func()->handleSkinChange();
+ ret = 1;
+ }
+ break;
+#endif
+#endif // Q_WS_S60
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+#ifndef QT_NO_WHEELEVENT
+int QApplication::wheelScrollLines()
+{
+ return QApplicationPrivate::wheel_scroll_lines;
+}
+
+void QApplication::setWheelScrollLines(int n)
+{
+ QApplicationPrivate::wheel_scroll_lines = n;
+}
+#endif //QT_NO_WHEELEVENT
+
+bool QApplication::isEffectEnabled(Qt::UIEffect /* effect */)
+{
+ // TODO: Implement QApplication::isEffectEnabled(Qt::UIEffect effect)
+ return false;
+}
+
+void QApplication::setEffectEnabled(Qt::UIEffect /* effect */, bool /* enable */)
+{
+ // TODO: Implement QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable)
+}
+
+TUint QApplicationPrivate::resolveS60ScanCode(TInt scanCode, TUint keysym)
+{
+ if (keysym) {
+ // If keysym is specified, cache it.
+ scanCodeCache.insert(scanCode, keysym);
+ return keysym;
+ } else {
+ // If not, retrieve the cached version.
+ return scanCodeCache[scanCode];
+ }
+}
+
+void QApplicationPrivate::initializeMultitouch_sys()
+{
+#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
+ if (HAL::Get(HALData::EPointer3DMaxPressure, maxTouchPressure) != KErrNone)
+ maxTouchPressure = KMaxTInt;
+#endif
+}
+
+void QApplicationPrivate::cleanupMultitouch_sys()
+{ }
+
+#ifndef QT_NO_SESSIONMANAGER
+QSessionManager::QSessionManager(QApplication * /* app */, QString & /* id */, QString& /* key */)
+{
+
+}
+
+QSessionManager::~QSessionManager()
+{
+
+}
+
+bool QSessionManager::allowsInteraction()
+{
+ return false;
+}
+
+void QSessionManager::cancel()
+{
+
+}
+#endif //QT_NO_SESSIONMANAGER
+
+#ifdef QT_KEYPAD_NAVIGATION
+/*
+ * Show/Hide the mouse cursor depending on phone type and chosen mode
+ */
+void QApplicationPrivate::setNavigationMode(Qt::NavigationMode mode)
+{
+#ifndef QT_NO_CURSOR
+ const bool wasCursorOn = (QApplicationPrivate::navigationMode == Qt::NavigationModeCursorAuto
+ && !S60->hasTouchscreen)
+ || QApplicationPrivate::navigationMode == Qt::NavigationModeCursorForceVisible;
+ const bool isCursorOn = (mode == Qt::NavigationModeCursorAuto
+ && !S60->hasTouchscreen)
+ || mode == Qt::NavigationModeCursorForceVisible;
+
+ if (!wasCursorOn && isCursorOn) {
+ //Show the cursor, when changing from another mode to cursor mode
+ qt_symbian_set_cursor_visible(true);
+ }
+ else if (wasCursorOn && !isCursorOn) {
+ //Hide the cursor, when leaving cursor mode
+ qt_symbian_set_cursor_visible(false);
+ }
+#endif
+ QApplicationPrivate::navigationMode = mode;
+}
+#endif
+
+#ifndef QT_NO_CURSOR
+/*****************************************************************************
+ QApplication cursor stack
+ *****************************************************************************/
+
+void QApplication::setOverrideCursor(const QCursor &cursor)
+{
+ qApp->d_func()->cursor_list.prepend(cursor);
+ qt_symbian_setGlobalCursor(cursor);
+}
+
+void QApplication::restoreOverrideCursor()
+{
+ if (qApp->d_func()->cursor_list.isEmpty())
+ return;
+ qApp->d_func()->cursor_list.removeFirst();
+
+ if (!qApp->d_func()->cursor_list.isEmpty()) {
+ qt_symbian_setGlobalCursor(qApp->d_func()->cursor_list.first());
+ }
+ else {
+ //determine which widget has focus
+ QWidget *w = QApplication::widgetAt(QCursor::pos());
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ if (S60->brokenPointerCursors) {
+ qt_symbian_set_pointer_sprite(w ? w->cursor() : Qt::ArrowCursor);
+ }
+ else
+#endif
+ {
+ //because of the internals of window server, we need to force the cursor
+ //to be set in all child windows too, otherwise when the cursor is over
+ //the child window it may show a widget cursor or arrow cursor instead,
+ //depending on construction order.
+ QListIterator<WId> iter(QWidgetPrivate::mapper->uniqueKeys());
+ while (iter.hasNext()) {
+ CCoeControl *ctrl = iter.next();
+ if(ctrl->OwnsWindow()) {
+ ctrl->DrawableWindow()->ClearPointerCursor();
+ }
+ }
+ if (w)
+ qt_symbian_setWindowCursor(w->cursor(), w->effectiveWinId());
+ else
+ qt_symbian_setWindowGroupCursor(Qt::ArrowCursor, S60->windowGroup());
+ }
+ }
+}
+
+#endif // QT_NO_CURSOR
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 7d9e6ea22..b67722847 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -92,8 +92,6 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
#include <private/qkeymapper_p.h>
#include <private/qlocale_p.h>
#include "qevent_p.h"
-#include "qstandardgestures.h"
-#include "qstandardgestures_p.h"
//#define ALIEN_DEBUG
@@ -171,6 +169,13 @@ typedef struct tagTOUCHINPUT
#include <mywinsock.h>
#endif
+#ifndef IMR_RECONVERTSTRING
+#define IMR_RECONVERTSTRING 4
+#endif
+
+#ifndef IMR_CONFIRMRECONVERTSTRING
+#define IMR_CONFIRMRECONVERTSTRING 0x0005
+#endif
QT_BEGIN_NAMESPACE
#ifdef Q_WS_WINCE
@@ -216,7 +221,7 @@ static void resolveAygLibs()
# define FE_FONTSMOOTHINGCLEARTYPE 0x0002
#endif
-bool qt_cleartype_enabled;
+Q_GUI_EXPORT bool qt_cleartype_enabled;
Q_GUI_EXPORT bool qt_win_owndc_required; // CS_OWNDC is required if we use the GL graphicssystem as default
typedef HCTX (API *PtrWTOpen)(HWND, LPLOGCONTEXT, BOOL);
@@ -238,8 +243,12 @@ static PtrWTGet ptrWTGet = 0;
static PACKET localPacketBuf[QT_TABLET_NPACKETQSIZE]; // our own tablet packet queue.
HCTX qt_tablet_context; // the hardware context for the tablet (like a window handle)
bool qt_tablet_tilt_support;
-static void tabletInit(UINT wActiveCsr, HCTX hTab);
+
+#ifndef QT_NO_TABLETEVENT
+static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab);
+static void tabletUpdateCursor(QTabletDeviceData &tdd, const UINT currentCursor);
static void initWinTabFunctions(); // resolve the WINTAB api functions
+#endif // QT_NO_TABLETEVENT
#ifndef QT_NO_ACCESSIBILITY
@@ -251,7 +260,7 @@ extern QWidget* qt_get_tablet_widget();
extern bool qt_sendSpontaneousEvent(QObject*, QEvent*);
extern QRegion qt_dirtyRegion(QWidget *);
-typedef QHash<UINT, QTabletDeviceData> QTabletCursorInfo;
+typedef QHash<quint64, QTabletDeviceData> QTabletCursorInfo;
Q_GLOBAL_STATIC(QTabletCursorInfo, tCursorInfo)
QTabletDeviceData currentTabletPointer;
@@ -323,6 +332,7 @@ extern HRGN qt_tryCreateRegion(QRegion::RegionType type, int left, int top, int
#define APPCOMMAND_BASS_UP 21
#define APPCOMMAND_TREBLE_DOWN 22
#define APPCOMMAND_TREBLE_UP 23
+#endif // FAPPCOMMAND_MOUSE
// New commands from Windows XP (some even Sp1)
#ifndef APPCOMMAND_MICROPHONE_VOLUME_MUTE
@@ -357,8 +367,6 @@ extern HRGN qt_tryCreateRegion(QRegion::RegionType type, int left, int top, int
#define APPCOMMAND_MEDIA_CHANNEL_DOWN 52
#endif // APPCOMMAND_MICROPHONE_VOLUME_MUTE
-#endif // FAPPCOMMAND_MOUSE
-
#if (_WIN32_WINNT < 0x0400)
// This struct is defined in winuser.h if the _WIN32_WINNT >= 0x0400 -- in the
// other cases we have to define it on our own.
@@ -452,7 +460,7 @@ public:
bool translateConfigEvent(const MSG &msg);
bool translateCloseEvent(const MSG &msg);
bool translateTabletEvent(const MSG &msg, PACKET *localPacketBuf, int numPackets);
- bool translateGestureEvent(const MSG &msg);
+ bool translateGestureEvent(const MSG &msg, const GESTUREINFO &gi);
void repolishStyle(QStyle &style);
inline void showChildren(bool spontaneous) { d_func()->showChildren(spontaneous); }
inline void hideChildren(bool spontaneous) { d_func()->hideChildren(spontaneous); }
@@ -611,6 +619,8 @@ static void qt_set_windows_font_resources()
if (qt_wince_is_mobile()) {
smallerFont.setPointSize(systemFont.pointSize()-1);
QApplication::setFont(smallerFont, "QTabBar");
+ smallerFont.setBold(true);
+ QApplication::setFont(smallerFont, "QAbstractButton");
}
#endif// Q_WS_WINCE
}
@@ -785,7 +795,9 @@ void qt_init(QApplicationPrivate *priv, int)
if (QApplication::desktopSettingsAware())
qt_set_windows_resources();
+#ifndef QT_NO_TABLETEVENT
initWinTabFunctions();
+#endif // QT_NO_TABLETEVENT
QApplicationPrivate::inputContext = new QWinInputContext(0);
// Read the initial cleartype settings...
@@ -815,14 +827,18 @@ void qt_init(QApplicationPrivate *priv, int)
priv->GetGestureInfo = 0;
priv->GetGestureExtraArgs = 0;
+ priv->CloseGestureInfoHandle = 0;
+ priv->SetGestureConfig = 0;
+ priv->GetGestureConfig = 0;
+ priv->BeginPanningFeedback = 0;
+ priv->UpdatePanningFeedback = 0;
+ priv->EndPanningFeedback = 0;
#if defined(Q_WS_WINCE_WM) && defined(QT_WINCE_GESTURES)
priv->GetGestureInfo = (PtrGetGestureInfo) &TKGetGestureInfo;
priv->GetGestureExtraArgs = (PtrGetGestureExtraArgs) &TKGetGestureExtraArguments;
- priv->CloseGestureInfoHandle = (PtrCloseGestureInfoHandle) 0;
- priv->SetGestureConfig = (PtrSetGestureConfig) 0;
- priv->GetGestureConfig = (PtrGetGestureConfig) 0;
#elif !defined(Q_WS_WINCE)
+ #if !defined(QT_NO_NATIVE_GESTURES)
priv->GetGestureInfo =
(PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"),
"GetGestureInfo");
@@ -838,6 +854,7 @@ void qt_init(QApplicationPrivate *priv, int)
priv->GetGestureConfig =
(PtrGetGestureConfig)QLibrary::resolve(QLatin1String("user32"),
"GetGestureConfig");
+ #endif // QT_NO_NATIVE_GESTURES
priv->BeginPanningFeedback =
(PtrBeginPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
"BeginPanningFeedback");
@@ -1748,79 +1765,18 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
case APPCOMMAND_BASS_UP:
key = Qt::Key_BassUp;
break;
- case APPCOMMAND_BROWSER_BACKWARD:
- key = Qt::Key_Back;
- break;
- case APPCOMMAND_BROWSER_FAVORITES:
- key = Qt::Key_Favorites;
- break;
- case APPCOMMAND_BROWSER_FORWARD:
- key = Qt::Key_Forward;
- break;
- case APPCOMMAND_BROWSER_HOME:
- key = Qt::Key_HomePage;
- break;
- case APPCOMMAND_BROWSER_REFRESH:
- key = Qt::Key_Refresh;
- break;
- case APPCOMMAND_BROWSER_SEARCH:
- key = Qt::Key_Search;
- break;
- case APPCOMMAND_BROWSER_STOP:
- key = Qt::Key_Stop;
- break;
- case APPCOMMAND_LAUNCH_APP1:
- key = Qt::Key_Launch0;
- break;
- case APPCOMMAND_LAUNCH_APP2:
- key = Qt::Key_Launch1;
- break;
- case APPCOMMAND_LAUNCH_MAIL:
- key = Qt::Key_LaunchMail;
- break;
- case APPCOMMAND_LAUNCH_MEDIA_SELECT:
- key = Qt::Key_LaunchMedia;
- break;
- case APPCOMMAND_MEDIA_NEXTTRACK:
- key = Qt::Key_MediaNext;
- break;
- case APPCOMMAND_MEDIA_PLAY_PAUSE:
- key = Qt::Key_MediaPlay;
- break;
- case APPCOMMAND_MEDIA_PREVIOUSTRACK:
- key = Qt::Key_MediaPrevious;
- break;
- case APPCOMMAND_MEDIA_STOP:
- key = Qt::Key_MediaStop;
- break;
case APPCOMMAND_TREBLE_DOWN:
key = Qt::Key_TrebleDown;
break;
case APPCOMMAND_TREBLE_UP:
key = Qt::Key_TrebleUp;
break;
- case APPCOMMAND_VOLUME_DOWN:
- key = Qt::Key_VolumeDown;
- break;
- case APPCOMMAND_VOLUME_MUTE:
- key = Qt::Key_VolumeMute;
- break;
- case APPCOMMAND_VOLUME_UP:
- key = Qt::Key_VolumeUp;
- break;
- // Commands new in Windows XP
case APPCOMMAND_HELP:
key = Qt::Key_Help;
break;
case APPCOMMAND_FIND:
key = Qt::Key_Search;
break;
- case APPCOMMAND_PRINT:
- key = Qt::Key_Print;
- break;
- case APPCOMMAND_MEDIA_PLAY:
- key = Qt::Key_MediaPlay;
- break;
default:
break;
}
@@ -1899,11 +1855,9 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
QHideEvent e;
qt_sendSpontaneousEvent(widget, &e);
widget->hideChildren(true);
-#ifndef Q_WS_WINCE
const QString title = widget->windowIconText();
if (!title.isEmpty())
widget->setWindowTitle_helper(title);
-#endif
}
result = false;
break;
@@ -1922,11 +1876,9 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
widget->showChildren(true);
QShowEvent e;
qt_sendSpontaneousEvent(widget, &e);
-#ifndef Q_WS_WINCE
const QString title = widget->windowTitle();
if (!title.isEmpty())
widget->setWindowTitle_helper(title);
-#endif
}
result = false;
break;
@@ -1939,7 +1891,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
QWindowStateChangeEvent e(oldstate);
qt_sendSpontaneousEvent(widget, &e);
}
-#endif
+#endif // #ifndef Q_OS_WINCE
break;
}
@@ -1974,11 +1926,9 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
#ifndef Q_WS_WINCE
case WM_ENTERSIZEMOVE:
autoCaptureWnd = hwnd;
- QApplicationPrivate::inSizeMove = true;
break;
case WM_EXITSIZEMOVE:
autoCaptureWnd = 0;
- QApplicationPrivate::inSizeMove = false;
break;
#endif
case WM_MOVE: // move window
@@ -2026,13 +1976,28 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
// WM_ACTIVATEAPP handles the "true" false case, as this is only when the application
// loses focus. Doing it here would result in the widget getting focus to not know
// where it got it from; it would simply get a 0 value as the old focus widget.
-#ifndef Q_WS_WINCE_WM
- if (!(widget->windowState() & Qt::WindowMinimized)) {
- // Ignore the activate message send by WindowsXP to a minimized window
-#else
+#ifdef Q_WS_WINCE
{
+#ifdef Q_WS_WINCE_WM
+ // On Windows mobile we do not receive WM_SYSCOMMAND / SC_MINIMIZE messages.
+ // Thus we have to unset the minimized state explicitly. We must do this for all
+ // top-level widgets, because we get the HWND of a random widget here.
+ foreach (QWidget* tlw, QApplication::topLevelWidgets()) {
+ if (tlw->isMinimized())
+ tlw->setWindowState(tlw->windowState() & ~Qt::WindowMinimized);
+ }
+#else
+ // On Windows CE we do not receive WM_SYSCOMMAND / SC_MINIMIZE messages.
+ // Thus we have to unset the minimized state explicitly.
if (widget->windowState() & Qt::WindowMinimized)
- widget->dataPtr()->window_state &= ~Qt::WindowMinimized;
+ widget->setWindowState(widget->windowState() & ~Qt::WindowMinimized);
+#endif // Q_WS_WINCE_WM
+
+#else
+ if (!(widget->windowState() & Qt::WindowMinimized)) {
+#endif
+ // Ignore the activate message send by WindowsXP to a minimized window
+#ifdef Q_WS_WINCE_WM
if (widget->windowState() & Qt::WindowFullScreen)
qt_wince_hide_taskbar(widget->winId());
#endif
@@ -2263,7 +2228,26 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
}
break;
}
-
+ case WM_IME_REQUEST: {
+ QWidget *fw = QApplication::focusWidget();
+ QWinInputContext *im = fw ? qobject_cast<QWinInputContext *>(fw->inputContext()) : 0;
+ if (fw && im) {
+ if(wParam == IMR_RECONVERTSTRING) {
+ int ret = im->reconvertString((RECONVERTSTRING *)lParam);
+ if (ret == -1) {
+ result = false;
+ } else {
+ return ret;
+ }
+ } else if (wParam == IMR_CONFIRMRECONVERTSTRING) {
+ RETURN(TRUE);
+ } else {
+ // in all other cases, call DefWindowProc()
+ result = false;
+ }
+ }
+ break;
+ }
#ifndef Q_WS_WINCE
case WM_CHANGECBCHAIN:
case WM_DRAWCLIPBOARD:
@@ -2347,25 +2331,43 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
}
break;
case WT_PROXIMITY:
- if (ptrWTPacketsGet) {
- bool enteredProximity = LOWORD(lParam) != 0;
- PACKET proximityBuffer[QT_TABLET_NPACKETQSIZE];
- int totalPacks = ptrWTPacketsGet(qt_tablet_context, QT_TABLET_NPACKETQSIZE, proximityBuffer);
- if (totalPacks > 0 && enteredProximity) {
- uint currentCursor = proximityBuffer[0].pkCursor;
- if (!tCursorInfo()->contains(currentCursor))
- tabletInit(currentCursor, qt_tablet_context);
- currentTabletPointer = tCursorInfo()->value(currentCursor);
+
+ #ifndef QT_NO_TABLETEVENT
+ if (ptrWTPacketsGet && ptrWTInfo) {
+ const bool enteredProximity = LOWORD(lParam) != 0;
+ PACKET proximityBuffer[1]; // we are only interested in the first packet in this case
+ const int totalPacks = ptrWTPacketsGet(qt_tablet_context, 1, proximityBuffer);
+ if (totalPacks > 0) {
+ const UINT currentCursor = proximityBuffer[0].pkCursor;
+
+ UINT csr_physid;
+ ptrWTInfo(WTI_CURSORS + currentCursor, CSR_PHYSID, &csr_physid);
+ UINT csr_type;
+ ptrWTInfo(WTI_CURSORS + currentCursor, CSR_TYPE, &csr_type);
+ const UINT deviceIdMask = 0xFF6; // device type mask && device color mask
+ quint64 uniqueId = (csr_type & deviceIdMask);
+ uniqueId = (uniqueId << 32) | csr_physid;
+
+ // initialising and updating the cursor should be done in response to
+ // WT_CSRCHANGE. We do it in WT_PROXIMITY because some wintab never send
+ // the event WT_CSRCHANGE even if asked with CXO_CSRMESSAGES
+ const QTabletCursorInfo *const globalCursorInfo = tCursorInfo();
+ if (!globalCursorInfo->contains(uniqueId))
+ tabletInit(uniqueId, csr_type, qt_tablet_context);
+
+ currentTabletPointer = globalCursorInfo->value(uniqueId);
+ tabletUpdateCursor(currentTabletPointer, currentCursor);
}
qt_tabletChokeMouse = false;
-#ifndef QT_NO_TABLETEVENT
+
QTabletEvent tabletProximity(enteredProximity ? QEvent::TabletEnterProximity
: QEvent::TabletLeaveProximity,
QPoint(), QPoint(), QPointF(), currentTabletPointer.currentDevice, currentTabletPointer.currentPointerType, 0, 0,
0, 0, 0, 0, 0, currentTabletPointer.llId);
QApplication::sendEvent(qApp, &tabletProximity);
-#endif // QT_NO_TABLETEVENT
}
+ #endif // QT_NO_TABLETEVENT
+
break;
#ifdef Q_WS_WINCE_WM
case WM_SETFOCUS: {
@@ -2513,10 +2515,38 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
}
result = false;
break;
- case WM_GESTURE:
- widget->translateGestureEvent(msg);
+ case WM_GESTURE: {
+ GESTUREINFO gi;
+ memset(&gi, 0, sizeof(GESTUREINFO));
+ gi.cbSize = sizeof(GESTUREINFO);
+
+ QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
+ BOOL bResult = false;
+ if (qAppPriv->GetGestureInfo)
+ bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi);
+ if (bResult) {
+ if (gi.dwID == GID_BEGIN) {
+ // find the alien widget for the gesture position.
+ // This might not be accurate as the position is the center
+ // point of two fingers for multi-finger gestures.
+ QPoint pt(gi.ptsLocation.x, gi.ptsLocation.y);
+ QWidget *w = widget->childAt(widget->mapFromGlobal(pt));
+ qAppPriv->gestureWidget = w ? w : widget;
+ }
+ if (qAppPriv->gestureWidget)
+ static_cast<QETWidget*>(qAppPriv->gestureWidget)->translateGestureEvent(msg, gi);
+ if (qAppPriv->CloseGestureInfoHandle)
+ qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam);
+ if (gi.dwID == GID_END)
+ qAppPriv->gestureWidget = 0;
+ } else {
+ DWORD dwErr = GetLastError();
+ if (dwErr > 0)
+ qWarning() << "translateGestureEvent: error = " << dwErr;
+ }
result = true;
break;
+ }
default:
result = false; // event was not processed
break;
@@ -3311,63 +3341,57 @@ bool QETWidget::translateWheelEvent(const MSG &msg)
// the following is adapted from the wintab syspress example (public domain)
/* -------------------------------------------------------------------------- */
-static void tabletInit(UINT wActiveCsr, HCTX hTab)
+// Initialize the "static" information of a cursor device (pen, airbrush, etc).
+// The QTabletDeviceData is initialized with the data that do not change in time
+// (number of button, type of device, etc) but do not initialize the variable data
+// (e.g.: pen or eraser)
+#ifndef QT_NO_TABLETEVENT
+
+static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab)
{
+ Q_ASSERT(ptrWTInfo);
+ Q_ASSERT(ptrWTGet);
+
+ Q_ASSERT(!tCursorInfo()->contains(uniqueId));
+
/* browse WinTab's many info items to discover pressure handling. */
- if (ptrWTInfo && ptrWTGet) {
- AXIS np;
- LOGCONTEXT lc;
- BYTE wPrsBtn;
- BYTE logBtns[32];
- UINT size;
-
- /* discover the LOGICAL button generated by the pressure channel. */
- /* get the PHYSICAL button from the cursor category and run it */
- /* through that cursor's button map (usually the identity map). */
- wPrsBtn = (BYTE)-1;
- ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_NPBUTTON, &wPrsBtn);
- size = ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_BUTTONMAP, &logBtns);
- if ((UINT)wPrsBtn < size)
- wPrsBtn = logBtns[wPrsBtn];
-
- /* get the current context for its device variable. */
- ptrWTGet(hTab, &lc);
-
- /* get the size of the pressure axis. */
- QTabletDeviceData tdd;
- ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_NPRESSURE, &np);
- tdd.minPressure = int(np.axMin);
- tdd.maxPressure = int(np.axMax);
-
- ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_TPRESSURE, &np);
- tdd.minTanPressure = int(np.axMin);
- tdd.maxTanPressure = int(np.axMax);
-
- LOGCONTEXT lcMine;
-
- /* get default region */
- ptrWTInfo(WTI_DEFCONTEXT, 0, &lcMine);
-
- tdd.minX = 0;
- tdd.maxX = int(lcMine.lcInExtX) - int(lcMine.lcInOrgX);
-
- tdd.minY = 0;
- tdd.maxY = int(lcMine.lcInExtY) - int(lcMine.lcInOrgY);
-
- tdd.minZ = 0;
- tdd.maxZ = int(lcMine.lcInExtZ) - int(lcMine.lcInOrgZ);
-
- int csr_type,
- csr_physid;
- ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_TYPE, &csr_type);
- ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_PHYSID, &csr_physid);
- tdd.llId = csr_type & 0x0F06;
- tdd.llId = (tdd.llId << 24) | csr_physid;
-#ifndef QT_NO_TABLETEVENT
- if (((csr_type & 0x0006) == 0x0002) && ((csr_type & 0x0F06) != 0x0902)) {
- tdd.currentDevice = QTabletEvent::Stylus;
- } else {
- switch (csr_type & 0x0F06) {
+ AXIS np;
+ LOGCONTEXT lc;
+
+ /* get the current context for its device variable. */
+ ptrWTGet(hTab, &lc);
+
+ /* get the size of the pressure axis. */
+ QTabletDeviceData tdd;
+ tdd.llId = uniqueId;
+
+ ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_NPRESSURE, &np);
+ tdd.minPressure = int(np.axMin);
+ tdd.maxPressure = int(np.axMax);
+
+ ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_TPRESSURE, &np);
+ tdd.minTanPressure = int(np.axMin);
+ tdd.maxTanPressure = int(np.axMax);
+
+ LOGCONTEXT lcMine;
+
+ /* get default region */
+ ptrWTInfo(WTI_DEFCONTEXT, 0, &lcMine);
+
+ tdd.minX = 0;
+ tdd.maxX = int(lcMine.lcInExtX) - int(lcMine.lcInOrgX);
+
+ tdd.minY = 0;
+ tdd.maxY = int(lcMine.lcInExtY) - int(lcMine.lcInOrgY);
+
+ tdd.minZ = 0;
+ tdd.maxZ = int(lcMine.lcInExtZ) - int(lcMine.lcInOrgZ);
+
+ const uint cursorTypeBitMask = 0x0F06; // bitmask to find the specific cursor type (see Wacom FAQ)
+ if (((csr_type & 0x0006) == 0x0002) && ((csr_type & cursorTypeBitMask) != 0x0902)) {
+ tdd.currentDevice = QTabletEvent::Stylus;
+ } else {
+ switch (csr_type & cursorTypeBitMask) {
case 0x0802:
tdd.currentDevice = QTabletEvent::Stylus;
break;
@@ -3385,26 +3409,34 @@ static void tabletInit(UINT wActiveCsr, HCTX hTab)
break;
default:
tdd.currentDevice = QTabletEvent::NoDevice;
- }
- }
-
- switch (wActiveCsr % 3) {
- case 2:
- tdd.currentPointerType = QTabletEvent::Eraser;
- break;
- case 1:
- tdd.currentPointerType = QTabletEvent::Pen;
- break;
- case 0:
- tdd.currentPointerType = QTabletEvent::Cursor;
- break;
- default:
- tdd.currentPointerType = QTabletEvent::UnknownPointer;
}
+ }
+ tCursorInfo()->insert(uniqueId, tdd);
+}
#endif // QT_NO_TABLETEVENT
- tCursorInfo()->insert(wActiveCsr, tdd);
+
+// Update the "dynamic" informations of a cursor device (pen, airbrush, etc).
+// The dynamic information is the information of QTabletDeviceData that can change
+// in time (eraser or pen if a device is turned around).
+#ifndef QT_NO_TABLETEVENT
+
+static void tabletUpdateCursor(QTabletDeviceData &tdd, const UINT currentCursor)
+{
+ switch (currentCursor % 3) { // %3 for dual track
+ case 0:
+ tdd.currentPointerType = QTabletEvent::Cursor;
+ break;
+ case 1:
+ tdd.currentPointerType = QTabletEvent::Pen;
+ break;
+ case 2:
+ tdd.currentPointerType = QTabletEvent::Eraser;
+ break;
+ default:
+ tdd.currentPointerType = QTabletEvent::UnknownPointer;
}
}
+#endif // QT_NO_TABLETEVENT
bool QETWidget::translateTabletEvent(const MSG &msg, PACKET *localPacketBuf,
int numPackets)
@@ -3540,6 +3572,10 @@ bool QETWidget::translateTabletEvent(const MSG &msg, PACKET *localPacketBuf,
}
extern bool qt_is_gui_used;
+
+
+#ifndef QT_NO_TABLETEVENT
+
static void initWinTabFunctions()
{
#if defined(Q_OS_WINCE)
@@ -3558,6 +3594,7 @@ static void initWinTabFunctions()
}
#endif // Q_OS_WINCE
}
+#endif // QT_NO_TABLETEVENT
//
@@ -3725,69 +3762,42 @@ bool QETWidget::translateCloseEvent(const MSG &)
return d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
}
-bool QETWidget::translateGestureEvent(const MSG &msg)
+bool QETWidget::translateGestureEvent(const MSG &, const GESTUREINFO &gi)
{
- GESTUREINFO gi;
- memset(&gi, 0, sizeof(GESTUREINFO));
- gi.cbSize = sizeof(GESTUREINFO);
+ const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
+ QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
+ if (alienWidget && alienWidget->internalWinId())
+ alienWidget = 0;
+ QWidget *widget = alienWidget ? alienWidget : this;
- QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
-#if defined(Q_WS_WINCE_WM) && defined(QT_WINCE_GESTURES)
-#undef GID_ZOOM
-#define GID_ZOOM 0xf000
-#undef GID_ROTATE
-#define GID_ROTATE 0xf001
-#undef GID_TWOFINGERTAP
-#define GID_TWOFINGERTAP 0xf002
-#undef GID_ROLLOVER
-#define GID_ROLLOVER 0xf003
-#endif
- BOOL bResult = false;
- if (qAppPriv->GetGestureInfo)
- bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi);
-
- if (bResult) {
- const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
- QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
- if (alienWidget && alienWidget->internalWinId())
- alienWidget = 0;
- QWidget *widget = alienWidget ? alienWidget : this;
-
- QNativeGestureEvent event;
- event.sequenceId = gi.dwSequenceID;
- event.position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
- event.argument = gi.ullArguments;
-
- switch (gi.dwID) {
- case GID_BEGIN:
- event.gestureType = QNativeGestureEvent::GestureBegin;
- break;
- case GID_END:
- event.gestureType = QNativeGestureEvent::GestureEnd;
- break;
- case GID_ZOOM:
- event.gestureType = QNativeGestureEvent::Zoom;
- break;
- case GID_PAN:
- event.gestureType = QNativeGestureEvent::Pan;
- break;
- case GID_ROTATE:
- event.gestureType = QNativeGestureEvent::Rotate;
- break;
- case GID_TWOFINGERTAP:
- case GID_ROLLOVER:
- default:
- break;
- }
- if (qAppPriv->CloseGestureInfoHandle)
- qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam);
- if (event.gestureType != QNativeGestureEvent::None)
- qt_sendSpontaneousEvent(widget, &event);
- } else {
- DWORD dwErr = GetLastError();
- if (dwErr > 0)
- qWarning() << "translateGestureEvent: error = " << dwErr;
+ QNativeGestureEvent event;
+ event.sequenceId = gi.dwSequenceID;
+ event.position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
+ event.argument = gi.ullArguments;
+
+ switch (gi.dwID) {
+ case GID_BEGIN:
+ event.gestureType = QNativeGestureEvent::GestureBegin;
+ break;
+ case GID_END:
+ event.gestureType = QNativeGestureEvent::GestureEnd;
+ break;
+ case GID_ZOOM:
+ event.gestureType = QNativeGestureEvent::Zoom;
+ break;
+ case GID_PAN:
+ event.gestureType = QNativeGestureEvent::Pan;
+ break;
+ case GID_ROTATE:
+ event.gestureType = QNativeGestureEvent::Rotate;
+ break;
+ case GID_TWOFINGERTAP:
+ case GID_ROLLOVER:
+ default:
+ break;
}
+ if (event.gestureType != QNativeGestureEvent::None)
+ qt_sendSpontaneousEvent(widget, &event);
return true;
}
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index db349f0e1..b71ae73a4 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -79,11 +79,13 @@
#include <private/qcolor_p.h>
#include <private/qcursor_p.h>
#include <private/qiconloader_p.h>
+#include <qgtkstyle.h>
#include "qstyle.h"
#include "qmetaobject.h"
#include "qtimer.h"
#include "qlibrary.h"
#include <private/qgraphicssystemfactory_p.h>
+#include "qguiplatformplugin_p.h"
#include "qkde_p.h"
#if !defined (QT_NO_TABLET)
@@ -189,10 +191,12 @@ static const char * x11_atomnames = {
"TARGETS\0"
"MULTIPLE\0"
"TIMESTAMP\0"
+ "SAVE_TARGETS\0"
"CLIP_TEMPORARY\0"
"_QT_SELECTION\0"
"_QT_CLIPBOARD_SENTINEL\0"
"_QT_SELECTION_SENTINEL\0"
+ "CLIPBOARD_MANAGER\0"
"RESOURCE_MANAGER\0"
@@ -916,7 +920,7 @@ bool QApplicationPrivate::x11_apply_settings()
QString stylename = settings.value(QLatin1String("style")).toString();
if (stylename.isEmpty() && QApplicationPrivate::styleOverride.isNull() && X11->use_xrender) {
- stylename = x11_desktop_style();
+ stylename = qt_guiPlatformPlugin()->styleName();
}
static QString currentStyleName = stylename;
@@ -1310,8 +1314,7 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0,
pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::darkBlue);
}
- if (kdeColors)
- pal = QKde::kdePalette().resolve(pal);
+ pal = qt_guiPlatformPlugin()->palette().resolve(pal);
QApplicationPrivate::setSystemPalette(pal);
QColor::setAllowX11ColorNames(allowX11ColorNames);
}
@@ -1622,6 +1625,7 @@ void qt_init(QApplicationPrivate *priv, int,
// MIT-SHM
X11->use_mitshm = false;
+ X11->use_mitshm_pixmaps = false;
X11->mitshm_major = 0;
X11->sip_serial = 0;
@@ -1851,10 +1855,20 @@ void qt_init(QApplicationPrivate *priv, int,
QX11InfoData *screen = X11->screens + s;
screen->ref = 1; // ensures it doesn't get deleted
screen->screen = s;
- screen->dpiX = (DisplayWidth(X11->display, s) * 254 + DisplayWidthMM(X11->display, s)*5)
- / (DisplayWidthMM(X11->display, s)*10);
- screen->dpiY = (DisplayHeight(X11->display, s) * 254 + DisplayHeightMM(X11->display, s)*5)
- / (DisplayHeightMM(X11->display, s)*10);
+
+ int widthMM = DisplayWidthMM(X11->display, s);
+ if (widthMM != 0) {
+ screen->dpiX = (DisplayWidth(X11->display, s) * 254 + widthMM * 5) / (widthMM * 10);
+ } else {
+ screen->dpiX = 72;
+ }
+
+ int heightMM = DisplayHeightMM(X11->display, s);
+ if (heightMM != 0) {
+ screen->dpiY = (DisplayHeight(X11->display, s) * 254 + heightMM * 5) / (heightMM * 10);
+ } else {
+ screen->dpiY = 72;
+ }
X11->argbVisuals[s] = 0;
X11->argbColormaps[s] = 0;
@@ -1905,9 +1919,13 @@ void qt_init(QApplicationPrivate *priv, int,
bool local = displayName.isEmpty() || displayName.lastIndexOf(QLatin1Char(':')) == 0;
if (local && (qgetenv("QT_X11_NO_MITSHM").toInt() == 0)) {
Visual *defaultVisual = DefaultVisual(X11->display, DefaultScreen(X11->display));
- X11->use_mitshm = mitshm_pixmaps && (defaultVisual->red_mask == 0xff0000
- && defaultVisual->green_mask == 0xff00
- && defaultVisual->blue_mask == 0xff);
+ X11->use_mitshm = ((defaultVisual->red_mask == 0xff0000
+ || defaultVisual->red_mask == 0xf800)
+ && (defaultVisual->green_mask == 0xff00
+ || defaultVisual->green_mask == 0x7e0)
+ && (defaultVisual->blue_mask == 0xff
+ || defaultVisual->blue_mask == 0x1f));
+ X11->use_mitshm_pixmaps = X11->use_mitshm && mitshm_pixmaps;
}
}
#endif // QT_NO_MITSHM
@@ -2240,8 +2258,13 @@ void qt_init(QApplicationPrivate *priv, int,
unsigned long length, after;
uchar *data = 0;
- if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING),
- 0, 1, False, AnyPropertyType, &type, &format, &length,
+ QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION"));
+ if (session == QLatin1String("kde")) {
+ X11->desktopEnvironment = DE_KDE;
+ } else if (session == QLatin1String("gnome") || session == QLatin1String("xfce")) {
+ X11->desktopEnvironment = DE_GNOME;
+ } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING),
+ 0, 1, False, AnyPropertyType, &type, &format, &length,
&after, &data) == Success && length) {
// DTWM is running, meaning most likely CDE is running...
X11->desktopEnvironment = DE_CDE;
@@ -2274,6 +2297,12 @@ void qt_init(QApplicationPrivate *priv, int,
if (X11->desktopEnvironment == DE_KDE)
X11->desktopVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt();
+#if !defined(QT_NO_STYLE_GTK)
+ if (X11->desktopEnvironment == DE_GNOME) {
+ static bool menusHaveIcons = QGtkStyle::getGConfBool(QLatin1String("/desktop/gnome/interface/menus_have_icons"), true);
+ QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !menusHaveIcons);
+ }
+#endif
qt_set_input_encoding();
qt_set_x11_resources(appFont, appFGCol, appBGCol, appBTNCol);
@@ -2533,42 +2562,6 @@ void qt_init(QApplicationPrivate *priv, int,
#endif
}
-
- // run-time search for default style
-/*!
- \internal
-*/
-QString QApplicationPrivate::x11_desktop_style()
-{
- QString stylename;
- switch(X11->desktopEnvironment) {
- case DE_KDE:
- stylename = QKde::kdeStyle();
- break;
- case DE_GNOME: {
- QStringList availableStyles = QStyleFactory::keys();
- // Set QGtkStyle for GNOME if available
- QString gtkStyleKey = QString::fromLatin1("GTK+");
- if (availableStyles.contains(gtkStyleKey)) {
- stylename = gtkStyleKey;
- break;
- }
- if (X11->use_xrender)
- stylename = QLatin1String("cleanlooks");
- else
- stylename = QLatin1String("windows");
- break;
- }
- case DE_CDE:
- stylename = QLatin1String("cde");
- break;
- default:
- // Don't do anything
- break;
- }
- return stylename;
-}
-
void QApplicationPrivate::initializeWidgetPaletteHash()
{
}
@@ -2800,8 +2793,6 @@ void QApplicationPrivate::applyX11SpecificCommandLineArguments(QWidget *main_wid
QApplication cursor stack
*****************************************************************************/
-extern void qt_x11_enforce_cursor(QWidget * w);
-
void QApplication::setOverrideCursor(const QCursor &cursor)
{
qApp->d_func()->cursor_list.prepend(cursor);
@@ -3761,6 +3752,12 @@ int QApplication::x11ProcessEvent(XEvent* event)
qt_get_net_virtual_roots();
} else if (event->xproperty.atom == ATOM(_NET_WORKAREA)) {
qt_desktopwidget_update_workarea();
+
+ // emit the workAreaResized() signal
+ QDesktopWidget *desktop = QApplication::desktop();
+ int numScreens = desktop->numScreens();
+ for (int i = 0; i < numScreens; ++i)
+ emit desktop->workAreaResized(i);
}
} else if (widget) {
widget->translatePropertyEvent(event);
@@ -4497,7 +4494,9 @@ void fetchWacomToolId(int &deviceType, qint64 &serialId)
struct qt_tablet_motion_data
{
- Time timestamp;
+ bool filterByWidget;
+ const QWidget *widget;
+ const QWidget *etWidget;
int tabletMotionType;
bool error; // found a reason to stop searching
};
@@ -4520,15 +4519,20 @@ static Bool qt_tabletMotion_scanner(Display *, XEvent *event, XPointer arg)
qt_tablet_motion_data *data = (qt_tablet_motion_data *) arg;
if (data->error)
return false;
-
if (event->type == data->tabletMotionType) {
- if (data->timestamp > 0) {
- if ((reinterpret_cast<const XDeviceMotionEvent*>(event))->time > data->timestamp) {
- data->error = true;
- return false;
+ const XDeviceMotionEvent *const motion = reinterpret_cast<const XDeviceMotionEvent*>(event);
+ if (data->filterByWidget) {
+ const QPoint curr(motion->x, motion->y);
+ const QWidget *w = data->etWidget;
+ const QWidget *const child = w->childAt(curr);
+ if (child) {
+ w = child;
}
+ if (w == data->widget)
+ return true;
+ } else {
+ return true;
}
- return true;
}
data->error = event->type != MotionNotify; // we stop compression when another event gets in between.
@@ -4561,57 +4565,17 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet
qreal rotation = 0;
int deviceType = QTabletEvent::NoDevice;
int pointerType = QTabletEvent::UnknownPointer;
- XEvent mouseMotionEvent;
const XDeviceMotionEvent *motion = 0;
XDeviceButtonEvent *button = 0;
const XProximityNotifyEvent *proximity = 0;
QEvent::Type t;
Qt::KeyboardModifiers modifiers = 0;
- bool reinsertMouseEvent = false;
- XEvent mouseMotionEventSave;
#if !defined (Q_OS_IRIX)
XID device_id;
#endif
if (ev->type == tablet->xinput_motion) {
motion = reinterpret_cast<const XDeviceMotionEvent*>(ev);
-
- // Do event compression. Skip over tablet+mouse move events if there are newer ones.
- qt_tablet_motion_data tabletMotionData;
- tabletMotionData.tabletMotionType = tablet->xinput_motion;
- XEvent dummy;
- while (true) {
- // Find first mouse event since we expect them in pairs inside Qt
- tabletMotionData.error =false;
- tabletMotionData.timestamp = 0;
- if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) {
- mouseMotionEventSave = mouseMotionEvent;
- reinsertMouseEvent = true;
- } else {
- break;
- }
-
- // Now discard any duplicate tablet events.
- tabletMotionData.error = false;
- tabletMotionData.timestamp = mouseMotionEvent.xmotion.time;
- while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) {
- motion = reinterpret_cast<const XDeviceMotionEvent*>(&dummy);
- }
-
- // now check if there are more recent tablet motion events since we'll compress the current one with
- // newer ones in that case
- tabletMotionData.error = false;
- tabletMotionData.timestamp = 0;
- if (! XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) {
- break; // done with compression
- }
- motion = reinterpret_cast<const XDeviceMotionEvent*>(&dummy);
- }
-
- if (reinsertMouseEvent) {
- XPutBackEvent(X11->display, &mouseMotionEventSave);
- }
-
t = QEvent::TabletMove;
global = QPoint(motion->x_root, motion->y_root);
curr = QPoint(motion->x, motion->y);
@@ -4764,11 +4728,14 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet
}
#endif
- QWidget *child = w->childAt(curr);
- if (child) {
- w = child;
- curr = w->mapFromGlobal(global);
+ if (tablet->widgetToGetPress) {
+ w = tablet->widgetToGetPress;
+ } else {
+ QWidget *child = w->childAt(curr);
+ if (child)
+ w = child;
}
+ curr = w->mapFromGlobal(global);
if (t == QEvent::TabletPress) {
tablet->widgetToGetPress = w;
@@ -4782,10 +4749,45 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet
deviceType, pointerType,
qreal(pressure / qreal(tablet->maxPressure - tablet->minPressure)),
xTilt, yTilt, tangentialPressure, rotation, z, modifiers, uid);
- if (proximity)
+ if (proximity) {
QApplication::sendSpontaneousEvent(qApp, &e);
- else
+ } else {
QApplication::sendSpontaneousEvent(w, &e);
+ const bool accepted = e.isAccepted();
+ if (!accepted && ev->type == tablet->xinput_motion) {
+ // If the widget does not accept tablet events, we drop the next ones from the event queue
+ // for this widget so it is not overloaded with the numerous tablet events.
+ qt_tablet_motion_data tabletMotionData;
+ tabletMotionData.tabletMotionType = tablet->xinput_motion;
+ tabletMotionData.widget = w;
+ tabletMotionData.etWidget = this;
+ // if nothing is pressed, the events are filtered by position
+ tabletMotionData.filterByWidget = (tablet->widgetToGetPress == 0);
+
+ bool reinsertMouseEvent = false;
+ XEvent mouseMotionEvent;
+ while (true) {
+ // Find first mouse event since we expect them in pairs inside Qt
+ tabletMotionData.error =false;
+ if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) {
+ reinsertMouseEvent = true;
+ } else {
+ break;
+ }
+
+ // Now discard any duplicate tablet events.
+ tabletMotionData.error = false;
+ XEvent dummy;
+ while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) {
+ // just discard the event
+ }
+ }
+
+ if (reinsertMouseEvent) {
+ XPutBackEvent(X11->display, &mouseMotionEvent);
+ }
+ }
+ }
return true;
}
#endif
@@ -5391,7 +5393,8 @@ class QSessionManagerPrivate : public QObjectPrivate
{
public:
QSessionManagerPrivate(QSessionManager* mgr, QString& id, QString& key)
- : QObjectPrivate(), sm(mgr), sessionId(id), sessionKey(key), eventLoop(0) {}
+ : QObjectPrivate(), sm(mgr), sessionId(id), sessionKey(key),
+ restartHint(QSessionManager::RestartIfRunning), eventLoop(0) {}
QSessionManager* sm;
QStringList restartCommand;
QStringList discardCommand;
diff --git a/src/gui/kernel/qboxlayout.cpp b/src/gui/kernel/qboxlayout.cpp
index 5dd77e8a2..d96593355 100644
--- a/src/gui/kernel/qboxlayout.cpp
+++ b/src/gui/kernel/qboxlayout.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -452,7 +452,6 @@ void QBoxLayoutPrivate::calcHfw(int w)
vertically.
\ingroup geomanagement
- \ingroup appearance
QBoxLayout takes the space it gets (from its parent layout or from
the parentWidget()), divides it up into a row of boxes, and makes
@@ -925,9 +924,15 @@ void QBoxLayout::insertSpacing(int index, int size)
else
b = QLayoutPrivate::createSpacerItem(this, 0, size, QSizePolicy::Minimum, QSizePolicy::Fixed);
- QBoxLayoutItem *it = new QBoxLayoutItem(b);
- it->magic = true;
- d->list.insert(index, it);
+ QT_TRY {
+ QBoxLayoutItem *it = new QBoxLayoutItem(b);
+ it->magic = true;
+ d->list.insert(index, it);
+
+ } QT_CATCH(...) {
+ delete b;
+ QT_RETHROW;
+ }
invalidate();
}
@@ -1027,8 +1032,21 @@ void QBoxLayout::insertWidget(int index, QWidget *widget, int stretch,
index = d->list.count();
QWidgetItem *b = QLayoutPrivate::createWidgetItem(this, widget);
b->setAlignment(alignment);
- QBoxLayoutItem *it = new QBoxLayoutItem(b, stretch);
- d->list.insert(index, it);
+
+ QBoxLayoutItem *it;
+ QT_TRY{
+ it = new QBoxLayoutItem(b, stretch);
+ } QT_CATCH(...) {
+ delete b;
+ QT_RETHROW;
+ }
+
+ QT_TRY{
+ d->list.insert(index, it);
+ } QT_CATCH(...) {
+ delete it;
+ QT_RETHROW;
+ }
invalidate();
}
@@ -1271,8 +1289,6 @@ QBoxLayout::Direction QBoxLayout::direction() const
\brief The QHBoxLayout class lines up widgets horizontally.
\ingroup geomanagement
- \ingroup appearance
- \mainclass
This class is used to construct horizontal box layout objects. See
QBoxLayout for details.
@@ -1389,8 +1405,6 @@ QHBoxLayout::~QHBoxLayout()
\brief The QVBoxLayout class lines up widgets vertically.
\ingroup geomanagement
- \ingroup appearance
- \mainclass
This class is used to construct vertical box layout objects. See
QBoxLayout for details.
diff --git a/src/gui/kernel/qboxlayout.h b/src/gui/kernel/qboxlayout.h
index 6566453b2..df643464d 100644
--- a/src/gui/kernel/qboxlayout.h
+++ b/src/gui/kernel/qboxlayout.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 27797179c..e43f8b5f1 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -58,10 +58,6 @@ QT_BEGIN_NAMESPACE
\class QClipboard
\brief The QClipboard class provides access to the window system clipboard.
- \ingroup io
- \ingroup environment
- \mainclass
-
The clipboard offers a simple mechanism to copy and paste data
between applications.
@@ -300,12 +296,16 @@ QString QClipboard::text(QString &subtype, Mode mode) const
const QByteArray rawData = data->data(QLatin1String("text/") + subtype);
+#ifndef QT_NO_TEXTCODEC
QTextCodec* codec = QTextCodec::codecForMib(106); // utf-8 is default
if (subtype == QLatin1String("html"))
codec = QTextCodec::codecForHtml(rawData, codec);
else
codec = QTextCodec::codecForUtfText(rawData, codec);
return codec->toUnicode(rawData);
+#else //QT_NO_TEXTCODEC
+ return rawData;
+#endif //QT_NO_TEXTCODEC
}
/*!
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index 2f7db9182..f55221f1f 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qclipboard_mac.cpp b/src/gui/kernel/qclipboard_mac.cpp
index 513a0f832..889226931 100644
--- a/src/gui/kernel/qclipboard_mac.cpp
+++ b/src/gui/kernel/qclipboard_mac.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -532,7 +532,7 @@ QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
// Try to get the NSStringPboardType from NSPasteboard, newlines are mapped
// correctly (as '\n') in this data. The 'public.utf16-plain-text' type
// usually maps newlines to '\r' instead.
- QString str = qt_mac_get_pasteboardString();
+ QString str = qt_mac_get_pasteboardString(paste);
if (!str.isEmpty())
return str;
}
diff --git a/src/gui/kernel/qclipboard_p.h b/src/gui/kernel/qclipboard_p.h
index 3b35be188..efb62cdc8 100644
--- a/src/gui/kernel/qclipboard_p.h
+++ b/src/gui/kernel/qclipboard_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qclipboard_qws.cpp b/src/gui/kernel/qclipboard_qws.cpp
index 4a93fb7cd..41aea97cf 100644
--- a/src/gui/kernel/qclipboard_qws.cpp
+++ b/src/gui/kernel/qclipboard_qws.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp
new file mode 100644
index 000000000..48aa331c9
--- /dev/null
+++ b/src/gui/kernel/qclipboard_s60.cpp
@@ -0,0 +1,266 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qclipboard.h"
+
+#ifndef QT_NO_CLIPBOARD
+
+#include "qapplication.h"
+#include "qbitmap.h"
+#include "qdatetime.h"
+#include "qbuffer.h"
+#include "qwidget.h"
+#include "qevent.h"
+#include "private/qcore_symbian_p.h"
+#include <QtDebug>
+
+// Symbian's clipboard
+#include <baclipb.h>
+QT_BEGIN_NAMESPACE
+
+//### Mime Type mapping to UIDs
+
+const TUid KQtCbDataStream = {0x2001B2DD};
+
+
+class QClipboardData
+{
+public:
+ QClipboardData();
+ ~QClipboardData();
+
+ void setSource(QMimeData* s)
+ {
+ if (s == src)
+ return;
+ delete src;
+ src = s;
+ }
+ QMimeData* source()
+ { return src; }
+ bool connected()
+ { return connection; }
+ void clear();
+
+private:
+ QMimeData* src;
+ bool connection;
+};
+
+QClipboardData::QClipboardData():src(0),connection(true)
+{
+ clear();
+}
+
+QClipboardData::~QClipboardData()
+{
+ connection = false;
+ delete src;
+}
+
+void QClipboardData::clear()
+{
+ QMimeData* newSrc = new QMimeData;
+ delete src;
+ src = newSrc;
+}
+
+static QClipboardData *internalCbData = 0;
+
+static void cleanupClipboardData()
+{
+ delete internalCbData;
+ internalCbData = 0;
+}
+
+static QClipboardData *clipboardData()
+{
+ if (internalCbData == 0) {
+ internalCbData = new QClipboardData;
+ if (internalCbData)
+ {
+ if (!internalCbData->connected())
+ {
+ delete internalCbData;
+ internalCbData = 0;
+ }
+ else
+ {
+ qAddPostRoutine(cleanupClipboardData);
+ }
+ }
+ }
+ return internalCbData;
+}
+
+void writeToStreamLX(const QMimeData* aData, RWriteStream& aStream)
+{
+ // This function both leaves and throws exceptions. There must be no destructor
+ // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects.
+ QStringList headers = aData->formats();
+ aStream << TCardinality(headers.count());
+ for (QStringList::const_iterator iter= headers.constBegin();iter != headers.constEnd();iter++)
+ {
+ HBufC* stringData = TPtrC(reinterpret_cast<const TUint16*>((*iter).utf16())).AllocLC();
+ QByteArray ba = aData->data((*iter));
+ qDebug() << "copy to clipboard mime: " << *iter << " data: " << ba;
+ // mime type
+ aStream << TCardinality(stringData->Size());
+ aStream << *(stringData);
+ // mime data
+ aStream << TCardinality(ba.size());
+ aStream.WriteL(reinterpret_cast<const uchar*>(ba.constData()),ba.size());
+ CleanupStack::PopAndDestroy(stringData);
+ }
+}
+
+void readFromStreamLX(QMimeData* aData,RReadStream& aStream)
+{
+ // This function both leaves and throws exceptions. There must be no destructor
+ // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects.
+ TCardinality mimeTypeCount;
+ aStream >> mimeTypeCount;
+ for (int i = 0; i< mimeTypeCount;i++)
+ {
+ // mime type
+ TCardinality mimeTypeSize;
+ aStream >> mimeTypeSize;
+ HBufC* mimeTypeBuf = HBufC::NewLC(aStream,mimeTypeSize);
+ QString mimeType = QString::fromUtf16(mimeTypeBuf->Des().Ptr(),mimeTypeBuf->Length());
+ CleanupStack::PopAndDestroy(mimeTypeBuf);
+ // mime data
+ TCardinality dataSize;
+ aStream >> dataSize;
+ QByteArray ba;
+ ba.reserve(dataSize);
+ aStream.ReadL(reinterpret_cast<uchar*>(ba.data_ptr()->data),dataSize);
+ ba.data_ptr()->size = dataSize;
+ qDebug() << "paste from clipboard mime: " << mimeType << " data: " << ba;
+ aData->setData(mimeType,ba);
+ }
+}
+
+
+/*****************************************************************************
+ QClipboard member functions
+ *****************************************************************************/
+
+void QClipboard::clear(Mode mode)
+{
+ setText(QString(), mode);
+}
+const QMimeData* QClipboard::mimeData(Mode mode) const
+{
+ if (mode != Clipboard) return 0;
+ QClipboardData *d = clipboardData();
+ if (d)
+ {
+ TRAPD(err,{
+ RFs fs = qt_s60GetRFs();
+ CClipboard* cb = CClipboard::NewForReadingLC(fs);
+ Q_ASSERT(cb);
+ RStoreReadStream stream;
+ TStreamId stid = (cb->StreamDictionary()).At(KQtCbDataStream);
+ stream.OpenLC(cb->Store(),stid);
+ QT_TRYCATCH_LEAVING(readFromStreamLX(d->source(),stream));
+ CleanupStack::PopAndDestroy(2,cb);
+ return d->source();
+ });
+ if (err != KErrNone){
+ qDebug()<< "clipboard is empty/err: " << err;
+ }
+
+ }
+ return 0;
+}
+
+
+void QClipboard::setMimeData(QMimeData* src, Mode mode)
+{
+ if (mode != Clipboard) return;
+ QClipboardData *d = clipboardData();
+ if (d)
+ {
+ TRAPD(err,{
+ RFs fs = qt_s60GetRFs();
+ CClipboard* cb = CClipboard::NewForWritingLC(fs);
+ RStoreWriteStream stream;
+ TStreamId stid = stream.CreateLC(cb->Store());
+ QT_TRYCATCH_LEAVING(writeToStreamLX(src,stream));
+ d->setSource(src);
+ stream.CommitL();
+ (cb->StreamDictionary()).AssignL(KQtCbDataStream,stid);
+ cb->CommitL();
+ CleanupStack::PopAndDestroy(2,cb);
+ });
+ if (err != KErrNone){
+ qDebug()<< "clipboard write err :" << err;
+ }
+ }
+ emitChanged(QClipboard::Clipboard);
+}
+
+bool QClipboard::supportsMode(Mode mode) const
+{
+ return (mode == Clipboard);
+}
+
+bool QClipboard::ownsMode(Mode mode) const
+{
+ if (mode == Clipboard)
+ qWarning("QClipboard::ownsClipboard: UNIMPLEMENTED!");
+ return false;
+}
+
+bool QClipboard::event(QEvent * /* e */)
+{
+ return true;
+}
+
+void QClipboard::connectNotify( const char * )
+{
+}
+
+void QClipboard::ownerDestroyed()
+{
+}
+QT_END_NAMESPACE
+#endif // QT_NO_CLIPBOARD
diff --git a/src/gui/kernel/qclipboard_win.cpp b/src/gui/kernel/qclipboard_win.cpp
index 1967cac3a..01570525d 100644
--- a/src/gui/kernel/qclipboard_win.cpp
+++ b/src/gui/kernel/qclipboard_win.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,6 +51,7 @@
#include "qmime.h"
#include "qt_windows.h"
#include "qdnd_p.h"
+#include <private/qwidget_p.h>
QT_BEGIN_NAMESPACE
@@ -140,6 +141,9 @@ public:
clipBoardViewer = new QWidget();
clipBoardViewer->createWinId();
clipBoardViewer->setObjectName(QLatin1String("internal clipboard owner"));
+ // We dont need this internal widget to appear in QApplication::topLevelWidgets()
+ if (QWidgetPrivate::allWidgets)
+ QWidgetPrivate::allWidgets->remove(clipBoardViewer);
}
~QClipboardData()
diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp
index 1339f396f..22d7c9e23 100644
--- a/src/gui/kernel/qclipboard_x11.cpp
+++ b/src/gui/kernel/qclipboard_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -78,6 +78,7 @@
#include "qimagewriter.h"
#include "qvariant.h"
#include "qdnd_p.h"
+#include <private/qwidget_p.h>
#ifndef QT_NO_XFIXES
#include <X11/extensions/Xfixes.h>
@@ -131,6 +132,11 @@ void setupOwner()
requestor = new QWidget(0);
requestor->createWinId();
requestor->setObjectName(QLatin1String("internal clipboard requestor"));
+ // We dont need this internal widgets to appear in QApplication::topLevelWidgets()
+ if (QWidgetPrivate::allWidgets) {
+ QWidgetPrivate::allWidgets->remove(owner);
+ QWidgetPrivate::allWidgets->remove(requestor);
+ }
qAddPostRoutine(cleanup);
}
@@ -769,6 +775,9 @@ QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property,
delete requestor;
requestor = new QWidget(0);
requestor->setObjectName(QLatin1String("internal clipboard requestor"));
+ // We dont need this internal widget to appear in QApplication::topLevelWidgets()
+ if (QWidgetPrivate::allWidgets)
+ QWidgetPrivate::allWidgets->remove(requestor);
return QByteArray();
}
@@ -787,6 +796,7 @@ static Atom send_targets_selection(QClipboardData *d, Window window, Atom proper
types.append(ATOM(TARGETS));
types.append(ATOM(MULTIPLE));
types.append(ATOM(TIMESTAMP));
+ types.append(ATOM(SAVE_TARGETS));
XChangeProperty(X11->display, window, property, XA_ATOM, 32,
PropModeReplace, (uchar *) types.data(), types.size());
@@ -911,8 +921,31 @@ bool QClipboard::event(QEvent *e)
XEvent *xevent = (XEvent *)(((QClipboardEvent *)e)->data());
Display *dpy = X11->display;
- if (!xevent)
+ if (!xevent) {
+ // That means application exits and we need to give clipboard
+ // content to the clipboard manager.
+ // First we check if there is a clipboard manager.
+ if (XGetSelectionOwner(X11->display, ATOM(CLIPBOARD_MANAGER)) == XNone
+ || !owner)
+ return true;
+
+ Window ownerId = owner->internalWinId();
+ Q_ASSERT(ownerId);
+ // we delete the property so the manager saves all TARGETS.
+ XDeleteProperty(X11->display, ownerId, ATOM(_QT_SELECTION));
+ XConvertSelection(X11->display, ATOM(CLIPBOARD_MANAGER), ATOM(SAVE_TARGETS),
+ ATOM(_QT_SELECTION), ownerId, X11->time);
+ XSync(dpy, false);
+
+ XEvent event;
+ // waiting until the clipboard manager fetches the content.
+ if (!X11->clipboardWaitForEvent(ownerId, SelectionNotify, &event, 10000)) {
+ qWarning("QClipboard: Unable to receive an event from the "
+ "clipboard manager in a reasonable time");
+ }
+
return true;
+ }
switch (xevent->type) {
diff --git a/src/gui/kernel/qcocoaapplication_mac.mm b/src/gui/kernel/qcocoaapplication_mac.mm
index 1f0965fbd..fe287d493 100644
--- a/src/gui/kernel/qcocoaapplication_mac.mm
+++ b/src/gui/kernel/qcocoaapplication_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,25 +21,21 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**
+**
+**
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qcocoaapplication_mac_p.h b/src/gui/kernel/qcocoaapplication_mac_p.h
index a25ab594d..fa81a2712 100644
--- a/src/gui/kernel/qcocoaapplication_mac_p.h
+++ b/src/gui/kernel/qcocoaapplication_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
index 572df705f..304e5d358 100644
--- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
+++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,25 +21,21 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -86,6 +83,7 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qdesktopwidget_mac_p.h>
#include <qevent.h>
+#include <qurl.h>
#include <qapplication.h>
QT_BEGIN_NAMESPACE
@@ -180,6 +178,9 @@ static void cleanupCocoaApplicationDelegate()
return [[qtMenuLoader retain] autorelease];
}
+// This function will only be called when NSApp is actually running. Before
+// that, the kAEQuitApplication apple event will be sendt to
+// QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
Q_UNUSED(sender);
@@ -197,11 +198,19 @@ static void cleanupCocoaApplicationDelegate()
}
}
- // Prevent Cocoa from terminating the application, since this simply
- // exits the program whithout allowing QApplication::exec() to return.
- // The call to QApplication::quit() above will instead quit the
- // application from the Qt side.
- return NSTerminateCancel;
+ if (qtPrivate->threadData->eventLoops.size() == 0) {
+ // INVARIANT: No event loop is executing. This probably
+ // means that Qt is used as a plugin, or as a part of a native
+ // Cocoa application. In any case it should be fine to
+ // terminate now:
+ return NSTerminateNow;
+ } else {
+ // Prevent Cocoa from terminating the application, since this simply
+ // exits the program whithout allowing QApplication::exec() to return.
+ // The call to QApplication::quit() above will instead quit the
+ // application from the Qt side.
+ return NSTerminateCancel;
+ }
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
@@ -298,5 +307,15 @@ static void cleanupCocoaApplicationDelegate()
[self doesNotRecognizeSelector:invocationSelector];
}
+- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
+{
+ Q_UNUSED(replyEvent);
+
+ NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
+ QUrl url(qt_mac_NSStringToQString(urlString));
+ QFileOpenEvent qtEvent(url);
+ qt_sendSpontaneousEvent(qAppInstance(), &qtEvent);
+}
+
@end
#endif
diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h b/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h
index d32b032c8..a13774411 100644
--- a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h
+++ b/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -123,5 +123,6 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate);
- (void)setMenuLoader:(QT_MANGLE_NAMESPACE(QCocoaMenuLoader)*)menuLoader;
- (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader;
- (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate;
+- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
@end
#endif
diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm
index 9f293fb59..990571dce 100644
--- a/src/gui/kernel/qcocoamenuloader_mac.mm
+++ b/src/gui/kernel/qcocoamenuloader_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,25 +21,21 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**
+**
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -47,6 +44,7 @@
#include <qaction.h>
#include <qcoreapplication.h>
#include <private/qcocoamenuloader_mac_p.h>
+#include <private/qapplication_p.h>
#include <private/qt_mac_p.h>
#include <qmenubar.h>
@@ -78,9 +76,14 @@ QT_USE_NAMESPACE
- (void)ensureAppMenuInMenu:(NSMenu *)menu
{
+ // The application menu is the menu in the menu bar that contains the
+ // 'Quit' item. When changing menu bar (e.g when swithing between
+ // windows with different menu bars), we never recreate this menu, but
+ // instead pull it out the current menu bar and place into the new one:
NSMenu *mainMenu = [NSApp mainMenu];
if ([NSApp mainMenu] == menu)
- return; // nothing to do!
+ return; // nothing to do (menu is the current menu bar)!
+
#ifndef QT_NAMESPACE
Q_ASSERT(mainMenu);
#endif
@@ -201,6 +204,7 @@ QT_USE_NAMESPACE
- (IBAction)qtDispatcherToQAction:(id)sender
{
+ QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData);
NSMenuItem *item = static_cast<NSMenuItem *>(sender);
if (QAction *action = reinterpret_cast<QAction *>([item tag])) {
action->trigger();
diff --git a/src/gui/kernel/qcocoamenuloader_mac_p.h b/src/gui/kernel/qcocoamenuloader_mac_p.h
index d310a041a..16e98e881 100644
--- a/src/gui/kernel/qcocoamenuloader_mac_p.h
+++ b/src/gui/kernel/qcocoamenuloader_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qcocoapanel_mac.mm b/src/gui/kernel/qcocoapanel_mac.mm
index 81b4d6bff..915428415 100644
--- a/src/gui/kernel/qcocoapanel_mac.mm
+++ b/src/gui/kernel/qcocoapanel_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,152 +50,16 @@
#include <QtGui/QWidget>
QT_FORWARD_DECLARE_CLASS(QWidget);
-QT_BEGIN_NAMESPACE
-extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm
-QT_END_NAMESPACE
QT_USE_NAMESPACE
-
-@interface NSWindow (QtCoverForHackWithCategory)
-+ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
-@end
-
-
@implementation QT_MANGLE_NAMESPACE(QCocoaPanel)
-- (BOOL)canBecomeKeyWindow
-{
- QWidget *widget = [self QT_MANGLE_NAMESPACE(qt_qwidget)];
-
- bool isToolTip = (widget->windowType() == Qt::ToolTip);
- bool isPopup = (widget->windowType() == Qt::Popup);
- return !(isPopup || isToolTip);
-}
-
/***********************************************************************
- BEGIN Copy and Paste between QCocoaWindow and QCocoaPanel
+ Copy and Paste between QCocoaWindow and QCocoaPanel
This is a bit unfortunate, but thanks to the dynamic dispatch we
have to duplicate this code or resort to really silly forwarding methods
**************************************************************************/
-
-/*
- The methods keyDown, keyUp, and flagsChanged... These really shouldn't ever
- get hit. We automatically say we can be first responder if we are a window.
- So, the handling should get handled by the view. This is here more as a
- last resort (i.e., this is code that can potentially be removed).
- */
-
-- (void)toggleToolbarShown:(id)sender
-{
- macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]);
- [super toggleToolbarShown:sender];
-}
-
-- (void)keyDown:(NSEvent *)theEvent
-{
- bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
- if (!keyOK)
- [super keyDown:theEvent];
-}
-
-- (void)keyUp:(NSEvent *)theEvent
-{
- bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
- if (!keyOK)
- [super keyUp:theEvent];
-}
-
-- (void)flagsChanged:(NSEvent *)theEvent
-{
- qt_dispatchModifiersChanged(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
- [super flagsChanged:theEvent];
-}
-
-
-- (void)tabletProximity:(NSEvent *)tabletEvent
-{
- qt_dispatchTabletProximityEvent(tabletEvent);
-}
-
-- (void)sendEvent:(NSEvent *)event
-{
- QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
-
- // Cocoa can hold onto the window after we've disavowed its knowledge. So,
- // if we get sent an event afterwards just have it go through the super's
- // version and don't do any stuff with Qt.
- if (!widget) {
- [super sendEvent:event];
- return;
- }
- [self retain];
- QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_nativeview_for(widget));
- Qt::MouseButton mouseButton = cocoaButton2QtButton([event buttonNumber]);
-
- // sometimes need to redirect mouse events to the popup.
- QWidget *popup = qAppInstance()->activePopupWidget();
- if (popup && popup != widget) {
- switch([event type])
- {
- case NSLeftMouseDown:
- qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonPress, mouseButton);
- // Don't call super here. This prevents us from getting the mouseUp event,
- // which we need to send even if the mouseDown event was not accepted.
- // (this is standard Qt behavior.)
- break;
- case NSRightMouseDown:
- case NSOtherMouseDown:
- if (!qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonPress, mouseButton))
- [super sendEvent:event];
- break;
- case NSLeftMouseUp:
- case NSRightMouseUp:
- case NSOtherMouseUp:
- if (!qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonRelease, mouseButton))
- [super sendEvent:event];
- break;
- case NSMouseMoved:
- qt_mac_handleMouseEvent(view, event, QEvent::MouseMove, Qt::NoButton);
- break;
- case NSLeftMouseDragged:
- case NSRightMouseDragged:
- case NSOtherMouseDragged:
- [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->view = view;
- [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->theEvent = event;
- if (!qt_mac_handleMouseEvent(view, event, QEvent::MouseMove, mouseButton))
- [super sendEvent:event];
- break;
- default:
- [super sendEvent:event];
- break;
- }
- } else {
- [super sendEvent:event];
- }
- qt_mac_dispatchNCMouseMessage(self, event, [self QT_MANGLE_NAMESPACE(qt_qwidget)], leftButtonIsRightButton);
-
-
- [self release];
-}
-
-- (BOOL)makeFirstResponder:(NSResponder *)responder
-{
- // For some reason Cocoa wants to flip the first responder
- // when Qt doesn't want to, sorry, but "No" :-)
- if (responder == nil && qApp->focusWidget())
- return NO;
- return [super makeFirstResponder:responder];
-}
-
-/***********************************************************************
- END Copy and Paste between QCocoaWindow and QCocoaPanel
-***********************************************************************/
-+ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask
-{
- if (styleMask & QtMacCustomizeWindow)
- return [QT_MANGLE_NAMESPACE(QCocoaWindowCustomThemeFrame) class];
- return [super frameViewClassForStyleMask:styleMask];
-}
+#include "qcocoasharedwindowmethods_mac_p.h"
@end
#endif
diff --git a/src/gui/kernel/qcocoapanel_mac_p.h b/src/gui/kernel/qcocoapanel_mac_p.h
index 73d12af0c..f35d9fb63 100644
--- a/src/gui/kernel/qcocoapanel_mac_p.h
+++ b/src/gui/kernel/qcocoapanel_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,12 +54,16 @@
#ifdef QT_MAC_USE_COCOA
#import <Cocoa/Cocoa.h>
+QT_FORWARD_DECLARE_CLASS(QStringList);
@interface QT_MANGLE_NAMESPACE(QCocoaPanel) : NSPanel {
bool leftButtonIsRightButton;
+ QStringList *currentCustomDragTypes;
}
+ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
+- (void)registerDragTypes;
@end
#endif
+
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
new file mode 100644
index 000000000..cc5839c55
--- /dev/null
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -0,0 +1,319 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/****************************************************************************
+ NB: This is not a header file, dispite the file name suffix. This file is
+ included directly into the source code of qcocoawindow_mac.mm and
+ qcocoapanel_mac.mm to avoid manually doing copy and paste of the exact
+ same code needed at both places. This solution makes it more difficult
+ to e.g fix a bug in qcocoawindow_mac.mm, but forget to do the same in
+ qcocoapanel_mac.mm.
+ The reason we need to do copy and paste in the first place, rather than
+ resolve to method overriding, is that QCocoaPanel needs to inherit from
+ NSPanel, while QCocoaWindow needs to inherit NSWindow rather than NSPanel).
+****************************************************************************/
+
+QT_BEGIN_NAMESPACE
+extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm
+extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
+extern const QStringList& qEnabledDraggedTypes(); // qmime_mac.cpp
+
+Q_GLOBAL_STATIC(QPointer<QWidget>, currentDragTarget);
+
+QT_END_NAMESPACE
+
+- (id)initWithContentRect:(NSRect)contentRect
+ styleMask:(NSUInteger)windowStyle
+ backing:(NSBackingStoreType)bufferingType
+ defer:(BOOL)deferCreation
+{
+ self = [super initWithContentRect:contentRect styleMask:windowStyle
+ backing:bufferingType defer:deferCreation];
+ if (self) {
+ currentCustomDragTypes = 0;
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ delete currentCustomDragTypes;
+ [super dealloc];
+}
+
+- (BOOL)canBecomeKeyWindow
+{
+ QWidget *widget = [self QT_MANGLE_NAMESPACE(qt_qwidget)];
+
+ bool isToolTip = (widget->windowType() == Qt::ToolTip);
+ bool isPopup = (widget->windowType() == Qt::Popup);
+ return !(isPopup || isToolTip);
+}
+
+- (void)toggleToolbarShown:(id)sender
+{
+ macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]);
+ [super toggleToolbarShown:sender];
+}
+
+/*
+ The methods keyDown, keyUp, and flagsChanged... These really shouldn't ever
+ get hit. We automatically say we can be first responder if we are a window.
+ So, the handling should get handled by the view. This is here more as a
+ last resort (i.e., this is code that can potentially be removed).
+ */
+- (void)keyDown:(NSEvent *)theEvent
+{
+ bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
+ if (!keyOK)
+ [super keyDown:theEvent];
+}
+
+- (void)keyUp:(NSEvent *)theEvent
+{
+ bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
+ if (!keyOK)
+ [super keyUp:theEvent];
+}
+
+- (void)flagsChanged:(NSEvent *)theEvent
+{
+ qt_dispatchModifiersChanged(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
+ [super flagsChanged:theEvent];
+}
+
+
+- (void)tabletProximity:(NSEvent *)tabletEvent
+{
+ qt_dispatchTabletProximityEvent(tabletEvent);
+}
+
+- (void)sendEvent:(NSEvent *)event
+{
+ QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
+
+ // Cocoa can hold onto the window after we've disavowed its knowledge. So,
+ // if we get sent an event afterwards just have it go through the super's
+ // version and don't do any stuff with Qt.
+ if (!widget) {
+ [super sendEvent:event];
+ return;
+ }
+
+ [self retain];
+ QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_nativeview_for(widget));
+ Qt::MouseButton mouseButton = cocoaButton2QtButton([event buttonNumber]);
+
+ bool handled = false;
+ // sometimes need to redirect mouse events to the popup.
+ QWidget *popup = qAppInstance()->activePopupWidget();
+ if (popup) {
+ switch([event type])
+ {
+ case NSLeftMouseDown:
+ if (!qt_button_down)
+ qt_button_down = widget;
+ handled = qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonPress, mouseButton);
+ // Don't call super here. This prevents us from getting the mouseUp event,
+ // which we need to send even if the mouseDown event was not accepted.
+ // (this is standard Qt behavior.)
+ break;
+ case NSRightMouseDown:
+ case NSOtherMouseDown:
+ if (!qt_button_down)
+ qt_button_down = widget;
+ handled = qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonPress, mouseButton);
+ break;
+ case NSLeftMouseUp:
+ case NSRightMouseUp:
+ case NSOtherMouseUp:
+ handled = qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonRelease, mouseButton);
+ qt_button_down = 0;
+ break;
+ case NSMouseMoved:
+ handled = qt_mac_handleMouseEvent(view, event, QEvent::MouseMove, Qt::NoButton);
+ break;
+ case NSLeftMouseDragged:
+ case NSRightMouseDragged:
+ case NSOtherMouseDragged:
+ [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->view = view;
+ [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->theEvent = event;
+ handled = qt_mac_handleMouseEvent(view, event, QEvent::MouseMove, mouseButton);
+ break;
+ default:
+ [super sendEvent:event];
+ break;
+ }
+ } else {
+ [super sendEvent:event];
+ }
+
+ if (!handled)
+ qt_mac_dispatchNCMouseMessage(self, event, [self QT_MANGLE_NAMESPACE(qt_qwidget)], leftButtonIsRightButton);
+
+ [self release];
+}
+
+- (BOOL)makeFirstResponder:(NSResponder *)responder
+{
+ // For some reason Cocoa wants to flip the first responder
+ // when Qt doesn't want to, sorry, but "No" :-)
+ if (responder == nil && qApp->focusWidget())
+ return NO;
+ return [super makeFirstResponder:responder];
+}
+
++ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask
+{
+ if (styleMask & QtMacCustomizeWindow)
+ return [QT_MANGLE_NAMESPACE(QCocoaWindowCustomThemeFrame) class];
+ return [super frameViewClassForStyleMask:styleMask];
+}
+
+-(void)registerDragTypes
+{
+ // Calling registerForDraggedTypes below is slow, so only do
+ // it once for each window, or when the custom types change.
+ QMacCocoaAutoReleasePool pool;
+ const QStringList& customTypes = qEnabledDraggedTypes();
+ if (currentCustomDragTypes == 0 || *currentCustomDragTypes != customTypes) {
+ if (currentCustomDragTypes == 0)
+ currentCustomDragTypes = new QStringList();
+ *currentCustomDragTypes = customTypes;
+ const NSString* mimeTypeGeneric = @"com.trolltech.qt.MimeTypeName";
+ NSMutableArray *supportedTypes = [NSMutableArray arrayWithObjects:NSColorPboardType,
+ NSFilenamesPboardType, NSStringPboardType,
+ NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType,
+ NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType,
+ NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType,
+ NSRTFDPboardType, NSHTMLPboardType, NSPICTPboardType,
+ NSURLPboardType, NSPDFPboardType, NSVCardPboardType,
+ NSFilesPromisePboardType, NSInkTextPboardType,
+ NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil];
+ // Add custom types supported by the application.
+ for (int i = 0; i < customTypes.size(); i++) {
+ [supportedTypes addObject:reinterpret_cast<const NSString *>(QCFString::toCFStringRef(customTypes[i]))];
+ }
+ [self registerForDraggedTypes:supportedTypes];
+ }
+}
+
+- (QWidget *)dragTargetHitTest:(id <NSDraggingInfo>)sender
+{
+ // Do a hittest to find the NSView under the
+ // mouse, and return the corresponding QWidget:
+ NSPoint windowPoint = [sender draggingLocation];
+ NSView *candidateView = [[self contentView] hitTest:windowPoint];
+ if (![candidateView isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]])
+ return 0;
+ return [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(candidateView) qt_qwidget];
+}
+
+- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
+{
+ // The user dragged something into the window. Send a draggingEntered message
+ // to the QWidget under the mouse. As the drag moves over the window, and over
+ // different widgets, we will handle enter and leave events from within
+ // draggingUpdated below. The reason why we handle this ourselves rather than
+ // subscribing for drag events directly in QCocoaView is that calling
+ // registerForDraggedTypes on the views will severly degrade initialization time
+ // for an application that uses a lot of drag subscribing widgets.
+
+ QWidget *target = [self dragTargetHitTest:sender];
+ if (!target)
+ return [super draggingEntered:sender];
+ if (target->testAttribute(Qt::WA_DropSiteRegistered) == false)
+ return NSDragOperationNone;
+
+ *currentDragTarget() = target;
+ return [reinterpret_cast<NSView *>((*currentDragTarget())->winId()) draggingEntered:sender];
+ }
+
+- (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender
+{
+ QWidget *target = [self dragTargetHitTest:sender];
+ if (!target)
+ return [super draggingUpdated:sender];
+
+ if (target == *currentDragTarget()) {
+ // The drag continues to move over the widget that we have sendt
+ // a draggingEntered message to. So just update the view:
+ return [reinterpret_cast<NSView *>((*currentDragTarget())->winId()) draggingUpdated:sender];
+ } else {
+ // The widget under the mouse has changed.
+ // So we need to fake enter/leave events:
+ if (*currentDragTarget())
+ [reinterpret_cast<NSView *>((*currentDragTarget())->winId()) draggingExited:sender];
+ if (target->testAttribute(Qt::WA_DropSiteRegistered) == false) {
+ *currentDragTarget() = 0;
+ return NSDragOperationNone;
+ }
+ *currentDragTarget() = target;
+ return [reinterpret_cast<NSView *>((*currentDragTarget())->winId()) draggingEntered:sender];
+ }
+}
+
+- (void)draggingExited:(id < NSDraggingInfo >)sender
+{
+ QWidget *target = [self dragTargetHitTest:sender];
+ if (!target)
+ return [super draggingExited:sender];
+
+ if (*currentDragTarget()) {
+ [reinterpret_cast<NSView *>((*currentDragTarget())->winId()) draggingExited:sender];
+ *currentDragTarget() = 0;
+ }
+}
+
+- (BOOL)performDragOperation:(id < NSDraggingInfo >)sender
+{
+ QWidget *target = [self dragTargetHitTest:sender];
+ if (!target)
+ return [super performDragOperation:sender];
+
+ BOOL dropResult = NO;
+ if (*currentDragTarget()) {
+ dropResult = [reinterpret_cast<NSView *>((*currentDragTarget())->winId()) performDragOperation:sender];
+ *currentDragTarget() = 0;
+ }
+ return dropResult;
+}
+
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 45b0adacb..212684bff 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,6 +51,7 @@
#include <private/qmacinputcontext_p.h>
#include <private/qmultitouch_mac_p.h>
#include <private/qevent_p.h>
+#include <private/qbackingstore_p.h>
#include <qscrollarea.h>
#include <qhash.h>
@@ -63,6 +64,15 @@
#include <qdebug.h>
+@interface NSEvent (Qt_Compile_Leopard_DeviceDelta)
+ - (CGFloat)deviceDeltaX;
+ - (CGFloat)deviceDeltaY;
+ - (CGFloat)deviceDeltaZ;
+@end
+
+@interface NSEvent (Qt_Compile_Leopard_Gestures)
+ - (CGFloat)magnification;
+@end
QT_BEGIN_NAMESPACE
@@ -71,8 +81,8 @@ Q_GLOBAL_STATIC(DnDParams, qMacDnDParams);
extern void qt_mac_update_cursor_at_global_pos(const QPoint &globalPos); // qcursor_mac.mm
extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); // qapplication.cpp
extern OSViewRef qt_mac_nativeview_for(const QWidget *w); // qwidget_mac.mm
-extern const QStringList& qEnabledDraggedTypes(); // qmime_mac.cpp
extern QPointer<QWidget> qt_mouseover; //qapplication_mac.mm
+extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
{
@@ -201,8 +211,6 @@ extern "C" {
composingText = new QString();
composing = false;
sendKeyEvents = true;
- inKeyDown = false;
- currentCustomTypes = 0;
[self setHidden:YES];
return self;
}
@@ -217,34 +225,6 @@ extern "C" {
object:self];
}
--(void)registerDragTypes
-{
- QMacCocoaAutoReleasePool pool;
- // Calling registerForDraggedTypes is slow, so only do it once for each widget
- // or when the custom types change.
- const QStringList& customTypes = qEnabledDraggedTypes();
- if (currentCustomTypes == 0 || *currentCustomTypes != customTypes) {
- if (currentCustomTypes == 0)
- currentCustomTypes = new QStringList();
- *currentCustomTypes = customTypes;
- const NSString* mimeTypeGeneric = @"com.trolltech.qt.MimeTypeName";
- NSMutableArray *supportedTypes = [NSMutableArray arrayWithObjects:NSColorPboardType,
- NSFilenamesPboardType, NSStringPboardType,
- NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType,
- NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType,
- NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType,
- NSRTFDPboardType, NSHTMLPboardType, NSPICTPboardType,
- NSURLPboardType, NSPDFPboardType, NSVCardPboardType,
- NSFilesPromisePboardType, NSInkTextPboardType,
- NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil];
- // Add custom types supported by the application.
- for (int i = 0; i < customTypes.size(); i++) {
- [supportedTypes addObject:reinterpret_cast<const NSString *>(QCFString::toCFStringRef(customTypes[i]))];
- }
- [self registerForDraggedTypes:supportedTypes];
- }
-}
-
- (void)resetCursorRects
{
QWidget *cursorWidget = qwidget;
@@ -290,15 +270,9 @@ extern "C" {
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
- if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false)
- return NSDragOperationNone;
+ // NB: This function is called from QCoocaWindow/QCocoaPanel rather than directly
+ // from Cocoa. They modify the drag target, and might fake enter/leave events.
NSPoint windowPoint = [sender draggingLocation];
- if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) {
- // pass the drag enter event to the view underneath.
- NSView *candidateView = [[[self window] contentView] hitTest:windowPoint];
- if (candidateView && candidateView != self)
- return [candidateView draggingEntered:sender];
- }
dragEnterSequence = [sender draggingSequenceNumber];
[self addDropData:sender];
QMimeData *mimeData = dropData;
@@ -350,13 +324,9 @@ extern "C" {
- (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender
{
+ // NB: This function is called from QCoocaWindow/QCocoaPanel rather than directly
+ // from Cocoa. They modify the drag target, and might fake enter/leave events.
NSPoint windowPoint = [sender draggingLocation];
- if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) {
- // pass the drag move event to the view underneath.
- NSView *candidateView = [[[self window] contentView] hitTest:windowPoint];
- if (candidateView && candidateView != self)
- return [candidateView draggingUpdated:sender];
- }
// in cases like QFocusFrame, the view under the mouse might
// not have received the drag enter. Generate a synthetic
// drag enter event for that view.
@@ -404,14 +374,10 @@ extern "C" {
- (void)draggingExited:(id < NSDraggingInfo >)sender
{
+ // NB: This function is called from QCoocaWindow/QCocoaPanel rather than directly
+ // from Cocoa. They modify the drag target, and might fake enter/leave events.
+ Q_UNUSED(sender);
dragEnterSequence = -1;
- if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) {
- // try sending the leave event to the last view which accepted drag enter.
- DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent];
- NSView *candidateView = [[[self window] contentView] hitTest:dndParams->activeDragEnterPos];
- if (candidateView && candidateView != self)
- return [candidateView draggingExited:sender];
- }
// drag enter event was rejected, so ignore the move event.
if (dropData) {
QDragLeaveEvent de;
@@ -422,14 +388,10 @@ extern "C" {
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
+ // NB: This function is called from QCoocaWindow/QCocoaPanel rather than directly
+ // from Cocoa. They modify the drag target, and might fake enter/leave events.
NSPoint windowPoint = [sender draggingLocation];
dragEnterSequence = -1;
- if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) {
- // pass the drop event to the view underneath.
- NSView *candidateView = [[[self window] contentView] hitTest:windowPoint];
- if (candidateView && candidateView != self)
- return [candidateView performDragOperation:sender];
- }
[self addDropData:sender];
NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint];
@@ -459,8 +421,6 @@ extern "C" {
{
delete composingText;
[[NSNotificationCenter defaultCenter] removeObserver:self];
- delete currentCustomTypes;
- [self unregisterDraggedTypes];
[super dealloc];
}
@@ -499,6 +459,12 @@ extern "C" {
- (void)drawRect:(NSRect)aRect
{
+ if (QApplicationPrivate::graphicsSystem() != 0) {
+ if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore())
+ bs->markDirty(qwidget->rect(), qwidget);
+ qwidgetprivate->syncBackingStore(qwidget->rect());
+ return;
+ }
CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
qwidgetprivate->hd = cg;
CGContextSaveGState(cg);
@@ -667,11 +633,22 @@ extern "C" {
- (void)mouseMoved:(NSEvent *)theEvent
{
- qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
+ // We always enable mouse tracking for all QCocoaView-s. In cases where we have
+ // child views, we will receive mouseMoved for both parent & the child (if
+ // mouse is over the child). We need to ignore the parent mouseMoved in such
+ // cases.
+ NSPoint windowPoint = [theEvent locationInWindow];
+ NSView *candidateView = [[[self window] contentView] hitTest:windowPoint];
+ if (candidateView && candidateView == self) {
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
+ }
}
- (void)mouseDown:(NSEvent *)theEvent
{
+ if (!qt_button_down)
+ qt_button_down = qwidget;
+
qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::LeftButton);
// Don't call super here. This prevents us from getting the mouseUp event,
// which we need to send even if the mouseDown event was not accepted.
@@ -681,76 +658,62 @@ extern "C" {
- (void)mouseUp:(NSEvent *)theEvent
{
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton);
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton);
- if (!mouseOK)
- [super mouseUp:theEvent];
+ qt_button_down = 0;
}
- (void)rightMouseDown:(NSEvent *)theEvent
{
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton);
+ if (!qt_button_down)
+ qt_button_down = qwidget;
- if (!mouseOK)
- [super rightMouseDown:theEvent];
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton);
}
- (void)rightMouseUp:(NSEvent *)theEvent
{
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton);
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton);
- if (!mouseOK)
- [super rightMouseUp:theEvent];
+ qt_button_down = 0;
}
- (void)otherMouseDown:(NSEvent *)theEvent
{
- Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton);
+ if (!qt_button_down)
+ qt_button_down = qwidget;
- if (!mouseOK)
- [super otherMouseDown:theEvent];
+ Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton);
}
- (void)otherMouseUp:(NSEvent *)theEvent
{
Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton);
-
- if (!mouseOK)
- [super otherMouseUp:theEvent];
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton);
+ qt_button_down = 0;
}
- (void)mouseDragged:(NSEvent *)theEvent
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::LeftButton);
-
- if (!mouseOK)
- [super mouseDragged:theEvent];
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
}
- (void)rightMouseDragged:(NSEvent *)theEvent
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::RightButton);
-
- if (!mouseOK)
- [super rightMouseDragged:theEvent];
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
}
- (void)otherMouseDragged:(NSEvent *)theEvent
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
- bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, mouseButton);
-
- if (!mouseOK)
- [super otherMouseDragged:theEvent];
+ qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
}
- (void)scrollWheel:(NSEvent *)theEvent
@@ -764,22 +727,43 @@ extern "C" {
NSPoint windowPoint = [theEvent locationInWindow];
NSPoint globalPoint = [[theEvent window] convertBaseToScreen:windowPoint];
NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
- QPoint qlocal = QPoint(localPoint.x, localPoint.y);
- QPoint qglobal = QPoint(globalPoint.x, globalPoint.y);
- Qt::MouseButton buttons = cocoaButton2QtButton([theEvent buttonNumber]);
+ QPoint qlocal = QPoint(localPoint.x, flipYCoordinate(localPoint.y));
+ QPoint qglobal = QPoint(globalPoint.x, flipYCoordinate(globalPoint.y));
+ Qt::MouseButtons buttons = QApplication::mouseButtons();
bool wheelOK = false;
Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]);
-
QWidget *widgetToGetMouse = qwidget;
+ // if popup is open it should get wheel events if the cursor is over the popup,
+ // otherwise the event should be ignored.
+ if (QWidget *popup = qAppInstance()->activePopupWidget()) {
+ if (!popup->geometry().contains(qglobal))
+ return;
+ }
- // Mouse wheel deltas seem to tick in at increments of 0.1. Qt widgets
- // expect the delta to be a multiple of 120.
- const int ScrollFactor = 10 * 120;
- // The qMax(...) factor reduces the
- // acceleration for large wheel deltas.
- int deltaX = [theEvent deltaX] * ScrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaX]));
- int deltaY = [theEvent deltaY] * ScrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaY]));
- int deltaZ = [theEvent deltaZ] * ScrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaZ]));
+ int deltaX = 0;
+ int deltaY = 0;
+ int deltaZ = 0;
+
+ const EventRef carbonEvent = (EventRef)[theEvent eventRef];
+ const UInt32 carbonEventKind = carbonEvent ? ::GetEventKind(carbonEvent) : 0;
+ const bool scrollEvent = carbonEventKind == kEventMouseScroll;
+
+ if (scrollEvent) {
+ // The mouse device containts pixel scroll wheel support (Mighty Mouse, Trackpad).
+ // Since deviceDelta is delivered as pixels rather than degrees, we need to
+ // convert from pixels to degrees in a sensible manner.
+ // It looks like four degrees per pixel behaves most native.
+ // Qt expects the unit for delta to be 1/8 of a degree:
+ deltaX = [theEvent deviceDeltaX];
+ deltaY = [theEvent deviceDeltaY];
+ deltaZ = [theEvent deviceDeltaZ];
+ } else {
+ // carbonEventKind == kEventMouseWheelMoved
+ // Remove acceleration, and use either -120 or 120 as delta:
+ deltaX = qBound(-120, int([theEvent deltaX] * 10000), 120);
+ deltaY = qBound(-120, int([theEvent deltaY] * 10000), 120);
+ deltaZ = qBound(-120, int([theEvent deltaZ] * 10000), 120);
+ }
if (deltaX != 0) {
QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal);
@@ -861,6 +845,7 @@ extern "C" {
bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents);
qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all));
}
+#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
- (void)magnifyWithEvent:(NSEvent *)event;
{
@@ -872,7 +857,7 @@ extern "C" {
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
qNGEvent.percentage = [event magnification];
- qApp->sendEvent(qwidget, &qNGEvent);
+ qt_sendSpontaneousEvent(qwidget, &qNGEvent);
}
- (void)rotateWithEvent:(NSEvent *)event;
@@ -884,8 +869,8 @@ extern "C" {
qNGEvent.gestureType = QNativeGestureEvent::Rotate;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
- qNGEvent.percentage = [event rotation];
- qApp->sendEvent(qwidget, &qNGEvent);
+ qNGEvent.percentage = -[event rotation];
+ qt_sendSpontaneousEvent(qwidget, &qNGEvent);
}
- (void)swipeWithEvent:(NSEvent *)event;
@@ -897,8 +882,15 @@ extern "C" {
qNGEvent.gestureType = QNativeGestureEvent::Swipe;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
- qNGEvent.direction = QSize(-[event deltaX], -[event deltaY]);
- qApp->sendEvent(qwidget, &qNGEvent);
+ if ([event deltaX] == 1)
+ qNGEvent.angle = 180.0f;
+ else if ([event deltaX] == -1)
+ qNGEvent.angle = 0.0f;
+ else if ([event deltaY] == 1)
+ qNGEvent.angle = 90.0f;
+ else if ([event deltaY] == -1)
+ qNGEvent.angle = 270.0f;
+ qt_sendSpontaneousEvent(qwidget, &qNGEvent);
}
- (void)beginGestureWithEvent:(NSEvent *)event;
@@ -910,7 +902,7 @@ extern "C" {
qNGEvent.gestureType = QNativeGestureEvent::GestureBegin;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
- qApp->sendEvent(qwidget, &qNGEvent);
+ qt_sendSpontaneousEvent(qwidget, &qNGEvent);
}
- (void)endGestureWithEvent:(NSEvent *)event;
@@ -922,9 +914,8 @@ extern "C" {
qNGEvent.gestureType = QNativeGestureEvent::GestureEnd;
NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
qNGEvent.position = flipPoint(p).toPoint();
- qApp->sendEvent(qwidget, &qNGEvent);
+ qt_sendSpontaneousEvent(qwidget, &qNGEvent);
}
-#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
- (void)frameDidChange:(NSNotification *)note
{
@@ -968,6 +959,15 @@ extern "C" {
return qwidget->focusPolicy() != Qt::NoFocus;
}
+- (BOOL)resignFirstResponder
+{
+ // Seems like the following test only triggers if this
+ // view is inside a QMacNativeWidget:
+ if (qwidget == QApplication::focusWidget())
+ QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
+ return YES;
+}
+
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
{
Q_UNUSED(isLocal);
@@ -1013,7 +1013,6 @@ extern "C" {
- (void)keyDown:(NSEvent *)theEvent
{
- inKeyDown = true;
sendKeyEvents = true;
QWidget *widgetToGetKey = qwidget;
@@ -1025,7 +1024,10 @@ extern "C" {
sendToPopup = true;
}
- if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled)) {
+ if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled)
+ && !(widgetToGetKey->inputMethodHints() & Qt::ImhDigitsOnly
+ || widgetToGetKey->inputMethodHints() & Qt::ImhFormattedNumbersOnly
+ || widgetToGetKey->inputMethodHints() & Qt::ImhHiddenText)) {
[qt_mac_nativeview_for(widgetToGetKey) interpretKeyEvents:[NSArray arrayWithObject: theEvent]];
}
if (sendKeyEvents && !composing) {
@@ -1033,7 +1035,6 @@ extern "C" {
if (!keyOK && !sendToPopup)
[super keyDown:theEvent];
}
- inKeyDown = false;
}
@@ -1080,13 +1081,7 @@ extern "C" {
};
}
- if ([aString length] && !inKeyDown) {
- // Handle the case where insertText is called from somewhere else than the keyDown
- // implementation, for example when inserting text from the character palette.
- QInputMethodEvent e;
- e.setCommitString(commitText);
- qt_sendSpontaneousEvent(qwidget, &e);
- } else if ([aString length] && composing) {
+ if ([aString length] && composing) {
// Send the commit string to the widget.
composing = false;
sendKeyEvents = false;
@@ -1386,29 +1381,32 @@ Qt::DropAction QDragManager::drag(QDrag *o)
// convert the image to NSImage.
NSImage *image = (NSImage *)qt_mac_create_nsimage(pix);
[image retain];
- DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent];
+ DnDParams dndParams = *[QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent];
// save supported actions
- [dndParams->view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)];
- NSPoint imageLoc = {dndParams->localPoint.x - hotspot.x(),
- dndParams->localPoint.y + pix.height() - hotspot.y()};
+ [dndParams.view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)];
+ NSPoint imageLoc = {dndParams.localPoint.x - hotspot.x(),
+ dndParams.localPoint.y + pix.height() - hotspot.y()};
NSSize mouseOffset = {0.0, 0.0};
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
- NSPoint windowPoint = [dndParams->theEvent locationInWindow];
+ NSPoint windowPoint = [dndParams.theEvent locationInWindow];
dragPrivate()->executed_action = Qt::ActionMask;
// do the drag
- [dndParams->view retain];
- [dndParams->view dragImage:image
+ [dndParams.view retain];
+ [dndParams.view dragImage:image
at:imageLoc
offset:mouseOffset
- event:dndParams->theEvent
+ event:dndParams.theEvent
pasteboard:pboard
- source:dndParams->view
+ source:dndParams.view
slideBack:YES];
- [dndParams->view release];
+ // reset the implicit grab widget when drag ends because we will not
+ // receive the mouse release event when DND is active.
+ qt_button_down = 0;
+ [dndParams.view release];
[image release];
dragPrivate()->executed_action = Qt::IgnoreAction;
object = 0;
- Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams->performedAction));
+ Qt::DropAction performedAction(qt_mac_mapNSDragOperation(qMacDnDParams()->performedAction));
// do post drag processing, if required.
if(performedAction != Qt::IgnoreAction) {
// check if the receiver points us to a file location.
diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h
index d93fa2f8d..e6ff4234a 100644
--- a/src/gui/kernel/qcocoaview_mac_p.h
+++ b/src/gui/kernel/qcocoaview_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -59,6 +59,7 @@ QT_FORWARD_DECLARE_CLASS(QWidgetPrivate);
QT_FORWARD_DECLARE_CLASS(QWidget);
QT_FORWARD_DECLARE_CLASS(QEvent);
QT_FORWARD_DECLARE_CLASS(QCocoaDropData);
+QT_FORWARD_DECLARE_CLASS(QString);
QT_FORWARD_DECLARE_CLASS(QStringList);
QT_BEGIN_NAMESPACE
@@ -85,9 +86,7 @@ Q_GUI_EXPORT
bool composing;
int composingLength;
bool sendKeyEvents;
- bool inKeyDown;
QString *composingText;
- QStringList *currentCustomTypes;
NSInteger dragEnterSequence;
}
- (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate;
@@ -97,7 +96,6 @@ Q_GUI_EXPORT
- (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender;
- (void)draggingExited:(id < NSDraggingInfo >)sender;
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
-- (void)registerDragTypes;
- (void)removeDropData;
- (void)addDropData:(id <NSDraggingInfo>)sender;
- (void)setSupportedActions:(NSDragOperation)actions;
diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm
index 47067e4bf..a9aa37366 100644
--- a/src/gui/kernel/qcocoawindow_mac.mm
+++ b/src/gui/kernel/qcocoawindow_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,25 +21,21 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,15 +50,8 @@
#include <QtGui/QWidget>
QT_FORWARD_DECLARE_CLASS(QWidget);
-QT_BEGIN_NAMESPACE
-extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm
-QT_END_NAMESPACE
QT_USE_NAMESPACE
-@interface NSWindow (QtCoverForHackWithCategory)
-+ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
-@end
-
@implementation NSWindow (QT_MANGLE_NAMESPACE(QWidgetIntegration))
- (id)QT_MANGLE_NAMESPACE(qt_initWithQWidget):(QWidget*)widget contentRect:(NSRect)rect styleMask:(NSUInteger)mask;
@@ -86,138 +76,12 @@ QT_USE_NAMESPACE
@implementation QT_MANGLE_NAMESPACE(QCocoaWindow)
-- (BOOL)canBecomeKeyWindow
-{
- return YES;
-}
-
/***********************************************************************
- BEGIN Copy and Paste between QCocoaWindow and QCocoaPanel
+ Copy and Paste between QCocoaWindow and QCocoaPanel
This is a bit unfortunate, but thanks to the dynamic dispatch we
have to duplicate this code or resort to really silly forwarding methods
**************************************************************************/
-
-/*
- The methods keyDown, keyUp, and flagsChanged... These really shouldn't ever
- get hit. We automatically say we can be first responder if we are a window.
- So, the handling should get handled by the view. This is here more as a
- last resort (i.e., this is code that can potentially be removed).
- */
-
-- (void)toggleToolbarShown:(id)sender
-{
- macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]);
- [super toggleToolbarShown:sender];
-}
-
-- (void)keyDown:(NSEvent *)theEvent
-{
- bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
- if (!keyOK)
- [super keyDown:theEvent];
-}
-
-- (void)keyUp:(NSEvent *)theEvent
-{
- bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
- if (!keyOK)
- [super keyUp:theEvent];
-}
-
-- (void)flagsChanged:(NSEvent *)theEvent
-{
- qt_dispatchModifiersChanged(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
- [super flagsChanged:theEvent];
-}
-
-
-- (void)tabletProximity:(NSEvent *)tabletEvent
-{
- qt_dispatchTabletProximityEvent(tabletEvent);
-}
-
-- (void)sendEvent:(NSEvent *)event
-{
- QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
-
- // Cocoa can hold onto the window after we've disavowed its knowledge. So,
- // if we get sent an event afterwards just have it go through the super's
- // version and don't do any stuff with Qt.
- if (!widget) {
- [super sendEvent:event];
- return;
- }
-
- [self retain];
- QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_nativeview_for(widget));
- Qt::MouseButton mouseButton = cocoaButton2QtButton([event buttonNumber]);
- // sometimes need to redirect mouse events to the popup.
- QWidget *popup = qAppInstance()->activePopupWidget();
- if (popup && popup != widget) {
- switch([event type])
- {
- case NSLeftMouseDown:
- qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonPress, mouseButton);
- // Don't call super here. This prevents us from getting the mouseUp event,
- // which we need to send even if the mouseDown event was not accepted.
- // (this is standard Qt behavior.)
- break;
- case NSRightMouseDown:
- case NSOtherMouseDown:
- if (!qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonPress, mouseButton))
- [super sendEvent:event];
- break;
- case NSLeftMouseUp:
- case NSRightMouseUp:
- case NSOtherMouseUp:
- if (!qt_mac_handleMouseEvent(view, event, QEvent::MouseButtonRelease, mouseButton))
- [super sendEvent:event];
- break;
- case NSMouseMoved:
- qt_mac_handleMouseEvent(view, event, QEvent::MouseMove, Qt::NoButton);
- break;
- case NSLeftMouseDragged:
- case NSRightMouseDragged:
- case NSOtherMouseDragged:
- [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->view = view;
- [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->theEvent = event;
- if (!qt_mac_handleMouseEvent(view, event, QEvent::MouseMove, mouseButton))
- [super sendEvent:event];
- break;
- default:
- [super sendEvent:event];
- break;
- }
- } else {
- [super sendEvent:event];
- }
- qt_mac_dispatchNCMouseMessage(self, event, [self QT_MANGLE_NAMESPACE(qt_qwidget)], leftButtonIsRightButton);
-
-
- [self release];
-}
-
-
-- (BOOL)makeFirstResponder:(NSResponder *)responder
-{
- // For some reason Cocoa wants to flip the first responder
- // when Qt doesn't want to, sorry, but "No" :-)
- if (responder == nil && qApp->focusWidget())
- return NO;
- return [super makeFirstResponder:responder];
-}
-
-/***********************************************************************
- END Copy and Paste between QCocoaWindow and QCocoaPanel
-***********************************************************************/
-
-+ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask
-{
- if (styleMask & QtMacCustomizeWindow)
- return [QT_MANGLE_NAMESPACE(QCocoaWindowCustomThemeFrame) class];
- return [super frameViewClassForStyleMask:styleMask];
-}
+#include "qcocoasharedwindowmethods_mac_p.h"
@end
-
#endif
diff --git a/src/gui/kernel/qcocoawindow_mac_p.h b/src/gui/kernel/qcocoawindow_mac_p.h
index 15e5c6fab..ea3461c8c 100644
--- a/src/gui/kernel/qcocoawindow_mac_p.h
+++ b/src/gui/kernel/qcocoawindow_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,13 +50,18 @@
// We mean it.
//
-#include "qmacdefines_mac.h"
#ifdef QT_MAC_USE_COCOA
+#include "qmacdefines_mac.h"
#import <Cocoa/Cocoa.h>
enum { QtMacCustomizeWindow = 1 << 21 }; // This will one day be run over by
QT_FORWARD_DECLARE_CLASS(QWidget);
+QT_FORWARD_DECLARE_CLASS(QStringList);
+
+@interface NSWindow (QtCoverForHackWithCategory)
++ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
+@end
@interface NSWindow (QT_MANGLE_NAMESPACE(QWidgetIntegration))
- (id)QT_MANGLE_NAMESPACE(qt_initWithQWidget):(QWidget *)widget contentRect:(NSRect)rect styleMask:(NSUInteger)mask;
@@ -65,8 +70,12 @@ QT_FORWARD_DECLARE_CLASS(QWidget);
@interface QT_MANGLE_NAMESPACE(QCocoaWindow) : NSWindow {
bool leftButtonIsRightButton;
+ QStringList *currentCustomDragTypes;
}
+ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
+- (void)registerDragTypes;
+
@end
#endif
+
diff --git a/src/gui/kernel/qcocoawindowcustomthemeframe_mac.mm b/src/gui/kernel/qcocoawindowcustomthemeframe_mac.mm
index 5ee906ca7..3ea284800 100644
--- a/src/gui/kernel/qcocoawindowcustomthemeframe_mac.mm
+++ b/src/gui/kernel/qcocoawindowcustomthemeframe_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qcocoawindowcustomthemeframe_mac_p.h b/src/gui/kernel/qcocoawindowcustomthemeframe_mac_p.h
index 5d88d50ab..8f014d804 100644
--- a/src/gui/kernel/qcocoawindowcustomthemeframe_mac_p.h
+++ b/src/gui/kernel/qcocoawindowcustomthemeframe_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm
index 01e5bed3e..8a22a65aa 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac.mm
+++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,25 +21,21 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+**
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -310,13 +307,30 @@ static void cleanupCocoaWindowDelegate()
return m_windowHash->value(window);
}
+- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame
+{
+ Q_UNUSED(newFrame);
+ // saving the current window geometry before the window is maximized
+ QWidget *qwidget = m_windowHash->value(window);
+ if (qwidget->isWindow() && !(qwidget->windowState() & Qt::WindowMaximized)) {
+ QWidgetPrivate *widgetPrivate = qt_widget_private(qwidget);
+ widgetPrivate->topData()->normalGeometry = qwidget->geometry();
+ }
+ return YES;
+}
+
- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)defaultFrame
{
NSRect frameToReturn = defaultFrame;
QWidget *qwidget = m_windowHash->value(window);
QSizeF size = qwidget->maximumSize();
- frameToReturn.size.width = qMin<CGFloat>(frameToReturn.size.width, size.width());
- frameToReturn.size.height = qMin<CGFloat>(frameToReturn.size.height, size.height());
+ NSRect windowFrameRect = [window frame];
+ NSRect viewFrameRect = [[window contentView] frame];
+ // consider additional size required for titlebar & frame
+ frameToReturn.size.width = qMin<CGFloat>(frameToReturn.size.width,
+ size.width()+(windowFrameRect.size.width - viewFrameRect.size.width));
+ frameToReturn.size.height = qMin<CGFloat>(frameToReturn.size.height,
+ size.height()+(windowFrameRect.size.height - viewFrameRect.size.height));
return frameToReturn;
}
@@ -349,5 +363,28 @@ static void cleanupCocoaWindowDelegate()
m_drawerHash->remove(drawer);
}
+- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
+{
+ Q_UNUSED(menu);
+ QWidget *qwidget = m_windowHash->value(window);
+ if (qwidget && !qwidget->windowFilePath().isEmpty()) {
+ return YES;
+ }
+ return NO;
+}
+
+- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event
+ from:(NSPoint)dragImageLocation
+ withPasteboard:(NSPasteboard *)pasteboard
+{
+ Q_UNUSED(event);
+ Q_UNUSED(dragImageLocation);
+ Q_UNUSED(pasteboard);
+ QWidget *qwidget = m_windowHash->value(window);
+ if (qwidget && !qwidget->windowFilePath().isEmpty()) {
+ return YES;
+ }
+ return NO;
+}
@end
#endif// QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac_p.h b/src/gui/kernel/qcocoawindowdelegate_mac_p.h
index b0b3c8f60..243ba03a1 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac_p.h
+++ b/src/gui/kernel/qcocoawindowdelegate_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -76,6 +76,9 @@ QT_FORWARD_DECLARE_CLASS(QWidgetData)
- (void)windowDidResignMain:(NSNotification*)notification;
- (void)windowDidBecomeKey:(NSNotification*)notification;
- (void)windowDidResignKey:(NSNotification*)notification;
+- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu;
+- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard;
+- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
@end
@protocol NSDrawerDelegate <NSObject>
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index b83843bc5..2e54daf13 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
\ingroup appearance
\ingroup shared
- \mainclass
+
This class is mainly used to create mouse cursors that are
associated with particular widgets and to get and set the position
@@ -561,7 +561,6 @@ QCursor::operator QVariant() const
{
return QVariant(QVariant::Cursor, this);
}
-
+QT_END_NAMESPACE
#endif // QT_NO_CURSOR
-QT_END_NAMESPACE
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 8da52bf9b..2b2aa4a75 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -72,13 +72,19 @@ private:
#ifndef QT_NO_CURSOR
-struct QCursorData;
+class QCursorData;
class QBitmap;
class QPixmap;
#if defined(Q_WS_MAC)
void qt_mac_set_cursor(const QCursor *c, const QPoint &p);
#endif
+#if defined(Q_OS_SYMBIAN)
+extern void qt_symbian_show_pointer_sprite();
+extern void qt_symbian_hide_pointer_sprite();
+extern void qt_symbian_set_pointer_sprite(const QCursor& cursor);
+extern void qt_symbian_move_cursor_sprite();
+#endif
class Q_GUI_EXPORT QCursor
{
@@ -103,7 +109,7 @@ public:
static QPoint pos();
static void setPos(int x, int y);
inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); }
-
+
#ifdef qdoc
HCURSOR_or_HANDLE handle() const;
QCursor(HCURSOR cursor);
@@ -122,6 +128,8 @@ public:
Qt::HANDLE handle() const;
#elif defined(Q_WS_QWS)
int handle() const;
+#elif defined(Q_OS_SYMBIAN)
+ Qt::HANDLE handle() const;
#endif
#endif
@@ -131,6 +139,12 @@ private:
friend void *qt_mac_nsCursorForQCursor(const QCursor &c);
friend void qt_mac_set_cursor(const QCursor *c, const QPoint &p);
#endif
+#if defined(Q_OS_SYMBIAN)
+ friend void qt_symbian_show_pointer_sprite();
+ friend void qt_symbian_hide_pointer_sprite();
+ friend void qt_symbian_set_pointer_sprite(const QCursor& cursor);
+ friend void qt_symbian_move_cursor_sprite();
+#endif
};
#ifdef QT3_SUPPORT
diff --git a/src/gui/kernel/qcursor_mac.mm b/src/gui/kernel/qcursor_mac.mm
index 25a8ff76b..78a71daec 100644
--- a/src/gui/kernel/qcursor_mac.mm
+++ b/src/gui/kernel/qcursor_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h
index 0b9c1fd5c..12166c802 100644
--- a/src/gui/kernel/qcursor_p.h
+++ b/src/gui/kernel/qcursor_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -64,6 +64,8 @@
# include "private/qt_x11_p.h"
# elif defined(Q_WS_WIN)
# include "QtCore/qt_windows.h"
+# elif defined(Q_OS_SYMBIAN)
+# include "private/qt_s60_p.h"
#endif
QT_BEGIN_NAMESPACE
@@ -74,7 +76,8 @@ class QMacAnimateCursor;
#endif
class QBitmap;
-struct QCursorData {
+class QCursorData {
+public:
QCursorData(Qt::CursorShape s = Qt::ArrowCursor);
~QCursorData();
@@ -111,12 +114,21 @@ struct QCursorData {
} curs;
void initCursorFromBitmap();
void initCursorFromPixmap();
+#elif defined Q_OS_SYMBIAN
+ void loadShapeFromResource(RWsSpriteBase& target, QString resource, int hx, int hy, int interval=0);
+ void constructShapeSprite(RWsSpriteBase& target);
+ void constructCursorSprite(RWsSpriteBase& target);
+ RWsPointerCursor pcurs;
+ RWsSprite scurs;
+ RPointerArray<TSpriteMember> nativeSpriteMembers;
#endif
static bool initialized;
void update();
static QCursorData *setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY);
};
+extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp
+
QT_END_NAMESPACE
#endif // QCURSOR_P_H
diff --git a/src/gui/kernel/qcursor_qws.cpp b/src/gui/kernel/qcursor_qws.cpp
index dd391323b..0eeb187d4 100644
--- a/src/gui/kernel/qcursor_qws.cpp
+++ b/src/gui/kernel/qcursor_qws.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -66,7 +66,11 @@ QCursorData::~QCursorData()
{
delete bm;
delete bmm;
- QPaintDevice::qwsDisplay()->destroyCursor(id);
+ QT_TRY {
+ QPaintDevice::qwsDisplay()->destroyCursor(id);
+ } QT_CATCH(const std::bad_alloc &) {
+ // do nothing.
+ }
}
@@ -74,8 +78,6 @@ QCursorData::~QCursorData()
Global cursors
*****************************************************************************/
-extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp
-
int QCursor::handle() const
{
return d->id;
diff --git a/src/gui/kernel/qcursor_s60.cpp b/src/gui/kernel/qcursor_s60.cpp
new file mode 100644
index 000000000..07b6de4ca
--- /dev/null
+++ b/src/gui/kernel/qcursor_s60.cpp
@@ -0,0 +1,533 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <private/qcursor_p.h>
+#include <private/qwidget_p.h>
+#include <private/qapplication_p.h>
+#include <coecntrl.h>
+#include <qcursor.h>
+#include <qt_s60_p.h>
+#include <qbitmap.h>
+#include <w32std.h>
+#include <qapplication.h>
+#include <qwidget.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_CURSOR
+static QCursor cursorSprite;
+static int cursorSpriteVisible;
+#endif
+
+//pos and setpos are required whether cursors are configured or not.
+QPoint QCursor::pos()
+{
+ return S60->lastCursorPos;
+}
+
+void QCursor::setPos(int x, int y)
+{
+ //clip to screen size (window server allows a sprite hotspot to be outside the screen)
+ if (x < 0)
+ x=0;
+ else if (x >= S60->screenWidthInPixels)
+ x = S60->screenWidthInPixels - 1;
+ if (y < 0)
+ y = 0;
+ else if (y >= S60->screenHeightInPixels)
+ y = S60->screenHeightInPixels - 1;
+
+#ifndef QT_NO_CURSOR
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ if (S60->brokenPointerCursors && cursorSpriteVisible)
+ cursorSprite.d->scurs.SetPosition(TPoint(x,y));
+ else
+#endif
+ S60->wsSession().SetPointerCursorPosition(TPoint(x, y));
+#endif
+ S60->lastCursorPos = QPoint(x, y);
+ //send a fake mouse move event, so that enter/leave events go to the widget hierarchy
+ QWidget *w = QApplication::topLevelAt(S60->lastCursorPos);
+ if (w) {
+ CCoeControl* ctrl = w->effectiveWinId();
+ TPoint epos(x, y);
+ TPoint cpos = epos - ctrl->PositionRelativeToScreen();
+ TPointerEvent fakeEvent;
+ fakeEvent.iType = TPointerEvent::EMove;
+ fakeEvent.iModifiers = 0U;
+ fakeEvent.iPosition = cpos;
+ fakeEvent.iParentPosition = epos;
+ ctrl->HandlePointerEventL(fakeEvent);
+ }
+}
+
+#ifndef QT_NO_CURSOR
+/*
+ * Request cursor to be turned on or off.
+ * Reference counted, so 2 on + 1 off = on, for example
+ */
+void qt_symbian_set_cursor_visible(bool visible) {
+ if (visible)
+ cursorSpriteVisible++;
+ else
+ cursorSpriteVisible--;
+ Q_ASSERT(cursorSpriteVisible >=0);
+
+ if (cursorSpriteVisible && !S60->mouseInteractionEnabled) {
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ if (S60->brokenPointerCursors)
+ qt_symbian_show_pointer_sprite();
+ else
+#endif
+ S60->wsSession().SetPointerCursorMode(EPointerCursorNormal);
+ } else if (!cursorSpriteVisible && S60->mouseInteractionEnabled) {
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ if (S60->brokenPointerCursors)
+ qt_symbian_hide_pointer_sprite();
+ else
+#endif
+ S60->wsSession().SetPointerCursorMode(EPointerCursorNone);
+ }
+ S60->mouseInteractionEnabled = ((cursorSpriteVisible > 0) ? true : false);
+}
+
+/*
+ * Check if the cursor is on or off
+ */
+bool qt_symbian_is_cursor_visible() {
+ return S60->mouseInteractionEnabled;
+}
+
+QCursorData::QCursorData(Qt::CursorShape s) :
+ cshape(s), bm(0), bmm(0), hx(0), hy(0), pcurs()
+{
+ ref = 1;
+}
+
+QCursorData::~QCursorData()
+{
+ for(int i=0;i<nativeSpriteMembers.Count();i++) {
+ delete nativeSpriteMembers[i]->iBitmap;
+ delete nativeSpriteMembers[i]->iMaskBitmap;
+ }
+ nativeSpriteMembers.ResetAndDestroy();
+ pcurs.Close();
+ delete bm;
+ delete bmm;
+}
+
+/* Create a bitmap cursor, this is called by public constructors in the
+ * generic QCursor code.
+ */
+QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY)
+{
+ if (!QCursorData::initialized)
+ QCursorData::initialize();
+ if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) {
+ qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)");
+ QCursorData *c = qt_cursorTable[0];
+ c->ref.ref();
+ return c;
+ }
+ QCursorData *d = new QCursorData;
+ d->bm = new QBitmap(bitmap);
+ d->bmm = new QBitmap(mask);
+ d->cshape = Qt::BitmapCursor;
+ d->hx = hotX >= 0 ? hotX : bitmap.width() / 2;
+ d->hy = hotY >= 0 ? hotY : bitmap.height() / 2;
+ return d;
+}
+
+/*
+ * returns an opaque native handle to a cursor.
+ * It happens to be the address of the native handle, as window server handles
+ * are not POD types. Note there is no QCursor(HANDLE) constructor on Symbian,
+ * Mac or QWS.
+ */
+Qt::HANDLE QCursor::handle() const
+{
+ if (d->pcurs.WsHandle())
+ return reinterpret_cast<Qt::HANDLE> (&(d->pcurs));
+
+#ifdef Q_SYMBIAN_HAS_SYSTEM_CURSORS
+ // don't construct shape cursors, QApplication_s60 will use the system cursor instead
+ if (!(d->bm))
+ return 0;
+#endif
+
+ d->pcurs = RWsPointerCursor(S60->wsSession());
+ d->pcurs.Construct(0);
+ d->constructCursorSprite(d->pcurs);
+ d->pcurs.Activate();
+
+ return reinterpret_cast<Qt::HANDLE> (&(d->pcurs));
+}
+
+#ifndef Q_SYMBIAN_HAS_SYSTEM_CURSORS
+/*
+ * Loads a single cursor shape from resources and appends it to a native sprite.
+ * Animated cursors (e.g. the busy cursor) have multiple members.
+ */
+void QCursorData::loadShapeFromResource(RWsSpriteBase& target, QString resource, int hx, int hy, int interval)
+{
+ QPixmap pix;
+ CFbsBitmap* native;
+ QScopedPointer<TSpriteMember> member(new TSpriteMember);
+ member->iInterval = interval;
+ member->iInvertMask = false;
+ member->iMaskBitmap = 0; // all shapes are RGBA
+ member->iDrawMode = CGraphicsContext::EDrawModePEN;
+ member->iOffset = TPoint(-hx, -hy);
+ QString res(QLatin1String(":/trolltech/symbian/cursors/images/%1.png"));
+ pix.load(res.arg(resource));
+ native = pix.toSymbianCFbsBitmap();
+ member->iBitmap = native;
+ qt_symbian_throwIfError(nativeSpriteMembers.Append(member.data()));
+ target.AppendMember(*(member.take()));
+}
+
+//TODO: after 4.6, connect with style & skins?
+/*
+ * Constructs the native cursor from resources compiled into QtGui
+ * This is needed only when the platform doesn't have system cursors.
+ *
+ * System cursors are higher performance, since they are constructed once
+ * and shared by all applications by specifying the shape number.
+ * Due to symbian platform security considerations, and the fact most
+ * existing phones have a broken RWsPointerCursor, system cursors are not
+ * being used.
+ */
+void QCursorData::constructShapeSprite(RWsSpriteBase& target)
+{
+ int i;
+ switch (cshape) {
+ default:
+ qWarning("QCursorData::constructShapeSprite unknown shape %d", cshape);
+ //fall through and give arrow cursor
+ case Qt::ArrowCursor:
+ loadShapeFromResource(target, QLatin1String("pointer"), 1, 1);
+ break;
+ case Qt::UpArrowCursor:
+ loadShapeFromResource(target, QLatin1String("uparrow"), 4, 0);
+ break;
+ case Qt::CrossCursor:
+ loadShapeFromResource(target, QLatin1String("cross"), 7, 7);
+ break;
+ case Qt::WaitCursor:
+ for (i = 1; i <= 12; i++) {
+ loadShapeFromResource(target, QString(QLatin1String("wait%1")).arg(i), 7, 7, 1000000);
+ }
+ break;
+ case Qt::IBeamCursor:
+ loadShapeFromResource(target, QLatin1String("ibeam"), 3, 10);
+ break;
+ case Qt::SizeVerCursor:
+ loadShapeFromResource(target, QLatin1String("sizever"), 4, 8);
+ break;
+ case Qt::SizeHorCursor:
+ loadShapeFromResource(target, QLatin1String("sizehor"), 8, 4);
+ break;
+ case Qt::SizeBDiagCursor:
+ loadShapeFromResource(target, QLatin1String("sizebdiag"), 8, 8);
+ break;
+ case Qt::SizeFDiagCursor:
+ loadShapeFromResource(target, QLatin1String("sizefdiag"), 8, 8);
+ break;
+ case Qt::SizeAllCursor:
+ loadShapeFromResource(target, QLatin1String("sizeall"), 7, 7);
+ break;
+ case Qt::BlankCursor:
+ loadShapeFromResource(target, QLatin1String("blank"), 0, 0);
+ break;
+ case Qt::SplitVCursor:
+ loadShapeFromResource(target, QLatin1String("splitv"), 7, 7);
+ break;
+ case Qt::SplitHCursor:
+ loadShapeFromResource(target, QLatin1String("splith"), 7, 7);
+ break;
+ case Qt::PointingHandCursor:
+ loadShapeFromResource(target, QLatin1String("handpoint"), 5, 0);
+ break;
+ case Qt::ForbiddenCursor:
+ loadShapeFromResource(target, QLatin1String("forbidden"), 7, 7);
+ break;
+ case Qt::WhatsThisCursor:
+ loadShapeFromResource(target, QLatin1String("whatsthis"), 1, 1);
+ break;
+ case Qt::BusyCursor:
+ loadShapeFromResource(target, QLatin1String("busy3"), 1, 1, 1000000);
+ loadShapeFromResource(target, QLatin1String("busy6"), 1, 1, 1000000);
+ loadShapeFromResource(target, QLatin1String("busy9"), 1, 1, 1000000);
+ loadShapeFromResource(target, QLatin1String("busy12"), 1, 1, 1000000);
+ break;
+ case Qt::OpenHandCursor:
+ loadShapeFromResource(target, QLatin1String("openhand"), 7, 7);
+ break;
+ case Qt::ClosedHandCursor:
+ loadShapeFromResource(target, QLatin1String("closehand"), 7, 7);
+ break;
+ }
+}
+#endif
+
+/*
+ * Common code between the sprite workaround and standard modes of operation.
+ * RWsSpriteBase is the base class for both RWsSprite and RWsPointerCursor.
+ * It is called from both handle() and qt_s60_show_pointer_sprite()
+ */
+void QCursorData::constructCursorSprite(RWsSpriteBase& target)
+{
+ int count = nativeSpriteMembers.Count();
+ if (count) {
+ // already constructed
+ for (int i = 0; i < count; i++)
+ target.AppendMember(*(nativeSpriteMembers[i]));
+
+ return;
+ }
+ if (pixmap.isNull() && !bm) {
+#ifndef Q_SYMBIAN_HAS_SYSTEM_CURSORS
+ //shape cursor
+ constructShapeSprite(target);
+#endif
+ return;
+ }
+ QScopedPointer<TSpriteMember> member(new TSpriteMember);
+ if (pixmap.isNull()) {
+ //construct mono cursor
+ member->iBitmap = bm->toSymbianCFbsBitmap();
+ member->iMaskBitmap = bmm->toSymbianCFbsBitmap();
+ }
+ else {
+ //construct normal cursor
+ member->iBitmap = pixmap.toSymbianCFbsBitmap();
+ if (pixmap.hasAlphaChannel()) {
+ member->iMaskBitmap = 0; //use alpha blending
+ }
+ else if (pixmap.hasAlpha()) {
+ member->iMaskBitmap = pixmap.mask().toSymbianCFbsBitmap();
+ }
+ else {
+ member->iMaskBitmap = 0; //opaque rectangle cursor (due to EDrawModePEN)
+ }
+ }
+
+ member->iDrawMode = CGraphicsContext::EDrawModePEN;
+ member->iInvertMask = EFalse;
+ member->iInterval = 0;
+ member->iOffset = TPoint(-(hx), -(hy)); //Symbian hotspot coordinates are negative
+ qt_symbian_throwIfError(nativeSpriteMembers.Append(member.data()));
+ target.AppendMember(*(member.take()));
+}
+
+/*
+ * shows the pointer sprite by constructing a native handle, and registering
+ * it with the window server.
+ * Only used when the sprite workaround is in use.
+ */
+void qt_symbian_show_pointer_sprite()
+{
+ if (cursorSprite.d) {
+ if (cursorSprite.d->scurs.WsHandle())
+ cursorSprite.d->scurs.Close();
+ } else {
+ cursorSprite = QCursor(Qt::ArrowCursor);
+ }
+
+ cursorSprite.d->scurs = RWsSprite(S60->wsSession());
+ QPoint pos = QCursor::pos();
+ cursorSprite.d->scurs.Construct(S60->windowGroup(), TPoint(pos.x(), pos.y()), ESpriteNoChildClip | ESpriteNoShadows);
+
+ cursorSprite.d->constructCursorSprite(cursorSprite.d->scurs);
+ cursorSprite.d->scurs.Activate();
+}
+
+/*
+ * hides the pointer sprite by closing the native handle.
+ * Only used when the sprite workaround is in use.
+ */
+void qt_symbian_hide_pointer_sprite()
+{
+ if (cursorSprite.d) {
+ cursorSprite.d->scurs.Close();
+ }
+}
+
+/*
+ * Changes the cursor sprite to the cursor specified.
+ * Only used when the sprite workaround is in use.
+ */
+void qt_symbian_set_pointer_sprite(const QCursor& cursor)
+{
+ if (S60->mouseInteractionEnabled)
+ qt_symbian_hide_pointer_sprite();
+ cursorSprite = cursor;
+ if (S60->mouseInteractionEnabled)
+ qt_symbian_show_pointer_sprite();
+}
+
+/*
+ * When using sprites as a workaround on phones that have a broken
+ * RWsPointerCursor, this function is called in response to pointer events
+ * and when QCursor::setPos() is called.
+ * Performance is worse than a real pointer cursor, due to extra context
+ * switches vs. the window server moving the cursor by itself.
+ */
+void qt_symbian_move_cursor_sprite()
+{
+ if (S60->mouseInteractionEnabled) {
+ cursorSprite.d->scurs.SetPosition(TPoint(S60->lastCursorPos.x(), S60->lastCursorPos.y()));
+ }
+}
+
+/*
+ * Translate from Qt::CursorShape to OS system pointer cursor list index.
+ * Currently we control the implementation of the system pointer cursor list,
+ * so this function is trivial. That may not always be the case.
+ */
+TInt qt_symbian_translate_cursor_shape(Qt::CursorShape shape)
+{
+ return (TInt) shape;
+}
+
+/*
+ Internal function called from QWidget::setCursor()
+ force is true if this function is called from dispatchEnterLeave, it means that the
+ mouse is actually directly under this widget.
+*/
+void qt_symbian_set_cursor(QWidget *w, bool force)
+{
+ static QPointer<QWidget> lastUnderMouse = 0;
+ if (force) {
+ lastUnderMouse = w;
+ }
+ else if (w->testAttribute(Qt::WA_WState_Created) && lastUnderMouse
+ && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) {
+ w = lastUnderMouse;
+ }
+
+ if (!S60->curWin && w && w->internalWinId())
+ return;
+ QWidget* cW = w && !w->internalWinId() ? w : QWidget::find(S60->curWin);
+ if (!cW || cW->window() != w->window() || !cW->isVisible() || !cW->underMouse()
+ || QApplication::overrideCursor())
+ return;
+
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ if (S60->brokenPointerCursors)
+ qt_symbian_set_pointer_sprite(cW->cursor());
+ else
+#endif
+ qt_symbian_setWindowCursor(cW->cursor(), w->effectiveWinId());
+}
+
+/*
+ * Makes the specified cursor appear above a specific native window group
+ * Called from QSymbianControl and QApplication::restoreOverrideCursor
+ *
+ * Window server is needed for this, so there is no equivalent when using
+ * the sprite workaround.
+ */
+void qt_symbian_setWindowGroupCursor(const QCursor &cursor, RWindowTreeNode &node)
+{
+ Qt::HANDLE handle = cursor.handle();
+ if (handle) {
+ RWsPointerCursor *pcurs = reinterpret_cast<RWsPointerCursor *> (handle);
+ node.SetCustomPointerCursor(*pcurs);
+ }
+#ifdef Q_SYMBIAN_HAS_SYSTEM_CURSORS
+ else {
+ TInt shape = qt_symbian_translate_cursor_shape(cursor.shape());
+ node.SetPointerCursor(shape);
+ }
+#else
+ qWarning("qt_s60_setWindowGroupCursor - null handle");
+#endif
+}
+
+/*
+ * Makes the specified cursor appear above a specific native window
+ * Called from QSymbianControl and QApplication::restoreOverrideCursor
+ *
+ * Window server is needed for this, so there is no equivalent when using
+ * the sprite workaround.
+ */
+void qt_symbian_setWindowCursor(const QCursor &cursor, const CCoeControl* wid)
+{
+ //find the window for this control
+ while (!wid->OwnsWindow()) {
+ wid = wid->Parent();
+ if (!wid)
+ return;
+ }
+ RWindowTreeNode *node = wid->DrawableWindow();
+ qt_symbian_setWindowGroupCursor(cursor, *node);
+}
+
+/*
+ * Makes the specified cursor appear everywhere.
+ * Called from QApplication::setOverrideCursor
+ */
+void qt_symbian_setGlobalCursor(const QCursor &cursor)
+{
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ if (S60->brokenPointerCursors) {
+ qt_symbian_set_pointer_sprite(cursor);
+ } else
+#endif
+ {
+ //because of the internals of window server, we need to force the cursor
+ //to be set in all child windows too, otherwise when the cursor is over
+ //the child window it may show a widget cursor or arrow cursor instead,
+ //depending on construction order.
+ QListIterator<WId> iter(QWidgetPrivate::mapper->uniqueKeys());
+ while(iter.hasNext())
+ {
+ CCoeControl *ctrl = iter.next();
+ if(ctrl->OwnsWindow()) {
+ RWindowTreeNode *node = ctrl->DrawableWindow();
+ qt_symbian_setWindowGroupCursor(cursor, *node);
+ }
+ }
+ }
+}
+QT_END_NAMESPACE
+#endif // QT_NO_CURSOR
diff --git a/src/gui/kernel/qcursor_win.cpp b/src/gui/kernel/qcursor_win.cpp
index c2d19bbba..a4e7b1fb8 100644
--- a/src/gui/kernel/qcursor_win.cpp
+++ b/src/gui/kernel/qcursor_win.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,8 +50,6 @@
QT_BEGIN_NAMESPACE
-extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp
-
/*****************************************************************************
Internal QCursorData class
*****************************************************************************/
@@ -155,8 +153,8 @@ static HCURSOR create32BitCursor(const QPixmap &pixmap, int hx, int hy)
bool invb, invm;
bbits = pixmap.toImage().convertToFormat(QImage::Format_Mono);
mbits = pixmap.toImage().convertToFormat(QImage::Format_Mono);
- invb = bbits.numColors() > 1 && qGray(bbits.color(0)) < qGray(bbits.color(1));
- invm = mbits.numColors() > 1 && qGray(mbits.color(0)) < qGray(mbits.color(1));
+ invb = bbits.colorCount() > 1 && qGray(bbits.color(0)) < qGray(bbits.color(1));
+ invm = mbits.colorCount() > 1 && qGray(mbits.color(0)) < qGray(mbits.color(1));
int sysW = GetSystemMetrics(SM_CXCURSOR);
int sysH = GetSystemMetrics(SM_CYCURSOR);
@@ -398,8 +396,8 @@ void QCursorData::update()
} else {
bbits = bm->toImage().convertToFormat(QImage::Format_Mono);
mbits = bmm->toImage().convertToFormat(QImage::Format_Mono);
- invb = bbits.numColors() > 1 && qGray(bbits.color(0)) < qGray(bbits.color(1));
- invm = mbits.numColors() > 1 && qGray(mbits.color(0)) < qGray(mbits.color(1));
+ invb = bbits.colorCount() > 1 && qGray(bbits.color(0)) < qGray(bbits.color(1));
+ invm = mbits.colorCount() > 1 && qGray(mbits.color(0)) < qGray(mbits.color(1));
}
int n = qMax(1, bbits.width() / 8);
int h = bbits.height();
diff --git a/src/gui/kernel/qcursor_x11.cpp b/src/gui/kernel/qcursor_x11.cpp
index 3d0d79375..3e53f0409 100644
--- a/src/gui/kernel/qcursor_x11.cpp
+++ b/src/gui/kernel/qcursor_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -63,8 +63,6 @@ QT_BEGIN_NAMESPACE
// Define QT_USE_APPROXIMATE_CURSORS when compiling if you REALLY want to
// use the ugly X11 cursors.
-extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp
-
/*****************************************************************************
Internal QCursorData class
*****************************************************************************/
@@ -100,6 +98,7 @@ QCursor::QCursor(Qt::HANDLE cursor)
d = new QCursorData(Qt::CustomCursor);
d->hcurs = cursor;
}
+
#endif
QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY)
diff --git a/src/gui/kernel/qdesktopwidget.cpp b/src/gui/kernel/qdesktopwidget.cpp
new file mode 100644
index 000000000..c6d500050
--- /dev/null
+++ b/src/gui/kernel/qdesktopwidget.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qglobal.h"
+#include "qdesktopwidget.h"
+#include "qwidget_p.h"
+
+QT_BEGIN_NAMESPACE
+
+const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const
+{
+ QRect rect = QWidgetPrivate::screenGeometry(widget);
+ if (rect.isNull())
+ return screenGeometry(screenNumber(widget));
+ else return rect;
+}
+
+const QRect QDesktopWidget::availableGeometry(const QWidget *widget) const
+{
+ QRect rect = QWidgetPrivate::screenGeometry(widget);
+ if (rect.isNull())
+ return availableGeometry(screenNumber(widget));
+ else
+ return rect;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/gui/kernel/qdesktopwidget.h b/src/gui/kernel/qdesktopwidget.h
index db5fbc164..6e3447ce2 100644
--- a/src/gui/kernel/qdesktopwidget.h
+++ b/src/gui/kernel/qdesktopwidget.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -75,14 +75,12 @@ public:
QWidget *screen(int screen = -1);
const QRect screenGeometry(int screen = -1) const;
- const QRect screenGeometry(const QWidget *widget) const
- { return screenGeometry(screenNumber(widget)); }
+ const QRect screenGeometry(const QWidget *widget) const;
const QRect screenGeometry(const QPoint &point) const
{ return screenGeometry(screenNumber(point)); }
const QRect availableGeometry(int screen = -1) const;
- const QRect availableGeometry(const QWidget *widget) const
- { return availableGeometry(screenNumber(widget)); }
+ const QRect availableGeometry(const QWidget *widget) const;
const QRect availableGeometry(const QPoint &point) const
{ return availableGeometry(screenNumber(point)); }
diff --git a/src/gui/kernel/qdesktopwidget.qdoc b/src/gui/kernel/qdesktopwidget.qdoc
new file mode 100644
index 000000000..bc7f5aeec
--- /dev/null
+++ b/src/gui/kernel/qdesktopwidget.qdoc
@@ -0,0 +1,283 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QDesktopWidget
+ \brief The QDesktopWidget class provides access to screen information on multi-head systems.
+
+ \ingroup advanced
+ \ingroup desktop
+
+ Systems with more than one graphics card and monitor can manage the
+ physical screen space available either as multiple desktops, or as a
+ large virtual desktop.
+
+ This class provides information about the user's desktop, such as its
+ total size, number of screens, the geometry of each screen, and whether
+ they are configured as separate desktops or a single virtual desktop.
+
+ Widgets provided by Qt use this class to place tooltips, menus and
+ dialog boxes on the correct screen for their parent or application
+ widgets. Applications can use this class to obtain information that
+ can be used to save window positions, or to place child widgets and
+ dialogs on one particular screen.
+
+ \section1 Obtaining a Desktop Widget
+
+ The QApplication::desktop() function is used to get an instance of
+ QDesktopWidget.
+
+ The widget's screenGeometry() function provides information about the
+ geometry of the available screens with. The number of screens
+ available is returned by screenCount, and the screenCountChanged()
+ signal is emitted when screens are added or removed.
+ The screen number that a particular point or widget is located in
+ is returned by screenNumber().
+
+ \section1 Screen Geometry
+
+ To obtain the dimensions of a particular screen, call the screenGeometry()
+ function. On some desktop environments, not all of the screen is
+ available for applications to use; for example, an application dock or
+ menu bar may take up some space. Use the availableGeometry() function
+ to obtain the available area for applications.
+
+ QDesktopWidget also inherits the QWidget properties, width() and
+ height(), which specify the size of the desktop. However, for
+ desktops with multiple screens, the size of the desktop is the union
+ of all the screen sizes, so width() and height() should \e not be
+ used for computing the size of a widget to be placed on one of the
+ screens.
+
+ On systems that are configured to use the available screens as a
+ single, large virtual desktop, the virtualDesktop property will be
+ set to true. In this case, the widget's size is usually the size of
+ the bounding rectangle of all the screens.
+
+ \section1 Use of the Primary Screen
+
+ For an application, the screen where the main widget resides is the
+ primary screen. This is stored in the primaryScreen property.
+ All windows opened in the context of the application should be
+ constrained to the boundaries of the primary screen; for example,
+ it would be inconvenient if a dialog box popped up on a different
+ screen, or split over two screens.
+
+ \image qdesktopwidget.png Managing Multiple Screens
+
+ In the illustration above, Application One's primary screen is
+ screen 0, and App Two's primary screen is screen 1.
+
+ \sa QApplication, QApplication::desktop(), QX11Info::appRootWindow()
+*/
+
+/*!
+ \fn QDesktopWidget::QDesktopWidget()
+
+ \internal
+
+ Creates the desktop widget.
+
+ If the system supports a virtual desktop, this widget will have
+ the size of the virtual desktop; otherwise this widget will have
+ the size of the primary screen.
+
+ Instead of using QDesktopWidget directly, use QApplication::desktop().
+*/
+
+/*!
+ \fn QDesktopWidget::~QDesktopWidget()
+
+ \internal
+
+ Destroys the desktop widget and frees any allocated resources.
+*/
+
+/*!
+ \fn int QDesktopWidget::numScreens() const
+
+ Returns the number of available screens.
+
+ \obsolete
+
+ This function is deprecated. Use screenCount instead.
+
+ \sa primaryScreen
+*/
+
+/*!
+ \fn QWidget *QDesktopWidget::screen(int screen)
+
+ Returns a widget that represents the screen with index \a screen
+ (a value of -1 means the default screen).
+
+ If the system uses a virtual desktop, the returned widget will
+ have the geometry of the entire virtual desktop; i.e., bounding
+ every \a screen.
+
+ \sa primaryScreen, screenCount, virtualDesktop
+*/
+
+/*!
+ \fn const QRect QDesktopWidget::availableGeometry(int screen) const
+
+ Returns the available geometry of the screen with index \a screen. What
+ is available will be subrect of screenGeometry() based on what the
+ platform decides is available (for example excludes the dock and menu bar
+ on Mac OS X, or the task bar on Windows). The default screen is used if
+ \a screen is -1.
+
+ \sa screenNumber(), screenGeometry()
+*/
+
+/*!
+ \fn const QRect QDesktopWidget::availableGeometry(const QWidget *widget) const
+ \overload
+
+ Returns the available geometry of the screen which contains \a widget.
+
+ \sa screenGeometry()
+*/
+
+/*!
+ \fn const QRect QDesktopWidget::availableGeometry(const QPoint &p) const
+ \overload
+
+ Returns the available geometry of the screen which contains \a p.
+
+ \sa screenGeometry()
+*/
+
+
+/*!
+ \fn const QRect QDesktopWidget::screenGeometry(int screen) const
+
+ Returns the geometry of the screen with index \a screen. The default
+ screen is used if \a screen is -1.
+
+ \sa screenNumber()
+*/
+
+/*!
+ \fn const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const
+ \overload
+
+ Returns the geometry of the screen which contains \a widget.
+*/
+
+/*!
+ \fn const QRect QDesktopWidget::screenGeometry(const QPoint &p) const
+ \overload
+
+ Returns the geometry of the screen which contains \a p.
+*/
+
+
+/*!
+ \fn int QDesktopWidget::screenNumber(const QWidget *widget) const
+
+ Returns the index of the screen that contains the largest
+ part of \a widget, or -1 if the widget not on a screen.
+
+ \sa primaryScreen
+*/
+
+/*!
+ \fn int QDesktopWidget::screenNumber(const QPoint &point) const
+
+ \overload
+ Returns the index of the screen that contains the \a point, or the
+ screen which is the shortest distance from the \a point.
+
+ \sa primaryScreen
+*/
+
+/*!
+ \fn void QDesktopWidget::resizeEvent(QResizeEvent *event)
+ \reimp
+*/
+
+/*!
+ \fn void QDesktopWidget::resized(int screen)
+
+ This signal is emitted when the size of \a screen changes.
+*/
+
+/*!
+ \fn void QDesktopWidget::workAreaResized(int screen)
+
+ This signal is emitted when the work area available on \a screen changes.
+*/
+
+/*!
+ \property QDesktopWidget::screenCount
+ \brief the number of screens currently available on the system.
+
+ \since 4.6
+
+ \sa screenCountChanged()
+*/
+
+/*!
+ \property QDesktopWidget::primaryScreen
+ \brief the index of the screen that is configured to be the primary screen
+ on the system.
+*/
+
+/*!
+ \property QDesktopWidget::virtualDesktop
+
+ \brief if the system manages the available screens in a virtual desktop.
+
+ For virtual desktops, screen() will always return the same widget.
+ The size of the virtual desktop is the size of this desktop
+ widget.
+*/
+
+/*!
+ \fn void QDesktopWidget::screenCountChanged(int newCount)
+
+ \since 4.6
+
+ This signal is emitted when the number of screens changes to \a newCount.
+
+ \sa screenCount
+*/
diff --git a/src/gui/kernel/qdesktopwidget_mac.mm b/src/gui/kernel/qdesktopwidget_mac.mm
index d03277822..c2d05d71b 100644
--- a/src/gui/kernel/qdesktopwidget_mac.mm
+++ b/src/gui/kernel/qdesktopwidget_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -136,16 +136,19 @@ void QDesktopWidgetImplementation::onResize()
screenRects.clear();
availableRects.clear();
NSRect primaryRect = [[displays objectAtIndex:0] frame];
- for (int i = 0; i<screenCount; i++) {
- NSRect r = [[displays objectAtIndex:i] frame];
- const int flippedY = - r.origin.y + // account for position offset and
+ for (int i = 0; i<screenCount; i++) {
+ NSRect r = [[displays objectAtIndex:i] frame];
+ int flippedY = - r.origin.y + // account for position offset and
primaryRect.size.height - r.size.height; // height difference.
screenRects.append(QRectF(r.origin.x, flippedY,
r.size.width, r.size.height));
- r = [[displays objectAtIndex:i] visibleFrame];
+
+ r = [[displays objectAtIndex:i] visibleFrame];
+ flippedY = - r.origin.y + // account for position offset and
+ primaryRect.size.height - r.size.height; // height difference.
availableRects.append(QRectF(r.origin.x, flippedY,
r.size.width, r.size.height));
- }
+ }
}
diff --git a/src/gui/kernel/qdesktopwidget_mac_p.h b/src/gui/kernel/qdesktopwidget_mac_p.h
index 010ed68b0..2b2edd76f 100644
--- a/src/gui/kernel/qdesktopwidget_mac_p.h
+++ b/src/gui/kernel/qdesktopwidget_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdesktopwidget_qws.cpp b/src/gui/kernel/qdesktopwidget_qws.cpp
index 95c570cdd..0c0837126 100644
--- a/src/gui/kernel/qdesktopwidget_qws.cpp
+++ b/src/gui/kernel/qdesktopwidget_qws.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp
new file mode 100644
index 000000000..79b8f9152
--- /dev/null
+++ b/src/gui/kernel/qdesktopwidget_s60.cpp
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdesktopwidget.h"
+#include "qapplication_p.h"
+#include "qwidget_p.h"
+#include "qt_s60_p.h"
+#include <w32std.h>
+
+#include "hal.h"
+#include "hal_data.h"
+
+QT_BEGIN_NAMESPACE
+
+class QDesktopWidgetPrivate : public QWidgetPrivate
+{
+
+public:
+ QDesktopWidgetPrivate();
+ ~QDesktopWidgetPrivate();
+
+ static void init(QDesktopWidget *that);
+ static void cleanup();
+
+ static int screenCount;
+ static int primaryScreen;
+
+ static QVector<QRect> *rects;
+ static QVector<QRect> *workrects;
+
+ static int refcount;
+};
+
+int QDesktopWidgetPrivate::screenCount = 1;
+int QDesktopWidgetPrivate::primaryScreen = 0;
+QVector<QRect> *QDesktopWidgetPrivate::rects = 0;
+QVector<QRect> *QDesktopWidgetPrivate::workrects = 0;
+int QDesktopWidgetPrivate::refcount = 0;
+
+QDesktopWidgetPrivate::QDesktopWidgetPrivate()
+{
+ ++refcount;
+}
+
+QDesktopWidgetPrivate::~QDesktopWidgetPrivate()
+{
+ if (!--refcount)
+ cleanup();
+}
+
+void QDesktopWidgetPrivate::init(QDesktopWidget *that)
+{
+ int screenCount=0;
+
+ if (HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount) == KErrNone)
+ QDesktopWidgetPrivate::screenCount = screenCount;
+ else
+ QDesktopWidgetPrivate::screenCount = 0;
+
+ rects = new QVector<QRect>();
+ workrects = new QVector<QRect>();
+
+ rects->resize(QDesktopWidgetPrivate::screenCount);
+ workrects->resize(QDesktopWidgetPrivate::screenCount);
+
+ // ### TODO: Implement proper multi-display support
+ rects->resize(1);
+ rects->replace(0, that->rect());
+ workrects->resize(1);
+ workrects->replace(0, that->rect());
+}
+
+void QDesktopWidgetPrivate::cleanup()
+{
+ delete rects;
+ rects = 0;
+ delete workrects;
+ workrects = 0;
+}
+
+
+QDesktopWidget::QDesktopWidget()
+ : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop)
+{
+ setObjectName(QLatin1String("desktop"));
+ QDesktopWidgetPrivate::init(this);
+}
+
+QDesktopWidget::~QDesktopWidget()
+{
+}
+
+bool QDesktopWidget::isVirtualDesktop() const
+{
+ return true;
+}
+
+int QDesktopWidget::primaryScreen() const
+{
+ return QDesktopWidgetPrivate::primaryScreen;
+}
+
+int QDesktopWidget::numScreens() const
+{
+ Q_D(const QDesktopWidget);
+ return QDesktopWidgetPrivate::screenCount;
+}
+
+QWidget *QDesktopWidget::screen(int /* screen */)
+{
+ return this;
+}
+
+const QRect QDesktopWidget::availableGeometry(int /* screen */) const
+{
+ TRect clientRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ return qt_TRect2QRect(clientRect);
+}
+
+const QRect QDesktopWidget::screenGeometry(int /* screen */) const
+{
+ Q_D(const QDesktopWidget);
+ return QRect(0, 0, S60->screenWidthInPixels, S60->screenHeightInPixels);
+ }
+
+int QDesktopWidget::screenNumber(const QWidget * /* widget */) const
+{
+ return QDesktopWidgetPrivate::primaryScreen;
+}
+
+int QDesktopWidget::screenNumber(const QPoint & /* point */) const
+{
+ return QDesktopWidgetPrivate::primaryScreen;
+}
+
+void QDesktopWidget::resizeEvent(QResizeEvent *)
+{
+ Q_D(QDesktopWidget);
+ QVector<QRect> oldrects;
+ oldrects = *d->rects;
+ QVector<QRect> oldworkrects;
+ oldworkrects = *d->workrects;
+ int oldscreencount = d->screenCount;
+
+ QDesktopWidgetPrivate::cleanup();
+ QDesktopWidgetPrivate::init(this);
+
+ for (int i = 0; i < qMin(oldscreencount, d->screenCount); ++i) {
+ QRect oldrect = oldrects[i];
+ QRect newrect = d->rects->at(i);
+ if (oldrect != newrect)
+ emit resized(i);
+ }
+
+ for (int j = 0; j < qMin(oldscreencount, d->screenCount); ++j) {
+ QRect oldrect = oldworkrects[j];
+ QRect newrect = d->workrects->at(j);
+ if (oldrect != newrect)
+ emit workAreaResized(j);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qdesktopwidget_win.cpp b/src/gui/kernel/qdesktopwidget_win.cpp
index de8f646cb..bb498ce56 100644
--- a/src/gui/kernel/qdesktopwidget_win.cpp
+++ b/src/gui/kernel/qdesktopwidget_win.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp
index 2a21ef9d5..14eb97644 100644
--- a/src/gui/kernel/qdesktopwidget_x11.cpp
+++ b/src/gui/kernel/qdesktopwidget_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -197,7 +197,7 @@ void QDesktopWidgetPrivate::init()
if (screens) {
// leaks QWidget* pointers on purpose, can't delete them as pointer escapes
- screens = (QWidget**) realloc(screens, j * sizeof(QWidget*));
+ screens = q_check_ptr((QWidget**) realloc(screens, j * sizeof(QWidget*)));
if (j > screenCount)
memset(&screens[screenCount], 0, (j-screenCount) * sizeof(QWidget*));
}
@@ -384,10 +384,8 @@ void QDesktopWidget::resizeEvent(QResizeEvent *event)
Q_D(QDesktopWidget);
int oldScreenCount = d->screenCount;
QVector<QRect> oldRects(oldScreenCount);
- QVector<QRect> oldWorks(oldScreenCount);
for (int i = 0; i < oldScreenCount; ++i) {
oldRects[i] = d->rects[i];
- oldWorks[i] = d->workareas[i];
}
d->init();
@@ -397,13 +395,6 @@ void QDesktopWidget::resizeEvent(QResizeEvent *event)
emit resized(i);
}
- // ### workareas are just reset by init, not filled with new values
- // ### so this will not work correctly
- for (int j = 0; j < qMin(oldScreenCount, d->screenCount); ++j) {
- if (oldWorks.at(j) != d->workareas[j])
- emit workAreaResized(j);
- }
-
if (oldScreenCount != d->screenCount) {
emit screenCountChanged(d->screenCount);
}
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 52292458e..01c376f90 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdnd_mac.mm b/src/gui/kernel/qdnd_mac.mm
index 1beea24f3..4360c540a 100644
--- a/src/gui/kernel/qdnd_mac.mm
+++ b/src/gui/kernel/qdnd_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index b204af6d7..b635685b5 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -58,6 +58,7 @@
#include "QtGui/qmime.h"
#include "QtGui/qdrag.h"
#include "QtGui/qpixmap.h"
+#include "QtGui/qcursor.h"
#include "QtCore/qpoint.h"
#include "private/qobject_p.h"
#ifdef Q_WS_MAC
@@ -265,7 +266,11 @@ private:
#ifdef Q_WS_QWS
Qt::DropAction currentActionForOverrideCursor;
#endif
-
+#ifdef Q_OS_SYMBIAN
+#ifndef QT_NO_CURSOR
+ QCursor overrideCursor;
+#endif
+#endif
QWidget *currentDropTarget;
static QDragManager *instance;
diff --git a/src/gui/kernel/qdnd_qws.cpp b/src/gui/kernel/qdnd_qws.cpp
index c149f86e9..7e5b08294 100644
--- a/src/gui/kernel/qdnd_qws.cpp
+++ b/src/gui/kernel/qdnd_qws.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdnd_s60.cpp b/src/gui/kernel/qdnd_s60.cpp
new file mode 100644
index 000000000..65deb5d3f
--- /dev/null
+++ b/src/gui/kernel/qdnd_s60.cpp
@@ -0,0 +1,359 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qapplication.h"
+
+#ifndef QT_NO_DRAGANDDROP
+
+#include "qwidget.h"
+#include "qdatetime.h"
+#include "qbitmap.h"
+#include "qcursor.h"
+#include "qevent.h"
+#include "qpainter.h"
+#include "qdnd_p.h"
+#include "qt_s60_p.h"
+
+#include <COECNTRL.H>
+// pointer cursor
+#include <w32std.h>
+#include <gdi.h>
+#include <QCursor>
+
+QT_BEGIN_NAMESPACE
+//### artistic impression of Symbians default DnD cursor ?
+
+static QPixmap *defaultPm = 0;
+static const int default_pm_hotx = -50;
+static const int default_pm_hoty = -50;
+static const char *const default_pm[] = {
+"13 9 3 1",
+". c None",
+" c #000000",
+"X c #FFFFFF",
+"X X X X X X X",
+" X X X X X X ",
+"X ......... X",
+" X.........X ",
+"X ......... X",
+" X.........X ",
+"X ......... X",
+" X X X X X X ",
+"X X X X X X X",
+};
+//### actions need to be redefined for S60
+// Shift/Ctrl handling, and final drop status
+static Qt::DropAction global_accepted_action = Qt::MoveAction;
+static Qt::DropActions possible_actions = Qt::IgnoreAction;
+
+
+// static variables in place of a proper cross-process solution
+static QDrag *drag_object;
+static bool qt_symbian_dnd_dragging = false;
+
+
+static Qt::KeyboardModifiers oldstate;
+
+void QDragManager::updatePixmap()
+{
+ QPixmap pm;
+ QPoint pm_hot(default_pm_hotx,default_pm_hoty);
+ if (drag_object) {
+ pm = drag_object->pixmap();
+ if (!pm.isNull())
+ pm_hot = drag_object->hotSpot();
+ }
+ if (pm.isNull()) {
+ if (!defaultPm)
+ defaultPm = new QPixmap(default_pm);
+ pm = *defaultPm;
+ }
+#ifndef QT_NO_CURSOR
+ QCursor cursor(pm, pm_hot.x(), pm_hot.y());
+ overrideCursor = cursor;
+#endif
+}
+
+void QDragManager::timerEvent(QTimerEvent *) { }
+
+void QDragManager::move(const QPoint&) {
+}
+
+void QDragManager::updateCursor()
+{
+#ifndef QT_NO_CURSOR
+ QCursor cursor = willDrop ? overrideCursor : Qt::ForbiddenCursor;
+ if (!restoreCursor) {
+ QApplication::setOverrideCursor(cursor);
+ restoreCursor = true;
+ }
+ else {
+ QApplication::changeOverrideCursor(cursor);
+ }
+#endif
+}
+
+
+bool QDragManager::eventFilter(QObject *o, QEvent *e)
+{
+ if (beingCancelled) {
+ return false;
+ }
+ if (!o->isWidgetType())
+ return false;
+
+ switch(e->type()) {
+ case QEvent::MouseButtonPress:
+ {
+ }
+ case QEvent::MouseMove:
+ {
+ if (!object) { //#### this should not happen
+ qWarning("QDragManager::eventFilter: No object");
+ return true;
+ }
+ QDragManager *manager = QDragManager::self();
+ QMimeData *dropData = manager->object ? manager->dragPrivate()->data : manager->dropData;
+ if (manager->object)
+ possible_actions = manager->dragPrivate()->possible_actions;
+ else
+ possible_actions = Qt::IgnoreAction;
+
+ QMouseEvent *me = (QMouseEvent *)e;
+
+ if (me->buttons()) {
+ Qt::DropAction prevAction = global_accepted_action;
+ QWidget *cw = QApplication::widgetAt(me->globalPos());
+ // map the Coords relative to the window.
+ if (!cw)
+ return true;
+
+ while (cw && !cw->acceptDrops() && !cw->isWindow())
+ cw = cw->parentWidget();
+
+ bool oldWillDrop = willDrop;
+ if (object->target() != cw) {
+ if (object->target()) {
+ QDragLeaveEvent dle;
+ QApplication::sendEvent(object->target(), &dle);
+ willDrop = false;
+ global_accepted_action = Qt::IgnoreAction;
+ if (oldWillDrop != willDrop)
+ updateCursor();
+ object->d_func()->target = 0;
+ }
+ if (cw && cw->acceptDrops()) {
+ object->d_func()->target = cw;
+ QDragEnterEvent dee(cw->mapFromGlobal(me->globalPos()), possible_actions, dropData,
+ me->buttons(), me->modifiers());
+ QApplication::sendEvent(object->target(), &dee);
+ willDrop = dee.isAccepted() && dee.dropAction() != Qt::IgnoreAction;
+ global_accepted_action = willDrop ? dee.dropAction() : Qt::IgnoreAction;
+ if (oldWillDrop != willDrop)
+ updateCursor();
+ }
+ } else if (cw) {
+ QDragMoveEvent dme(cw->mapFromGlobal(me->globalPos()), possible_actions, dropData,
+ me->buttons(), me->modifiers());
+ if (global_accepted_action != Qt::IgnoreAction) {
+ dme.setDropAction(global_accepted_action);
+ dme.accept();
+ }
+ QApplication::sendEvent(cw, &dme);
+ willDrop = dme.isAccepted();
+ global_accepted_action = willDrop ? dme.dropAction() : Qt::IgnoreAction;
+ if (oldWillDrop != willDrop) {
+ updatePixmap();
+ updateCursor();
+ }
+ }
+ if (global_accepted_action != prevAction)
+ emitActionChanged(global_accepted_action);
+ }
+ return true; // Eat all mouse events
+ }
+
+ case QEvent::MouseButtonRelease:
+ {
+ qApp->removeEventFilter(this);
+#ifndef QT_NO_CURSOR
+ if (restoreCursor) {
+ QApplication::restoreOverrideCursor();
+ willDrop = false;
+ restoreCursor = false;
+ }
+#endif
+ if (object && object->target()) {
+
+ QMouseEvent *me = (QMouseEvent *)e;
+
+ QDragManager *manager = QDragManager::self();
+ QMimeData *dropData = manager->object ? manager->dragPrivate()->data : manager->dropData;
+
+ QDropEvent de(object->target()->mapFromGlobal(me->globalPos()), possible_actions, dropData,
+ me->buttons(), me->modifiers());
+ QApplication::sendEvent(object->target(), &de);
+ if (de.isAccepted())
+ global_accepted_action = de.dropAction();
+ else
+ global_accepted_action = Qt::IgnoreAction;
+
+ if (object)
+ object->deleteLater();
+ drag_object = object = 0;
+ }
+ eventLoop->exit();
+ return true; // Eat all mouse events
+ }
+
+ default:
+ break;
+ }
+ return false;
+}
+
+Qt::DropAction QDragManager::drag(QDrag *o)
+{
+ Q_ASSERT(!qt_symbian_dnd_dragging);
+ if (object == o || !o || !o->source())
+ return Qt::IgnoreAction;
+
+ if (object) {
+ cancel();
+ qApp->removeEventFilter(this);
+ beingCancelled = false;
+ }
+
+ object = drag_object = o;
+
+ oldstate = Qt::NoModifier; // #### Should use state that caused the drag
+ willDrop = false;
+ updatePixmap();
+ updateCursor();
+
+#ifndef QT_NO_CURSOR
+ qt_symbian_set_cursor_visible(true); //force cursor on even for touch phone
+#endif
+
+ object->d_func()->target = 0;
+
+ qApp->installEventFilter(this);
+
+ global_accepted_action = defaultAction(dragPrivate()->possible_actions, Qt::NoModifier);
+ qt_symbian_dnd_dragging = true;
+
+ eventLoop = new QEventLoop;
+ // block
+ (void) eventLoop->exec(QEventLoop::AllEvents);
+ delete eventLoop;
+ eventLoop = 0;
+
+#ifndef QT_NO_CURSOR
+ qt_symbian_set_cursor_visible(false);
+
+ overrideCursor = QCursor(); //deref the cursor data
+ qt_symbian_dnd_dragging = false;
+#endif
+
+ return global_accepted_action;
+}
+
+
+void QDragManager::cancel(bool deleteSource)
+{
+ beingCancelled = true;
+
+ if (object->target()) {
+ QDragLeaveEvent dle;
+ QApplication::sendEvent(object->target(), &dle);
+ }
+
+ if (drag_object) {
+ if (deleteSource)
+ object->deleteLater();
+ drag_object = object = 0;
+ }
+
+#ifndef QT_NO_CURSOR
+ if (restoreCursor) {
+ QApplication::restoreOverrideCursor();
+ restoreCursor = false;
+ }
+#endif
+
+ global_accepted_action = Qt::IgnoreAction;
+}
+
+
+void QDragManager::drop()
+{
+#ifndef QT_NO_CURSOR
+ if (restoreCursor) {
+ QApplication::restoreOverrideCursor();
+ restoreCursor = false;
+ }
+#endif
+}
+
+QVariant QDropData::retrieveData_sys(const QString &mimetype, QVariant::Type type) const
+{
+ if (!drag_object)
+ return QVariant();
+ QByteArray data = drag_object->mimeData()->data(mimetype);
+ if (type == QVariant::String)
+ return QString::fromUtf8(data);
+ return data;
+}
+
+bool QDropData::hasFormat_sys(const QString &format) const
+{
+ return formats().contains(format);
+}
+
+QStringList QDropData::formats_sys() const
+{
+ if (drag_object)
+ return drag_object->mimeData()->formats();
+ return QStringList();
+}
+
+QT_END_NAMESPACE
+#endif // QT_NO_DRAGANDDROP
diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp
index 7bada8eea..e7afe15c4 100644
--- a/src/gui/kernel/qdnd_win.cpp
+++ b/src/gui/kernel/qdnd_win.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp
index a4042c163..da150fbdd 100644
--- a/src/gui/kernel/qdnd_x11.cpp
+++ b/src/gui/kernel/qdnd_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -506,6 +506,7 @@ bool QX11Data::xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data
*atomFormat = textprop.encoding;
*dataFormat = textprop.format;
*data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8);
+ ret = true;
DEBUG(" textprop type %lx\n"
" textprop name '%s'\n"
@@ -541,12 +542,13 @@ bool QX11Data::xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data
dm->xdndMimeTransferedPixmap[dm->xdndMimeTransferedPixmapIndex] = pm;
dm->xdndMimeTransferedPixmapIndex =
(dm->xdndMimeTransferedPixmapIndex + 1) % 2;
+ ret = true;
}
} else {
DEBUG("QClipboard: xdndMimeDataForAtom(): converting to type '%s' is not supported", qPrintable(atomName));
}
}
- return data;
+ return ret && data != 0;
}
//$$$
@@ -1073,12 +1075,14 @@ void qt_xdnd_send_leave()
if (!qt_xdnd_current_target)
return;
+ QDragManager *manager = QDragManager::self();
+
XClientMessageEvent leave;
leave.type = ClientMessage;
leave.window = qt_xdnd_current_target;
leave.format = 32;
leave.message_type = ATOM(XdndLeave);
- leave.data.l[0] = qt_xdnd_dragsource_xid;
+ leave.data.l[0] = manager->dragPrivate()->source->effectiveWinId();
leave.data.l[1] = 0; // flags
leave.data.l[2] = 0; // x, y
leave.data.l[3] = 0; // w, h
@@ -1094,8 +1098,8 @@ void qt_xdnd_send_leave()
else
XSendEvent(X11->display, qt_xdnd_current_proxy_target, False,
NoEventMask, (XEvent*)&leave);
+
// reset the drag manager state
- QDragManager *manager = QDragManager::self();
manager->willDrop = false;
if (global_accepted_action != Qt::IgnoreAction)
manager->emitActionChanged(Qt::IgnoreAction);
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index b60e57028..6d841affd 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index 43d837df6..542a30892 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 736582038..c4a25e18c 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -45,10 +45,13 @@
#include "private/qapplication_p.h"
#include "private/qkeysequence_p.h"
#include "qwidget.h"
+#include "qgraphicsview.h"
#include "qdebug.h"
#include "qmime.h"
#include "qdnd_p.h"
#include "qevent_p.h"
+#include "qgesture.h"
+#include "qgesture_p.h"
QT_BEGIN_NAMESPACE
@@ -396,6 +399,40 @@ QMouseEventEx::~QMouseEventEx()
The function pos() gives the current cursor position, while oldPos() gives
the old mouse position.
+
+ There are a few similarities between the events QEvent::HoverEnter
+ and QEvent::HoverLeave, and the events QEvent::Enter and QEvent::Leave.
+ However, they are slightly different because we do an update() in the event
+ handler of HoverEnter and HoverLeave.
+
+ QEvent::HoverMove is also slightly different from QEvent::MouseMove. Let us
+ consider a top-level window A containing a child B which in turn contains a
+ child C (all with mouse tracking enabled):
+
+ \image hoverEvents.png
+
+ Now, if you move the cursor from the top to the bottom in the middle of A,
+ you will get the following QEvent::MouseMove events:
+
+ \list 1
+ \o A::MouseMove
+ \o B::MouseMove
+ \o C::MouseMove
+ \endlist
+
+ You will get the same events for QEvent::HoverMove, except that the event
+ always propagates to the top-level regardless whether the event is accepted
+ or not. It will only stop propagating with the Qt::WA_NoMousePropagation
+ attribute.
+
+ In this case the events will occur in the following way:
+
+ \list 1
+ \o A::HoverMove
+ \o A::HoverMove, B::HoverMove
+ \o A::HoverMove, B::HoverMove, C::HoverMove
+ \endlist
+
*/
/*!
@@ -1080,8 +1117,17 @@ Qt::FocusReason QFocusEvent::reason() const
rect() that is the bounding rectangle of that region. Both are
provided because many widgets can't make much use of region(),
and rect() can be much faster than region().boundingRect().
+
+ \section1 Automatic Clipping
+
Painting is clipped to region() during the processing of a paint
- event.
+ event. This clipping is performed by Qt's paint system and is
+ independent of any clipping that may be applied to a QPainter used to
+ draw on the paint device.
+
+ As a result, the value returned by QPainter::clipRegion() on
+ a newly-constructed QPainter will not reflect the clip region that is
+ used by the paint system.
\sa QPainter, QWidget::update(), QWidget::repaint(),
QWidget::paintEvent()
@@ -1691,6 +1737,17 @@ Qt::ButtonState QContextMenuEvent::state() const
several are specified for any character in the string the behaviour
is undefined.
+ \value Selection
+ If set, the edit cursor should be moved to the specified position
+ in the editor text contents. In contrast with \c Cursor, this
+ attribute does not work on the preedit text, but on the surrounding
+ text. The cursor will be moved after the commit string has been
+ committed, and the preedit string will be located at the new edit
+ position.
+ The start position specifies the new position and the length
+ variable can be used to set a selection starting from that point.
+ The value is unused.
+
\sa Attribute
*/
@@ -2953,13 +3010,13 @@ QShowEvent::~QShowEvent()
/*!
\class QFileOpenEvent
\brief The QFileOpenEvent class provides an event that will be
- sent when there is a request to open a file.
+ sent when there is a request to open a file or a URL.
\ingroup events
File open events will be sent to the QApplication::instance()
- when the operating system requests that a file be opened. This is
- a high-level event that can be caused by different user actions
+ when the operating system requests that a file or URL should be opened.
+ This is a high-level event that can be caused by different user actions
depending on the user's desktop environment; for example, double
clicking on an file icon in the Finder on Mac OS X.
@@ -2976,12 +3033,27 @@ QShowEvent::~QShowEvent()
*/
QFileOpenEvent::QFileOpenEvent(const QString &file)
: QEvent(FileOpen), f(file)
-{}
+{
+ d = reinterpret_cast<QEventPrivate *>(new QFileOpenEventPrivate(QUrl::fromLocalFile(file)));
+}
+
+/*!
+ \internal
+
+ Constructs a file open event for the given \a url.
+*/
+QFileOpenEvent::QFileOpenEvent(const QUrl &url)
+ : QEvent(FileOpen)
+{
+ d = reinterpret_cast<QEventPrivate *>(new QFileOpenEventPrivate(url));
+ f = url.toLocalFile();
+}
/*! \internal
*/
QFileOpenEvent::~QFileOpenEvent()
{
+ delete reinterpret_cast<QFileOpenEventPrivate *>(d);
}
/*!
@@ -2990,6 +3062,16 @@ QFileOpenEvent::~QFileOpenEvent()
Returns the file that is being opened.
*/
+/*!
+ \fn QUrl QFileOpenEvent::url() const
+
+ Returns the url that is being opened.
+*/
+QUrl QFileOpenEvent::url() const
+{
+ return reinterpret_cast<const QFileOpenEventPrivate *>(d)->url;
+}
+
#ifndef QT_NO_TOOLBAR
/*!
\internal
@@ -3337,6 +3419,9 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
case QEvent::ChildRemoved: n = n ? n : "ChildRemoved";
dbg.nospace() << "QChildEvent(" << n << ", " << (static_cast<const QChildEvent*>(e))->child();
return dbg.space();
+ case QEvent::Gesture:
+ n = "Gesture";
+ break;
default:
dbg.nospace() << "QEvent(" << (const void *)e << ", type = " << e->type() << ')';
return dbg.space();
@@ -3533,43 +3618,117 @@ QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar)
#endif
-/*! \class QTouchEvent
+/*!
+ \class QTouchEvent
\brief The QTouchEvent class contains parameters that describe a touch event.
\since 4.6
\ingroup events
+ \ingroup multitouch
+
+ \section1 Enabling Touch Events
+
+ Touch events occur when pressing, releasing, or moving one or more touch points on a touch
+ device (such as a touch-screen or track-pad). To receive touch events, widgets have to have the
+ Qt::WA_AcceptTouchEvents attribute set and graphics items need to have the
+ \l{QGraphicsItem::setAcceptTouchEvents()}{acceptTouchEvents} attribute set to true.
+
+ When using QAbstractScrollArea based widgets, you should enable the Qt::WA_AcceptTouchEvents
+ attribute on the scroll area's \l{QAbstractScrollArea::viewport()}{viewport}.
- Touch events occur when pressing, releasing, or moving one or more
- touch points on a touch device (such as a touch-screen or
- track-pad). To receive touch events, widgets have to have the
- Qt::WA_AcceptTouchEvents attribute set and graphics items need to have
- the \l{QGraphicsItem::setAcceptTouchEvents()}{acceptTouchEvents}
- attribute set to true.
-
- All touch events are of type QEvent::TouchBegin,
- QEvent::TouchUpdate, or QEvent::TouchEnd. The touchPoints()
- function returns a list of all touch points contained in the event.
- Information about each touch point can be retrieved using the
- QTouchEvent::TouchPoint class. The Qt::TouchPointState enum
- describes the different states that a touch point may have.
-
- Similar to QMouseEvent, Qt automatically grabs each touch point on
- the first press inside a widget; the widget will receive all
- updates for the touch point until it is released. Note that it is
- possible for a widget to receive events for multiple touch points,
- and that multiple widgets may be receiving touch events at the same
- time.
-
- A touch event contains a special accept flag that indicates
- whether the receiver wants the event. By default, the event is
- accepted. You should call ignore() if the touch event is not handled by
- your widget. A QEvent::TouchBegin event is propagated up the parent widget
- chain until a widget accepts it with accept(), or an event filter
- consumes it. If the QEvent::TouchBegin event is neither accepted nor consumed,
- then mouse events are simulated from the state of the first touch
- point.
-
- Reimplement QWidget::event() for widgets and QGraphicsItem::sceneEvent()
- for items in a graphics view to receive touch events.
+ Similarly to QMouseEvent, Qt automatically grabs each touch point on the first press inside a
+ widget, and the widget will receive all updates for the touch point until it is released.
+ Note that it is possible for a widget to receive events for multiple touch points, and that
+ multiple widgets may be receiving touch events at the same time.
+
+ \section1 Event Handling
+
+ All touch events are of type QEvent::TouchBegin, QEvent::TouchUpdate, or QEvent::TouchEnd.
+ Reimplement QWidget::event() or QAbstractScrollArea::viewportEvent() for widgets and
+ QGraphicsItem::sceneEvent() for items in a graphics view to receive touch events.
+
+ The QEvent::TouchUpdate and QEvent::TouchEnd events are sent to the widget or item that
+ accepted the QEvent::TouchBegin event. If the QEvent::TouchBegin event is not accepted and not
+ filtered by an event filter, then no further touch events are sent until the next
+ QEvent::TouchBegin.
+
+ The touchPoints() function returns a list of all touch points contained in the event.
+ Information about each touch point can be retrieved using the QTouchEvent::TouchPoint class.
+ The Qt::TouchPointState enum describes the different states that a touch point may have.
+
+ \section1 Event Delivery and Propagation
+
+ By default, QWidget::event() translates the first non-primary touch point in a QTouchEvent into
+ a QMouseEvent. This makes it possible to enable touch events on existing widgets that do not
+ normally handle QTouchEvent. See below for information on some special considerations needed
+ when doing this.
+
+ QEvent::TouchBegin is the first touch event sent to a widget. The QEvent::TouchBegin event
+ contains a special accept flag that indicates whether the receiver wants the event. By default,
+ the event is accepted. You should call ignore() if the touch event is not handled by your
+ widget. The QEvent::TouchBegin event is propagated up the parent widget chain until a widget
+ accepts it with accept(), or an event filter consumes it. For QGraphicsItems, the
+ QEvent::TouchBegin event is propagated to items under the mouse (similar to mouse event
+ propagation for QGraphicsItems).
+
+ \section1 Touch Point Grouping
+
+ As mentioned above, it is possible that several widgets can be receiving QTouchEvents at the
+ same time. However, Qt makes sure to never send duplicate QEvent::TouchBegin events to the same
+ widget, which could theoretically happen during propagation if, for example, the user touched 2
+ separate widgets in a QGroupBox and both widgets ignored the QEvent::TouchBegin event.
+
+ To avoid this, Qt will group new touch points together using the following rules:
+
+ \list
+
+ \i When the first touch point is detected, the destination widget is determined firstly by the
+ location on screen and secondly by the propagation rules.
+
+ \i When additional touch points are detected, Qt first looks to see if there are any active
+ touch points on any ancestor or descendent of the widget under the new touch point. If there
+ are, the new touch point is grouped with the first, and the new touch point will be sent in a
+ single QTouchEvent to the widget that handled the first touch point. (The widget under the new
+ touch point will not receive an event).
+
+ \endlist
+
+ This makes it possible for sibling widgets to handle touch events independently while making
+ sure that the sequence of QTouchEvents is always correct.
+
+ \section1 Mouse Events and the Primary Touch Point
+
+ QTouchEvent delivery is independent from that of QMouseEvent. On some windowing systems, mouse
+ events are also sent for the \l{QTouchEvent::TouchPoint::isPrimary()}{primary touch point}.
+ This means it is possible for your widget to receive both QTouchEvent and QMouseEvent for the
+ same user interaction point. You can use the QTouchEvent::TouchPoint::isPrimary() function to
+ identify the primary touch point.
+
+ Note that on some systems, it is possible to receive touch events without a primary touch
+ point. All this means is that there will be no mouse event generated for the touch points in
+ the QTouchEvent.
+
+ \section1 Caveats
+
+ \list
+
+ \i As mentioned above, enabling touch events means multiple widgets can be receiving touch
+ events simultaneously. Combined with the default QWidget::event() handling for QTouchEvents,
+ this gives you great flexibility in designing multi-touch user interfaces. Be aware of the
+ implications. For example, it is possible that the user is moving a QSlider with one finger and
+ pressing a QPushButton with another. The signals emitted by these widgets will be
+ interleaved.
+
+ \i Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or
+ QMenu::exec()) in a QTouchEvent event handler is not supported. Since there are multiple event
+ recipients, recursion may cause problems, including but not limited to lost events
+ and unexpected infinite recursion.
+
+ \i QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an
+ \l{QApplication::activePopupWidget()}{active pop-up widget}. The behavior of QTouchEvents is
+ undefined when opening a pop-up or grabbing the mouse while there are multiple active touch
+ points.
+
+ \endlist
\sa QTouchEvent::TouchPoint, Qt::TouchPointState, Qt::WA_AcceptTouchEvents,
QGraphicsItem::acceptTouchEvents()
@@ -3648,6 +3807,11 @@ QTouchEvent::~QTouchEvent()
Returns the list of touch points contained in the touch event.
*/
+/*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const
+
+ Returns the touch device Type, which is of type \l {QTouchEvent::DeviceType} {DeviceType}.
+*/
+
/*! \fn void QTouchEvent::setWidget(QWidget *widget)
\internal
@@ -3669,8 +3833,16 @@ QTouchEvent::~QTouchEvent()
Sets the list of touch points for this event.
*/
+/*! \fn void QTouchEvent::setDeviceType(DeviceType deviceType)
+
+ \internal
+
+ Sets the device type to \a deviceType, which is of type \l {QTouchEvent::DeviceType}
+ {DeviceType}.
+*/
+
/*! \class QTouchEvent::TouchPoint
- \brief The QTouchEvent::TouchPoint class provides information about a touch point in a QTouchEvent.
+ \brief The TouchPoint class provides information about a touch point in a QTouchEvent.
\since 4.6
*/
@@ -4080,15 +4252,308 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T
return *this;
}
-/*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const
- Returns the touch device Type, which is of type
- \l {QTouchEvent::DeviceType} {DeviceType}.
- */
+/*!
+ \class QGestureEvent
+ \since 4.6
+ \ingroup events
+ \ingroup gestures
-/*! \fn void QTouchEvent::setDeviceType(DeviceType deviceType)
- Sets the device type to \a deviceType, which is of type
- \l {QTouchEvent::DeviceType} {DeviceType}.
- */
+ \brief The QGestureEvent class provides the description of triggered gestures.
+
+ The QGestureEvent class contains a list of gestures, which can be obtained using the
+ gestures() function.
+
+ The gestures are either active or canceled. A list of those that are currently being
+ executed can be obtained using the activeGestures() function. A list of those which
+ were previously active and have been canceled can be accessed using the
+ canceledGestures() function. A gesture might be canceled if the current window loses
+ focus, for example, or because of a timeout, or for other reasons.
+
+ If the event handler does not accept the event by calling the generic
+ QEvent::accept() function, all individual QGesture object that were not
+ accepted and in the Qt::GestureStarted state will be propagated up the
+ parent widget chain until a widget accepts them individually, by calling
+ QGestureEvent::accept() for each of them, or an event filter consumes the
+ event.
+
+ \sa QGesture, QGestureRecognizer,
+ QWidget::grabGesture(), QGraphicsObject::grabGesture()
+*/
+
+/*!
+ Creates new QGestureEvent containing a list of \a gestures.
+*/
+QGestureEvent::QGestureEvent(const QList<QGesture *> &gestures)
+ : QEvent(QEvent::Gesture)
+{
+ d = reinterpret_cast<QEventPrivate *>(new QGestureEventPrivate(gestures));
+}
+
+/*!
+ Destroys QGestureEvent.
+*/
+QGestureEvent::~QGestureEvent()
+{
+ delete reinterpret_cast<QGestureEventPrivate *>(d);
+}
+
+/*!
+ Returns all gestures that are delivered in the event.
+*/
+QList<QGesture *> QGestureEvent::gestures() const
+{
+ return d_func()->gestures;
+}
+
+/*!
+ Returns a gesture object by \a type.
+*/
+QGesture *QGestureEvent::gesture(Qt::GestureType type) const
+{
+ const QGestureEventPrivate *d = d_func();
+ for(int i = 0; i < d->gestures.size(); ++i)
+ if (d->gestures.at(i)->gestureType() == type)
+ return d->gestures.at(i);
+ return 0;
+}
+
+/*!
+ Returns a list of active (not canceled) gestures.
+*/
+QList<QGesture *> QGestureEvent::activeGestures() const
+{
+ QList<QGesture *> gestures;
+ foreach (QGesture *gesture, d_func()->gestures) {
+ if (gesture->state() != Qt::GestureCanceled)
+ gestures.append(gesture);
+ }
+ return gestures;
+}
+
+/*!
+ Returns a list of canceled gestures.
+*/
+QList<QGesture *> QGestureEvent::canceledGestures() const
+{
+ QList<QGesture *> gestures;
+ foreach (QGesture *gesture, d_func()->gestures) {
+ if (gesture->state() == Qt::GestureCanceled)
+ gestures.append(gesture);
+ }
+ return gestures;
+}
+
+/*!
+ Sets the accept flag of the given \a gesture object to the specified \a value.
+
+ Setting the accept flag indicates that the event receiver wants the \a gesture.
+ Unwanted gestures may be propagated to the parent widget.
+
+ By default, gestures in events of type QEvent::Gesture are accepted, and
+ gestures in QEvent::GestureOverride events are ignored.
+
+ For convenience, the accept flag can also be set with
+ \l{QGestureEvent::accept()}{accept(gesture)}, and cleared with
+ \l{QGestureEvent::ignore()}{ignore(gesture)}.
+*/
+void QGestureEvent::setAccepted(QGesture *gesture, bool value)
+{
+ if (gesture)
+ setAccepted(gesture->gestureType(), value);
+}
+
+/*!
+ Sets the accept flag of the given \a gesture object, the equivalent of calling
+ \l{QGestureEvent::setAccepted()}{setAccepted(gesture, true)}.
+ Setting the accept flag indicates that the event receiver wants the
+ gesture. Unwanted gestures may be propagated to the parent widget.
+
+ \sa QGestureEvent::ignore()
+*/
+void QGestureEvent::accept(QGesture *gesture)
+{
+ if (gesture)
+ setAccepted(gesture->gestureType(), true);
+}
+
+/*!
+ Clears the accept flag parameter of the given \a gesture object, the equivalent
+ of calling \l{QGestureEvent::setAccepted()}{setAccepted(gesture, false)}.
+
+ Clearing the accept flag indicates that the event receiver does not
+ want the gesture. Unwanted gestures may be propgated to the parent widget.
+
+ \sa QGestureEvent::accept()
+*/
+void QGestureEvent::ignore(QGesture *gesture)
+{
+ if (gesture)
+ setAccepted(gesture->gestureType(), false);
+}
+
+/*!
+ Returns true if the \a gesture is accepted; otherwise returns false.
+*/
+bool QGestureEvent::isAccepted(QGesture *gesture) const
+{
+ return gesture ? isAccepted(gesture->gestureType()) : false;
+}
+
+/*!
+ Sets the accept flag of the given \a gestureType object to the specified
+ \a value.
+
+ Setting the accept flag indicates that the event receiver wants to receive
+ gestures of the specified type, \a gestureType. Unwanted gestures may be
+ propagated to the parent widget.
+
+ By default, gestures in events of type QEvent::Gesture are accepted, and
+ gestures in QEvent::GestureOverride events are ignored.
+
+ For convenience, the accept flag can also be set with
+ \l{QGestureEvent::accept()}{accept(gestureType)}, and cleared with
+ \l{QGestureEvent::ignore()}{ignore(gestureType)}.
+*/
+void QGestureEvent::setAccepted(Qt::GestureType gestureType, bool value)
+{
+ setAccepted(false);
+ d_func()->accepted[gestureType] = value;
+}
+
+/*!
+ Sets the accept flag of the given \a gestureType, the equivalent of calling
+ \l{QGestureEvent::setAccepted()}{setAccepted(gestureType, true)}.
+
+ Setting the accept flag indicates that the event receiver wants the
+ gesture. Unwanted gestures may be propagated to the parent widget.
+
+ \sa QGestureEvent::ignore()
+*/
+void QGestureEvent::accept(Qt::GestureType gestureType)
+{
+ setAccepted(gestureType, true);
+}
+
+/*!
+ Clears the accept flag parameter of the given \a gestureType, the equivalent
+ of calling \l{QGestureEvent::setAccepted()}{setAccepted(gesture, false)}.
+
+ Clearing the accept flag indicates that the event receiver does not
+ want the gesture. Unwanted gestures may be propgated to the parent widget.
+
+ \sa QGestureEvent::accept()
+*/
+void QGestureEvent::ignore(Qt::GestureType gestureType)
+{
+ setAccepted(gestureType, false);
+}
+
+/*!
+ Returns true if the gesture of type \a gestureType is accepted; otherwise
+ returns false.
+*/
+bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const
+{
+ return d_func()->accepted.value(gestureType, true);
+}
+
+/*!
+ \internal
+
+ Sets the widget for this event to the \a widget specified.
+*/
+void QGestureEvent::setWidget(QWidget *widget)
+{
+ d_func()->widget = widget;
+}
+
+/*!
+ Returns the widget on which the event occurred.
+*/
+QWidget *QGestureEvent::widget() const
+{
+ return d_func()->widget;
+}
+
+#ifndef QT_NO_GRAPHICSVIEW
+/*!
+ Returns the scene-local coordinates if the \a gesturePoint is inside a
+ graphics view.
+
+ This functional might be useful when the gesture event is delivered to a
+ QGraphicsObject to translate a point in screen coordinates to scene-local
+ coordinates.
+
+ \sa QPointF::isNull().
+*/
+QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const
+{
+ QWidget *w = widget();
+ if (w) // we get the viewport as widget, not the graphics view
+ w = w->parentWidget();
+ QGraphicsView *view = qobject_cast<QGraphicsView*>(w);
+ if (view) {
+ return view->mapToScene(view->mapFromGlobal(gesturePoint.toPoint()));
+ }
+ return QPointF();
+}
+#endif //QT_NO_GRAPHICSVIEW
+
+/*!
+ \internal
+*/
+QGestureEventPrivate *QGestureEvent::d_func()
+{
+ return reinterpret_cast<QGestureEventPrivate *>(d);
+}
+
+/*!
+ \internal
+*/
+const QGestureEventPrivate *QGestureEvent::d_func() const
+{
+ return reinterpret_cast<const QGestureEventPrivate *>(d);
+}
+
+#ifdef Q_NO_USING_KEYWORD
+/*!
+ \fn void QGestureEvent::setAccepted(bool accepted)
+
+ Sets or clears the event's internal flag that determines whether it should
+ be delivered to other objects.
+
+ Calling this function with a value of true for \a accepted indicates that the
+ caller has accepted the event and that it should not be propagated further.
+ Calling this function with a value of false indicates that the caller has
+ ignored the event and that it should be delivered to other objects.
+
+ For convenience, the accept flag can also be set with accept(), and cleared
+ with ignore().
+
+ \sa QEvent::accepted
+*/
+/*!
+ \fn bool QGestureEvent::isAccepted() const
+
+ Returns true is the event has been accepted; otherwise returns false.
+
+ \sa QEvent::accepted
+*/
+/*!
+ \fn void QGestureEvent::accept()
+
+ Accepts the event, the equivalent of calling setAccepted(true).
+
+ \sa QEvent::accept()
+*/
+/*!
+ \fn void QGestureEvent::ignore()
+
+ Ignores the event, the equivalent of calling setAccepted(false).
+
+ \sa QEvent::ignore()
+*/
+#endif
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 15a8fbde8..461cc9225 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -70,7 +70,7 @@ public:
QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
~QInputEvent();
inline Qt::KeyboardModifiers modifiers() const { return modState; }
- inline void setModifiers(Qt::KeyboardModifiers modifiers) { modState = modifiers; }
+ inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; }
protected:
Qt::KeyboardModifiers modState;
};
@@ -245,7 +245,7 @@ public:
inline QT3_SUPPORT_CONSTRUCTOR QKeyEvent(Type type, int key, int /*ascii*/,
int modifiers, const QString& text = QString(),
bool autorep = false, ushort count = 1)
- : QInputEvent(type, (Qt::KeyboardModifiers)(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key),
+ : QInputEvent(type, Qt::KeyboardModifiers(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key),
c(count), autor(autorep)
{
if (key >= Qt::Key_Back && key <= Qt::Key_MediaLast)
@@ -428,7 +428,8 @@ public:
TextFormat,
Cursor,
Language,
- Ruby
+ Ruby,
+ Selection
};
class Attribute {
public:
@@ -637,9 +638,11 @@ class Q_GUI_EXPORT QFileOpenEvent : public QEvent
{
public:
QFileOpenEvent(const QString &file);
+ QFileOpenEvent(const QUrl &url);
~QFileOpenEvent();
inline QString file() const { return f; }
+ QUrl url() const;
private:
QString f;
};
@@ -684,7 +687,7 @@ public:
QClipboardEvent(QEventPrivate *data);
~QClipboardEvent();
- QEventPrivate *data() { return d; };
+ QEventPrivate *data() { return d; }
};
#endif
@@ -784,6 +787,8 @@ public:
private:
QTouchEventTouchPointPrivate *d;
+ friend class QApplication;
+ friend class QApplicationPrivate;
};
enum DeviceType {
@@ -804,10 +809,10 @@ public:
inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
// internal
- inline void setWidget(QWidget *widget) { _widget = widget; }
- inline void setDeviceType(DeviceType deviceType) { _deviceType = deviceType; }
- inline void setTouchPointStates(Qt::TouchPointStates touchPointStates) { _touchPointStates = touchPointStates; }
- inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &touchPoints) { _touchPoints = touchPoints; }
+ inline void setWidget(QWidget *awidget) { _widget = awidget; }
+ inline void setDeviceType(DeviceType adeviceType) { _deviceType = adeviceType; }
+ inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
+ inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
protected:
QWidget *_widget;
@@ -815,9 +820,62 @@ protected:
Qt::TouchPointStates _touchPointStates;
QList<QTouchEvent::TouchPoint> _touchPoints;
+ friend class QApplication;
friend class QApplicationPrivate;
};
+class QGesture;
+class QGestureEventPrivate;
+class Q_GUI_EXPORT QGestureEvent : public QEvent
+{
+public:
+ QGestureEvent(const QList<QGesture *> &gestures);
+ ~QGestureEvent();
+
+ QList<QGesture *> gestures() const;
+ QGesture *gesture(Qt::GestureType type) const;
+
+ QList<QGesture *> activeGestures() const;
+ QList<QGesture *> canceledGestures() const;
+
+#ifdef Q_NO_USING_KEYWORD
+ inline void setAccepted(bool accepted) { QEvent::setAccepted(accepted); }
+ inline bool isAccepted() const { return QEvent::isAccepted(); }
+
+ inline void accept() { QEvent::accept(); }
+ inline void ignore() { QEvent::ignore(); }
+#else
+ using QEvent::setAccepted;
+ using QEvent::isAccepted;
+ using QEvent::accept;
+ using QEvent::ignore;
+#endif
+
+ void setAccepted(QGesture *, bool);
+ void accept(QGesture *);
+ void ignore(QGesture *);
+ bool isAccepted(QGesture *) const;
+
+ void setAccepted(Qt::GestureType, bool);
+ void accept(Qt::GestureType);
+ void ignore(Qt::GestureType);
+ bool isAccepted(Qt::GestureType) const;
+
+ void setWidget(QWidget *widget);
+ QWidget *widget() const;
+
+#ifndef QT_NO_GRAPHICSVIEW
+ QPointF mapToGraphicsScene(const QPointF &gesturePoint) const;
+#endif
+
+private:
+ QGestureEventPrivate *d_func();
+ const QGestureEventPrivate *d_func() const;
+
+ friend class QApplication;
+ friend class QGestureManager;
+};
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index a26f5854e..4aaaa8bfc 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -43,6 +43,7 @@
#define QEVENT_P_H
#include <QtCore/qglobal.h>
+#include <QtCore/qurl.h>
#include <QtGui/qevent.h>
QT_BEGIN_NAMESPACE
@@ -143,13 +144,39 @@ public:
Type gestureType;
float percentage;
QPoint position;
- QSize direction;
+ float angle;
#ifdef Q_WS_WIN
ulong sequenceId;
quint64 argument;
#endif
};
+class QGestureEventPrivate
+{
+public:
+ inline QGestureEventPrivate(const QList<QGesture *> &list)
+ : gestures(list), widget(0)
+ {
+ }
+
+ QList<QGesture *> gestures;
+ QWidget *widget;
+ QMap<Qt::GestureType, bool> accepted;
+ QMap<Qt::GestureType, QWidget *> targetWidgets;
+};
+
+
+class QFileOpenEventPrivate
+{
+public:
+ inline QFileOpenEventPrivate(const QUrl &url)
+ : url(url)
+ {
+ }
+
+ QUrl url;
+};
+
QT_END_NAMESPACE
#endif // QEVENT_P_H
diff --git a/src/gui/kernel/qeventdispatcher_glib_qws.cpp b/src/gui/kernel/qeventdispatcher_glib_qws.cpp
index b88f6dabd..28013ca21 100644
--- a/src/gui/kernel/qeventdispatcher_glib_qws.cpp
+++ b/src/gui/kernel/qeventdispatcher_glib_qws.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qeventdispatcher_glib_qws_p.h b/src/gui/kernel/qeventdispatcher_glib_qws_p.h
index a65d07317..a75a9f487 100644
--- a/src/gui/kernel/qeventdispatcher_glib_qws_p.h
+++ b/src/gui/kernel/qeventdispatcher_glib_qws_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index efe6375a1..e0eebfdb1 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -136,14 +136,19 @@ void QEventDispatcherMacPrivate::activateTimer(CFRunLoopTimerRef, void *info)
if (tmr == 0 || tmr->pending == true)
return; // Can't send another timer event if it's pending.
- tmr->pending = true;
- QTimerEvent e(tmr->id);
- qt_sendSpontaneousEvent(tmr->obj, &e);
- // Get the value again in case the timer gets unregistered during the sendEvent.
- tmr = macTimerHash.value(timerID);
- if (tmr != 0)
- tmr->pending = false;
+ if (blockSendPostedEvents) {
+ QCoreApplication::postEvent(tmr->obj, new QTimerEvent(tmr->id));
+ } else {
+ tmr->pending = true;
+ QTimerEvent e(tmr->id);
+ qt_sendSpontaneousEvent(tmr->obj, &e);
+ // Get the value again in case the timer gets unregistered during the sendEvent.
+ tmr = macTimerHash.value(timerID);
+ if (tmr != 0)
+ tmr->pending = false;
+ }
+
}
void QEventDispatcherMac::registerTimer(int timerId, int interval, QObject *obj)
@@ -500,7 +505,7 @@ static bool IsMouseOrKeyEvent( NSEvent* event )
static inline void qt_mac_waitForMoreEvents()
{
#ifndef QT_MAC_USE_COCOA
- while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0e20, true) == kCFRunLoopRunTimedOut);
+ while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0e20, true) == kCFRunLoopRunTimedOut) ;
#else
// If no event exist in the cocoa event que, wait
// (and free up cpu time) until at least one event occur.
@@ -566,6 +571,12 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
QBoolBlocker execGuard(d->currentExecIsNSAppRun, false);
while (!d->interrupt && [NSApp runModalSession:session] == NSRunContinuesResponse)
qt_mac_waitForMoreModalSessionEvents();
+ if (!d->interrupt && session == d->currentModalSessionCached) {
+ // INVARIANT: Someone called e.g. [NSApp stopModal:] from outside the event
+ // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
+ // 'session' as well. As a result, we need to restart all internal sessions:
+ d->temporarilyStopAllModalSessions();
+ }
} else {
d->nsAppRunCalledByQt = true;
QBoolBlocker execGuard(d->currentExecIsNSAppRun, true);
@@ -585,7 +596,13 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
if (NSModalSession session = d->currentModalSession()) {
if (flags & QEventLoop::WaitForMoreEvents)
qt_mac_waitForMoreModalSessionEvents();
- [NSApp runModalSession:session];
+ NSInteger status = [NSApp runModalSession:session];
+ if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) {
+ // INVARIANT: Someone called e.g. [NSApp stopModal:] from outside the event
+ // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
+ // 'session' as well. As a result, we need to restart all internal sessions:
+ d->temporarilyStopAllModalSessions();
+ }
retVal = true;
break;
} else {
@@ -767,7 +784,7 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession()
// Sadly, we need to introduce this little event flush
// to stop dialogs from blinking/poping in front if a
// modal session restart was needed:
- while (NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask
+ while (NSEvent *event = [NSApp nextEventMatchingMask:0
untilDate:nil
inMode:NSDefaultRunLoopMode
dequeue: YES]) {
@@ -909,6 +926,21 @@ QEventDispatcherMac::QEventDispatcherMac(QObject *parent)
QEventDispatcherMacPrivate::waitingObserverCallback,
&observerContext);
CFRunLoopAddObserver(mainRunLoop(), d->waitingObserver, kCFRunLoopCommonModes);
+
+ /* The first cycle in the loop adds the source and the events of the source
+ are not processed.
+ We use an observer to process the posted events for the first
+ execution of the loop. */
+ CFRunLoopObserverContext firstTimeObserverContext;
+ bzero(&firstTimeObserverContext, sizeof(CFRunLoopObserverContext));
+ firstTimeObserverContext.info = d;
+ d->firstTimeObserver = CFRunLoopObserverCreate(kCFAllocatorDefault,
+ kCFRunLoopEntry,
+ /* repeats = */ false,
+ 0,
+ QEventDispatcherMacPrivate::firstLoopEntry,
+ &firstTimeObserverContext);
+ CFRunLoopAddObserver(mainRunLoop(), d->firstTimeObserver, kCFRunLoopCommonModes);
}
void QEventDispatcherMacPrivate::waitingObserverCallback(CFRunLoopObserverRef,
@@ -925,10 +957,9 @@ Boolean QEventDispatcherMacPrivate::postedEventSourceEqualCallback(const void *i
return info1 == info2;
}
-void QEventDispatcherMacPrivate::postedEventsSourcePerformCallback(void *info)
+inline static void processPostedEvents(QEventDispatcherMacPrivate *const d, const bool blockSendPostedEvents)
{
- QEventDispatcherMacPrivate *d = static_cast<QEventDispatcherMacPrivate *>(info);
- if (blockSendPostedEvents) {
+ if (blockSendPostedEvents || d->interrupt) {
CFRunLoopSourceSignal(d->postedEventsSource);
} else {
if (!d->threadData->canWait || (d->serialNumber != d->lastSerial)) {
@@ -938,6 +969,20 @@ void QEventDispatcherMacPrivate::postedEventsSourcePerformCallback(void *info)
}
}
+void QEventDispatcherMacPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
+ CFRunLoopActivity activity,
+ void *info)
+{
+ Q_UNUSED(ref);
+ Q_UNUSED(activity);
+ processPostedEvents(static_cast<QEventDispatcherMacPrivate *>(info), blockSendPostedEvents);
+}
+
+void QEventDispatcherMacPrivate::postedEventsSourcePerformCallback(void *info)
+{
+ processPostedEvents(static_cast<QEventDispatcherMacPrivate *>(info), blockSendPostedEvents);
+}
+
void QEventDispatcherMac::interrupt()
{
Q_D(QEventDispatcherMac);
@@ -996,6 +1041,9 @@ QEventDispatcherMac::~QEventDispatcherMac()
CFRunLoopObserverInvalidate(d->waitingObserver);
CFRelease(d->waitingObserver);
+
+ CFRunLoopObserverInvalidate(d->firstTimeObserver);
+ CFRelease(d->firstTimeObserver);
}
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/gui/kernel/qeventdispatcher_mac_p.h b/src/gui/kernel/qeventdispatcher_mac_p.h
index 6747d5231..dfcb91ff3 100644
--- a/src/gui/kernel/qeventdispatcher_mac_p.h
+++ b/src/gui/kernel/qeventdispatcher_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -187,6 +187,7 @@ public:
QList<void *> queuedUserInputEvents; // List of EventRef in Carbon, and NSEvent * in Cocoa
CFRunLoopSourceRef postedEventsSource;
CFRunLoopObserverRef waitingObserver;
+ CFRunLoopObserverRef firstTimeObserver;
QAtomicInt serialNumber;
int lastSerial;
bool interrupt;
@@ -196,6 +197,7 @@ private:
static void activateTimer(CFRunLoopTimerRef, void *info);
static void waitingObserverCallback(CFRunLoopObserverRef observer,
CFRunLoopActivity activity, void *info);
+ static void firstLoopEntry(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info);
};
#ifdef QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qeventdispatcher_qws.cpp b/src/gui/kernel/qeventdispatcher_qws.cpp
index ed4af9ed3..224b303ba 100644
--- a/src/gui/kernel/qeventdispatcher_qws.cpp
+++ b/src/gui/kernel/qeventdispatcher_qws.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qeventdispatcher_qws_p.h b/src/gui/kernel/qeventdispatcher_qws_p.h
index 490da57a4..98c2ac269 100644
--- a/src/gui/kernel/qeventdispatcher_qws_p.h
+++ b/src/gui/kernel/qeventdispatcher_qws_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qeventdispatcher_s60.cpp b/src/gui/kernel/qeventdispatcher_s60.cpp
new file mode 100644
index 000000000..4c1429a53
--- /dev/null
+++ b/src/gui/kernel/qeventdispatcher_s60.cpp
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qwidget.h>
+
+#include "qeventdispatcher_s60_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QEventDispatcherS60::QEventDispatcherS60(QObject *parent)
+ : QEventDispatcherSymbian(parent),
+ m_noInputEvents(false)
+{
+}
+
+QEventDispatcherS60::~QEventDispatcherS60()
+{
+ for (int c = 0; c < m_deferredInputEvents.size(); ++c) {
+ delete m_deferredInputEvents[c].event;
+ }
+}
+
+bool QEventDispatcherS60::processEvents ( QEventLoop::ProcessEventsFlags flags )
+{
+ bool ret = false;
+
+ QT_TRY {
+ bool oldNoInputEventsValue = m_noInputEvents;
+ if (flags & QEventLoop::ExcludeUserInputEvents) {
+ m_noInputEvents = true;
+ } else {
+ m_noInputEvents = false;
+ ret = sendDeferredInputEvents() || ret;
+ }
+
+ ret = QEventDispatcherSymbian::processEvents(flags) || ret;
+
+ m_noInputEvents = oldNoInputEventsValue;
+ } QT_CATCH (const std::exception& ex) {
+#ifndef QT_NO_EXCEPTIONS
+ CActiveScheduler::Current()->Error(qt_symbian_exception2Error(ex));
+#endif
+ }
+
+ return ret;
+}
+
+bool QEventDispatcherS60::hasPendingEvents()
+{
+ return !m_deferredInputEvents.isEmpty() || QEventDispatcherSymbian::hasPendingEvents();
+}
+
+void QEventDispatcherS60::saveInputEvent(QSymbianControl *control, QWidget *widget, QInputEvent *event)
+{
+ DeferredInputEvent inputEvent = {control, widget, event};
+ m_deferredInputEvents.append(inputEvent);
+ connect(widget, SIGNAL(destroyed(QObject*)), SLOT(removeInputEventsForWidget(QObject*)));
+}
+
+bool QEventDispatcherS60::sendDeferredInputEvents()
+{
+ bool eventsSent = false;
+ while (!m_deferredInputEvents.isEmpty()) {
+ DeferredInputEvent inputEvent = m_deferredInputEvents.takeFirst();
+#ifndef QT_NO_EXCEPTIONS
+ try {
+#endif
+ inputEvent.control->sendInputEvent(inputEvent.widget, inputEvent.event);
+#ifndef QT_NO_EXCEPTIONS
+ } catch (...) {
+ delete inputEvent.event;
+ throw;
+ }
+#endif
+ delete inputEvent.event;
+ eventsSent = true;
+ }
+
+ return eventsSent;
+}
+
+void QEventDispatcherS60::removeInputEventsForWidget(QObject *object)
+{
+ for (int c = 0; c < m_deferredInputEvents.size(); ++c) {
+ if (m_deferredInputEvents[c].widget == object) {
+ delete m_deferredInputEvents[c].event;
+ m_deferredInputEvents.removeAt(c--);
+ }
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qeventdispatcher_s60_p.h b/src/gui/kernel/qeventdispatcher_s60_p.h
new file mode 100644
index 000000000..fbce60a59
--- /dev/null
+++ b/src/gui/kernel/qeventdispatcher_s60_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QEVENTDISPATCHER_S60_P_H
+#define QEVENTDISPATCHER_S60_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qeventdispatcher_symbian_p.h>
+#include "qt_s60_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QEventDispatcherS60 : public QEventDispatcherSymbian
+{
+ Q_OBJECT
+
+public:
+ QEventDispatcherS60(QObject *parent = 0);
+ ~QEventDispatcherS60();
+
+ bool processEvents ( QEventLoop::ProcessEventsFlags flags );
+ bool hasPendingEvents();
+
+ bool excludeUserInputEvents() { return m_noInputEvents; }
+
+ void saveInputEvent(QSymbianControl *control, QWidget *widget, QInputEvent *event);
+
+private:
+ bool sendDeferredInputEvents();
+
+private Q_SLOTS:
+ void removeInputEventsForWidget(QObject *object);
+
+private:
+ bool m_noInputEvents;
+
+ struct DeferredInputEvent
+ {
+ QSymbianControl *control;
+ QWidget *widget;
+ QInputEvent *event;
+ };
+ QList<DeferredInputEvent> m_deferredInputEvents;
+};
+
+QT_END_NAMESPACE
+
+#endif // QEVENTDISPATCHER_S60_P_H
diff --git a/src/gui/kernel/qeventdispatcher_x11.cpp b/src/gui/kernel/qeventdispatcher_x11.cpp
index f8db9b2c9..59977ec2d 100644
--- a/src/gui/kernel/qeventdispatcher_x11.cpp
+++ b/src/gui/kernel/qeventdispatcher_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -105,7 +105,7 @@ bool QEventDispatcherX11::processEvents(QEventLoop::ProcessEventsFlags flags)
// _qt_scrolldone protocols, queue all other
// client messages
if (event.xclient.format == 32) {
- if (event.xclient.message_type == ATOM(WM_PROTOCOLS) ||
+ if (event.xclient.message_type == ATOM(WM_PROTOCOLS) &&
(Atom) event.xclient.data.l[0] == ATOM(WM_TAKE_FOCUS)) {
break;
} else if (event.xclient.message_type == ATOM(_QT_SCROLL_DONE)) {
diff --git a/src/gui/kernel/qeventdispatcher_x11_p.h b/src/gui/kernel/qeventdispatcher_x11_p.h
index 240bf29d3..fa2ad620f 100644
--- a/src/gui/kernel/qeventdispatcher_x11_p.h
+++ b/src/gui/kernel/qeventdispatcher_x11_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qformlayout.cpp b/src/gui/kernel/qformlayout.cpp
index 4e632de0a..33f5489dd 100644
--- a/src/gui/kernel/qformlayout.cpp
+++ b/src/gui/kernel/qformlayout.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -252,7 +252,7 @@ QFormLayoutPrivate::QFormLayoutPrivate()
: fieldGrowthPolicy(DefaultFieldGrowthPolicy),
rowWrapPolicy(DefaultRowWrapPolicy), has_hfw(false), dirty(true), sizesDirty(true),
expandVertical(0), expandHorizontal(0), labelAlignment(0), formAlignment(0),
- hfw_width(-1), hfw_sh_height(-1), min_width(-1),
+ layoutWidth(-1), hfw_width(-1), hfw_sh_height(-1), min_width(-1),
sh_width(-1), thresh_width(QLAYOUTSIZE_MAX), hSpacing(-1), vSpacing(-1)
{
}
@@ -1006,10 +1006,8 @@ QStyle* QFormLayoutPrivate::getStyle() const
\since 4.4
\brief The QFormLayout class manages forms of input widgets and their associated labels.
- \ingroup appearance
\ingroup geomanagement
- \mainclass
QFormLayout is a convenience layout class that lays out its
children in a two-column form. The left column consists of labels
@@ -1126,14 +1124,15 @@ QStyle* QFormLayoutPrivate::getStyle() const
\value DontWrapRows
Fields are always laid out next to their label. This is
- the default policy for all styles except Qt Extended styles.
+ the default policy for all styles except Qt Extended styles
+ and QS60Style.
\value WrapLongRows
Labels are given enough horizontal space to fit the widest label,
and the rest of the space is given to the fields. If the minimum
size of a field pair is wider than the available space, the field
is wrapped to the next line. This is the default policy for
- Qt Extended styles.
+ Qt Extended styles and and QS60Style.
\value WrapAllRows
Fields are always laid out below their label.
@@ -1722,8 +1721,8 @@ QFormLayout::FieldGrowthPolicy QFormLayout::fieldGrowthPolicy() const
\brief the way in which the form's rows wrap
The default value depends on the widget or application style. For
- Qt Extended styles, the default is WrapLongRows; for the other styles,
- the default is DontWrapRows.
+ Qt Extended styles and QS60Style, the default is WrapLongRows;
+ for the other styles, the default is DontWrapRows.
If you want to display each label above its associated field
(instead of next to it), set this property to WrapAllRows.
diff --git a/src/gui/kernel/qformlayout.h b/src/gui/kernel/qformlayout.h
index b40f375ce..ec0c4e688 100644
--- a/src/gui/kernel/qformlayout.h
+++ b/src/gui/kernel/qformlayout.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
index 79dcae1c6..e8c2f8af5 100644
--- a/src/gui/kernel/qgesture.cpp
+++ b/src/gui/kernel/qgesture.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,264 +21,707 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qgesture.h"
-#include <private/qgesture_p.h>
-#include "qgraphicsitem.h"
+#include "private/qgesture_p.h"
QT_BEGIN_NAMESPACE
+ /*!
+ \class QGesture
+ \since 4.6
+ \ingroup gestures
+
+ \brief The QGesture class represents a gesture, containing properties that
+ describe the corresponding user input.
+
+ Gesture objects are not constructed directly by developers. They are created by
+ the QGestureRecognizer object that is registered with the application; see
+ QGestureRecognizer::registerRecognizer().
+
+ \section1 Gesture Properties
+
+ The class has a list of properties that can be queried by the user to get
+ some gesture-specific arguments. For example, the pinch gesture has a scale
+ factor that is exposed as a property.
+
+ Developers of custom gesture recognizers can add additional properties in
+ order to provide additional information about a gesture. This can be done
+ by adding new dynamic properties to a QGesture object, or by subclassing
+ the QGesture class (or one of its subclasses).
+
+ \section1 Lifecycle of a Gesture Object
+
+ A QGesture instance is implicitly created when needed and is owned by Qt.
+ Developers should never destroy them or store them for later use as Qt may
+ destroy particular instances of them and create new ones to replace them.
+
+ The registered gesture recognizer monitors the input events for the target
+ object via its \l{QGestureRecognizer::}{recognize()} function, updating the
+ properties of the gesture object as required.
-class QEventFilterProxyGraphicsItem : public QGraphicsItem
+ The gesture object may be delivered to the target object in a QGestureEvent if
+ the corresponding gesture is active or has just been canceled. Each event that
+ is delivered contains a list of gesture objects, since support for more than
+ one gesture may be enabled for the target object. Due to the way events are
+ handled in Qt, gesture events may be filtered by other objects.
+
+ \sa QGestureEvent, QGestureRecognizer
+*/
+
+/*!
+ Constructs a new gesture object with the given \a parent.
+
+ QGesture objects are created by gesture recognizers in the
+ QGestureRecognizer::create() function.
+*/
+QGesture::QGesture(QObject *parent)
+ : QObject(*new QGesturePrivate, parent)
{
-public:
- QEventFilterProxyGraphicsItem(QGesture *g)
- : gesture(g)
- {
- }
- bool sceneEventFilter(QGraphicsItem *, QEvent *event)
- {
- return gesture ? gesture->filterEvent(event) : false;
- }
- QRectF boundingRect() const { return QRectF(); }
- void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) { }
+ d_func()->gestureType = Qt::CustomGesture;
+}
-private:
- QGesture *gesture;
-};
+/*!
+ \internal
+*/
+QGesture::QGesture(QGesturePrivate &dd, QObject *parent)
+ : QObject(dd, parent)
+{
+}
/*!
- \class QGesture
- \since 4.6
+ Destroys the gesture object.
+*/
+QGesture::~QGesture()
+{
+}
- \brief The QGesture class is the base class for implementing custom
- gestures.
+/*!
+ \property QGesture::state
+ \brief the current state of the gesture
+*/
- This class represents both an object that recognizes a gesture out of a set
- of input events (a gesture recognizer), and a gesture object itself that
- can be used to get extended information about the triggered gesture.
+/*!
+ \property QGesture::gestureType
+ \brief the type of the gesture
+*/
- The class has a list of properties that can be queried by the user to get
- some gesture-specific parameters (for example, an offset of a Pan gesture).
+/*!
+ \property QGesture::hotSpot
- Usually gesture recognizer implements a state machine, storing its state
- internally in the recognizer object. The recognizer receives input events
- through the \l{QGesture::}{filterEvent()} virtual function and decides
- whether the event should change the state of the recognizer by emitting an
- appropriate signal.
+ \brief The point that is used to find the receiver for the gesture event.
- Input events should be either fed to the recognizer one by one with a
- filterEvent() function, or the gesture recognizer should be attached to an
- object it filters events for by specifying it as a parent object. The
- QGesture object installs itself as an event filter to the parent object
- automatically, the unsetObject() function should be used to remove an event
- filter from the parent object. To make a
- gesture that operates on a QGraphicsItem, both the appropriate QGraphicsView
- should be passed as a parent object and setGraphicsItem() functions should
- be used to attach a gesture to a graphics item.
+ The hot-spot is a point in the global coordinate system, use
+ QWidget::mapFromGlobal() or QGestureEvent::mapToGraphicsScene() to get a
+ local hot-spot.
- This is a base class, to create a custom gesture type, you should subclass
- it and implement its pure virtual functions.
+ The hot-spot should be set by the gesture recognizer to allow gesture event
+ delivery to a QGraphicsObject.
+*/
- \sa QPanGesture
+/*!
+ \property QGesture::hasHotSpot
+ \brief whether the gesture has a hot-spot
*/
-/*! \fn bool QGesture::filterEvent(QEvent *event)
+Qt::GestureType QGesture::gestureType() const
+{
+ return d_func()->gestureType;
+}
+
+Qt::GestureState QGesture::state() const
+{
+ return d_func()->state;
+}
+
+QPointF QGesture::hotSpot() const
+{
+ return d_func()->hotSpot;
+}
- Parses input \a event and emits a signal when detects a gesture.
+void QGesture::setHotSpot(const QPointF &value)
+{
+ Q_D(QGesture);
+ d->hotSpot = value;
+ d->isHotSpotSet = true;
+}
- In your reimplementation of this function, if you want to filter the \a
- event out, i.e. stop it being handled further, return true; otherwise
- return false;
+bool QGesture::hasHotSpot() const
+{
+ return d_func()->isHotSpotSet;
+}
- This is a pure virtual function that needs to be implemented in subclasses.
+void QGesture::unsetHotSpot()
+{
+ d_func()->isHotSpotSet = false;
+}
+
+/*!
+ \property QGesture::gestureCancelPolicy
+ \brief the policy for deciding what happens on accepting a gesture
+
+ On accepting one gesture Qt can automatically cancel other gestures
+ that belong to other targets. The policy is normally set to not cancel
+ any other gestures and can be set to cancel all active gestures in the
+ context. For example for all child widgets.
*/
-/*! \fn void QGesture::started()
+/*!
+ \enum QGesture::GestureCancelPolicy
+
+ This enum describes how accepting a gesture can cancel other gestures
+ automatically.
- The signal is emitted when the gesture is started. Extended information
- about the gesture is contained in the signal sender object.
+ \value CancelNone On accepting this gesture no other gestures will be affected.
- In addition to started(), a triggered() signal should also be emitted.
+ \value CancelAllInContext On accepting this gesture all gestures that are
+ active in the context (respecting the Qt::GestureFlag that were specified
+ when subscribed to the gesture) will be cancelled.
*/
-/*! \fn void QGesture::triggered()
+void QGesture::setGestureCancelPolicy(GestureCancelPolicy policy)
+{
+ Q_D(QGesture);
+ d->gestureCancelPolicy = static_cast<uint>(policy);
+}
- The signal is emitted when the gesture is detected. Extended information
- about the gesture is contained in the signal sender object.
-*/
+QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const
+{
+ Q_D(const QGesture);
+ return static_cast<GestureCancelPolicy>(d->gestureCancelPolicy);
+}
+
+/*!
+ \class QPanGesture
+ \since 4.6
+ \brief The QPanGesture class describes a panning gesture made by the user.
+ \ingroup gestures
-/*! \fn void QGesture::finished()
+ \image pangesture.png
- The signal is emitted when the gesture is finished. Extended information
- about the gesture is contained in the signal sender object.
+ \sa {Gestures Programming}, QPinchGesture, QSwipeGesture
*/
-/*! \fn void QGesture::cancelled()
+/*!
+ \property QPanGesture::lastOffset
+ \brief the last offset recorded for this gesture
+
+ The last offset contains the change in position of the user's input as
+ reported in the \l offset property when a previous gesture event was
+ delivered for this gesture.
- The signal is emitted when the gesture is cancelled, for example the reset()
- function is called while the gesture was in the process of emitting a
- triggered() signal. Extended information about the gesture is contained in
- the sender object.
+ If no previous event was delivered with information about this gesture
+ (i.e., this gesture object contains information about the first movement
+ in the gesture) then this property contains a zero size.
*/
+/*!
+ \property QPanGesture::offset
+ \brief the total offset from the first input position to the current input
+ position
+
+ The offset measures the total change in position of the user's input
+ covered by the gesture on the input device.
+*/
/*!
- Creates a new gesture handler object and marks it as a child of \a parent.
+ \property QPanGesture::delta
+ \brief the offset from the previous input position to the current input
- The \a parent object is also the default event source for the gesture,
- meaning that the gesture installs itself as an event filter for the \a
- parent.
+ This is essentially the same as the difference between offset() and
+ lastOffset().
+*/
- \sa setGraphicsItem()
+/*!
+ \property QPanGesture::acceleration
*/
-QGesture::QGesture(QObject *parent)
- : QObject(*new QGesturePrivate, parent)
+
+/*!
+ \internal
+*/
+QPanGesture::QPanGesture(QObject *parent)
+ : QGesture(*new QPanGesturePrivate, parent)
{
- if (parent)
- parent->installEventFilter(this);
+ d_func()->gestureType = Qt::PanGesture;
}
-/*! \internal
- */
-QGesture::QGesture(QGesturePrivate &dd, QObject *parent)
- : QObject(dd, parent)
+
+QPointF QPanGesture::lastOffset() const
+{
+ return d_func()->lastOffset;
+}
+
+QPointF QPanGesture::offset() const
+{
+ return d_func()->offset;
+}
+
+QPointF QPanGesture::delta() const
+{
+ Q_D(const QPanGesture);
+ return d->offset - d->lastOffset;
+}
+
+qreal QPanGesture::acceleration() const
+{
+ return d_func()->acceleration;
+}
+
+void QPanGesture::setLastOffset(const QPointF &value)
+{
+ d_func()->lastOffset = value;
+}
+
+void QPanGesture::setOffset(const QPointF &value)
+{
+ d_func()->offset = value;
+}
+
+void QPanGesture::setAcceleration(qreal value)
{
- if (parent)
- parent->installEventFilter(this);
+ d_func()->acceleration = value;
}
/*!
- Destroys the gesture object.
+ \class QPinchGesture
+ \since 4.6
+ \brief The QPinchGesture class describes a pinch gesture made my the user.
+ \ingroup multitouch
+ \ingroup gestures
+
+ A pinch gesture is a form of multitouch user input in which the user typically
+ touches two points on the input device with a thumb and finger, before moving
+ them closer together or further apart to change the scale factor, zoom, or level
+ of detail of the user interface.
+
+ \image pinchgesture.png
+
+ Instead of repeatedly applying the same pinching gesture, the user may
+ continue to touch the input device in one place, and apply a second touch
+ to a new point, continuing the gesture. When this occurs, gesture events
+ will continue to be delivered to the target object, containing an instance
+ of QPinchGesture in the Qt::GestureUpdated state.
+
+ \sa {Gestures Programming}, QPanGesture, QSwipeGesture
*/
-QGesture::~QGesture()
+
+/*!
+ \enum QPinchGesture::ChangeFlag
+
+ This enum describes the changes that can occur to the properties of
+ the gesture object.
+
+ \value ScaleFactorChanged The scale factor held by scaleFactor changed.
+ \value RotationAngleChanged The rotation angle held by rotationAngle changed.
+ \value CenterPointChanged The center point held by centerPoint changed.
+
+ \sa changeFlags, totalChangeFlags
+*/
+
+/*!
+ \property QPinchGesture::totalChangeFlags
+ \brief the property of the gesture that has change
+
+ This property indicates which of the other properties has changed since the
+ gesture has started. You can use this information to determine which aspect
+ of your user interface needs to be updated.
+
+ \sa changeFlags, scaleFactor, rotationAngle, centerPoint
+*/
+
+/*!
+ \property QPinchGesture::changeFlags
+ \brief the property of the gesture that has changed in the current step
+
+ This property indicates which of the other properties has changed since
+ the previous gesture event included information about this gesture. You
+ can use this information to determine which aspect of your user interface
+ needs to be updated.
+
+ \sa totalChangeFlags, scaleFactor, rotationAngle, centerPoint
+*/
+
+/*!
+ \property QPinchGesture::totalScaleFactor
+ \brief the total scale factor
+
+ The total scale factor measures the total change in scale factor from the
+ original value to the current scale factor.
+
+ \sa scaleFactor, lastScaleFactor
+*/
+/*!
+ \property QPinchGesture::lastScaleFactor
+ \brief the last scale factor recorded for this gesture
+
+ The last scale factor contains the scale factor reported in the
+ \l scaleFactor property when a previous gesture event included
+ information about this gesture.
+
+ If no previous event was delivered with information about this gesture
+ (i.e., this gesture object contains information about the first movement
+ in the gesture) then this property contains zero.
+
+ \sa scaleFactor, totalScaleFactor
+*/
+/*!
+ \property QPinchGesture::scaleFactor
+ \brief the current scale factor
+
+ The scale factor measures the scale factor associated with the distance
+ between two of the user's inputs on a multitouch device.
+
+ \sa totalScaleFactor, lastScaleFactor
+*/
+
+/*!
+ \property QPinchGesture::totalRotationAngle
+ \brief the total angle covered by the gesture
+
+ This total angle measures the complete angle covered by the gesture. Usually, this
+ is equal to the value held by the \l rotationAngle property, except in the case where
+ the user performs multiple rotations by removing and repositioning one of the touch
+ points, as described above. In this case, the total angle will be the sum of the
+ rotation angles for the multiple stages of the gesture.
+
+ \sa rotationAngle, lastRotationAngle
+*/
+/*!
+ \property QPinchGesture::lastRotationAngle
+ \brief the last reported angle covered by the gesture motion
+
+ The last rotation angle is the angle as reported in the \l rotationAngle property
+ when a previous gesture event was delivered for this gesture.
+
+ \sa rotationAngle, totalRotationAngle
+*/
+/*!
+ \property QPinchGesture::rotationAngle
+ \brief the angle covered by the gesture motion
+
+ \sa totalRotationAngle, lastRotationAngle
+*/
+
+/*!
+ \property QPinchGesture::startCenterPoint
+ \brief the starting position of the center point
+
+ \sa centerPoint, lastCenterPoint
+*/
+/*!
+ \property QPinchGesture::lastCenterPoint
+ \brief the last position of the center point recorded for this gesture
+
+ \sa centerPoint, startCenterPoint
+*/
+/*!
+ \property QPinchGesture::centerPoint
+ \brief the current center point
+
+ The center point is the midpoint between the two input points in the gesture.
+
+ \sa startCenterPoint, lastCenterPoint
+*/
+
+/*!
+ \internal
+*/
+QPinchGesture::QPinchGesture(QObject *parent)
+ : QGesture(*new QPinchGesturePrivate, parent)
{
+ d_func()->gestureType = Qt::PinchGesture;
}
-/*! \internal
- */
-bool QGesture::eventFilter(QObject *receiver, QEvent *event)
+QPinchGesture::ChangeFlags QPinchGesture::totalChangeFlags() const
{
- Q_D(QGesture);
- if (d->graphicsItem && receiver == parent())
- return false;
- return filterEvent(event);
+ return d_func()->totalChangeFlags;
+}
+
+void QPinchGesture::setTotalChangeFlags(QPinchGesture::ChangeFlags value)
+{
+ d_func()->totalChangeFlags = value;
+}
+
+QPinchGesture::ChangeFlags QPinchGesture::changeFlags() const
+{
+ return d_func()->changeFlags;
+}
+
+void QPinchGesture::setChangeFlags(QPinchGesture::ChangeFlags value)
+{
+ d_func()->changeFlags = value;
+}
+
+QPointF QPinchGesture::startCenterPoint() const
+{
+ return d_func()->startCenterPoint;
+}
+
+QPointF QPinchGesture::lastCenterPoint() const
+{
+ return d_func()->lastCenterPoint;
+}
+
+QPointF QPinchGesture::centerPoint() const
+{
+ return d_func()->centerPoint;
+}
+
+void QPinchGesture::setStartCenterPoint(const QPointF &value)
+{
+ d_func()->startCenterPoint = value;
+}
+
+void QPinchGesture::setLastCenterPoint(const QPointF &value)
+{
+ d_func()->lastCenterPoint = value;
+}
+
+void QPinchGesture::setCenterPoint(const QPointF &value)
+{
+ d_func()->centerPoint = value;
+}
+
+
+qreal QPinchGesture::totalScaleFactor() const
+{
+ return d_func()->totalScaleFactor;
+}
+
+qreal QPinchGesture::lastScaleFactor() const
+{
+ return d_func()->lastScaleFactor;
+}
+
+qreal QPinchGesture::scaleFactor() const
+{
+ return d_func()->scaleFactor;
+}
+
+void QPinchGesture::setTotalScaleFactor(qreal value)
+{
+ d_func()->totalScaleFactor = value;
+}
+
+void QPinchGesture::setLastScaleFactor(qreal value)
+{
+ d_func()->lastScaleFactor = value;
+}
+
+void QPinchGesture::setScaleFactor(qreal value)
+{
+ d_func()->scaleFactor = value;
+}
+
+
+qreal QPinchGesture::totalRotationAngle() const
+{
+ return d_func()->totalRotationAngle;
+}
+
+qreal QPinchGesture::lastRotationAngle() const
+{
+ return d_func()->lastRotationAngle;
+}
+
+qreal QPinchGesture::rotationAngle() const
+{
+ return d_func()->rotationAngle;
+}
+
+void QPinchGesture::setTotalRotationAngle(qreal value)
+{
+ d_func()->totalRotationAngle = value;
+}
+
+void QPinchGesture::setLastRotationAngle(qreal value)
+{
+ d_func()->lastRotationAngle = value;
+}
+
+void QPinchGesture::setRotationAngle(qreal value)
+{
+ d_func()->rotationAngle = value;
}
/*!
- \property QGesture::state
+ \class QSwipeGesture
+ \since 4.6
+ \brief The QSwipeGesture class describes a swipe gesture made by the user.
+ \ingroup gestures
+
+ \image swipegesture.png
- \brief The current state of the gesture.
+ \sa {Gestures Programming}, QPanGesture, QPinchGesture
*/
/*!
- Returns the gesture recognition state.
- */
-Qt::GestureState QGesture::state() const
+ \enum QSwipeGesture::SwipeDirection
+
+ This enum describes the possible directions for the gesture's motion
+ along the horizontal and vertical axes.
+
+ \value NoDirection The gesture had no motion associated with it on a particular axis.
+ \value Left The gesture involved a horizontal motion to the left.
+ \value Right The gesture involved a horizontal motion to the right.
+ \value Up The gesture involved an upward vertical motion.
+ \value Down The gesture involved a downward vertical motion.
+*/
+
+/*!
+ \property QSwipeGesture::horizontalDirection
+ \brief the horizontal direction of the gesture
+
+ If the gesture has a horizontal component, the horizontal direction
+ is either Left or Right; otherwise, it is NoDirection.
+
+ \sa verticalDirection, swipeAngle
+*/
+
+/*!
+ \property QSwipeGesture::verticalDirection
+ \brief the vertical direction of the gesture
+
+ If the gesture has a vertical component, the vertical direction
+ is either Up or Down; otherwise, it is NoDirection.
+
+ \sa horizontalDirection, swipeAngle
+*/
+
+/*!
+ \property QSwipeGesture::swipeAngle
+ \brief the angle of the motion associated with the gesture
+
+ If the gesture has either a horizontal or vertical component, the
+ swipe angle describes the angle between the direction of motion and the
+ x-axis as defined using the standard widget
+ \l{The Coordinate System}{coordinate system}.
+
+ \sa horizontalDirection, verticalDirection
+*/
+
+/*!
+ \internal
+*/
+QSwipeGesture::QSwipeGesture(QObject *parent)
+ : QGesture(*new QSwipeGesturePrivate, parent)
{
- return d_func()->state;
+ d_func()->gestureType = Qt::SwipeGesture;
}
-/*!
- Sets this gesture's recognition state to \a state and emits appropriate
- signals.
+QSwipeGesture::SwipeDirection QSwipeGesture::horizontalDirection() const
+{
+ Q_D(const QSwipeGesture);
+ if (d->swipeAngle < 0 || d->swipeAngle == 90 || d->swipeAngle == 270)
+ return QSwipeGesture::NoDirection;
+ else if (d->swipeAngle < 90 || d->swipeAngle > 270)
+ return QSwipeGesture::Right;
+ else
+ return QSwipeGesture::Left;
+}
- This functions emits the signals according to the old state and the new
- \a state, and it should be called after all the internal properties have been
- initialized.
+QSwipeGesture::SwipeDirection QSwipeGesture::verticalDirection() const
+{
+ Q_D(const QSwipeGesture);
+ if (d->swipeAngle <= 0 || d->swipeAngle == 180)
+ return QSwipeGesture::NoDirection;
+ else if (d->swipeAngle < 180)
+ return QSwipeGesture::Up;
+ else
+ return QSwipeGesture::Down;
+}
- \sa started(), triggered(), finished(), cancelled()
- */
-void QGesture::updateState(Qt::GestureState state)
+qreal QSwipeGesture::swipeAngle() const
{
- Q_D(QGesture);
- if (d->state == state) {
- if (state == Qt::GestureUpdated)
- emit triggered();
- return;
- }
- const Qt::GestureState oldState = d->state;
- d->state = state;
- if (state != Qt::NoGesture && oldState > state) {
- // comparing the state as ints: state should only be changed from
- // started to (optionally) updated and to finished.
- qWarning("QGesture::updateState: incorrect new state");
- return;
- }
- if (oldState == Qt::NoGesture)
- emit started();
- if (state == Qt::GestureUpdated)
- emit triggered();
- else if (state == Qt::GestureFinished)
- emit finished();
- else if (state == Qt::NoGesture)
- emit cancelled();
-
- if (state == Qt::GestureFinished) {
- // gesture is finished, so we reset the internal state.
- d->state = Qt::NoGesture;
- }
-}
-
-/*!
- Sets the \a graphicsItem the gesture is filtering events for.
-
- The gesture will install an event filter to the \a graphicsItem and
- redirect them to the filterEvent() function.
-
- \sa graphicsItem()
-*/
-void QGesture::setGraphicsItem(QGraphicsItem *graphicsItem)
+ return d_func()->swipeAngle;
+}
+
+void QSwipeGesture::setSwipeAngle(qreal value)
{
- Q_D(QGesture);
- if (d->graphicsItem && d->eventFilterProxyGraphicsItem)
- d->graphicsItem->removeSceneEventFilter(d->eventFilterProxyGraphicsItem);
- d->graphicsItem = graphicsItem;
- if (!d->eventFilterProxyGraphicsItem)
- d->eventFilterProxyGraphicsItem = new QEventFilterProxyGraphicsItem(this);
- if (graphicsItem)
- graphicsItem->installSceneEventFilter(d->eventFilterProxyGraphicsItem);
+ d_func()->swipeAngle = value;
}
/*!
- Returns the graphics item the gesture is filtering events for.
+ \class QTapGesture
+ \since 4.6
+ \brief The QTapGesture class describes a tap gesture made by the user.
+ \ingroup gestures
- \sa setGraphicsItem()
+ \sa {Gestures Programming}, QPanGesture, QPinchGesture
+*/
+
+/*!
+ \property QTapGesture::position
+ \brief the position of the tap
*/
-QGraphicsItem* QGesture::graphicsItem() const
+
+/*!
+ \internal
+*/
+QTapGesture::QTapGesture(QObject *parent)
+ : QGesture(*new QTapGesturePrivate, parent)
{
- return d_func()->graphicsItem;
+ d_func()->gestureType = Qt::TapGesture;
}
-/*! \fn void QGesture::reset()
+QPointF QTapGesture::position() const
+{
+ return d_func()->position;
+}
+
+void QTapGesture::setPosition(const QPointF &value)
+{
+ d_func()->position = value;
+}
+/*!
+ \class QTapAndHoldGesture
+ \since 4.6
+ \brief The QTapAndHoldGesture class describes a tap-and-hold (aka LongTap)
+ gesture made by the user.
+ \ingroup gestures
+
+ \sa {Gestures Programming}, QPanGesture, QPinchGesture
+*/
+
+/*!
+ \property QTapAndHoldGesture::position
+ \brief the position of the tap
+*/
- Resets the internal state of the gesture. This function might be called by
- the filterEvent() implementation in a derived class, or by the user to
- cancel a gesture. The base class implementation calls
- updateState(Qt::NoGesture) which emits the cancelled()
- signal if the state() of the gesture indicated it was active.
+/*!
+ \internal
*/
-void QGesture::reset()
+QTapAndHoldGesture::QTapAndHoldGesture(QObject *parent)
+ : QGesture(*new QTapAndHoldGesturePrivate, parent)
+{
+ d_func()->gestureType = Qt::TapAndHoldGesture;
+}
+
+QPointF QTapAndHoldGesture::position() const
+{
+ return d_func()->position;
+}
+
+void QTapAndHoldGesture::setPosition(const QPointF &value)
{
- updateState(Qt::NoGesture);
+ d_func()->position = value;
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index ee28ea4ac..f995d7b61 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,11 +51,12 @@
QT_BEGIN_HEADER
+Q_DECLARE_METATYPE(Qt::GestureState)
+
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-class QGraphicsItem;
class QGesturePrivate;
class Q_GUI_EXPORT QGesture : public QObject
{
@@ -63,37 +64,198 @@ class Q_GUI_EXPORT QGesture : public QObject
Q_DECLARE_PRIVATE(QGesture)
Q_PROPERTY(Qt::GestureState state READ state)
+ Q_PROPERTY(Qt::GestureType gestureType READ gestureType)
+ Q_PROPERTY(QGesture::GestureCancelPolicy gestureCancelPolicy READ gestureCancelPolicy WRITE setGestureCancelPolicy)
+ Q_PROPERTY(QPointF hotSpot READ hotSpot WRITE setHotSpot RESET unsetHotSpot)
+ Q_PROPERTY(bool hasHotSpot READ hasHotSpot)
public:
explicit QGesture(QObject *parent = 0);
~QGesture();
- virtual bool filterEvent(QEvent *event) = 0;
-
- void setGraphicsItem(QGraphicsItem *);
- QGraphicsItem *graphicsItem() const;
+ Qt::GestureType gestureType() const;
Qt::GestureState state() const;
+ QPointF hotSpot() const;
+ void setHotSpot(const QPointF &value);
+ bool hasHotSpot() const;
+ void unsetHotSpot();
+
+ enum GestureCancelPolicy {
+ CancelNone = 0,
+ CancelAllInContext
+ };
+
+ void setGestureCancelPolicy(GestureCancelPolicy policy);
+ GestureCancelPolicy gestureCancelPolicy() const;
+
protected:
QGesture(QGesturePrivate &dd, QObject *parent);
- bool eventFilter(QObject*, QEvent*);
- virtual void reset();
- void updateState(Qt::GestureState state);
+private:
+ friend class QGestureEvent;
+ friend class QGestureRecognizer;
+ friend class QGestureManager;
+ friend class QGraphicsScenePrivate;
+};
-Q_SIGNALS:
- void started();
- void triggered();
- void finished();
- void cancelled();
+class QPanGesturePrivate;
+class Q_GUI_EXPORT QPanGesture : public QGesture
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QPanGesture)
-private:
- friend class QWidget;
+ Q_PROPERTY(QPointF lastOffset READ lastOffset WRITE setLastOffset)
+ Q_PROPERTY(QPointF offset READ offset WRITE setOffset)
+ Q_PROPERTY(QPointF delta READ delta STORED false)
+ Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration)
+
+public:
+ QPanGesture(QObject *parent = 0);
+
+ QPointF lastOffset() const;
+ QPointF offset() const;
+ QPointF delta() const;
+ qreal acceleration() const;
+
+ void setLastOffset(const QPointF &value);
+ void setOffset(const QPointF &value);
+ void setAcceleration(qreal value);
+
+ friend class QPanGestureRecognizer;
+ friend class QWinNativePanGestureRecognizer;
+};
+
+class QPinchGesturePrivate;
+class Q_GUI_EXPORT QPinchGesture : public QGesture
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QPinchGesture)
+
+public:
+ enum ChangeFlag {
+ ScaleFactorChanged = 0x1,
+ RotationAngleChanged = 0x2,
+ CenterPointChanged = 0x4
+ };
+ Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag)
+
+ Q_PROPERTY(ChangeFlags totalChangeFlags READ totalChangeFlags WRITE setTotalChangeFlags)
+ Q_PROPERTY(ChangeFlags changeFlags READ changeFlags WRITE setChangeFlags)
+
+ Q_PROPERTY(qreal totalScaleFactor READ totalScaleFactor WRITE setTotalScaleFactor)
+ Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor WRITE setLastScaleFactor)
+ Q_PROPERTY(qreal scaleFactor READ scaleFactor WRITE setScaleFactor)
+
+ Q_PROPERTY(qreal totalRotationAngle READ totalRotationAngle WRITE setTotalRotationAngle)
+ Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle WRITE setLastRotationAngle)
+ Q_PROPERTY(qreal rotationAngle READ rotationAngle WRITE setRotationAngle)
+
+ Q_PROPERTY(QPointF startCenterPoint READ startCenterPoint WRITE setStartCenterPoint)
+ Q_PROPERTY(QPointF lastCenterPoint READ lastCenterPoint WRITE setLastCenterPoint)
+ Q_PROPERTY(QPointF centerPoint READ centerPoint WRITE setCenterPoint)
+
+public:
+ QPinchGesture(QObject *parent = 0);
+
+ ChangeFlags totalChangeFlags() const;
+ void setTotalChangeFlags(ChangeFlags value);
+
+ ChangeFlags changeFlags() const;
+ void setChangeFlags(ChangeFlags value);
+
+ QPointF startCenterPoint() const;
+ QPointF lastCenterPoint() const;
+ QPointF centerPoint() const;
+ void setStartCenterPoint(const QPointF &value);
+ void setLastCenterPoint(const QPointF &value);
+ void setCenterPoint(const QPointF &value);
+
+ qreal totalScaleFactor() const;
+ qreal lastScaleFactor() const;
+ qreal scaleFactor() const;
+ void setTotalScaleFactor(qreal value);
+ void setLastScaleFactor(qreal value);
+ void setScaleFactor(qreal value);
+
+ qreal totalRotationAngle() const;
+ qreal lastRotationAngle() const;
+ qreal rotationAngle() const;
+ void setTotalRotationAngle(qreal value);
+ void setLastRotationAngle(qreal value);
+ void setRotationAngle(qreal value);
+
+ friend class QPinchGestureRecognizer;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QPinchGesture::ChangeFlags)
+
+QT_BEGIN_NAMESPACE
+
+class QSwipeGesturePrivate;
+class Q_GUI_EXPORT QSwipeGesture : public QGesture
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QSwipeGesture)
+ Q_ENUMS(SwipeDirection)
+
+ Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection STORED false)
+ Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection STORED false)
+ Q_PROPERTY(qreal swipeAngle READ swipeAngle WRITE setSwipeAngle)
+
+public:
+ enum SwipeDirection { NoDirection, Left, Right, Up, Down };
+ QSwipeGesture(QObject *parent = 0);
+
+ SwipeDirection horizontalDirection() const;
+ SwipeDirection verticalDirection() const;
+
+ qreal swipeAngle() const;
+ void setSwipeAngle(qreal value);
+
+ friend class QSwipeGestureRecognizer;
+};
+
+class QTapGesturePrivate;
+class Q_GUI_EXPORT QTapGesture : public QGesture
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QTapGesture)
+
+ Q_PROPERTY(QPointF position READ position WRITE setPosition)
+
+public:
+ QTapGesture(QObject *parent = 0);
+
+ QPointF position() const;
+ void setPosition(const QPointF &pos);
+
+ friend class QTapGestureRecognizer;
+};
+
+class QTapAndHoldGesturePrivate;
+class Q_GUI_EXPORT QTapAndHoldGesture : public QGesture
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QTapAndHoldGesture)
+
+ Q_PROPERTY(QPointF position READ position WRITE setPosition)
+
+public:
+ QTapAndHoldGesture(QObject *parent = 0);
+
+ QPointF position() const;
+ void setPosition(const QPointF &pos);
+
+ friend class QTapAndHoldGestureRecognizer;
};
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy)
QT_END_HEADER
#endif // QGESTURE_H
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index 37f314639..2537f4702 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -61,23 +61,120 @@
QT_BEGIN_NAMESPACE
-class QObject;
-class QGraphicsItem;
class QGesturePrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QGesture)
public:
QGesturePrivate()
- : graphicsItem(0), eventFilterProxyGraphicsItem(0), state(Qt::NoGesture)
+ : gestureType(Qt::CustomGesture), state(Qt::NoGesture),
+ isHotSpotSet(false), gestureCancelPolicy(0)
+
{
}
+ Qt::GestureType gestureType;
+ Qt::GestureState state;
+ QPointF hotSpot;
+ uint isHotSpotSet : 1;
+ uint gestureCancelPolicy : 2;
+};
- QGraphicsItem *graphicsItem;
- QGraphicsItem *eventFilterProxyGraphicsItem;
+class QPanGesturePrivate : public QGesturePrivate
+{
+ Q_DECLARE_PUBLIC(QPanGesture)
- Qt::GestureState state;
+public:
+ QPanGesturePrivate()
+ : acceleration(0)
+ {
+ }
+
+ QPointF lastOffset;
+ QPointF offset;
+ QPoint startPosition;
+ qreal acceleration;
+};
+
+class QPinchGesturePrivate : public QGesturePrivate
+{
+ Q_DECLARE_PUBLIC(QPinchGesture)
+
+public:
+ QPinchGesturePrivate()
+ : totalChangeFlags(0), changeFlags(0),
+ totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0),
+ totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0),
+ isNewSequence(true)
+ {
+ }
+
+ QPinchGesture::ChangeFlags totalChangeFlags;
+ QPinchGesture::ChangeFlags changeFlags;
+
+ QPointF startCenterPoint;
+ QPointF lastCenterPoint;
+ QPointF centerPoint;
+
+ qreal totalScaleFactor;
+ qreal lastScaleFactor;
+ qreal scaleFactor;
+
+ qreal totalRotationAngle;
+ qreal lastRotationAngle;
+ qreal rotationAngle;
+
+ bool isNewSequence;
+ QPointF startPosition[2];
+};
+
+class QSwipeGesturePrivate : public QGesturePrivate
+{
+ Q_DECLARE_PUBLIC(QSwipeGesture)
+
+public:
+ QSwipeGesturePrivate()
+ : horizontalDirection(QSwipeGesture::NoDirection),
+ verticalDirection(QSwipeGesture::NoDirection),
+ swipeAngle(0),
+ started(false), speed(0)
+ {
+ }
+
+ QSwipeGesture::SwipeDirection horizontalDirection;
+ QSwipeGesture::SwipeDirection verticalDirection;
+ qreal swipeAngle;
+
+ QPoint lastPositions[3];
+ bool started;
+ qreal speed;
+ QTime time;
+};
+
+class QTapGesturePrivate : public QGesturePrivate
+{
+ Q_DECLARE_PUBLIC(QTapGesture)
+
+public:
+ QTapGesturePrivate()
+ {
+ }
+
+ QPointF position;
+};
+
+class QTapAndHoldGesturePrivate : public QGesturePrivate
+{
+ Q_DECLARE_PUBLIC(QTapAndHoldGesture)
+
+public:
+ QTapAndHoldGesturePrivate()
+ : timerId(0)
+ {
+ }
+
+ QPointF position;
+ int timerId;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
new file mode 100644
index 000000000..192f9acf6
--- /dev/null
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -0,0 +1,716 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "private/qgesturemanager_p.h"
+#include "private/qstandardgestures_p.h"
+#include "private/qwidget_p.h"
+#include "private/qgesture_p.h"
+#include "private/qgraphicsitem_p.h"
+#include "private/qevent_p.h"
+#include "qgesture.h"
+#include "qevent.h"
+#include "qgraphicsitem.h"
+
+#ifdef Q_WS_MAC
+#include "qmacgesturerecognizer_mac_p.h"
+#endif
+#if defined(Q_OS_WIN) && !defined(QT_NO_NATIVE_GESTURES)
+#include "qwinnativepangesturerecognizer_win_p.h"
+#endif
+
+#include "qdebug.h"
+
+// #define GESTURE_DEBUG
+#ifndef GESTURE_DEBUG
+# define DEBUG if (0) qDebug
+#else
+# define DEBUG qDebug
+#endif
+
+QT_BEGIN_NAMESPACE
+
+QGestureManager *qt_gestureManager = 0;
+
+QGestureManager* QGestureManager::instance()
+{
+ if (!qt_gestureManager)
+ qt_gestureManager = new QGestureManager(qApp);
+ return qt_gestureManager;
+}
+
+QGestureManager::QGestureManager(QObject *parent)
+ : QObject(parent), state(NotGesture), m_lastCustomGestureId(0)
+{
+ qRegisterMetaType<Qt::GestureState>();
+
+#if defined(Q_WS_MAC)
+ registerGestureRecognizer(new QMacSwipeGestureRecognizer);
+ registerGestureRecognizer(new QMacPinchGestureRecognizer);
+ #if defined(QT_MAC_USE_COCOA)
+ registerGestureRecognizer(new QMacPanGestureRecognizer);
+ #endif
+#else
+ registerGestureRecognizer(new QPanGestureRecognizer);
+ registerGestureRecognizer(new QPinchGestureRecognizer);
+ registerGestureRecognizer(new QSwipeGestureRecognizer);
+ registerGestureRecognizer(new QTapGestureRecognizer);
+#endif
+#if defined(Q_OS_WIN)
+ #if !defined(QT_NO_NATIVE_GESTURES)
+ registerGestureRecognizer(new QWinNativePanGestureRecognizer);
+ #endif
+#else
+ registerGestureRecognizer(new QTapAndHoldGestureRecognizer);
+#endif
+}
+
+QGestureManager::~QGestureManager()
+{
+ qDeleteAll(m_recognizers.values());
+ foreach (QGestureRecognizer *recognizer, m_obsoleteGestures.keys()) {
+ qDeleteAll(m_obsoleteGestures.value(recognizer));
+ delete recognizer;
+ }
+ m_obsoleteGestures.clear();
+}
+
+Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer)
+{
+ QGesture *dummy = recognizer->create(0);
+ if (!dummy) {
+ qWarning("QGestureManager::registerGestureRecognizer: "
+ "the recognizer fails to create a gesture object, skipping registration.");
+ return Qt::GestureType(0);
+ }
+ Qt::GestureType type = dummy->gestureType();
+ if (type == Qt::CustomGesture) {
+ // generate a new custom gesture id
+ ++m_lastCustomGestureId;
+ type = Qt::GestureType(Qt::CustomGesture + m_lastCustomGestureId);
+ }
+ m_recognizers.insertMulti(type, recognizer);
+ delete dummy;
+ return type;
+}
+
+void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type)
+{
+ QList<QGestureRecognizer *> list = m_recognizers.values(type);
+ m_recognizers.remove(type);
+ foreach (QGesture *g, m_gestureToRecognizer.keys()) {
+ QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g);
+ if (list.contains(recognizer)) {
+ m_deletedRecognizers.insert(g, recognizer);
+ m_gestureToRecognizer.remove(g);
+ }
+ }
+
+ foreach (QGestureRecognizer *recognizer, list) {
+ QList<QGesture *> obsoleteGestures;
+ QMap<ObjectGesture, QList<QGesture *> >::Iterator iter = m_objectGestures.begin();
+ while (iter != m_objectGestures.end()) {
+ ObjectGesture objectGesture = iter.key();
+ if (objectGesture.gesture == type)
+ obsoleteGestures << iter.value();
+ ++iter;
+ }
+ m_obsoleteGestures.insert(recognizer, obsoleteGestures);
+ }
+}
+
+void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType type)
+{
+ QMap<ObjectGesture, QList<QGesture *> >::Iterator iter = m_objectGestures.begin();
+ while (iter != m_objectGestures.end()) {
+ ObjectGesture objectGesture = iter.key();
+ if (objectGesture.gesture == type && target == objectGesture.object.data()) {
+ qDeleteAll(iter.value());
+ iter = m_objectGestures.erase(iter);
+ } else {
+ ++iter;
+ }
+ }
+}
+
+// get or create a QGesture object that will represent the state for a given object, used by the recognizer
+QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recognizer, Qt::GestureType type)
+{
+ // if the widget is being deleted we should be carefull and not to
+ // create a new state, as it will create QWeakPointer which doesnt work
+ // from the destructor.
+ if (object->isWidgetType()) {
+ if (static_cast<QWidget *>(object)->d_func()->data.in_destructor)
+ return 0;
+ } else if (QGesture *g = qobject_cast<QGesture *>(object)) {
+ return g;
+#ifndef QT_NO_GRAPHICSVIEW
+ } else {
+ Q_ASSERT(qobject_cast<QGraphicsObject *>(object));
+#endif
+ }
+
+ QList<QGesture *> states =
+ m_objectGestures.value(QGestureManager::ObjectGesture(object, type));
+ // check if the QGesture for this recognizer has already been created
+ foreach (QGesture *state, states) {
+ if (m_gestureToRecognizer.value(state) == recognizer)
+ return state;
+ }
+
+ Q_ASSERT(recognizer);
+ QGesture *state = recognizer->create(object);
+ if (!state)
+ return 0;
+ state->setParent(this);
+ if (state->gestureType() == Qt::CustomGesture) {
+ // if the recognizer didn't fill in the gesture type, then this
+ // is a custom gesture with autogenerated id and we fill it.
+ state->d_func()->gestureType = type;
+#if defined(GESTURE_DEBUG)
+ state->setObjectName(QString::number((int)type));
+#endif
+ }
+ m_objectGestures[QGestureManager::ObjectGesture(object, type)].append(state);
+ m_gestureToRecognizer[state] = recognizer;
+ m_gestureOwners[state] = object;
+
+ return state;
+}
+
+bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
+ Qt::GestureType> &contexts,
+ QEvent *event)
+{
+ QSet<QGesture *> triggeredGestures;
+ QSet<QGesture *> finishedGestures;
+ QSet<QGesture *> newMaybeGestures;
+ QSet<QGesture *> canceledGestures;
+ QSet<QGesture *> notGestures;
+
+ // TODO: sort contexts by the gesture type and check if one of the contexts
+ // is already active.
+
+ bool ret = false;
+
+ // filter the event through recognizers
+ typedef QHash<QObject *, Qt::GestureType>::const_iterator ContextIterator;
+ for (ContextIterator cit = contexts.begin(), ce = contexts.end(); cit != ce; ++cit) {
+ Qt::GestureType gestureType = cit.value();
+ QMap<Qt::GestureType, QGestureRecognizer *>::const_iterator
+ rit = m_recognizers.lowerBound(gestureType),
+ re = m_recognizers.upperBound(gestureType);
+ for (; rit != re; ++rit) {
+ QGestureRecognizer *recognizer = rit.value();
+ QObject *target = cit.key();
+ QGesture *state = getState(target, recognizer, gestureType);
+ if (!state)
+ continue;
+ QGestureRecognizer::Result result = recognizer->recognize(state, target, event);
+ QGestureRecognizer::Result type = result & QGestureRecognizer::ResultState_Mask;
+ result &= QGestureRecognizer::ResultHint_Mask;
+ if (type == QGestureRecognizer::TriggerGesture) {
+ DEBUG() << "QGestureManager:Recognizer: gesture triggered: " << state;
+ triggeredGestures << state;
+ } else if (type == QGestureRecognizer::FinishGesture) {
+ DEBUG() << "QGestureManager:Recognizer: gesture finished: " << state;
+ finishedGestures << state;
+ } else if (type == QGestureRecognizer::MayBeGesture) {
+ DEBUG() << "QGestureManager:Recognizer: maybe gesture: " << state;
+ newMaybeGestures << state;
+ } else if (type == QGestureRecognizer::CancelGesture) {
+ DEBUG() << "QGestureManager:Recognizer: not gesture: " << state;
+ notGestures << state;
+ } else if (type == QGestureRecognizer::Ignore) {
+ DEBUG() << "QGestureManager:Recognizer: ignored the event: " << state;
+ } else {
+ DEBUG() << "QGestureManager:Recognizer: hm, lets assume the recognizer"
+ << "ignored the event: " << state;
+ }
+ if (result & QGestureRecognizer::ConsumeEventHint) {
+ DEBUG() << "QGestureManager: we were asked to consume the event: "
+ << state;
+ ret = true;
+ }
+ }
+ }
+
+ QSet<QGesture *> startedGestures = triggeredGestures - m_activeGestures;
+ triggeredGestures &= m_activeGestures;
+
+ // check if a running gesture switched back to maybe state
+ QSet<QGesture *> activeToMaybeGestures = m_activeGestures & newMaybeGestures;
+
+ // check if a running gesture switched back to not gesture state,
+ // i.e. were canceled
+ QSet<QGesture *> activeToCancelGestures = m_activeGestures & notGestures;
+ canceledGestures += activeToCancelGestures;
+
+ // start timers for new gestures in maybe state
+ foreach (QGesture *state, newMaybeGestures) {
+ QBasicTimer &timer = m_maybeGestures[state];
+ if (!timer.isActive())
+ timer.start(3000, this);
+ }
+ // kill timers for gestures that were in maybe state
+ QSet<QGesture *> notMaybeGestures = (startedGestures | triggeredGestures
+ | finishedGestures | canceledGestures
+ | notGestures);
+ foreach(QGesture *gesture, notMaybeGestures) {
+ QHash<QGesture *, QBasicTimer>::iterator it =
+ m_maybeGestures.find(gesture);
+ if (it != m_maybeGestures.end()) {
+ it.value().stop();
+ m_maybeGestures.erase(it);
+ }
+ }
+
+ Q_ASSERT((startedGestures & finishedGestures).isEmpty());
+ Q_ASSERT((startedGestures & newMaybeGestures).isEmpty());
+ Q_ASSERT((startedGestures & canceledGestures).isEmpty());
+ Q_ASSERT((finishedGestures & newMaybeGestures).isEmpty());
+ Q_ASSERT((finishedGestures & canceledGestures).isEmpty());
+ Q_ASSERT((canceledGestures & newMaybeGestures).isEmpty());
+
+ QSet<QGesture *> notStarted = finishedGestures - m_activeGestures;
+ if (!notStarted.isEmpty()) {
+ // there are some gestures that claim to be finished, but never started.
+ // probably those are "singleshot" gestures so we'll fake the started state.
+ foreach (QGesture *gesture, notStarted)
+ gesture->d_func()->state = Qt::GestureStarted;
+ QSet<QGesture *> undeliveredGestures;
+ deliverEvents(notStarted, &undeliveredGestures);
+ finishedGestures -= undeliveredGestures;
+ }
+
+ m_activeGestures += startedGestures;
+ // sanity check: all triggered gestures should already be in active gestures list
+ Q_ASSERT((m_activeGestures & triggeredGestures).size() == triggeredGestures.size());
+ m_activeGestures -= finishedGestures;
+ m_activeGestures -= activeToMaybeGestures;
+ m_activeGestures -= canceledGestures;
+
+ // set the proper gesture state on each gesture
+ foreach (QGesture *gesture, startedGestures)
+ gesture->d_func()->state = Qt::GestureStarted;
+ foreach (QGesture *gesture, triggeredGestures)
+ gesture->d_func()->state = Qt::GestureUpdated;
+ foreach (QGesture *gesture, finishedGestures)
+ gesture->d_func()->state = Qt::GestureFinished;
+ foreach (QGesture *gesture, canceledGestures)
+ gesture->d_func()->state = Qt::GestureCanceled;
+ foreach (QGesture *gesture, activeToMaybeGestures)
+ gesture->d_func()->state = Qt::GestureFinished;
+
+ if (!m_activeGestures.isEmpty() || !m_maybeGestures.isEmpty() ||
+ !startedGestures.isEmpty() || !triggeredGestures.isEmpty() ||
+ !finishedGestures.isEmpty() || !canceledGestures.isEmpty()) {
+ DEBUG() << "QGestureManager::filterEventThroughContexts:"
+ << "\n\tactiveGestures:" << m_activeGestures
+ << "\n\tmaybeGestures:" << m_maybeGestures.keys()
+ << "\n\tstarted:" << startedGestures
+ << "\n\ttriggered:" << triggeredGestures
+ << "\n\tfinished:" << finishedGestures
+ << "\n\tcanceled:" << canceledGestures;
+ }
+
+ QSet<QGesture *> undeliveredGestures;
+ deliverEvents(startedGestures+triggeredGestures+finishedGestures+canceledGestures,
+ &undeliveredGestures);
+
+ foreach (QGesture *g, startedGestures) {
+ if (undeliveredGestures.contains(g))
+ continue;
+ if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) {
+ DEBUG() << "lets try to cancel some";
+ // find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them
+ cancelGesturesForChildren(g);
+ }
+ }
+
+ m_activeGestures -= undeliveredGestures;
+
+ // reset gestures that ended
+ QSet<QGesture *> endedGestures =
+ finishedGestures + canceledGestures + undeliveredGestures;
+ foreach (QGesture *gesture, endedGestures) {
+ recycle(gesture);
+ m_gestureTargets.remove(gesture);
+ }
+ return ret;
+}
+
+// Cancel all gestures of children of the widget that original is associated with
+void QGestureManager::cancelGesturesForChildren(QGesture *original)
+{
+ Q_ASSERT(original);
+ QWidget *originatingWidget = m_gestureTargets.value(original);
+ Q_ASSERT(originatingWidget);
+
+ // iterate over all active gestures and all maybe gestures
+ // for each find the owner
+ // if the owner is part of our sub-hierarchy, cancel it.
+
+ QSet<QGesture*> cancelledGestures;
+ QSet<QGesture*>::Iterator iter = m_activeGestures.begin();
+ while (iter != m_activeGestures.end()) {
+ QWidget *widget = m_gestureTargets.value(*iter);
+ // note that we don't touch the gestures for our originatingWidget
+ if (widget != originatingWidget && originatingWidget->isAncestorOf(widget)) {
+ DEBUG() << " found a gesture to cancel" << (*iter);
+ (*iter)->d_func()->state = Qt::GestureCanceled;
+ cancelledGestures << *iter;
+ iter = m_activeGestures.erase(iter);
+ } else {
+ ++iter;
+ }
+ }
+
+ // TODO handle 'maybe' gestures too
+
+ // sort them per target widget by cherry picking from almostCanceledGestures and delivering
+ QSet<QGesture *> almostCanceledGestures = cancelledGestures;
+ while (!almostCanceledGestures.isEmpty()) {
+ QWidget *target = 0;
+ QSet<QGesture*> gestures;
+ iter = almostCanceledGestures.begin();
+ // sort per target widget
+ while (iter != almostCanceledGestures.end()) {
+ QWidget *widget = m_gestureTargets.value(*iter);
+ if (target == 0)
+ target = widget;
+ if (target == widget) {
+ gestures << *iter;
+ iter = almostCanceledGestures.erase(iter);
+ } else {
+ ++iter;
+ }
+ }
+ Q_ASSERT(target);
+
+ QSet<QGesture*> undeliveredGestures;
+ deliverEvents(gestures, &undeliveredGestures);
+ }
+
+ for (iter = cancelledGestures.begin(); iter != cancelledGestures.end(); ++iter)
+ recycle(*iter);
+}
+
+void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture)
+{
+ QGestureRecognizer *recognizer = m_deletedRecognizers.value(gesture);
+ Q_ASSERT(recognizer);
+ m_deletedRecognizers.remove(gesture);
+ if (m_deletedRecognizers.keys(recognizer).isEmpty()) {
+ // no more active gestures, cleanup!
+ qDeleteAll(m_obsoleteGestures.value(recognizer));
+ m_obsoleteGestures.remove(recognizer);
+ delete recognizer;
+ }
+}
+
+// return true if accepted (consumed)
+bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
+{
+ QSet<Qt::GestureType> types;
+ QMultiHash<QObject *, Qt::GestureType> contexts;
+ QWidget *w = receiver;
+ typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
+ if (!w->d_func()->gestureContext.isEmpty()) {
+ for(ContextIterator it = w->d_func()->gestureContext.begin(),
+ e = w->d_func()->gestureContext.end(); it != e; ++it) {
+ types.insert(it.key());
+ contexts.insertMulti(w, it.key());
+ }
+ }
+ // find all gesture contexts for the widget tree
+ w = w->isWindow() ? 0 : w->parentWidget();
+ while (w)
+ {
+ for (ContextIterator it = w->d_func()->gestureContext.begin(),
+ e = w->d_func()->gestureContext.end(); it != e; ++it) {
+ if (!(it.value() & Qt::DontStartGestureOnChildren)) {
+ if (!types.contains(it.key())) {
+ types.insert(it.key());
+ contexts.insertMulti(w, it.key());
+ }
+ }
+ }
+ if (w->isWindow())
+ break;
+ w = w->parentWidget();
+ }
+ return filterEventThroughContexts(contexts, event);
+}
+
+#ifndef QT_NO_GRAPHICSVIEW
+bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
+{
+ QSet<Qt::GestureType> types;
+ QMultiHash<QObject *, Qt::GestureType> contexts;
+ QGraphicsObject *item = receiver;
+ if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) {
+ typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
+ for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(),
+ e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
+ types.insert(it.key());
+ contexts.insertMulti(item, it.key());
+ }
+ }
+ // find all gesture contexts for the graphics object tree
+ item = item->parentObject();
+ while (item)
+ {
+ typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
+ for (ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(),
+ e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
+ if (!(it.value() & Qt::DontStartGestureOnChildren)) {
+ if (!types.contains(it.key())) {
+ types.insert(it.key());
+ contexts.insertMulti(item, it.key());
+ }
+ }
+ }
+ item = item->parentObject();
+ }
+ return filterEventThroughContexts(contexts, event);
+}
+#endif
+
+bool QGestureManager::filterEvent(QGesture *state, QEvent *event)
+{
+ QMultiHash<QObject *, Qt::GestureType> contexts;
+ contexts.insert(state, state->gestureType());
+ return filterEventThroughContexts(contexts, event);
+}
+
+void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures,
+ QMap<QWidget *, QList<QGesture *> > *conflicts,
+ QMap<QWidget *, QList<QGesture *> > *normal)
+{
+ typedef QHash<Qt::GestureType, QHash<QWidget *, QGesture *> > GestureByTypes;
+ GestureByTypes gestureByTypes;
+
+ // sort gestures by types
+ foreach (QGesture *gesture, gestures) {
+ QWidget *receiver = m_gestureTargets.value(gesture, 0);
+ Q_ASSERT(receiver);
+ gestureByTypes[gesture->gestureType()].insert(receiver, gesture);
+ }
+
+ // for each gesture type
+ foreach (Qt::GestureType type, gestureByTypes.keys()) {
+ QHash<QWidget *, QGesture *> gestures = gestureByTypes.value(type);
+ foreach (QWidget *widget, gestures.keys()) {
+ QWidget *w = widget->parentWidget();
+ while (w) {
+ QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it
+ = w->d_func()->gestureContext.find(type);
+ if (it != w->d_func()->gestureContext.end()) {
+ // i.e. 'w' listens to gesture 'type'
+ Qt::GestureFlags flags = it.value();
+ if (!(it.value() & Qt::DontStartGestureOnChildren) && w != widget) {
+ // conflicting gesture!
+ (*conflicts)[widget].append(gestures[widget]);
+ break;
+ }
+ }
+ if (w->isWindow()) {
+ w = 0;
+ break;
+ }
+ w = w->parentWidget();
+ }
+ if (!w)
+ (*normal)[widget].append(gestures[widget]);
+ }
+ }
+}
+
+void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
+ QSet<QGesture *> *undeliveredGestures)
+{
+ if (gestures.isEmpty())
+ return;
+
+ typedef QMap<QWidget *, QList<QGesture *> > GesturesPerWidget;
+ GesturesPerWidget conflictedGestures;
+ GesturesPerWidget normalStartedGestures;
+
+ QSet<QGesture *> startedGestures;
+ // first figure out the initial receivers of gestures
+ for (QSet<QGesture *>::const_iterator it = gestures.begin(),
+ e = gestures.end(); it != e; ++it) {
+ QGesture *gesture = *it;
+ QWidget *target = m_gestureTargets.value(gesture, 0);
+ if (!target) {
+ // the gesture has just started and doesn't have a target yet.
+ Q_ASSERT(gesture->state() == Qt::GestureStarted);
+ if (gesture->hasHotSpot()) {
+ // guess the target widget using the hotspot of the gesture
+ QPoint pt = gesture->hotSpot().toPoint();
+ if (QWidget *w = qApp->topLevelAt(pt)) {
+ target = w->childAt(w->mapFromGlobal(pt));
+ }
+ } else {
+ // or use the context of the gesture
+ QObject *context = m_gestureOwners.value(gesture, 0);
+ if (context->isWidgetType())
+ target = static_cast<QWidget *>(context);
+ }
+ if (target)
+ m_gestureTargets.insert(gesture, target);
+ }
+
+ Qt::GestureType gestureType = gesture->gestureType();
+ Q_ASSERT(gestureType != Qt::CustomGesture);
+ Q_UNUSED(gestureType);
+
+ if (target) {
+ if (gesture->state() == Qt::GestureStarted) {
+ startedGestures.insert(gesture);
+ } else {
+ normalStartedGestures[target].append(gesture);
+ }
+ } else {
+ DEBUG() << "QGestureManager::deliverEvent: could not find the target for gesture"
+ << gesture->gestureType();
+ qWarning("QGestureManager::deliverEvent: could not find the target for gesture");
+ undeliveredGestures->insert(gesture);
+ }
+ }
+
+ getGestureTargets(startedGestures, &conflictedGestures, &normalStartedGestures);
+ DEBUG() << "QGestureManager::deliverEvents:"
+ << "\nstarted: " << startedGestures
+ << "\nconflicted: " << conflictedGestures
+ << "\nnormal: " << normalStartedGestures
+ << "\n";
+
+ // if there are conflicting gestures, send the GestureOverride event
+ for (GesturesPerWidget::const_iterator it = conflictedGestures.begin(),
+ e = conflictedGestures.end(); it != e; ++it) {
+ QWidget *receiver = it.key();
+ QList<QGesture *> gestures = it.value();
+ DEBUG() << "QGestureManager::deliverEvents: sending GestureOverride to"
+ << receiver
+ << "gestures:" << gestures;
+ QGestureEvent event(gestures);
+ event.t = QEvent::GestureOverride;
+ // mark event and individual gestures as ignored
+ event.ignore();
+ foreach(QGesture *g, gestures)
+ event.setAccepted(g, false);
+
+ QApplication::sendEvent(receiver, &event);
+ bool eventAccepted = event.isAccepted();
+ foreach(QGesture *gesture, event.gestures()) {
+ if (eventAccepted || event.isAccepted(gesture)) {
+ QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0);
+ Q_ASSERT(w);
+ DEBUG() << "override event: gesture was accepted:" << gesture << w;
+ QList<QGesture *> &gestures = normalStartedGestures[w];
+ gestures.append(gesture);
+ // override the target
+ m_gestureTargets[gesture] = w;
+ } else {
+ DEBUG() << "override event: gesture wasn't accepted. putting back:" << gesture;
+ QList<QGesture *> &gestures = normalStartedGestures[receiver];
+ gestures.append(gesture);
+ }
+ }
+ }
+
+ // delivering gestures that are not in conflicted state
+ for (GesturesPerWidget::const_iterator it = normalStartedGestures.begin(),
+ e = normalStartedGestures.end(); it != e; ++it) {
+ if (!it.value().isEmpty()) {
+ DEBUG() << "QGestureManager::deliverEvents: sending to" << it.key()
+ << "gestures:" << it.value();
+ QGestureEvent event(it.value());
+ QApplication::sendEvent(it.key(), &event);
+ bool eventAccepted = event.isAccepted();
+ foreach (QGesture *gesture, event.gestures()) {
+ if (gesture->state() == Qt::GestureStarted &&
+ (eventAccepted || event.isAccepted(gesture))) {
+ QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0);
+ Q_ASSERT(w);
+ DEBUG() << "started gesture was delivered and accepted by" << w;
+ m_gestureTargets[gesture] = w;
+ }
+ }
+ }
+ }
+}
+
+void QGestureManager::timerEvent(QTimerEvent *event)
+{
+ QHash<QGesture *, QBasicTimer>::iterator it = m_maybeGestures.begin(),
+ e = m_maybeGestures.end();
+ for (; it != e; ) {
+ QBasicTimer &timer = it.value();
+ Q_ASSERT(timer.isActive());
+ if (timer.timerId() == event->timerId()) {
+ timer.stop();
+ QGesture *gesture = it.key();
+ it = m_maybeGestures.erase(it);
+ DEBUG() << "QGestureManager::timerEvent: gesture stopped due to timeout:"
+ << gesture;
+ recycle(gesture);
+ } else {
+ ++it;
+ }
+ }
+}
+
+void QGestureManager::recycle(QGesture *gesture)
+{
+ QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0);
+ if (recognizer) {
+ gesture->setGestureCancelPolicy(QGesture::CancelNone);
+ recognizer->reset(gesture);
+ } else {
+ cleanupGesturesForRemovedRecognizer(gesture);
+ }
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qgesturemanager_p.cpp"
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
new file mode 100644
index 000000000..4efa10b0c
--- /dev/null
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGESTUREMANAGER_P_H
+#define QGESTUREMANAGER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qobject.h"
+#include "qbasictimer.h"
+#include "private/qwidget_p.h"
+#include "qgesturerecognizer.h"
+
+QT_BEGIN_NAMESPACE
+
+class QBasicTimer;
+class QGraphicsObject;
+class QGestureManager : public QObject
+{
+ Q_OBJECT
+public:
+ QGestureManager(QObject *parent);
+ ~QGestureManager();
+
+ Qt::GestureType registerGestureRecognizer(QGestureRecognizer *recognizer);
+ void unregisterGestureRecognizer(Qt::GestureType type);
+
+ bool filterEvent(QWidget *receiver, QEvent *event);
+ bool filterEvent(QGesture *receiver, QEvent *event);
+#ifndef QT_NO_GRAPHICSVIEW
+ bool filterEvent(QGraphicsObject *receiver, QEvent *event);
+#endif //QT_NO_GRAPHICSVIEW
+
+ static QGestureManager* instance();
+
+ void cleanupCachedGestures(QObject *target, Qt::GestureType type);
+
+ void recycle(QGesture *gesture);
+
+protected:
+ void timerEvent(QTimerEvent *event);
+ bool filterEventThroughContexts(const QMultiHash<QObject *, Qt::GestureType> &contexts,
+ QEvent *event);
+
+private:
+ QMultiMap<Qt::GestureType, QGestureRecognizer *> m_recognizers;
+
+ QSet<QGesture *> m_activeGestures;
+ QHash<QGesture *, QBasicTimer> m_maybeGestures;
+
+ enum State {
+ Gesture,
+ NotGesture,
+ MaybeGesture // this means timers are up and waiting for some
+ // more events, and input events are handled by
+ // gesture recognizer explicitely
+ } state;
+
+ struct ObjectGesture
+ {
+ QWeakPointer<QObject> object;
+ Qt::GestureType gesture;
+
+ ObjectGesture(QObject *o, const Qt::GestureType &g) : object(o), gesture(g) { }
+ inline bool operator<(const ObjectGesture &rhs) const
+ {
+ if (object.data() < rhs.object.data())
+ return true;
+ if (object == rhs.object)
+ return gesture < rhs.gesture;
+ return false;
+ }
+ };
+
+ QMap<ObjectGesture, QList<QGesture *> > m_objectGestures;
+ QHash<QGesture *, QGestureRecognizer *> m_gestureToRecognizer;
+ QHash<QGesture *, QObject *> m_gestureOwners;
+
+ QHash<QGesture *, QWidget *> m_gestureTargets;
+
+ int m_lastCustomGestureId;
+
+ QHash<QGestureRecognizer *, QList<QGesture *> > m_obsoleteGestures;
+ QHash<QGesture *, QGestureRecognizer *> m_deletedRecognizers;
+ void cleanupGesturesForRemovedRecognizer(QGesture *gesture);
+
+ QGesture *getState(QObject *widget, QGestureRecognizer *recognizer,
+ Qt::GestureType gesture);
+ void deliverEvents(const QSet<QGesture *> &gestures,
+ QSet<QGesture *> *undeliveredGestures);
+ void getGestureTargets(const QSet<QGesture*> &gestures,
+ QMap<QWidget *, QList<QGesture *> > *conflicts,
+ QMap<QWidget *, QList<QGesture *> > *normal);
+
+ void cancelGesturesForChildren(QGesture *originatingGesture);
+};
+
+extern QGestureManager *qt_gestureManager;
+
+QT_END_NAMESPACE
+
+#endif // QGESTUREMANAGER_P_H
diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp
new file mode 100644
index 000000000..ed0bdcca9
--- /dev/null
+++ b/src/gui/kernel/qgesturerecognizer.cpp
@@ -0,0 +1,230 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgesturerecognizer.h"
+
+#include "private/qgesture_p.h"
+#include "private/qgesturemanager_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QGestureRecognizer
+ \since 4.6
+ \brief The QGestureRecognizer class provides the infrastructure for gesture recognition.
+ \ingroup gestures
+
+ Gesture recognizers are responsible for creating and managing QGesture objects and
+ monitoring input events sent to QWidget and QGraphicsObject subclasses.
+ QGestureRecognizer is the base class for implementing custom gestures.
+
+ Developers that only need to provide gesture recognition for standard gestures do not
+ need to use this class directly. Instances will be created behind the scenes by the
+ framework.
+
+ \section1 Recognizing Gestures
+
+ The process of recognizing gestures involves filtering input events sent to specific
+ objects, and modifying the associated QGesture objects to include relevant information
+ about the user's input.
+
+ Gestures are created when the framework calls create() to handle user input
+ for a particular instance of a QWidget or QGraphicsObject subclass. A QGesture object
+ is created for each widget or item that is configured to use gestures.
+
+ Once a QGesture has been created for a target object, the gesture recognizer will
+ receive events for it in its recognize() handler function.
+
+ When a gesture is canceled, the reset() function is called, giving the recognizer the
+ chance to update the appropriate properties in the corresponding QGesture object.
+
+ \section1 Supporting New Gestures
+
+ To add support for new gestures, you need to derive from QGestureRecognizer to create
+ a custom recognizer class, construct an instance of this class, and register it with
+ the application by calling QGestureRecognizer::registerRecognizer(). You can also
+ subclass QGesture to create a custom gesture class, or rely on dynamic properties
+ to express specific details of the gesture you want to handle.
+
+ Your custom QGestureRecognizer subclass needs to reimplement the recognize()
+ function to handle and filter the incoming input events for QWidget and
+ QGraphicsObject subclasses. Although the logic for gesture recognition is
+ implemented in this function, you can store persistent information about the
+ state of the recognition process in the QGesture object supplied. The
+ recognize() function must return a value of QGestureRecognizer::Result that
+ indicates the state of recognition for a given gesture and target object.
+ This determines whether or not a gesture event will be delivered to a target
+ object.
+
+ If you choose to represent a gesture by a custom QGesture subclass, you will need to
+ reimplement the create() function to construct instances of your gesture class.
+ Similarly, you may need to reimplement the reset() function if your custom gesture
+ objects need to be specially handled when a gesture is canceled.
+
+ \sa QGesture
+*/
+
+/*!
+ \enum QGestureRecognizer::ResultFlag
+
+ This enum describes the result of the current event filtering step in
+ a gesture recognizer state machine.
+
+ The result consists of a state value (one of Ignore, MayBeGesture,
+ TriggerGesture, FinishGesture, CancelGesture) and an optional hint
+ (ConsumeEventHint).
+
+ \value Ignore The event does not change the state of the recognizer.
+
+ \value MayBeGesture The event changed the internal state of the recognizer,
+ but it isn't clear yet if it is a gesture or not. The recognizer needs to
+ filter more events to decide. Gesture recognizers in the MayBeGesture state
+ may be reset automatically if they take too long to recognize gestures.
+
+ \value TriggerGesture The gesture has been triggered and the appropriate
+ QGesture object will be delivered to the target as a part of a
+ QGestureEvent.
+
+ \value FinishGesture The gesture has been finished successfully and the
+ appropriate QGesture object will be delivered to the target as a part of a
+ QGestureEvent.
+
+ \value CancelGesture The event made it clear that it is not a gesture. If
+ the gesture recognizer was in GestureTriggered state before, then the
+ gesture is canceled and the appropriate QGesture object will be delivered
+ to the target as a part of a QGestureEvent.
+
+ \value ConsumeEventHint This hint specifies that the gesture framework
+ should consume the filtered event and not deliver it to the receiver.
+
+ \omitvalue ResultState_Mask
+ \omitvalue ResultHint_Mask
+
+ \sa QGestureRecognizer::recognize()
+*/
+
+/*!
+ Constructs a new gesture recognizer object.
+*/
+QGestureRecognizer::QGestureRecognizer()
+{
+}
+
+/*!
+ Destroys the gesture recognizer.
+*/
+QGestureRecognizer::~QGestureRecognizer()
+{
+}
+
+/*!
+ This function is called by Qt to create a new QGesture object for the
+ given \a target (QWidget or QGraphicsObject).
+
+ Reimplement this function to create a custom QGesture-derived gesture
+ object if necessary.
+*/
+QGesture *QGestureRecognizer::create(QObject *target)
+{
+ Q_UNUSED(target);
+ return new QGesture;
+}
+
+/*!
+ This function is called by the framework to reset a given \a gesture.
+
+ Reimplement this function to implement additional requirements for custom QGesture
+ objects. This may be necessary if you implement a custom QGesture whose properties
+ need special handling when the gesture is reset.
+*/
+void QGestureRecognizer::reset(QGesture *gesture)
+{
+ if (gesture) {
+ QGesturePrivate *d = gesture->d_func();
+ d->state = Qt::NoGesture;
+ d->hotSpot = QPointF();
+ d->isHotSpotSet = false;
+ }
+}
+
+/*!
+ \fn QGestureRecognizer::recognize(QGesture *gesture, QObject *watched, QEvent *event)
+
+ Handles the given \a event for the \a watched object, updating the state of the \a gesture
+ object as required, and returns a suitable result for the current recognition step.
+
+ This function is called by the framework to allow the recognizer to filter input events
+ dispatched to QWidget or QGraphicsObject instances that it is monitoring.
+
+ The result reflects how much of the gesture has been recognized. The state of the
+ \a gesture object is set depending on the result.
+
+ \sa QGestureRecognizer::Result
+*/
+
+/*!
+ Registers the given \a recognizer in the gesture framework and returns a gesture ID
+ for it.
+
+ The application takes ownership of the \a recognizer and returns the gesture type
+ ID associated with it. For gesture recognizers which handle custom QGesture
+ objects (i.e., those which return Qt::CustomGesture in a QGesture::gestureType()
+ function) the return value is a generated gesture ID with the Qt::CustomGesture
+ flag set.
+
+ \sa unregisterRecognizer(), QGestureRecognizer::create(), QGesture
+*/
+Qt::GestureType QGestureRecognizer::registerRecognizer(QGestureRecognizer *recognizer)
+{
+ return QGestureManager::instance()->registerGestureRecognizer(recognizer);
+}
+
+/*!
+ Unregisters all gesture recognizers of the specified \a type.
+
+ \sa registerRecognizer()
+*/
+void QGestureRecognizer::unregisterRecognizer(Qt::GestureType type)
+{
+ QGestureManager::instance()->unregisterGestureRecognizer(type);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h
new file mode 100644
index 000000000..4eebf7cf3
--- /dev/null
+++ b/src/gui/kernel/qgesturerecognizer.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGESTURERECOGNIZER_H
+#define QGESTURERECOGNIZER_H
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qnamespace.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QObject;
+class QEvent;
+class QGesture;
+class Q_GUI_EXPORT QGestureRecognizer
+{
+public:
+ enum ResultFlag
+ {
+ Ignore = 0x0001,
+
+ MayBeGesture = 0x0002,
+ TriggerGesture = 0x0004,
+ FinishGesture = 0x0008,
+ CancelGesture = 0x0010,
+
+ ResultState_Mask = 0x00ff,
+
+ ConsumeEventHint = 0x0100,
+ // StoreEventHint = 0x0200,
+ // ReplayStoredEventsHint = 0x0400,
+ // DiscardStoredEventsHint = 0x0800,
+
+ ResultHint_Mask = 0xff00
+ };
+ Q_DECLARE_FLAGS(Result, ResultFlag)
+
+ QGestureRecognizer();
+ virtual ~QGestureRecognizer();
+
+ virtual QGesture *create(QObject *target);
+ virtual Result recognize(QGesture *state, QObject *watched,
+ QEvent *event) = 0;
+ virtual void reset(QGesture *state);
+
+ static Qt::GestureType registerRecognizer(QGestureRecognizer *recognizer);
+ static void unregisterRecognizer(Qt::GestureType type);
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QGestureRecognizer::Result)
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QGESTURERECOGNIZER_H
diff --git a/src/gui/kernel/qgridlayout.cpp b/src/gui/kernel/qgridlayout.cpp
index 6624b7788..d644e3a72 100644
--- a/src/gui/kernel/qgridlayout.cpp
+++ b/src/gui/kernel/qgridlayout.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -980,8 +980,7 @@ QRect QGridLayoutPrivate::cellRect(int row, int col) const
\brief The QGridLayout class lays out widgets in a grid.
\ingroup geomanagement
- \ingroup appearance
- \mainclass
+
QGridLayout takes the space made available to it (by its parent
layout or by the parentWidget()), divides it up into rows and
diff --git a/src/gui/kernel/qgridlayout.h b/src/gui/kernel/qgridlayout.h
index 569bd7c84..7b0d4e0ec 100644
--- a/src/gui/kernel/qgridlayout.h
+++ b/src/gui/kernel/qgridlayout.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qguieventdispatcher_glib.cpp b/src/gui/kernel/qguieventdispatcher_glib.cpp
index 241ea3d5f..f8a638c28 100644
--- a/src/gui/kernel/qguieventdispatcher_glib.cpp
+++ b/src/gui/kernel/qguieventdispatcher_glib.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -120,7 +120,7 @@ static gboolean x11EventSourceDispatch(GSource *s, GSourceFunc callback, gpointe
// _qt_scrolldone protocols, queue all other
// client messages
if (event.xclient.format == 32) {
- if (event.xclient.message_type == ATOM(WM_PROTOCOLS) ||
+ if (event.xclient.message_type == ATOM(WM_PROTOCOLS) &&
(Atom) event.xclient.data.l[0] == ATOM(WM_TAKE_FOCUS)) {
break;
} else if (event.xclient.message_type == ATOM(_QT_SCROLL_DONE)) {
diff --git a/src/gui/kernel/qguieventdispatcher_glib_p.h b/src/gui/kernel/qguieventdispatcher_glib_p.h
index 854a8ca63..4574df924 100644
--- a/src/gui/kernel/qguieventdispatcher_glib_p.h
+++ b/src/gui/kernel/qguieventdispatcher_glib_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp
index ad7f63ceb..58e12eece 100644
--- a/src/gui/kernel/qguifunctions_wince.cpp
+++ b/src/gui/kernel/qguifunctions_wince.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -327,20 +327,20 @@ void qt_wince_maximize(QWidget *widget)
}
}
-void qt_wince_minimize(HWND hwnd) {
-
- uint exstyle = GetWindowLong(hwnd, GWL_EXSTYLE);
- uint style = GetWindowLong(hwnd, GWL_STYLE);
- RECT rect;
- RECT crect = {0,0,0,0};
- GetWindowRect(hwnd, &rect);
- AdjustWindowRectEx(&crect, style & ~WS_OVERLAPPED, FALSE, exstyle);
- MoveWindow(hwnd, rect.left - crect.left, rect.top - crect.top, 0, 0, true);
- SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong (hwnd, GWL_EXSTYLE) | WS_EX_NODRAG);
+void qt_wince_minimize(HWND hwnd)
+{
+#ifdef Q_OS_WINCE_WM
ShowWindow(hwnd, SW_HIDE);
+#else
+ if (!IsWindowVisible(hwnd)) {
+ // Hack for an initial showMinimized.
+ // Without it, our widget doesn't appear in the task bar.
+ ShowWindow(hwnd, SW_SHOW);
+ }
+ ShowWindow(hwnd, SW_MINIMIZE);
+#endif
}
-
void qt_wince_hide_taskbar(HWND hwnd) {
if (ptrAygFullScreen)
ptrAygFullScreen(hwnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON);
diff --git a/src/gui/kernel/qguifunctions_wince.h b/src/gui/kernel/qguifunctions_wince.h
index c259b4f17..b7b30a997 100644
--- a/src/gui/kernel/qguifunctions_wince.h
+++ b/src/gui/kernel/qguifunctions_wince.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp
new file mode 100644
index 000000000..e6efec1bf
--- /dev/null
+++ b/src/gui/kernel/qguiplatformplugin.cpp
@@ -0,0 +1,298 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qguiplatformplugin_p.h"
+#include <qdebug.h>
+#include <qfile.h>
+#include <qdir.h>
+#include <qsettings.h>
+#include "private/qfactoryloader_p.h"
+#include "qstylefactory.h"
+#include "qapplication.h"
+#include "qplatformdefs.h"
+#include "qicon.h"
+
+#ifdef Q_WS_WINCE
+#include "qguifunctions_wince.h"
+extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp
+extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp
+extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp
+#endif
+
+
+#if defined(Q_WS_X11)
+#include <private/qkde_p.h>
+#include <private/qgtkstyle_p.h>
+#include <private/qt_x11_p.h>
+#endif
+
+
+QT_BEGIN_NAMESPACE
+
+
+/*! \internal
+ Return (an construct if necesseray) the Gui Platform plugin.
+
+ The plugin key to be loaded is inside the QT_PLATFORM_PLUGIN environment variable.
+ If it is not set, it will be the DESKTOP_SESSION on X11.
+
+ If no plugin can be loaded, the default one is returned.
+ */
+QGuiPlatformPlugin *qt_guiPlatformPlugin()
+{
+ static QGuiPlatformPlugin *plugin;
+ if (!plugin)
+ {
+#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+
+ QString key = QString::fromLocal8Bit(qgetenv("QT_PLATFORM_PLUGIN"));
+#ifdef Q_WS_X11
+ if (key.isEmpty()) {
+ switch(X11->desktopEnvironment) {
+ case DE_KDE:
+ key = QString::fromLatin1("kde");
+ break;
+ default:
+ key = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION"));
+ break;
+ }
+ }
+#endif
+
+ if (!key.isEmpty() && QApplication::desktopSettingsAware()) {
+ QFactoryLoader loader(QGuiPlatformPluginInterface_iid, QLatin1String("/gui_platform"));
+ plugin = qobject_cast<QGuiPlatformPlugin *>(loader.instance(key));
+ }
+#endif // QT_NO_LIBRARY
+
+ if(!plugin) {
+ static QGuiPlatformPlugin def;
+ plugin = &def;
+ }
+ }
+ return plugin;
+}
+
+
+/* \class QPlatformPlugin
+ QGuiPlatformPlugin can be used to integrate Qt applications in a platform built on top of Qt.
+ The application developer should not know or use the plugin, it is only used by Qt internaly.
+
+ But full platform that are built on top of Qt may provide a plugin so 3rd party Qt application
+ running in the platform are integrated.
+ */
+
+/*
+ The constructor can be used to install hooks in Qt
+ */
+QGuiPlatformPlugin::QGuiPlatformPlugin(QObject *parent) : QObject(parent) {}
+QGuiPlatformPlugin::~QGuiPlatformPlugin() {}
+
+
+/* return the string key to be used by default the application */
+QString QGuiPlatformPlugin::styleName()
+{
+#if defined(Q_WS_WIN) && defined(Q_WS_WINCE)
+ if (qt_wince_is_smartphone() || qt_wince_is_pocket_pc())
+ return QLatin1String("WindowsMobile");
+ else
+ return QLatin1String("WindowsCE");
+#elif defined(Q_WS_WIN)
+ if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
+ && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ return QLatin1String("WindowsVista");
+ else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
+ && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ return QLatin1String("WindowsXP");
+ else
+ return QLatin1String("Windows"); // default styles for Windows
+#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS)
+ return QLatin1String("CDE"); // default style for X11 on Solaris
+#elif defined(Q_WS_S60)
+ return QLatin1String("S60"); // default style for Symbian with S60
+#elif defined(Q_OS_SYMBIAN)
+ return QLatin1String("Windows"); // default style for Symbian without S60
+#elif defined(Q_WS_X11) && defined(Q_OS_IRIX)
+ return QLatin1String("SGI"); // default style for X11 on IRIX
+#elif defined(Q_WS_QWS)
+ return QLatin1String("Plastique"); // default style for X11 and small devices
+#elif defined(Q_WS_MAC)
+ return QLatin1String("Macintosh"); // default style for all Mac's
+#elif defined(Q_WS_X11)
+ QString stylename;
+ switch(X11->desktopEnvironment) {
+ case DE_KDE:
+ stylename = QKde::kdeStyle();
+ break;
+ case DE_GNOME: {
+ QStringList availableStyles = QStyleFactory::keys();
+ // Set QGtkStyle for GNOME if available
+ QString gtkStyleKey = QString::fromLatin1("GTK+");
+ if (availableStyles.contains(gtkStyleKey)) {
+ stylename = gtkStyleKey;
+ break;
+ }
+ if (X11->use_xrender)
+ stylename = QLatin1String("cleanlooks");
+ else
+ stylename = QLatin1String("windows");
+ break;
+ }
+ case DE_CDE:
+ stylename = QLatin1String("cde");
+ break;
+ default:
+ // Don't do anything
+ break;
+ }
+ return stylename;
+#endif
+}
+
+/* return an aditional default palette (only work on X11) */
+QPalette QGuiPlatformPlugin::palette()
+{
+#ifdef Q_WS_X11
+ if (QApplication::desktopSettingsAware() && X11->desktopEnvironment == DE_KDE)
+ return QKde::kdePalette();
+#endif
+
+ return QPalette();
+}
+
+/* the default icon theme name for QIcon::fromTheme. */
+QString QGuiPlatformPlugin::systemIconThemeName()
+{
+ QString result;
+#ifdef Q_WS_X11
+ if (X11->desktopEnvironment == DE_GNOME) {
+ result = QString::fromLatin1("gnome");
+#ifndef QT_NO_STYLE_GTK
+ result = QGtkStylePrivate::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), result);
+#endif
+ } else if (X11->desktopEnvironment == DE_KDE) {
+ result = X11->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg");
+ QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
+ settings.beginGroup(QLatin1String("Icons"));
+ result = settings.value(QLatin1String("Theme"), result).toString();
+ }
+#endif
+ return result;
+}
+
+
+QStringList QGuiPlatformPlugin::iconThemeSearchPaths()
+{
+ QStringList paths;
+#if defined(Q_WS_X11)
+ QString xdgDirString = QFile::decodeName(getenv("XDG_DATA_DIRS"));
+ if (xdgDirString.isEmpty())
+ xdgDirString = QLatin1String("/usr/local/share/:/usr/share/");
+
+ QStringList xdgDirs = xdgDirString.split(QLatin1Char(':'));
+
+ for (int i = 0 ; i < xdgDirs.size() ; ++i) {
+ QDir dir(xdgDirs[i]);
+ if (dir.exists())
+ paths.append(dir.path() + QLatin1String("/icons"));
+ }
+ if (X11->desktopEnvironment == DE_KDE) {
+ paths << QLatin1Char(':') + QKde::kdeHome() + QLatin1String("/share/icons");
+ QStringList kdeDirs = QFile::decodeName(getenv("KDEDIRS")).split(QLatin1Char(':'));
+ for (int i = 0 ; i< kdeDirs.count() ; ++i) {
+ QDir dir(QLatin1Char(':') + kdeDirs.at(i) + QLatin1String("/share/icons"));
+ if (dir.exists())
+ paths.append(dir.path());
+ }
+ }
+
+ // Add home directory first in search path
+ QDir homeDir(QDir::homePath() + QLatin1String("/.icons"));
+ if (homeDir.exists())
+ paths.prepend(homeDir.path());
+#endif
+
+#if defined(Q_WS_WIN)
+ paths.append(qApp->applicationDirPath() + QLatin1String("/icons"));
+#elif defined(Q_WS_MAC)
+ paths.append(qApp->applicationDirPath() + QLatin1String("/../Resources/icons"));
+#endif
+ return paths;
+}
+
+/* backend for QFileIconProvider, null icon means default */
+QIcon QGuiPlatformPlugin::fileSystemIcon(const QFileInfo &)
+{
+ return QIcon();
+}
+
+/* Like QStyle::styleHint */
+int QGuiPlatformPlugin::platformHint(PlatformHint hint)
+{
+ int ret = 0;
+ switch(hint)
+ {
+ case PH_ToolButtonStyle:
+ ret = Qt::ToolButtonIconOnly;
+#ifdef Q_WS_X11
+ if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4
+ && QApplication::desktopSettingsAware()) {
+ ret = QKde::kdeToolButtonStyle();
+ }
+#endif
+ break;
+ case PH_ToolBarIconSize:
+#ifdef Q_WS_X11
+ if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4
+ && QApplication::desktopSettingsAware()) {
+ ret = QKde::kdeToolBarIconSize();
+ }
+#endif
+ //by default keep ret = 0 so QCommonStyle will use the style default
+ break;
+ default:
+ break;
+ }
+ return ret;
+}
+
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qguiplatformplugin_p.h b/src/gui/kernel/qguiplatformplugin_p.h
new file mode 100644
index 000000000..2a70ee78c
--- /dev/null
+++ b/src/gui/kernel/qguiplatformplugin_p.h
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGUIPLATFORM_P_H
+#define QGUIPLATFORM_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qplugin.h>
+#include <QtCore/qfactoryinterface.h>
+#include <QtGui/qdialog.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QStyle;
+class QPalette;
+class QIcon;
+class QFileDialog;
+class QColorDialog;
+class QFileInfo;
+
+struct Q_GUI_EXPORT QGuiPlatformPluginInterface : public QFactoryInterface
+{
+};
+
+#define QGuiPlatformPluginInterface_iid "com.nokia.qt.QGuiPlatformPluginInterface"
+
+Q_DECLARE_INTERFACE(QGuiPlatformPluginInterface, QGuiPlatformPluginInterface_iid)
+
+class Q_GUI_EXPORT QGuiPlatformPlugin : public QObject, public QGuiPlatformPluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QGuiPlatformPluginInterface:QFactoryInterface)
+ public:
+ explicit QGuiPlatformPlugin(QObject *parent = 0);
+ ~QGuiPlatformPlugin();
+
+ virtual QStringList keys() const { return QStringList() << QLatin1String("default"); };
+
+ virtual QString styleName();
+ virtual QPalette palette();
+ virtual QString systemIconThemeName();
+ virtual QStringList iconThemeSearchPaths();
+ virtual QIcon fileSystemIcon(const QFileInfo &);
+
+ enum PlatformHint { PH_ToolButtonStyle, PH_ToolBarIconSize, PH_ItemView_ActivateItemOnSingleClick };
+ virtual int platformHint(PlatformHint hint);
+
+
+ virtual void fileDialogDelete(QFileDialog *) {}
+ virtual bool fileDialogSetVisible(QFileDialog *, bool) { return false; }
+ virtual QDialog::DialogCode fileDialogResultCode(QFileDialog *) { return QDialog::Rejected; }
+ virtual void fileDialogSetDirectory(QFileDialog *, const QString &) {}
+ virtual QString fileDialogDirectory(const QFileDialog *) const { return QString(); }
+ virtual void fileDialogSelectFile(QFileDialog *, const QString &) {}
+ virtual QStringList fileDialogSelectedFiles(const QFileDialog *) const { return QStringList(); }
+ virtual void fileDialogSetFilter(QFileDialog *) {}
+ virtual void fileDialogSetNameFilters(QFileDialog *, const QStringList &) {}
+ virtual void fileDialogSelectNameFilter(QFileDialog *, const QString &) {}
+ virtual QString fileDialogSelectedNameFilter(const QFileDialog *) const { return QString(); }
+
+ virtual void colorDialogDelete(QColorDialog *) {}
+ virtual bool colorDialogSetVisible(QColorDialog *, bool) { return false; }
+ virtual void colorDialogSetCurrentColor(QColorDialog *, const QColor &) {}
+};
+
+//internal
+QGuiPlatformPlugin *qt_guiPlatformPlugin();
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+
+#endif // QGUIPLATFORMPLUGIN_H
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index ef6b775f6..59bdc36a0 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qkde.cpp b/src/gui/kernel/qkde.cpp
index 98bf0a085..edc53ac9a 100644
--- a/src/gui/kernel/qkde.cpp
+++ b/src/gui/kernel/qkde.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -141,14 +141,33 @@ QString QKde::kdeStyle()
return QLatin1String("windows");
}
-/*!\internal
- placeholder to load icon from kde.
- to be implemented
- */
-QIcon QKde::kdeIcon(const QString &name)
+
+int QKde::kdeToolButtonStyle()
{
- //###todo
- return QIcon();
+ QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"),
+ QSettings::IniFormat);
+ settings.beginGroup(QLatin1String("Toolbar style"));
+ QString toolbarStyle = settings.value(QLatin1String("ToolButtonStyle"), QLatin1String("TextBesideIcon")).toString();
+ if (toolbarStyle == QLatin1String("TextBesideIcon"))
+ return Qt::ToolButtonTextBesideIcon;
+ else if (toolbarStyle == QLatin1String("TextOnly"))
+ return Qt::ToolButtonTextOnly;
+ else if (toolbarStyle == QLatin1String("TextUnderIcon"))
+ return Qt::ToolButtonTextUnderIcon;
+
+ return Qt::ToolButtonTextBesideIcon;
+}
+
+int QKde::kdeToolBarIconSize()
+{
+ static int iconSize = -1;
+ if (iconSize == -1) {
+ QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"),
+ QSettings::IniFormat);
+ settings.beginGroup(QLatin1String("ToolbarIcons"));
+ iconSize = settings.value(QLatin1String("Size")).toInt();
+ }
+ return iconSize;
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qkde_p.h b/src/gui/kernel/qkde_p.h
index c794bad19..c22a145f4 100644
--- a/src/gui/kernel/qkde_p.h
+++ b/src/gui/kernel/qkde_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -61,12 +61,17 @@
QT_BEGIN_NAMESPACE
-// This namespace contains helper function to help KDE integration
+/*!\internal
+ This namespace contains helper function to help KDE integration
+ They are only used if we detect the use of KDE and the KDE platform plugin is not found (old KDE version)
+ Or if the detected KDE version is KDE3
+*/
namespace QKde {
QString kdeHome();
QString kdeStyle();
QPalette kdePalette();
- QIcon kdeIcon(const QString &name);
+ int kdeToolButtonStyle();
+ int kdeToolBarIconSize();
}
diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp
index 0730ef6a0..283acf9f7 100644
--- a/src/gui/kernel/qkeymapper.cpp
+++ b/src/gui/kernel/qkeymapper.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE
/*!
\class QKeyMapper
\since 4.2
- \ingroup application
\internal
\sa QObject
diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp
index b10a8047c..b7c271182 100644
--- a/src/gui/kernel/qkeymapper_mac.cpp
+++ b/src/gui/kernel/qkeymapper_mac.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -563,7 +563,7 @@ QKeyMapperPrivate::QKeyMapperPrivate()
QKeyMapperPrivate::~QKeyMapperPrivate()
{
- clearMappings();
+ deleteLayouts();
}
bool
@@ -658,7 +658,7 @@ QKeyMapperPrivate::updateKeyboard()
}
void
-QKeyMapperPrivate::clearMappings()
+QKeyMapperPrivate::deleteLayouts()
{
keyboard_mode = NullMode;
for (int i = 0; i < 255; ++i) {
@@ -667,6 +667,12 @@ QKeyMapperPrivate::clearMappings()
keyLayout[i] = 0;
}
}
+}
+
+void
+QKeyMapperPrivate::clearMappings()
+{
+ deleteLayouts();
updateKeyboard();
}
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index fe83e3f6b..f1b425250 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -58,6 +58,7 @@
#include <qlist.h>
#include <qlocale.h>
#include <qevent.h>
+#include <qhash.h>
#if defined (Q_WS_MAC64)
# include <private/qt_mac_p.h>
@@ -160,6 +161,7 @@ public:
bool translateKeyEvent(QWidget *receiver, const MSG &msg, bool grab);
void updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 scancode, quint32 vk_key);
bool isADeadKey(unsigned int vk_key, unsigned int modifiers);
+ void deleteLayouts();
KeyboardLayoutItem *keyLayout[256];
@@ -188,6 +190,7 @@ public:
bool updateKeyboard();
void updateKeyMap(EventHandlerCallRef, EventRef, void *);
bool translateKeyEvent(QWidget *, EventHandlerCallRef, EventRef, void *, bool);
+ void deleteLayouts();
enum { NullMode, UnicodeMode, OtherMode } keyboard_mode;
union {
@@ -203,6 +206,13 @@ public:
UInt32 keyboard_dead;
KeyboardLayoutItem *keyLayout[256];
#elif defined(Q_WS_QWS)
+#elif defined(Q_OS_SYMBIAN)
+private:
+ QHash<TUint, int> s60ToQtKeyMap;
+ void fillKeyMap();
+public:
+ QString translateKeyEvent(int keySym, Qt::KeyboardModifiers modifiers);
+ int mapS60KeyToQt(TUint s60key);
#endif
};
diff --git a/src/gui/kernel/qkeymapper_qws.cpp b/src/gui/kernel/qkeymapper_qws.cpp
index 8a266a0f4..c2375b314 100644
--- a/src/gui/kernel/qkeymapper_qws.cpp
+++ b/src/gui/kernel/qkeymapper_qws.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qkeymapper_s60.cpp b/src/gui/kernel/qkeymapper_s60.cpp
new file mode 100644
index 000000000..ecfb7fb43
--- /dev/null
+++ b/src/gui/kernel/qkeymapper_s60.cpp
@@ -0,0 +1,247 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "private/qkeymapper_p.h"
+#include <e32keys.h>
+
+QT_BEGIN_NAMESPACE
+
+QKeyMapperPrivate::QKeyMapperPrivate()
+{
+ fillKeyMap();
+}
+
+QKeyMapperPrivate::~QKeyMapperPrivate()
+{
+}
+
+QList<int> QKeyMapperPrivate::possibleKeys(QKeyEvent * /* e */)
+{
+ QList<int> result;
+ return result;
+}
+
+void QKeyMapperPrivate::clearMappings()
+{
+ // stub
+}
+
+QString QKeyMapperPrivate::translateKeyEvent(int keySym, Qt::KeyboardModifiers /* modifiers */)
+{
+ if (keySym >= Qt::Key_Escape)
+ return QString();
+
+ // Symbian doesn't actually use modifiers, but gives us the character code directly.
+
+ return QString(QChar(keySym));
+}
+
+void QKeyMapperPrivate::fillKeyMap()
+{
+ using namespace Qt;
+ static const struct {
+ TUint s60Key;
+ int qtKey;
+ } map[] = {
+ {EKeyBell, Key_unknown},
+ {EKeyBackspace, Key_Backspace},
+ {EKeyTab, Key_Tab},
+ {EKeyLineFeed, Key_unknown},
+ {EKeyVerticalTab, Key_unknown},
+ {EKeyFormFeed, Key_unknown},
+ {EKeyEnter, Key_Enter},
+ {EKeyEscape, Key_Escape},
+ {EKeySpace, Key_Space},
+ {EKeyDelete, Key_Delete},
+ {EKeyPrintScreen, Key_SysReq},
+ {EKeyPause, Key_Pause},
+ {EKeyHome, Key_Home},
+ {EKeyEnd, Key_End},
+ {EKeyPageUp, Key_PageUp},
+ {EKeyPageDown, Key_PageDown},
+ {EKeyInsert, Key_Insert},
+ {EKeyLeftArrow, Key_Left},
+ {EKeyRightArrow, Key_Right},
+ {EKeyUpArrow, Key_Up},
+ {EKeyDownArrow, Key_Down},
+ {EKeyLeftShift, Key_Shift},
+ {EKeyRightShift, Key_Shift},
+ {EKeyLeftAlt, Key_Alt},
+ {EKeyRightAlt, Key_AltGr},
+ {EKeyLeftCtrl, Key_Control},
+ {EKeyRightCtrl, Key_Control},
+ {EKeyLeftFunc, Key_Super_L},
+ {EKeyRightFunc, Key_Super_R},
+ {EKeyCapsLock, Key_CapsLock},
+ {EKeyNumLock, Key_NumLock},
+ {EKeyScrollLock, Key_ScrollLock},
+ {EKeyF1, Key_F1},
+ {EKeyF2, Key_F2},
+ {EKeyF3, Key_F3},
+ {EKeyF4, Key_F4},
+ {EKeyF5, Key_F5},
+ {EKeyF6, Key_F6},
+ {EKeyF7, Key_F7},
+ {EKeyF8, Key_F8},
+ {EKeyF9, Key_F9},
+ {EKeyF10, Key_F10},
+ {EKeyF11, Key_F11},
+ {EKeyF12, Key_F12},
+ {EKeyF13, Key_F13},
+ {EKeyF14, Key_F14},
+ {EKeyF15, Key_F15},
+ {EKeyF16, Key_F16},
+ {EKeyF17, Key_F17},
+ {EKeyF18, Key_F18},
+ {EKeyF19, Key_F19},
+ {EKeyF20, Key_F20},
+ {EKeyF21, Key_F21},
+ {EKeyF22, Key_F22},
+ {EKeyF23, Key_F23},
+ {EKeyF24, Key_F24},
+ {EKeyOff, Key_unknown},
+ {EKeyIncContrast, Key_unknown},
+ {EKeyDecContrast, Key_unknown},
+ {EKeyBacklightOn, Key_unknown},
+ {EKeyBacklightOff, Key_unknown},
+ {EKeyBacklightToggle, Key_unknown},
+ {EKeySliderDown, Key_unknown},
+ {EKeySliderUp, Key_unknown},
+ {EKeyMenu, Key_Menu},
+ {EKeyDictaphonePlay, Key_unknown},
+ {EKeyDictaphoneStop, Key_unknown},
+ {EKeyDictaphoneRecord, Key_unknown},
+ {EKeyHelp, Key_unknown},
+ {EKeyDial, Key_Call},
+ {EKeyScreenDimension0, Key_unknown},
+ {EKeyScreenDimension1, Key_unknown},
+ {EKeyScreenDimension2, Key_unknown},
+ {EKeyScreenDimension3, Key_unknown},
+ {EKeyIncVolume, Key_unknown},
+ {EKeyDecVolume, Key_unknown},
+ {EKeyDevice0, Key_Context1}, // Found by manual testing, left softkey.
+ {EKeyDevice1, Key_Context2}, // Found by manual testing.
+ {EKeyDevice2, Key_unknown},
+ {EKeyDevice3, Key_Select}, // Found by manual testing.
+ {EKeyDevice4, Key_unknown},
+ {EKeyDevice5, Key_unknown},
+ {EKeyDevice6, Key_unknown},
+ {EKeyDevice7, Key_unknown},
+ {EKeyDevice8, Key_unknown},
+ {EKeyDevice9, Key_unknown},
+ {EKeyDeviceA, Key_unknown},
+ {EKeyDeviceB, Key_unknown},
+ {EKeyDeviceC, Key_unknown},
+ {EKeyDeviceD, Key_unknown},
+ {EKeyDeviceE, Key_unknown},
+ {EKeyDeviceF, Key_unknown},
+ {EKeyApplication0, Key_Launch0},
+ {EKeyApplication1, Key_Launch1},
+ {EKeyApplication2, Key_Launch2},
+ {EKeyApplication3, Key_Launch3},
+ {EKeyApplication4, Key_Launch4},
+ {EKeyApplication5, Key_Launch5},
+ {EKeyApplication6, Key_Launch6},
+ {EKeyApplication7, Key_Launch7},
+ {EKeyApplication8, Key_Launch8},
+ {EKeyApplication9, Key_Launch9},
+ {EKeyApplicationA, Key_LaunchA},
+ {EKeyApplicationB, Key_LaunchB},
+ {EKeyApplicationC, Key_LaunchC},
+ {EKeyApplicationD, Key_LaunchD},
+ {EKeyApplicationE, Key_LaunchE},
+ {EKeyApplicationF, Key_LaunchF},
+ {EKeyYes, Key_Yes},
+ {EKeyNo, Key_No},
+ {EKeyIncBrightness, Key_unknown},
+ {EKeyDecBrightness, Key_unknown},
+ {EKeyKeyboardExtend, Key_unknown},
+ {EKeyDevice10, Key_unknown},
+ {EKeyDevice11, Key_unknown},
+ {EKeyDevice12, Key_unknown},
+ {EKeyDevice13, Key_unknown},
+ {EKeyDevice14, Key_unknown},
+ {EKeyDevice15, Key_unknown},
+ {EKeyDevice16, Key_unknown},
+ {EKeyDevice17, Key_unknown},
+ {EKeyDevice18, Key_unknown},
+ {EKeyDevice19, Key_unknown},
+ {EKeyDevice1A, Key_unknown},
+ {EKeyDevice1B, Key_unknown},
+ {EKeyDevice1C, Key_unknown},
+ {EKeyDevice1D, Key_unknown},
+ {EKeyDevice1E, Key_unknown},
+ {EKeyDevice1F, Key_unknown},
+ {EKeyApplication10, Key_unknown},
+ {EKeyApplication11, Key_unknown},
+ {EKeyApplication12, Key_unknown},
+ {EKeyApplication13, Key_unknown},
+ {EKeyApplication14, Key_unknown},
+ {EKeyApplication15, Key_unknown},
+ {EKeyApplication16, Key_unknown},
+ {EKeyApplication17, Key_unknown},
+ {EKeyApplication18, Key_unknown},
+ {EKeyApplication19, Key_unknown},
+ {EKeyApplication1A, Key_unknown},
+ {EKeyApplication1B, Key_unknown},
+ {EKeyApplication1C, Key_unknown},
+ {EKeyApplication1D, Key_unknown},
+ {EKeyApplication1E, Key_unknown},
+ {EKeyApplication1F, Key_unknown}
+ };
+ const int mapSize = int(sizeof(map)/sizeof(map[0]));
+ s60ToQtKeyMap.reserve(mapSize + 5); // +5? docs: Ideally, slightly more than number of items
+ for (int i = 0; i < mapSize; ++i)
+ s60ToQtKeyMap.insert(map[i].s60Key, map[i].qtKey);
+}
+
+int QKeyMapperPrivate::mapS60KeyToQt(TUint s60key)
+{
+ QHash<TUint, int>::const_iterator mapping;
+ mapping = s60ToQtKeyMap.find(s60key);
+ if (mapping != s60ToQtKeyMap.end()) {
+ return *mapping;
+ } else {
+ return Qt::Key_unknown;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp
index 36abf8695..f95efa265 100644
--- a/src/gui/kernel/qkeymapper_win.cpp
+++ b/src/gui/kernel/qkeymapper_win.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -433,6 +433,23 @@ static const Qt::KeyboardModifiers ModsTbl[] = {
Qt::NoModifier, // Fall-back to raw Key_*
};
+/**
+ Remap return or action key to select key for windows mobile.
+*/
+inline int winceKeyBend(int keyCode)
+{
+#if defined(Q_OS_WINCE_WM) && defined(QT_KEYPAD_NAVIGATION)
+ // remap return or action key to select key for windows mobile.
+ // will be changed to a table remapping function in the next version (4.6/7).
+ if (keyCode == VK_RETURN && QApplication::keypadNavigationEnabled())
+ return Qt::Key_Select;
+ else
+ return KeyTbl[keyCode];
+#else
+ return KeyTbl[keyCode];
+#endif
+}
+
#if defined(Q_OS_WINCE)
// Use the KeyTbl to resolve a Qt::Key out of the virtual keys.
// In case it is not resolvable, continue using the virtual key itself.
@@ -472,7 +489,7 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer,
// Qt::Key_*'s are not encoded below 0x20, so try again, and DEL keys (0x7f) is encoded with a
// proper Qt::Key_ code
if (code < 0x20 || code == 0x7f) // Handles res==0 too
- code = KeyTbl[vk];
+ code = winceKeyBend(vk);
if (isDeadkey)
*isDeadkey = (res == -1);
@@ -482,7 +499,7 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer,
Q_GUI_EXPORT int qt_translateKeyCode(int vk)
{
- int code = (vk < 0 || vk > 255) ? 0 : KeyTbl[vk];
+ int code = winceKeyBend((vk < 0 || vk > 255) ? 0 : vk);
return code == Qt::Key_unknown ? 0 : code;
}
@@ -582,10 +599,10 @@ QKeyMapperPrivate::QKeyMapperPrivate()
QKeyMapperPrivate::~QKeyMapperPrivate()
{
- clearMappings();
+ deleteLayouts();
}
-void QKeyMapperPrivate::clearMappings()
+void QKeyMapperPrivate::deleteLayouts()
{
for (int i = 0; i < 255; ++i) {
if (keyLayout[i]) {
@@ -593,6 +610,11 @@ void QKeyMapperPrivate::clearMappings()
keyLayout[i] = 0;
}
}
+}
+
+void QKeyMapperPrivate::clearMappings()
+{
+ deleteLayouts();
/* MAKELCID()'s first argument is a WORD, and GetKeyboardLayout()
* returns a DWORD. */
@@ -684,7 +706,7 @@ void QKeyMapperPrivate::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
keyLayout[vk_key]->qtKey[7] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x80 : 0;
// Add a fall back key for layouts which don't do composition and show non-latin1 characters
- int fallbackKey = KeyTbl[vk_key];
+ int fallbackKey = winceKeyBend(vk_key);
if (!fallbackKey || fallbackKey == Qt::Key_unknown) {
fallbackKey = 0;
if (vk_key != keyLayout[vk_key]->qtKey[0] && vk_key < 0x5B && vk_key > 0x2F)
@@ -883,8 +905,8 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
if(msg.wParam == VK_PROCESSKEY)
return true;
- // Ignore invalid virtual keycode (see bug 127424)
- if (msg.wParam == 0xFF)
+ // Ignore invalid virtual keycodes (see bugs 127424, QTBUG-3630)
+ if (msg.wParam == 0 || msg.wParam == 0xFF)
return true;
// Translate VK_* (native) -> Key_* (Qt) keys
@@ -893,7 +915,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool
// ..also if we're typing numbers on the keypad, while holding down the Alt modifier.
int code = 0;
if (isNumpad && (nModifiers & AltAny)) {
- code = KeyTbl[msg.wParam];
+ code = winceKeyBend(msg.wParam);
} else if (!isDeadKey) {
unsigned char kbdBuffer[256]; // Will hold the complete keyboard state
GetKeyboardState(kbdBuffer);
diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp
index 4db59ee5f..816458907 100644
--- a/src/gui/kernel/qkeymapper_x11.cpp
+++ b/src/gui/kernel/qkeymapper_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -536,7 +536,7 @@ void QKeyMapperPrivate::clearMappings()
coreDesc.keysyms_per_keycode = 0;
coreDesc.keysyms = XGetKeyboardMapping(X11->display,
coreDesc.min_keycode,
- coreDesc.max_keycode - coreDesc.min_keycode,
+ coreDesc.max_keycode - coreDesc.min_keycode + 1,
&coreDesc.keysyms_per_keycode);
#if 0
@@ -714,47 +714,144 @@ extern bool qt_sm_blockUserInput;
#define XK_KP_Delete 0xFF9F
#endif
-// the next lines are taken from XFree > 4.0 (X11/XF86keysyms.h), defining some special
+// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special
// multimedia keys. They are included here as not every system has them.
-#define XF86XK_Standby 0x1008FF10
-#define XF86XK_AudioLowerVolume 0x1008FF11
-#define XF86XK_AudioMute 0x1008FF12
-#define XF86XK_AudioRaiseVolume 0x1008FF13
-#define XF86XK_AudioPlay 0x1008FF14
-#define XF86XK_AudioStop 0x1008FF15
-#define XF86XK_AudioPrev 0x1008FF16
-#define XF86XK_AudioNext 0x1008FF17
-#define XF86XK_HomePage 0x1008FF18
-#define XF86XK_Calculator 0x1008FF1D
-#define XF86XK_Mail 0x1008FF19
-#define XF86XK_Start 0x1008FF1A
-#define XF86XK_Search 0x1008FF1B
-#define XF86XK_AudioRecord 0x1008FF1C
-#define XF86XK_Back 0x1008FF26
-#define XF86XK_Forward 0x1008FF27
-#define XF86XK_Stop 0x1008FF28
-#define XF86XK_Refresh 0x1008FF29
-#define XF86XK_Favorites 0x1008FF30
-#define XF86XK_AudioPause 0x1008FF31
-#define XF86XK_AudioMedia 0x1008FF32
-#define XF86XK_MyComputer 0x1008FF33
-#define XF86XK_OpenURL 0x1008FF38
-#define XF86XK_Launch0 0x1008FF40
-#define XF86XK_Launch1 0x1008FF41
-#define XF86XK_Launch2 0x1008FF42
-#define XF86XK_Launch3 0x1008FF43
-#define XF86XK_Launch4 0x1008FF44
-#define XF86XK_Launch5 0x1008FF45
-#define XF86XK_Launch6 0x1008FF46
-#define XF86XK_Launch7 0x1008FF47
-#define XF86XK_Launch8 0x1008FF48
-#define XF86XK_Launch9 0x1008FF49
-#define XF86XK_LaunchA 0x1008FF4A
-#define XF86XK_LaunchB 0x1008FF4B
-#define XF86XK_LaunchC 0x1008FF4C
-#define XF86XK_LaunchD 0x1008FF4D
-#define XF86XK_LaunchE 0x1008FF4E
-#define XF86XK_LaunchF 0x1008FF4F
+#define XF86XK_MonBrightnessUp 0x1008FF02
+#define XF86XK_MonBrightnessDown 0x1008FF03
+#define XF86XK_KbdLightOnOff 0x1008FF04
+#define XF86XK_KbdBrightnessUp 0x1008FF05
+#define XF86XK_KbdBrightnessDown 0x1008FF06
+#define XF86XK_Standby 0x1008FF10
+#define XF86XK_AudioLowerVolume 0x1008FF11
+#define XF86XK_AudioMute 0x1008FF12
+#define XF86XK_AudioRaiseVolume 0x1008FF13
+#define XF86XK_AudioPlay 0x1008FF14
+#define XF86XK_AudioStop 0x1008FF15
+#define XF86XK_AudioPrev 0x1008FF16
+#define XF86XK_AudioNext 0x1008FF17
+#define XF86XK_HomePage 0x1008FF18
+#define XF86XK_Mail 0x1008FF19
+#define XF86XK_Start 0x1008FF1A
+#define XF86XK_Search 0x1008FF1B
+#define XF86XK_AudioRecord 0x1008FF1C
+#define XF86XK_Calculator 0x1008FF1D
+#define XF86XK_Memo 0x1008FF1E
+#define XF86XK_ToDoList 0x1008FF1F
+#define XF86XK_Calendar 0x1008FF20
+#define XF86XK_PowerDown 0x1008FF21
+#define XF86XK_ContrastAdjust 0x1008FF22
+#define XF86XK_Back 0x1008FF26
+#define XF86XK_Forward 0x1008FF27
+#define XF86XK_Stop 0x1008FF28
+#define XF86XK_Refresh 0x1008FF29
+#define XF86XK_PowerOff 0x1008FF2A
+#define XF86XK_WakeUp 0x1008FF2B
+#define XF86XK_Eject 0x1008FF2C
+#define XF86XK_ScreenSaver 0x1008FF2D
+#define XF86XK_WWW 0x1008FF2E
+#define XF86XK_Sleep 0x1008FF2F
+#define XF86XK_Favorites 0x1008FF30
+#define XF86XK_AudioPause 0x1008FF31
+#define XF86XK_AudioMedia 0x1008FF32
+#define XF86XK_MyComputer 0x1008FF33
+#define XF86XK_LightBulb 0x1008FF35
+#define XF86XK_Shop 0x1008FF36
+#define XF86XK_History 0x1008FF37
+#define XF86XK_OpenURL 0x1008FF38
+#define XF86XK_AddFavorite 0x1008FF39
+#define XF86XK_HotLinks 0x1008FF3A
+#define XF86XK_BrightnessAdjust 0x1008FF3B
+#define XF86XK_Finance 0x1008FF3C
+#define XF86XK_Community 0x1008FF3D
+#define XF86XK_AudioRewind 0x1008FF3E
+#define XF86XK_BackForward 0x1008FF3F
+#define XF86XK_Launch0 0x1008FF40
+#define XF86XK_Launch1 0x1008FF41
+#define XF86XK_Launch2 0x1008FF42
+#define XF86XK_Launch3 0x1008FF43
+#define XF86XK_Launch4 0x1008FF44
+#define XF86XK_Launch5 0x1008FF45
+#define XF86XK_Launch6 0x1008FF46
+#define XF86XK_Launch7 0x1008FF47
+#define XF86XK_Launch8 0x1008FF48
+#define XF86XK_Launch9 0x1008FF49
+#define XF86XK_LaunchA 0x1008FF4A
+#define XF86XK_LaunchB 0x1008FF4B
+#define XF86XK_LaunchC 0x1008FF4C
+#define XF86XK_LaunchD 0x1008FF4D
+#define XF86XK_LaunchE 0x1008FF4E
+#define XF86XK_LaunchF 0x1008FF4F
+#define XF86XK_ApplicationLeft 0x1008FF50
+#define XF86XK_ApplicationRight 0x1008FF51
+#define XF86XK_Book 0x1008FF52
+#define XF86XK_CD 0x1008FF53
+#define XF86XK_Calculater 0x1008FF54
+#define XF86XK_Clear 0x1008FF55
+#define XF86XK_ClearGrab 0x1008FE21
+#define XF86XK_Close 0x1008FF56
+#define XF86XK_Copy 0x1008FF57
+#define XF86XK_Cut 0x1008FF58
+#define XF86XK_Display 0x1008FF59
+#define XF86XK_DOS 0x1008FF5A
+#define XF86XK_Documents 0x1008FF5B
+#define XF86XK_Excel 0x1008FF5C
+#define XF86XK_Explorer 0x1008FF5D
+#define XF86XK_Game 0x1008FF5E
+#define XF86XK_Go 0x1008FF5F
+#define XF86XK_iTouch 0x1008FF60
+#define XF86XK_LogOff 0x1008FF61
+#define XF86XK_Market 0x1008FF62
+#define XF86XK_Meeting 0x1008FF63
+#define XF86XK_MenuKB 0x1008FF65
+#define XF86XK_MenuPB 0x1008FF66
+#define XF86XK_MySites 0x1008FF67
+#define XF86XK_News 0x1008FF69
+#define XF86XK_OfficeHome 0x1008FF6A
+#define XF86XK_Option 0x1008FF6C
+#define XF86XK_Paste 0x1008FF6D
+#define XF86XK_Phone 0x1008FF6E
+#define XF86XK_Reply 0x1008FF72
+#define XF86XK_Reload 0x1008FF73
+#define XF86XK_RotateWindows 0x1008FF74
+#define XF86XK_RotationPB 0x1008FF75
+#define XF86XK_RotationKB 0x1008FF76
+#define XF86XK_Save 0x1008FF77
+#define XF86XK_Send 0x1008FF7B
+#define XF86XK_Spell 0x1008FF7C
+#define XF86XK_SplitScreen 0x1008FF7D
+#define XF86XK_Support 0x1008FF7E
+#define XF86XK_TaskPane 0x1008FF7F
+#define XF86XK_Terminal 0x1008FF80
+#define XF86XK_Tools 0x1008FF81
+#define XF86XK_Travel 0x1008FF82
+#define XF86XK_Video 0x1008FF87
+#define XF86XK_Word 0x1008FF89
+#define XF86XK_Xfer 0x1008FF8A
+#define XF86XK_ZoomIn 0x1008FF8B
+#define XF86XK_ZoomOut 0x1008FF8C
+#define XF86XK_Away 0x1008FF8D
+#define XF86XK_Messenger 0x1008FF8E
+#define XF86XK_WebCam 0x1008FF8F
+#define XF86XK_MailForward 0x1008FF90
+#define XF86XK_Pictures 0x1008FF91
+#define XF86XK_Music 0x1008FF92
+#define XF86XK_Battery 0x1008FF93
+#define XF86XK_Bluetooth 0x1008FF94
+#define XF86XK_WLAN 0x1008FF95
+#define XF86XK_UWB 0x1008FF96
+#define XF86XK_AudioForward 0x1008FF97
+#define XF86XK_AudioRepeat 0x1008FF98
+#define XF86XK_AudioRandomPlay 0x1008FF99
+#define XF86XK_Subtitle 0x1008FF9A
+#define XF86XK_AudioCycleTrack 0x1008FF9B
+#define XF86XK_Time 0x1008FF9F
+#define XF86XK_Select 0x1008FFA0
+#define XF86XK_View 0x1008FFA1
+#define XF86XK_TopMenu 0x1008FFA2
+#define XF86XK_Suspend 0x1008FFA7
+#define XF86XK_Hibernate 0x1008FFA8
+
+
// end of XF86keysyms.h
// Special keys used by Qtopia, mapped into the X11 private keypad range.
@@ -942,10 +1039,8 @@ static const unsigned int KeyTbl[] = {
XK_dead_hook, Qt::Key_Dead_Hook,
XK_dead_horn, Qt::Key_Dead_Horn,
- // Special multimedia keys
- // currently only tested with MS internet keyboard
-
- // browsing keys
+ // Special keys from X.org - This include multimedia keys,
+ // wireless/bluetooth/uwb keys, special launcher keys, etc.
XF86XK_Back, Qt::Key_Back,
XF86XK_Forward, Qt::Key_Forward,
XF86XK_Stop, Qt::Key_Stop,
@@ -955,8 +1050,6 @@ static const unsigned int KeyTbl[] = {
XF86XK_OpenURL, Qt::Key_OpenUrl,
XF86XK_HomePage, Qt::Key_HomePage,
XF86XK_Search, Qt::Key_Search,
-
- // media keys
XF86XK_AudioLowerVolume, Qt::Key_VolumeDown,
XF86XK_AudioMute, Qt::Key_VolumeMute,
XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp,
@@ -965,13 +1058,106 @@ static const unsigned int KeyTbl[] = {
XF86XK_AudioPrev, Qt::Key_MediaPrevious,
XF86XK_AudioNext, Qt::Key_MediaNext,
XF86XK_AudioRecord, Qt::Key_MediaRecord,
-
- // launch keys
XF86XK_Mail, Qt::Key_LaunchMail,
XF86XK_MyComputer, Qt::Key_Launch0,
- XF86XK_Calculator, Qt::Key_Launch1,
+ XF86XK_Calculator, Qt::Key_Calculator,
+ XF86XK_Memo, Qt::Key_Memo,
+ XF86XK_ToDoList, Qt::Key_ToDoList,
+ XF86XK_Calendar, Qt::Key_Calendar,
+ XF86XK_PowerDown, Qt::Key_PowerDown,
+ XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust,
XF86XK_Standby, Qt::Key_Standby,
-
+ XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp,
+ XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown,
+ XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff,
+ XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp,
+ XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown,
+ XF86XK_PowerOff, Qt::Key_PowerOff,
+ XF86XK_WakeUp, Qt::Key_WakeUp,
+ XF86XK_Eject, Qt::Key_Eject,
+ XF86XK_ScreenSaver, Qt::Key_ScreenSaver,
+ XF86XK_WWW, Qt::Key_WWW,
+ XF86XK_Sleep, Qt::Key_Sleep,
+ XF86XK_LightBulb, Qt::Key_LightBulb,
+ XF86XK_Shop, Qt::Key_Shop,
+ XF86XK_History, Qt::Key_History,
+ XF86XK_AddFavorite, Qt::Key_AddFavorite,
+ XF86XK_HotLinks, Qt::Key_HotLinks,
+ XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust,
+ XF86XK_Finance, Qt::Key_Finance,
+ XF86XK_Community, Qt::Key_Community,
+ XF86XK_AudioRewind, Qt::Key_AudioRewind,
+ XF86XK_BackForward, Qt::Key_BackForward,
+ XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft,
+ XF86XK_ApplicationRight, Qt::Key_ApplicationRight,
+ XF86XK_Book, Qt::Key_Book,
+ XF86XK_CD, Qt::Key_CD,
+ XF86XK_Calculater, Qt::Key_Calculator,
+ XF86XK_Clear, Qt::Key_Clear,
+ XF86XK_ClearGrab, Qt::Key_ClearGrab,
+ XF86XK_Close, Qt::Key_Close,
+ XF86XK_Copy, Qt::Key_Copy,
+ XF86XK_Cut, Qt::Key_Cut,
+ XF86XK_Display, Qt::Key_Display,
+ XF86XK_DOS, Qt::Key_DOS,
+ XF86XK_Documents, Qt::Key_Documents,
+ XF86XK_Excel, Qt::Key_Excel,
+ XF86XK_Explorer, Qt::Key_Explorer,
+ XF86XK_Game, Qt::Key_Game,
+ XF86XK_Go, Qt::Key_Go,
+ XF86XK_iTouch, Qt::Key_iTouch,
+ XF86XK_LogOff, Qt::Key_LogOff,
+ XF86XK_Market, Qt::Key_Market,
+ XF86XK_Meeting, Qt::Key_Meeting,
+ XF86XK_MenuKB, Qt::Key_MenuKB,
+ XF86XK_MenuPB, Qt::Key_MenuPB,
+ XF86XK_MySites, Qt::Key_MySites,
+ XF86XK_News, Qt::Key_News,
+ XF86XK_OfficeHome, Qt::Key_OfficeHome,
+ XF86XK_Option, Qt::Key_Option,
+ XF86XK_Paste, Qt::Key_Paste,
+ XF86XK_Phone, Qt::Key_Phone,
+ XF86XK_Reply, Qt::Key_Reply,
+ XF86XK_Reload, Qt::Key_Reload,
+ XF86XK_RotateWindows, Qt::Key_RotateWindows,
+ XF86XK_RotationPB, Qt::Key_RotationPB,
+ XF86XK_RotationKB, Qt::Key_RotationKB,
+ XF86XK_Save, Qt::Key_Save,
+ XF86XK_Send, Qt::Key_Send,
+ XF86XK_Spell, Qt::Key_Spell,
+ XF86XK_SplitScreen, Qt::Key_SplitScreen,
+ XF86XK_Support, Qt::Key_Support,
+ XF86XK_TaskPane, Qt::Key_TaskPane,
+ XF86XK_Terminal, Qt::Key_Terminal,
+ XF86XK_Tools, Qt::Key_Tools,
+ XF86XK_Travel, Qt::Key_Travel,
+ XF86XK_Video, Qt::Key_Video,
+ XF86XK_Word, Qt::Key_Word,
+ XF86XK_Xfer, Qt::Key_Xfer,
+ XF86XK_ZoomIn, Qt::Key_ZoomIn,
+ XF86XK_ZoomOut, Qt::Key_ZoomOut,
+ XF86XK_Away, Qt::Key_Away,
+ XF86XK_Messenger, Qt::Key_Messenger,
+ XF86XK_WebCam, Qt::Key_WebCam,
+ XF86XK_MailForward, Qt::Key_MailForward,
+ XF86XK_Pictures, Qt::Key_Pictures,
+ XF86XK_Music, Qt::Key_Music,
+ XF86XK_Battery, Qt::Key_Battery,
+ XF86XK_Bluetooth, Qt::Key_Bluetooth,
+ XF86XK_WLAN, Qt::Key_WLAN,
+ XF86XK_UWB, Qt::Key_UWB,
+ XF86XK_AudioForward, Qt::Key_AudioForward,
+ XF86XK_AudioRepeat, Qt::Key_AudioRepeat,
+ XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay,
+ XF86XK_Subtitle, Qt::Key_Subtitle,
+ XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack,
+ XF86XK_Time, Qt::Key_Time,
+ XF86XK_Select, Qt::Key_Select,
+ XF86XK_View, Qt::Key_View,
+ XF86XK_TopMenu, Qt::Key_TopMenu,
+ XF86XK_Bluetooth, Qt::Key_Bluetooth,
+ XF86XK_Suspend, Qt::Key_Suspend,
+ XF86XK_Hibernate, Qt::Key_Hibernate,
XF86XK_Launch0, Qt::Key_Launch2,
XF86XK_Launch1, Qt::Key_Launch3,
XF86XK_Launch2, Qt::Key_Launch4,
diff --git a/src/gui/kernel/qkeymapper_x11_p.cpp b/src/gui/kernel/qkeymapper_x11_p.cpp
index dc308ca2d..cf8868cc1 100644
--- a/src/gui/kernel/qkeymapper_x11_p.cpp
+++ b/src/gui/kernel/qkeymapper_x11_p.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 99e263264..265f52f53 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -145,16 +145,15 @@ static int qtkeyForMacSymbol(const QChar ch)
#else
static bool qt_sequence_no_mnemonics = false;
#endif
-void Q_AUTOTEST_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemonics = !b; }
+void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemonics = !b; }
/*!
\class QKeySequence
\brief The QKeySequence class encapsulates a key sequence as used
by shortcuts.
- \ingroup misc
\ingroup shared
- \mainclass
+
In its most common form, a key sequence describes a combination of
keys that must be used together to perform some action. Key sequences
@@ -226,72 +225,72 @@ void Q_AUTOTEST_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mn
corresponds to the \key Control keys.
\table
- \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, Ctrl+Y \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 \i (none) \i (none)
- \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down \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
+ \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, Ctrl+Y \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)
\endtable
Note that, since the key sequences used for the standard shortcuts differ
@@ -417,47 +416,139 @@ static const struct {
{ Qt::Key_Menu, QT_TRANSLATE_NOOP("QShortcut", "Menu") },
{ Qt::Key_Help, QT_TRANSLATE_NOOP("QShortcut", "Help") },
- // Multimedia keys
- { Qt::Key_Back, QT_TRANSLATE_NOOP("QShortcut", "Back") },
- { Qt::Key_Forward, QT_TRANSLATE_NOOP("QShortcut", "Forward") },
- { Qt::Key_Stop, QT_TRANSLATE_NOOP("QShortcut", "Stop") },
- { Qt::Key_Refresh, QT_TRANSLATE_NOOP("QShortcut", "Refresh") },
- { Qt::Key_VolumeDown, QT_TRANSLATE_NOOP("QShortcut", "Volume Down") },
- { Qt::Key_VolumeMute, QT_TRANSLATE_NOOP("QShortcut", "Volume Mute") },
- { Qt::Key_VolumeUp, QT_TRANSLATE_NOOP("QShortcut", "Volume Up") },
- { Qt::Key_BassBoost, QT_TRANSLATE_NOOP("QShortcut", "Bass Boost") },
- { Qt::Key_BassUp, QT_TRANSLATE_NOOP("QShortcut", "Bass Up") },
- { Qt::Key_BassDown, QT_TRANSLATE_NOOP("QShortcut", "Bass Down") },
- { Qt::Key_TrebleUp, QT_TRANSLATE_NOOP("QShortcut", "Treble Up") },
- { Qt::Key_TrebleDown, QT_TRANSLATE_NOOP("QShortcut", "Treble Down") },
- { Qt::Key_MediaPlay, QT_TRANSLATE_NOOP("QShortcut", "Media Play") },
- { Qt::Key_MediaStop, QT_TRANSLATE_NOOP("QShortcut", "Media Stop") },
- { Qt::Key_MediaPrevious,QT_TRANSLATE_NOOP("QShortcut", "Media Previous") },
- { Qt::Key_MediaNext, QT_TRANSLATE_NOOP("QShortcut", "Media Next") },
- { Qt::Key_MediaRecord, QT_TRANSLATE_NOOP("QShortcut", "Media Record") },
- { Qt::Key_HomePage, QT_TRANSLATE_NOOP("QShortcut", "Home Page") },
- { Qt::Key_Favorites, QT_TRANSLATE_NOOP("QShortcut", "Favorites") },
- { Qt::Key_Search, QT_TRANSLATE_NOOP("QShortcut", "Search") },
- { Qt::Key_Standby, QT_TRANSLATE_NOOP("QShortcut", "Standby") },
- { Qt::Key_OpenUrl, QT_TRANSLATE_NOOP("QShortcut", "Open URL") },
- { Qt::Key_LaunchMail, QT_TRANSLATE_NOOP("QShortcut", "Launch Mail") },
- { Qt::Key_LaunchMedia, QT_TRANSLATE_NOOP("QShortcut", "Launch Media") },
- { Qt::Key_Launch0, QT_TRANSLATE_NOOP("QShortcut", "Launch (0)") },
- { Qt::Key_Launch1, QT_TRANSLATE_NOOP("QShortcut", "Launch (1)") },
- { Qt::Key_Launch2, QT_TRANSLATE_NOOP("QShortcut", "Launch (2)") },
- { Qt::Key_Launch3, QT_TRANSLATE_NOOP("QShortcut", "Launch (3)") },
- { Qt::Key_Launch4, QT_TRANSLATE_NOOP("QShortcut", "Launch (4)") },
- { Qt::Key_Launch5, QT_TRANSLATE_NOOP("QShortcut", "Launch (5)") },
- { Qt::Key_Launch6, QT_TRANSLATE_NOOP("QShortcut", "Launch (6)") },
- { Qt::Key_Launch7, QT_TRANSLATE_NOOP("QShortcut", "Launch (7)") },
- { Qt::Key_Launch8, QT_TRANSLATE_NOOP("QShortcut", "Launch (8)") },
- { Qt::Key_Launch9, QT_TRANSLATE_NOOP("QShortcut", "Launch (9)") },
- { Qt::Key_LaunchA, QT_TRANSLATE_NOOP("QShortcut", "Launch (A)") },
- { Qt::Key_LaunchB, QT_TRANSLATE_NOOP("QShortcut", "Launch (B)") },
- { Qt::Key_LaunchC, QT_TRANSLATE_NOOP("QShortcut", "Launch (C)") },
- { Qt::Key_LaunchD, QT_TRANSLATE_NOOP("QShortcut", "Launch (D)") },
- { Qt::Key_LaunchE, QT_TRANSLATE_NOOP("QShortcut", "Launch (E)") },
- { Qt::Key_LaunchF, QT_TRANSLATE_NOOP("QShortcut", "Launch (F)") },
+ // Special keys
+ // Includes multimedia, launcher, lan keys ( bluetooth, wireless )
+ // window navigation
+ { Qt::Key_Back, QT_TRANSLATE_NOOP("QShortcut", "Back") },
+ { Qt::Key_Forward, QT_TRANSLATE_NOOP("QShortcut", "Forward") },
+ { Qt::Key_Stop, QT_TRANSLATE_NOOP("QShortcut", "Stop") },
+ { Qt::Key_Refresh, QT_TRANSLATE_NOOP("QShortcut", "Refresh") },
+ { Qt::Key_VolumeDown, QT_TRANSLATE_NOOP("QShortcut", "Volume Down") },
+ { Qt::Key_VolumeMute, QT_TRANSLATE_NOOP("QShortcut", "Volume Mute") },
+ { Qt::Key_VolumeUp, QT_TRANSLATE_NOOP("QShortcut", "Volume Up") },
+ { Qt::Key_BassBoost, QT_TRANSLATE_NOOP("QShortcut", "Bass Boost") },
+ { Qt::Key_BassUp, QT_TRANSLATE_NOOP("QShortcut", "Bass Up") },
+ { Qt::Key_BassDown, QT_TRANSLATE_NOOP("QShortcut", "Bass Down") },
+ { Qt::Key_TrebleUp, QT_TRANSLATE_NOOP("QShortcut", "Treble Up") },
+ { Qt::Key_TrebleDown, QT_TRANSLATE_NOOP("QShortcut", "Treble Down") },
+ { Qt::Key_MediaPlay, QT_TRANSLATE_NOOP("QShortcut", "Media Play") },
+ { Qt::Key_MediaStop, QT_TRANSLATE_NOOP("QShortcut", "Media Stop") },
+ { Qt::Key_MediaPrevious, QT_TRANSLATE_NOOP("QShortcut", "Media Previous") },
+ { Qt::Key_MediaNext, QT_TRANSLATE_NOOP("QShortcut", "Media Next") },
+ { Qt::Key_MediaRecord, QT_TRANSLATE_NOOP("QShortcut", "Media Record") },
+ { Qt::Key_HomePage, QT_TRANSLATE_NOOP("QShortcut", "Home Page") },
+ { Qt::Key_Favorites, QT_TRANSLATE_NOOP("QShortcut", "Favorites") },
+ { Qt::Key_Search, QT_TRANSLATE_NOOP("QShortcut", "Search") },
+ { Qt::Key_Standby, QT_TRANSLATE_NOOP("QShortcut", "Standby") },
+ { Qt::Key_OpenUrl, QT_TRANSLATE_NOOP("QShortcut", "Open URL") },
+ { Qt::Key_LaunchMail, QT_TRANSLATE_NOOP("QShortcut", "Launch Mail") },
+ { Qt::Key_LaunchMedia, QT_TRANSLATE_NOOP("QShortcut", "Launch Media") },
+ { Qt::Key_Launch0, QT_TRANSLATE_NOOP("QShortcut", "Launch (0)") },
+ { Qt::Key_Launch1, QT_TRANSLATE_NOOP("QShortcut", "Launch (1)") },
+ { Qt::Key_Launch2, QT_TRANSLATE_NOOP("QShortcut", "Launch (2)") },
+ { Qt::Key_Launch3, QT_TRANSLATE_NOOP("QShortcut", "Launch (3)") },
+ { Qt::Key_Launch4, QT_TRANSLATE_NOOP("QShortcut", "Launch (4)") },
+ { Qt::Key_Launch5, QT_TRANSLATE_NOOP("QShortcut", "Launch (5)") },
+ { Qt::Key_Launch6, QT_TRANSLATE_NOOP("QShortcut", "Launch (6)") },
+ { Qt::Key_Launch7, QT_TRANSLATE_NOOP("QShortcut", "Launch (7)") },
+ { Qt::Key_Launch8, QT_TRANSLATE_NOOP("QShortcut", "Launch (8)") },
+ { Qt::Key_Launch9, QT_TRANSLATE_NOOP("QShortcut", "Launch (9)") },
+ { Qt::Key_LaunchA, QT_TRANSLATE_NOOP("QShortcut", "Launch (A)") },
+ { Qt::Key_LaunchB, QT_TRANSLATE_NOOP("QShortcut", "Launch (B)") },
+ { Qt::Key_LaunchC, QT_TRANSLATE_NOOP("QShortcut", "Launch (C)") },
+ { Qt::Key_LaunchD, QT_TRANSLATE_NOOP("QShortcut", "Launch (D)") },
+ { Qt::Key_LaunchE, QT_TRANSLATE_NOOP("QShortcut", "Launch (E)") },
+ { Qt::Key_LaunchF, QT_TRANSLATE_NOOP("QShortcut", "Launch (F)") },
+ { Qt::Key_MonBrightnessUp, QT_TRANSLATE_NOOP("QShortcut", "Monitor Brightness Up") },
+ { Qt::Key_MonBrightnessDown, QT_TRANSLATE_NOOP("QShortcut", "Monitor Brightness Down") },
+ { Qt::Key_KeyboardLightOnOff, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Light On/Off") },
+ { Qt::Key_KeyboardBrightnessUp, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Brightness Up") },
+ { Qt::Key_KeyboardBrightnessDown, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Brightness Down") },
+ { Qt::Key_PowerOff, QT_TRANSLATE_NOOP("QShortcut", "Power Off") },
+ { Qt::Key_WakeUp, QT_TRANSLATE_NOOP("QShortcut", "Wake Up") },
+ { Qt::Key_Eject, QT_TRANSLATE_NOOP("QShortcut", "Eject") },
+ { Qt::Key_ScreenSaver, QT_TRANSLATE_NOOP("QShortcut", "Screensaver") },
+ { Qt::Key_WWW, QT_TRANSLATE_NOOP("QShortcut", "WWW") },
+ { Qt::Key_Sleep, QT_TRANSLATE_NOOP("QShortcut", "Sleep") },
+ { Qt::Key_LightBulb, QT_TRANSLATE_NOOP("QShortcut", "LightBulb") },
+ { Qt::Key_Shop, QT_TRANSLATE_NOOP("QShortcut", "Shop") },
+ { Qt::Key_History, QT_TRANSLATE_NOOP("QShortcut", "History") },
+ { Qt::Key_AddFavorite, QT_TRANSLATE_NOOP("QShortcut", "Add Favorite") },
+ { Qt::Key_HotLinks, QT_TRANSLATE_NOOP("QShortcut", "Hot Links") },
+ { Qt::Key_BrightnessAdjust, QT_TRANSLATE_NOOP("QShortcut", "Adjust Brightness") },
+ { Qt::Key_Finance, QT_TRANSLATE_NOOP("QShortcut", "Finance") },
+ { Qt::Key_Community, QT_TRANSLATE_NOOP("QShortcut", "Community") },
+ { Qt::Key_AudioRewind, QT_TRANSLATE_NOOP("QShortcut", "Audio Rewind") },
+ { Qt::Key_BackForward, QT_TRANSLATE_NOOP("QShortcut", "Back Forward") },
+ { Qt::Key_ApplicationLeft, QT_TRANSLATE_NOOP("QShortcut", "Application Left") },
+ { Qt::Key_ApplicationRight, QT_TRANSLATE_NOOP("QShortcut", "Application Right") },
+ { Qt::Key_Book, QT_TRANSLATE_NOOP("QShortcut", "Book") },
+ { Qt::Key_CD, QT_TRANSLATE_NOOP("QShortcut", "CD") },
+ { Qt::Key_Calculator, QT_TRANSLATE_NOOP("QShortcut", "Calculator") },
+ { Qt::Key_Clear, QT_TRANSLATE_NOOP("QShortcut", "Clear") },
+ { Qt::Key_ClearGrab, QT_TRANSLATE_NOOP("QShortcut", "Clear Grab") },
+ { Qt::Key_Close, QT_TRANSLATE_NOOP("QShortcut", "Close") },
+ { Qt::Key_Copy, QT_TRANSLATE_NOOP("QShortcut", "Copy") },
+ { Qt::Key_Cut, QT_TRANSLATE_NOOP("QShortcut", "Cut") },
+ { Qt::Key_Display, QT_TRANSLATE_NOOP("QShortcut", "Display") },
+ { Qt::Key_DOS, QT_TRANSLATE_NOOP("QShortcut", "DOS") },
+ { Qt::Key_Documents, QT_TRANSLATE_NOOP("QShortcut", "Documents") },
+ { Qt::Key_Excel, QT_TRANSLATE_NOOP("QShortcut", "Spreadsheet") },
+ { Qt::Key_Explorer, QT_TRANSLATE_NOOP("QShortcut", "Browser") },
+ { Qt::Key_Game, QT_TRANSLATE_NOOP("QShortcut", "Game") },
+ { Qt::Key_Go, QT_TRANSLATE_NOOP("QShortcut", "Go") },
+ { Qt::Key_iTouch, QT_TRANSLATE_NOOP("QShortcut", "iTouch") },
+ { Qt::Key_LogOff, QT_TRANSLATE_NOOP("QShortcut", "Logoff") },
+ { Qt::Key_Market, QT_TRANSLATE_NOOP("QShortcut", "Market") },
+ { Qt::Key_Meeting, QT_TRANSLATE_NOOP("QShortcut", "Meeting") },
+ { Qt::Key_MenuKB, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Menu") },
+ { Qt::Key_MenuPB, QT_TRANSLATE_NOOP("QShortcut", "Menu PB") },
+ { Qt::Key_MySites, QT_TRANSLATE_NOOP("QShortcut", "My Sites") },
+ { Qt::Key_News, QT_TRANSLATE_NOOP("QShortcut", "News") },
+ { Qt::Key_OfficeHome, QT_TRANSLATE_NOOP("QShortcut", "Home Office") },
+ { Qt::Key_Option, QT_TRANSLATE_NOOP("QShortcut", "Option") },
+ { Qt::Key_Paste, QT_TRANSLATE_NOOP("QShortcut", "Paste") },
+ { Qt::Key_Phone, QT_TRANSLATE_NOOP("QShortcut", "Phone") },
+ { Qt::Key_Reply, QT_TRANSLATE_NOOP("QShortcut", "Reply") },
+ { Qt::Key_Reload, QT_TRANSLATE_NOOP("QShortcut", "Reload") },
+ { Qt::Key_RotateWindows, QT_TRANSLATE_NOOP("QShortcut", "Rotate Windows") },
+ { Qt::Key_RotationPB, QT_TRANSLATE_NOOP("QShortcut", "Rotation PB") },
+ { Qt::Key_RotationKB, QT_TRANSLATE_NOOP("QShortcut", "Rotation KB") },
+ { Qt::Key_Save, QT_TRANSLATE_NOOP("QShortcut", "Save") },
+ { Qt::Key_Send, QT_TRANSLATE_NOOP("QShortcut", "Send") },
+ { Qt::Key_Spell, QT_TRANSLATE_NOOP("QShortcut", "Spellchecker") },
+ { Qt::Key_SplitScreen, QT_TRANSLATE_NOOP("QShortcut", "Split Screen") },
+ { Qt::Key_Support, QT_TRANSLATE_NOOP("QShortcut", "Support") },
+ { Qt::Key_TaskPane, QT_TRANSLATE_NOOP("QShortcut", "Task Panel") },
+ { Qt::Key_Terminal, QT_TRANSLATE_NOOP("QShortcut", "Terminal") },
+ { Qt::Key_Tools, QT_TRANSLATE_NOOP("QShortcut", "Tools") },
+ { Qt::Key_Travel, QT_TRANSLATE_NOOP("QShortcut", "Travel") },
+ { Qt::Key_Video, QT_TRANSLATE_NOOP("QShortcut", "Video") },
+ { Qt::Key_Word, QT_TRANSLATE_NOOP("QShortcut", "Word Processor") },
+ { Qt::Key_Xfer, QT_TRANSLATE_NOOP("QShortcut", "XFer") },
+ { Qt::Key_ZoomIn, QT_TRANSLATE_NOOP("QShortcut", "Zoom In") },
+ { Qt::Key_ZoomOut, QT_TRANSLATE_NOOP("QShortcut", "Zoom Out") },
+ { Qt::Key_Away, QT_TRANSLATE_NOOP("QShortcut", "Away") },
+ { Qt::Key_Messenger, QT_TRANSLATE_NOOP("QShortcut", "Messenger") },
+ { Qt::Key_WebCam, QT_TRANSLATE_NOOP("QShortcut", "WebCam") },
+ { Qt::Key_MailForward, QT_TRANSLATE_NOOP("QShortcut", "Mail Forward") },
+ { Qt::Key_Pictures, QT_TRANSLATE_NOOP("QShortcut", "Pictures") },
+ { Qt::Key_Music, QT_TRANSLATE_NOOP("QShortcut", "Music") },
+ { Qt::Key_Battery, QT_TRANSLATE_NOOP("QShortcut", "Battery") },
+ { Qt::Key_Bluetooth, QT_TRANSLATE_NOOP("QShortcut", "Bluetooth") },
+ { Qt::Key_WLAN, QT_TRANSLATE_NOOP("QShortcut", "Wireless") },
+ { Qt::Key_UWB, QT_TRANSLATE_NOOP("QShortcut", "Ultra Wide Band") },
+ { Qt::Key_AudioForward, QT_TRANSLATE_NOOP("QShortcut", "Audio Forward") },
+ { Qt::Key_AudioRepeat, QT_TRANSLATE_NOOP("QShortcut", "Audio Repeat") },
+ { Qt::Key_AudioRandomPlay, QT_TRANSLATE_NOOP("QShortcut", "Audio Random Play") },
+ { Qt::Key_Subtitle, QT_TRANSLATE_NOOP("QShortcut", "Subtitle") },
+ { Qt::Key_AudioCycleTrack, QT_TRANSLATE_NOOP("QShortcut", "Audio Cycle Track") },
+ { Qt::Key_Time, QT_TRANSLATE_NOOP("QShortcut", "Time") },
+ { Qt::Key_Select, QT_TRANSLATE_NOOP("QShortcut", "Select") },
+ { Qt::Key_View, QT_TRANSLATE_NOOP("QShortcut", "View") },
+ { Qt::Key_TopMenu, QT_TRANSLATE_NOOP("QShortcut", "Top Menu") },
+ { Qt::Key_Suspend, QT_TRANSLATE_NOOP("QShortcut", "Suspend") },
+ { Qt::Key_Hibernate, QT_TRANSLATE_NOOP("QShortcut", "Hibernate") },
// --------------------------------------------------------------
// More consistent namings
@@ -502,9 +593,9 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, QApplicationPrivate::KB_All},
{QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, QApplicationPrivate::KB_All},
{QKeySequence::Delete, 1, Qt::Key_Delete, QApplicationPrivate::KB_All},
- {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, QApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, QApplicationPrivate::KB_Mac},
{QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, QApplicationPrivate::KB_All},
{QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, QApplicationPrivate::KB_All},
@@ -513,6 +604,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, QApplicationPrivate::KB_All},
{QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, QApplicationPrivate::KB_All},
{QKeySequence::HelpContents, 0, Qt::Key_F1, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::HelpContents, 0, Qt::Key_F2, QApplicationPrivate::KB_S60},
{QKeySequence::FindNext, 0, Qt::Key_F3, QApplicationPrivate::KB_X11},
{QKeySequence::FindNext, 1, Qt::Key_F3, QApplicationPrivate::KB_Win},
{QKeySequence::Refresh, 0, Qt::Key_F5, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
@@ -523,13 +615,14 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::PreviousChild, 0, Qt::Key_Back, QApplicationPrivate::KB_All},
{QKeySequence::NextChild, 0, Qt::Key_Forward, QApplicationPrivate::KB_All},
{QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, QApplicationPrivate::KB_Win},
+ {QKeySequence::Delete, 0, Qt::SHIFT | Qt::Key_Backspace, QApplicationPrivate::KB_S60},
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, QApplicationPrivate::KB_All},
{QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, QApplicationPrivate::KB_All},
{QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
{QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, //## Check if this should work on mac
- {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Mac},
- {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Mac},
{QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_All},
{QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, QApplicationPrivate::KB_All},
@@ -570,7 +663,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
{QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Mac},
{QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, QApplicationPrivate::KB_All},
- {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Win},
+ {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_S60},
{QKeySequence::Redo, 0, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Mac},//different priority from above
{QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, QApplicationPrivate::KB_All},
{QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, QApplicationPrivate::KB_Mac},
@@ -582,15 +675,15 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_Win},
{QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_Win},
{QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_Win},
- {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
- {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
+ {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, QApplicationPrivate::KB_Mac},
- {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, QApplicationPrivate::KB_Mac },
{QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, QApplicationPrivate::KB_Mac},
{QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, QApplicationPrivate::KB_Mac},
{QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, QApplicationPrivate::KB_Mac },
- {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, QApplicationPrivate::KB_Mac},
{QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, QApplicationPrivate::KB_Win},
{QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, QApplicationPrivate::KB_Mac},
@@ -599,16 +692,16 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QApplicationPrivate::KB_Win},
{QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, QApplicationPrivate::KB_KDE},
{QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac},
- {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::Redo, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Mac}, //different priority from above
{QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Mac },//different priority from above
- {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
- {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
- {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
+ {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
+ {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac },
{QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, QApplicationPrivate::KB_Mac},
- {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11},
+ {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60},
{QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac },
{QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, QApplicationPrivate::KB_Mac},
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, QApplicationPrivate::KB_Win},
@@ -639,6 +732,8 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QApplicationPrivate::KB_Mac},
{QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QApplicationPrivate::KB_Mac},
{QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QApplicationPrivate::KB_Mac},
+ {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QApplicationPrivate::KB_Mac},
+ {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QApplicationPrivate::KB_Mac},
{QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac},
{QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac}
};
@@ -751,7 +846,9 @@ QKeySequence::QKeySequence(StandardKey key)
*/
QKeySequence::QKeySequence()
{
- d = new QKeySequencePrivate();
+ static QKeySequencePrivate shared_empty;
+ d = &shared_empty;
+ d->ref.ref();
}
/*!
@@ -764,6 +861,8 @@ QKeySequence::QKeySequence()
Up to four key codes may be entered by separating them with
commas, e.g. "Alt+X,Ctrl+S,Q".
+ \a key should be in NativeText format.
+
This constructor is typically used with \link QObject::tr() tr
\endlink(), so that shortcut keys can be replaced in
translations:
@@ -780,6 +879,16 @@ QKeySequence::QKeySequence(const QString &key)
}
/*!
+ \since 4.x
+ Creates a key sequence from the \a key string based on \a format.
+*/
+QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat format)
+{
+ d = new QKeySequencePrivate();
+ assign(key, format);
+}
+
+/*!
Constructs a key sequence with up to 4 keys \a k1, \a k2,
\a k3 and \a k4.
@@ -919,9 +1028,12 @@ bool QKeySequence::isEmpty() const
*/
QKeySequence QKeySequence::mnemonic(const QString &text)
{
+ QKeySequence ret;
+
if(qt_sequence_no_mnemonics)
- return QKeySequence();
+ return ret;
+ bool found = false;
int p = 0;
while (p >= 0) {
p = text.indexOf(QLatin1Char('&'), p) + 1;
@@ -930,13 +1042,22 @@ QKeySequence QKeySequence::mnemonic(const QString &text)
if (text.at(p) != QLatin1Char('&')) {
QChar c = text.at(p);
if (c.isPrint()) {
- c = c.toUpper();
- return QKeySequence(c.unicode() + Qt::ALT);
+ if (!found) {
+ c = c.toUpper();
+ ret = QKeySequence(c.unicode() + Qt::ALT);
+#ifdef QT_NO_DEBUG
+ return ret;
+#else
+ found = true;
+ } else {
+ qWarning("QKeySequence::mnemonic: \"%s\" contains multiple occurences of '&'", qPrintable(text));
+#endif
+ }
}
}
p++;
}
- return QKeySequence();
+ return ret;
}
/*!
@@ -946,9 +1067,24 @@ QKeySequence QKeySequence::mnemonic(const QString &text)
contain up to four key codes, provided they are separated by a
comma; for example, "Alt+X,Ctrl+S,Z". The return value is the
number of key codes added.
+ \a keys should be in NativeText format.
*/
int QKeySequence::assign(const QString &ks)
{
+ return assign(ks, NativeText);
+}
+
+/*!
+ \fn int QKeySequence::assign(const QString &keys, QKeySequence::SequenceFormat format)
+ \since 4.x
+
+ Adds the given \a keys to the key sequence (based on \a format).
+ \a keys may contain up to four key codes, provided they are
+ separated by a comma; for example, "Alt+X,Ctrl+S,Z". The return
+ value is the number of key codes added.
+*/
+int QKeySequence::assign(const QString &ks, QKeySequence::SequenceFormat format)
+{
QString keyseq = ks;
QString part;
int n = 0;
@@ -977,7 +1113,7 @@ int QKeySequence::assign(const QString &ks)
}
part = keyseq.left(-1 == p ? keyseq.length() : p - diff);
keyseq = keyseq.right(-1 == p ? 0 : keyseq.length() - (p + 1));
- d->key[n] = decodeString(part);
+ d->key[n] = QKeySequencePrivate::decodeString(part, format);
++n;
}
return n;
@@ -1448,12 +1584,7 @@ QString QKeySequence::toString(SequenceFormat format) const
*/
QKeySequence QKeySequence::fromString(const QString &str, SequenceFormat format)
{
- QStringList sl = str.split(QLatin1String(", "));
- int keys[4] = {0, 0, 0, 0};
- int total = qMin(sl.count(), 4);
- for (int i = 0; i < total; ++i)
- keys[i] = QKeySequencePrivate::decodeString(sl[i], format);
- return QKeySequence(keys[0], keys[1], keys[2], keys[3]);
+ return QKeySequence(str, format);
}
/*****************************************************************************
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 7f016edc9..591cc372f 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -141,8 +141,14 @@ public:
Quit
};
+ enum SequenceFormat {
+ NativeText,
+ PortableText
+ };
+
QKeySequence();
QKeySequence(const QString &key);
+ QKeySequence(const QString &key, SequenceFormat format);
QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0);
QKeySequence(const QKeySequence &ks);
QKeySequence(StandardKey key);
@@ -160,11 +166,6 @@ public:
#endif
};
- enum SequenceFormat {
- NativeText,
- PortableText
- };
-
QString toString(SequenceFormat format = PortableText) const;
static QKeySequence fromString(const QString &str, SequenceFormat format = PortableText);
@@ -194,6 +195,7 @@ private:
static int decodeString(const QString &ks);
static QString encodeString(int key);
int assign(const QString &str);
+ int assign(const QString &str, SequenceFormat format);
void setKey(int key, int index);
QKeySequencePrivate *d;
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index 398649640..35fc67a91 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp
index e3cde493d..5d44b3d2a 100644
--- a/src/gui/kernel/qlayout.cpp
+++ b/src/gui/kernel/qlayout.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -75,7 +75,6 @@ static int menuBarHeightForWidth(QWidget *menubar, int w)
\class QLayout
\brief The QLayout class is the base class of geometry managers.
- \ingroup appearance
\ingroup geomanagement
This is an abstract base class inherited by the concrete classes
@@ -148,7 +147,12 @@ QLayout::QLayout(QLayoutPrivate &dd, QLayout *lay, QWidget *w)
} else {
d->topLevel = true;
w->d_func()->layout = this;
- invalidate();
+ QT_TRY {
+ invalidate();
+ } QT_CATCH(...) {
+ w->d_func()->layout = 0;
+ QT_RETHROW;
+ }
}
}
}
@@ -233,7 +237,12 @@ QLayout::QLayout(QWidget *parent, int margin, int spacing, const char *name)
} else {
d->topLevel = true;
parent->d_func()->layout = this;
- invalidate();
+ QT_TRY {
+ invalidate();
+ } QT_CATCH(...) {
+ parent->d_func()->layout = 0;
+ QT_RETHROW;
+ }
}
}
}
@@ -487,6 +496,21 @@ void QLayout::setContentsMargins(int left, int top, int right, int bottom)
}
/*!
+ \since 4.6
+
+ Sets the \a margins to use around the layout.
+
+ By default, QLayout uses the values provided by the style. On
+ most platforms, the margin is 11 pixels in all directions.
+
+ \sa contentsMargins()
+*/
+void QLayout::setContentsMargins(const QMargins &margins)
+{
+ setContentsMargins(margins.left(), margins.top(), margins.right(), margins.bottom());
+}
+
+/*!
\since 4.3
Extracts the left, top, right, and bottom margins used around the
@@ -512,6 +536,23 @@ void QLayout::getContentsMargins(int *left, int *top, int *right, int *bottom) c
}
/*!
+ \since 4.6
+
+ Returns the margins used around the layout.
+
+ By default, QLayout uses the values provided by the style. On
+ most platforms, the margin is 11 pixels in all directions.
+
+ \sa setContentsMargins()
+*/
+QMargins QLayout::contentsMargins() const
+{
+ int left, top, right, bottom;
+ getContentsMargins(&left, &top, &right, &bottom);
+ return QMargins(left, top, right, bottom);
+}
+
+/*!
\since 4.3
Returns the layout's geometry() rectangle, but taking into account the
diff --git a/src/gui/kernel/qlayout.h b/src/gui/kernel/qlayout.h
index c65a1df2d..2f302944e 100644
--- a/src/gui/kernel/qlayout.h
+++ b/src/gui/kernel/qlayout.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -46,6 +46,7 @@
#include <QtGui/qlayoutitem.h>
#include <QtGui/qsizepolicy.h>
#include <QtCore/qrect.h>
+#include <QtCore/qmargins.h>
#include <limits.h>
@@ -122,7 +123,9 @@ public:
void setSpacing(int);
void setContentsMargins(int left, int top, int right, int bottom);
+ void setContentsMargins(const QMargins &margins);
void getContentsMargins(int *left, int *top, int *right, int *bottom) const;
+ QMargins contentsMargins() const;
QRect contentsRect() const;
bool setAlignment(QWidget *w, Qt::Alignment alignment);
diff --git a/src/gui/kernel/qlayout_p.h b/src/gui/kernel/qlayout_p.h
index b32c67e98..eb79fd7ec 100644
--- a/src/gui/kernel/qlayout_p.h
+++ b/src/gui/kernel/qlayout_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qlayoutengine.cpp b/src/gui/kernel/qlayoutengine.cpp
index fbbeedc56..7b54c2278 100644
--- a/src/gui/kernel/qlayoutengine.cpp
+++ b/src/gui/kernel/qlayoutengine.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qlayoutengine_p.h b/src/gui/kernel/qlayoutengine_p.h
index 271683a3b..7af4142fc 100644
--- a/src/gui/kernel/qlayoutengine_p.h
+++ b/src/gui/kernel/qlayoutengine_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qlayoutitem.cpp b/src/gui/kernel/qlayoutitem.cpp
index 47fe5e67f..5f929ce06 100644
--- a/src/gui/kernel/qlayoutitem.cpp
+++ b/src/gui/kernel/qlayoutitem.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -87,7 +87,6 @@ QSizePolicy::operator QVariant() const
\brief The QLayoutItem class provides an abstract item that a
QLayout manipulates.
- \ingroup appearance
\ingroup geomanagement
This is used by custom layouts.
@@ -116,7 +115,6 @@ QSizePolicy::operator QVariant() const
/*!
\class QSpacerItem
- \ingroup appearance
\ingroup geomanagement
\brief The QSpacerItem class provides blank space in a layout.
@@ -144,7 +142,6 @@ QSizePolicy::operator QVariant() const
/*!
\class QWidgetItem
- \ingroup appearance
\ingroup geomanagement
\brief The QWidgetItem class is a layout item that represents a widget.
diff --git a/src/gui/kernel/qlayoutitem.h b/src/gui/kernel/qlayoutitem.h
index 2fdc473a0..6bcdf5180 100644
--- a/src/gui/kernel/qlayoutitem.h
+++ b/src/gui/kernel/qlayoutitem.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qmacdefines_mac.h b/src/gui/kernel/qmacdefines_mac.h
index c0b18a832..dd9c05639 100644
--- a/src/gui/kernel/qmacdefines_mac.h
+++ b/src/gui/kernel/qmacdefines_mac.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm
new file mode 100644
index 000000000..3e0ba2360
--- /dev/null
+++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm
@@ -0,0 +1,262 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmacgesturerecognizer_mac_p.h"
+#include "qgesture.h"
+#include "qgesture_p.h"
+#include "qevent.h"
+#include "qevent_p.h"
+#include "qwidget.h"
+#include "qdebug.h"
+
+QT_BEGIN_NAMESPACE
+
+QMacSwipeGestureRecognizer::QMacSwipeGestureRecognizer()
+{
+}
+
+QGesture *QMacSwipeGestureRecognizer::create(QObject * /*target*/)
+{
+ return new QSwipeGesture;
+}
+
+QGestureRecognizer::Result
+QMacSwipeGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event)
+{
+ if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) {
+ QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
+ switch (ev->gestureType) {
+ case QNativeGestureEvent::Swipe: {
+ QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture);
+ g->setSwipeAngle(ev->angle);
+ return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
+ break; }
+ default:
+ break;
+ }
+ }
+
+ return QGestureRecognizer::Ignore;
+}
+
+void QMacSwipeGestureRecognizer::reset(QGesture *gesture)
+{
+ QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture);
+ g->setSwipeAngle(0);
+ QGestureRecognizer::reset(gesture);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+QMacPinchGestureRecognizer::QMacPinchGestureRecognizer()
+{
+}
+
+QGesture *QMacPinchGestureRecognizer::create(QObject * /*target*/)
+{
+ return new QPinchGesture;
+}
+
+QGestureRecognizer::Result
+QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event)
+{
+ if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) {
+ QPinchGesture *g = static_cast<QPinchGesture *>(gesture);
+ QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
+ switch(ev->gestureType) {
+ case QNativeGestureEvent::GestureBegin:
+ reset(gesture);
+ g->setStartCenterPoint(static_cast<QWidget*>(obj)->mapFromGlobal(ev->position));
+ g->setCenterPoint(g->startCenterPoint());
+ g->setChangeFlags(QPinchGesture::CenterPointChanged);
+ g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
+ return QGestureRecognizer::MayBeGesture | QGestureRecognizer::ConsumeEventHint;
+ case QNativeGestureEvent::Rotate: {
+ g->setLastScaleFactor(g->scaleFactor());
+ g->setLastRotationAngle(g->rotationAngle());
+ g->setRotationAngle(g->rotationAngle() + ev->percentage);
+ g->setChangeFlags(QPinchGesture::RotationAngleChanged);
+ g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
+ return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
+ }
+ case QNativeGestureEvent::Zoom:
+ g->setLastScaleFactor(g->scaleFactor());
+ g->setLastRotationAngle(g->rotationAngle());
+ g->setScaleFactor(g->scaleFactor() * (1 + ev->percentage));
+ g->setChangeFlags(QPinchGesture::ScaleFactorChanged);
+ g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
+ return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
+ case QNativeGestureEvent::GestureEnd:
+ return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
+ default:
+ break;
+ }
+ }
+
+ return QGestureRecognizer::Ignore;
+}
+
+void QMacPinchGestureRecognizer::reset(QGesture *gesture)
+{
+ QPinchGesture *g = static_cast<QPinchGesture *>(gesture);
+ g->setChangeFlags(0);
+ g->setTotalChangeFlags(0);
+ g->setScaleFactor(1.0f);
+ g->setTotalScaleFactor(1.0f);
+ g->setLastScaleFactor(1.0f);
+ g->setRotationAngle(0.0f);
+ g->setTotalRotationAngle(0.0f);
+ g->setLastRotationAngle(0.0f);
+ g->setCenterPoint(QPointF());
+ g->setStartCenterPoint(QPointF());
+ g->setLastCenterPoint(QPointF());
+ QGestureRecognizer::reset(gesture);
+}
+
+////////////////////////////////////////////////////////////////////////
+
+#if defined(QT_MAC_USE_COCOA)
+
+QMacPanGestureRecognizer::QMacPanGestureRecognizer() : _panCanceled(true)
+{
+}
+
+QGesture *QMacPanGestureRecognizer::create(QObject *target)
+{
+ if (!target)
+ return new QPanGesture;
+
+ if (QWidget *w = qobject_cast<QWidget *>(target)) {
+ w->setAttribute(Qt::WA_AcceptTouchEvents);
+ w->setAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents);
+ return new QPanGesture;
+ }
+ return 0;
+}
+
+QGestureRecognizer::Result
+QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *event)
+{
+ const int panBeginDelay = 300;
+ const int panBeginRadius = 3;
+
+ QPanGesture *g = static_cast<QPanGesture *>(gesture);
+
+ switch (event->type()) {
+ case QEvent::TouchBegin: {
+ const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
+ if (ev->touchPoints().size() == 1) {
+ reset(gesture);
+ _startPos = QCursor::pos();
+ _panTimer.start(panBeginDelay, target);
+ _panCanceled = false;
+ return QGestureRecognizer::MayBeGesture;
+ }
+ break;}
+ case QEvent::TouchEnd: {
+ if (_panCanceled)
+ break;
+
+ const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
+ if (ev->touchPoints().size() == 1)
+ return QGestureRecognizer::FinishGesture;
+ break;}
+ case QEvent::TouchUpdate: {
+ if (_panCanceled)
+ break;
+
+ const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
+ if (ev->touchPoints().size() == 1) {
+ if (_panTimer.isActive()) {
+ // INVARIANT: Still in maybeGesture. Check if the user
+ // moved his finger so much that it makes sense to cancel the pan:
+ const QPointF p = QCursor::pos();
+ if ((p - _startPos).manhattanLength() > panBeginRadius) {
+ _panCanceled = true;
+ _panTimer.stop();
+ return QGestureRecognizer::CancelGesture;
+ }
+ } else {
+ const QPointF p = QCursor::pos();
+ const QPointF posOffset = p - _startPos;
+ g->setLastOffset(g->offset());
+ g->setOffset(QPointF(posOffset.x(), posOffset.y()));
+ return QGestureRecognizer::TriggerGesture;
+ }
+ } else if (_panTimer.isActive()) {
+ // I only want to cancel the pan if the user is pressing
+ // more than one finger, and the pan hasn't started yet:
+ _panCanceled = true;
+ _panTimer.stop();
+ return QGestureRecognizer::CancelGesture;
+ }
+ break;}
+ case QEvent::Timer: {
+ QTimerEvent *ev = static_cast<QTimerEvent *>(event);
+ if (ev->timerId() == _panTimer.timerId()) {
+ _panTimer.stop();
+ if (_panCanceled)
+ break;
+ // Begin new pan session!
+ _startPos = QCursor::pos();
+ return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
+ }
+ break; }
+ default:
+ break;
+ }
+
+ return QGestureRecognizer::Ignore;
+}
+
+void QMacPanGestureRecognizer::reset(QGesture *gesture)
+{
+ QPanGesture *g = static_cast<QPanGesture *>(gesture);
+ _startPos = QPointF();
+ _panCanceled = true;
+ g->setOffset(QPointF(0, 0));
+ g->setLastOffset(QPointF(0, 0));
+ g->setAcceleration(qreal(1));
+ QGestureRecognizer::reset(gesture);
+}
+#endif // QT_MAC_USE_COCOA
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qmacgesturerecognizer_mac_p.h b/src/gui/kernel/qmacgesturerecognizer_mac_p.h
new file mode 100644
index 000000000..2dac56a83
--- /dev/null
+++ b/src/gui/kernel/qmacgesturerecognizer_mac_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMACSWIPEGESTURERECOGNIZER_MAC_P_H
+#define QMACSWIPEGESTURERECOGNIZER_MAC_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qtimer.h"
+#include "qpoint.h"
+#include "qgesturerecognizer.h"
+
+QT_BEGIN_NAMESPACE
+
+class QMacSwipeGestureRecognizer : public QGestureRecognizer
+{
+public:
+ QMacSwipeGestureRecognizer();
+
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
+ void reset(QGesture *gesture);
+};
+
+class QMacPinchGestureRecognizer : public QGestureRecognizer
+{
+public:
+ QMacPinchGestureRecognizer();
+
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
+ void reset(QGesture *gesture);
+};
+
+#if defined(QT_MAC_USE_COCOA)
+
+class QMacPanGestureRecognizer : public QObject, public QGestureRecognizer
+{
+public:
+ QMacPanGestureRecognizer();
+
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
+ void reset(QGesture *gesture);
+private:
+ QPointF _startPos;
+ QBasicTimer _panTimer;
+ bool _panCanceled;
+};
+
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QMACSWIPEGESTURERECOGNIZER_MAC_P_H
diff --git a/src/gui/kernel/qmime.cpp b/src/gui/kernel/qmime.cpp
index ce0fdf7bc..015bddd46 100644
--- a/src/gui/kernel/qmime.cpp
+++ b/src/gui/kernel/qmime.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qmime.h b/src/gui/kernel/qmime.h
index ac018a0cd..3b4d9886c 100644
--- a/src/gui/kernel/qmime.h
+++ b/src/gui/kernel/qmime.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp
index f4d4707ee..4d842df83 100644
--- a/src/gui/kernel/qmime_mac.cpp
+++ b/src/gui/kernel/qmime_mac.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -68,6 +68,12 @@
#include "qmap.h"
#include <private/qt_mac_p.h>
+
+#ifdef Q_WS_MAC32
+#include <QuickTime/QuickTime.h>
+#include <qlibrary.h>
+#endif
+
QT_BEGIN_NAMESPACE
extern CGImageRef qt_mac_createCGImageFromQImage(const QImage &img, const QImage **imagePtr = 0); // qpaintengine_mac.cpp
@@ -126,9 +132,8 @@ CFStringRef qt_mac_mime_typeUTI = CFSTR("com.pasteboard.trolltech.marker");
\l{http://developer.apple.com/macosx/uniformtypeidentifiers.html}{Uniform
Type Identifier (UTI)} format.
\since 4.2
- \ingroup io
+
\ingroup draganddrop
- \ingroup misc
Qt's drag and drop and clipboard facilities use the MIME
standard. On X11, this maps trivially to the Xdnd protocol. On
@@ -504,9 +509,6 @@ QList<QByteArray> QMacPasteboardMimeHTMLText::convertFromMime(const QString &mim
// This can be removed once 10.6 is the minimum (or we have to require 64-bit) whichever comes first.
-#include <QuickTime/QuickTime.h>
-#include <qlibrary.h>
-
typedef ComponentResult (*PtrGraphicsImportSetDataHandle)(GraphicsImportComponent, Handle);
typedef ComponentResult (*PtrGraphicsImportCreateCGImage)(GraphicsImportComponent, CGImageRef*, UInt32);
typedef ComponentResult (*PtrGraphicsExportSetInputCGImage)(GraphicsExportComponent, CGImageRef);
@@ -637,7 +639,9 @@ QList<QByteArray> QMacPasteboardMimePict::convertFromMime(const QString &mime, Q
DisposeHandle(pic);
return ret;
}
-#endif
+
+
+#endif //Q_WS_MAC32
class QMacPasteboardMimeTiff : public QMacPasteboardMime {
public:
diff --git a/src/gui/kernel/qmime_win.cpp b/src/gui/kernel/qmime_win.cpp
index 63f37af61..9b4f39c22 100644
--- a/src/gui/kernel/qmime_win.cpp
+++ b/src/gui/kernel/qmime_win.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -219,9 +219,7 @@ Q_GLOBAL_STATIC(QWindowsMimeList, theMimeList);
/*!
\class QWindowsMime
\brief The QWindowsMime class maps open-standard MIME to Window Clipboard formats.
- \ingroup io
\ingroup draganddrop
- \ingroup misc
Qt's drag-and-drop and clipboard facilities use the MIME standard.
On X11, this maps trivially to the Xdnd protocol, but on Windows
diff --git a/src/gui/kernel/qmotifdnd_x11.cpp b/src/gui/kernel/qmotifdnd_x11.cpp
index d180eccc4..974e651e3 100644
--- a/src/gui/kernel/qmotifdnd_x11.cpp
+++ b/src/gui/kernel/qmotifdnd_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qmultitouch_mac.mm b/src/gui/kernel/qmultitouch_mac.mm
index aef66e462..f736146ae 100644
--- a/src/gui/kernel/qmultitouch_mac.mm
+++ b/src/gui/kernel/qmultitouch_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -180,7 +180,6 @@ QCocoaTouch::getCurrentTouchPointList(NSEvent *event, bool acceptSingleTouch)
if (_touchCount != _currentTouches.size()) {
// Remove all instances, and basically start from scratch:
touchPoints.clear();
- QList<QCocoaTouch *> list = _currentTouches.values();
foreach (QCocoaTouch *qcocoaTouch, _currentTouches.values()) {
if (!_updateInternalStateOnly) {
qcocoaTouch->_touchPoint.setState(Qt::TouchPointReleased);
diff --git a/src/gui/kernel/qmultitouch_mac_p.h b/src/gui/kernel/qmultitouch_mac_p.h
index ab94d535c..33eb13671 100644
--- a/src/gui/kernel/qmultitouch_mac_p.h
+++ b/src/gui/kernel/qmultitouch_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qnsframeview_mac_p.h b/src/gui/kernel/qnsframeview_mac_p.h
index 5d9d1f92d..10fb3dd13 100644
--- a/src/gui/kernel/qnsframeview_mac_p.h
+++ b/src/gui/kernel/qnsframeview_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qnsthemeframe_mac_p.h b/src/gui/kernel/qnsthemeframe_mac_p.h
index c1ebeb3a0..c8c7f4ac9 100644
--- a/src/gui/kernel/qnsthemeframe_mac_p.h
+++ b/src/gui/kernel/qnsthemeframe_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -157,7 +157,7 @@
- (void)resetCursorRects;
- (char)shouldBeTreatedAsInkEvent:fp8;
- (char)_shouldBeTreatedAsInkEventInInactiveWindow:fp8;
-- hitTest:(struct _NSPoint)fp8;
+//- hitTest:(struct _NSPoint)fp8; // collides with hittest in qcocoasharedwindowmethods_mac_p.h
- (NSRect)_leftGroupRect;
- (NSRect)_rightGroupRect;
- (void)_updateWidgets;
diff --git a/src/gui/kernel/qnstitledframe_mac_p.h b/src/gui/kernel/qnstitledframe_mac_p.h
index ba8fbd331..71c2e259a 100644
--- a/src/gui/kernel/qnstitledframe_mac_p.h
+++ b/src/gui/kernel/qnstitledframe_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qole_win.cpp b/src/gui/kernel/qole_win.cpp
index e4bb92a4e..0b3affb24 100644
--- a/src/gui/kernel/qole_win.cpp
+++ b/src/gui/kernel/qole_win.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 24e735cb7..9d96aadb1 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -399,8 +399,8 @@ void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g)
\ingroup appearance
\ingroup shared
- \ingroup multimedia
- \mainclass
+ \ingroup painting
+
A palette consists of three color groups: \e Active, \e Disabled,
and \e Inactive. All widgets in Qt contain a palette and
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index 76ac19305..168fecf79 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h
index 19e91e217..4f99fe020 100644
--- a/src/gui/kernel/qsessionmanager.h
+++ b/src/gui/kernel/qsessionmanager.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qsessionmanager_qws.cpp b/src/gui/kernel/qsessionmanager_qws.cpp
index f69548d6d..3a4d8135a 100644
--- a/src/gui/kernel/qsessionmanager_qws.cpp
+++ b/src/gui/kernel/qsessionmanager_qws.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qshortcut.cpp b/src/gui/kernel/qshortcut.cpp
index 194f648a2..3aba2d0ca 100644
--- a/src/gui/kernel/qshortcut.cpp
+++ b/src/gui/kernel/qshortcut.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
\brief The QShortcut class is used to create keyboard shortcuts.
\ingroup events
- \mainclass
+
The QShortcut class provides a way of connecting keyboard
shortcuts to Qt's \l{signals and slots} mechanism, so that
diff --git a/src/gui/kernel/qshortcut.h b/src/gui/kernel/qshortcut.h
index 347550807..5781146ac 100644
--- a/src/gui/kernel/qshortcut.h
+++ b/src/gui/kernel/qshortcut.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index c965bac5a..4c5eb7af1 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -99,11 +99,11 @@ struct QShortcutEntry
QObject *owner;
};
-#ifndef QT_NO_DEBUG_STREAM
+#if 0 //ndef QT_NO_DEBUG_STREAM
/*! \internal
QDebug operator<< for easy debug output of the shortcut entries.
*/
-QDebug &operator<<(QDebug &dbg, const QShortcutEntry *se) {
+static QDebug &operator<<(QDebug &dbg, const QShortcutEntry *se) {
if (!se)
return dbg << "QShortcutEntry(0x0)";
dbg.nospace()
@@ -146,9 +146,8 @@ public:
QShortcutMap constructor.
*/
QShortcutMap::QShortcutMap()
+ : d_ptr(new QShortcutMapPrivate(this))
{
- d_ptr = new QShortcutMapPrivate(this);
- Q_ASSERT(d_ptr != 0);
resetState();
}
@@ -157,8 +156,6 @@ QShortcutMap::QShortcutMap()
*/
QShortcutMap::~QShortcutMap()
{
- delete d_ptr;
- d_ptr = 0;
}
/*! \internal
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index c04e79e87..12bc67073 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,6 +55,7 @@
#include "QtGui/qkeysequence.h"
#include "QtCore/qvector.h"
+#include "QtCore/qscopedpointer.h"
QT_BEGIN_NAMESPACE
@@ -104,7 +105,7 @@ private:
#ifndef QT_NO_ACTION
bool correctContext(Qt::ShortcutContext context,QAction *a, QWidget *active_window) const;
#endif
- QShortcutMapPrivate *d_ptr;
+ QScopedPointer<QShortcutMapPrivate> d_ptr;
QKeySequence::SequenceMatch find(QKeyEvent *e);
QKeySequence::SequenceMatch matches(const QKeySequence &seq1, const QKeySequence &seq2) const;
diff --git a/src/gui/kernel/qsizepolicy.h b/src/gui/kernel/qsizepolicy.h
index ab04526df..2914a2182 100644
--- a/src/gui/kernel/qsizepolicy.h
+++ b/src/gui/kernel/qsizepolicy.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -64,6 +64,7 @@ private:
VMask = HMask << HSize,
CTShift = 9,
CTSize = 5,
+ WFHShift = CTShift + CTSize,
CTMask = ((0x1 << CTSize) - 1) << CTShift,
UnusedShift = CTShift + CTSize,
UnusedSize = 2
@@ -199,6 +200,17 @@ private:
QSizePolicy(int i) : data(i) { }
quint32 data;
+/* use bit flags instead, keep it here for improved readability for now
+ quint32 horzPolicy : 4;
+ quint32 vertPolicy : 4;
+ quint32 hfw : 1;
+ quint32 ctype : 5;
+ quint32 wfh : 1;
+ quint32 padding : 1; // we cannot use the highest bit
+ quint32 horStretch : 8;
+ quint32 verStretch : 8;
+*/
+
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
@@ -212,8 +224,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &);
inline void QSizePolicy::transpose() {
Policy hData = horizontalPolicy();
Policy vData = verticalPolicy();
- uchar hStretch = horizontalStretch();
- uchar vStretch = verticalStretch();
+ uchar hStretch = uchar(horizontalStretch());
+ uchar vStretch = uchar(verticalStretch());
setHorizontalPolicy(vData);
setVerticalPolicy(hData);
setHorizontalStretch(vStretch);
diff --git a/src/gui/kernel/qsizepolicy.qdoc b/src/gui/kernel/qsizepolicy.qdoc
new file mode 100644
index 000000000..2dcb07163
--- /dev/null
+++ b/src/gui/kernel/qsizepolicy.qdoc
@@ -0,0 +1,521 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QSizePolicy
+ \brief The QSizePolicy class is a layout attribute describing horizontal
+ and vertical resizing policy.
+
+ \ingroup geomanagement
+
+ The size policy of a widget is an expression of its willingness to
+ be resized in various ways, and affects how the widget is treated
+ by the \l{Layout Management}{layout engine}. Each widget returns a
+ QSizePolicy that describes the horizontal and vertical resizing
+ policy it prefers when being laid out. You can change this for
+ a specific widget by changing its QWidget::sizePolicy property.
+
+ QSizePolicy contains two independent QSizePolicy::Policy values
+ and two stretch factors; one describes the widgets's horizontal
+ size policy, and the other describes its vertical size policy. It
+ also contains a flag to indicate whether the height and width of
+ its preferred size are related.
+
+ The horizontal and vertical policies can be set in the
+ constructor, and altered using the setHorizontalPolicy() and
+ setVerticalPolicy() functions. The stretch factors can be set
+ using the setHorizontalStretch() and setVerticalStretch()
+ functions. The flag indicating whether the widget's
+ \l{QWidget::sizeHint()}{sizeHint()} is width-dependent (such as a
+ menu bar or a word-wrapping label) can be set using the
+ setHeightForWidth() function.
+
+ The current size policies and stretch factors be retrieved using
+ the horizontalPolicy(), verticalPolicy(), horizontalStretch() and
+ verticalStretch() functions. Alternatively, use the transpose()
+ function to swap the horizontal and vertical policies and
+ stretches. The hasHeightForWidth() function returns the current
+ status of the flag indicating the size hint dependencies.
+
+ Use the expandingDirections() function to determine whether the
+ associated widget can make use of more space than its
+ \l{QWidget::sizeHint()}{sizeHint()} function indicates, as well as
+ find out in which directions it can expand.
+
+ Finally, the QSizePolicy class provides operators comparing this
+ size policy to a given policy, as well as a QVariant operator
+ storing this QSizePolicy as a QVariant object.
+
+ \sa QSize, QWidget::sizeHint(), QWidget::sizePolicy,
+ QLayoutItem::sizeHint()
+*/
+
+/*!
+ \enum QSizePolicy::PolicyFlag
+
+ These flags are combined together to form the various \l{Policy}
+ values:
+
+ \value GrowFlag The widget can grow beyond its size hint if necessary.
+ \value ExpandFlag The widget should get as much space as possible.
+ \value ShrinkFlag The widget can shrink below its size hint if necessary.
+ \value IgnoreFlag The widget's size hint is ignored. The widget will get
+ as much space as possible.
+
+ \sa Policy
+*/
+
+/*!
+ \enum QSizePolicy::Policy
+
+ This enum describes the various per-dimension sizing types used
+ when constructing a QSizePolicy.
+
+ \value Fixed The QWidget::sizeHint() is the only acceptable
+ alternative, so the widget can never grow or shrink (e.g. the
+ vertical direction of a push button).
+
+ \value Minimum The sizeHint() is minimal, and sufficient. The
+ widget can be expanded, but there is no advantage to it being
+ larger (e.g. the horizontal direction of a push button).
+ It cannot be smaller than the size provided by sizeHint().
+
+ \value Maximum The sizeHint() is a maximum. The widget can be
+ shrunk any amount without detriment if other widgets need the
+ space (e.g. a separator line).
+ It cannot be larger than the size provided by sizeHint().
+
+ \value Preferred The sizeHint() is best, but the widget can be
+ shrunk and still be useful. The widget can be expanded, but there
+ is no advantage to it being larger than sizeHint() (the default
+ QWidget policy).
+
+ \value Expanding The sizeHint() is a sensible size, but the
+ widget can be shrunk and still be useful. The widget can make use
+ of extra space, so it should get as much space as possible (e.g.
+ the horizontal direction of a horizontal slider).
+
+ \value MinimumExpanding The sizeHint() is minimal, and sufficient.
+ The widget can make use of extra space, so it should get as much
+ space as possible (e.g. the horizontal direction of a horizontal
+ slider).
+
+ \value Ignored The sizeHint() is ignored. The widget will get as
+ much space as possible.
+
+ \sa PolicyFlag, setHorizontalPolicy(), setVerticalPolicy()
+*/
+
+/*!
+ \fn QSizePolicy::QSizePolicy()
+
+ Constructs a QSizePolicy object with \l Fixed as its horizontal
+ and vertical policies.
+
+ The policies can be altered using the setHorizontalPolicy() and
+ setVerticalPolicy() functions. Use the setHeightForWidth()
+ function if the preferred height of the widget is dependent on the
+ width of the widget (for example, a QLabel with line wrapping).
+
+ \sa setHorizontalStretch(), setVerticalStretch()
+*/
+
+/*!
+ \fn QSizePolicy::QSizePolicy(Policy horizontal, Policy vertical)
+
+ Constructs a QSizePolicy object with the given \a horizontal and
+ \a vertical policies, and DefaultType as the control type.
+
+ Use setHeightForWidth() if the preferred height of the widget is
+ dependent on the width of the widget (for example, a QLabel with
+ line wrapping).
+
+ \sa setHorizontalStretch(), setVerticalStretch()
+*/
+
+/*!
+ \fn QSizePolicy::QSizePolicy(Policy horizontal, Policy vertical, ControlType type)
+ \since 4.3
+
+ Constructs a QSizePolicy object with the given \a horizontal and
+ \a vertical policies, and the specified control \a type.
+
+ Use setHeightForWidth() if the preferred height of the widget is
+ dependent on the width of the widget (for example, a QLabel with
+ line wrapping).
+
+ \sa setHorizontalStretch(), setVerticalStretch(), controlType()
+*/
+
+/*!
+ \fn QSizePolicy::Policy QSizePolicy::horizontalPolicy() const
+
+ Returns the horizontal component of the size policy.
+
+ \sa setHorizontalPolicy(), verticalPolicy(), horizontalStretch()
+*/
+
+/*!
+ \fn QSizePolicy::Policy QSizePolicy::verticalPolicy() const
+
+ Returns the vertical component of the size policy.
+
+ \sa setVerticalPolicy(), horizontalPolicy(), verticalStretch()
+*/
+
+/*!
+ \fn void QSizePolicy::setHorizontalPolicy(Policy policy)
+
+ Sets the horizontal component to the given \a policy.
+
+ \sa horizontalPolicy(), setVerticalPolicy(), setHorizontalStretch()
+*/
+
+/*!
+ \fn void QSizePolicy::setVerticalPolicy(Policy policy)
+
+ Sets the vertical component to the given \a policy.
+
+ \sa verticalPolicy(), setHorizontalPolicy(), setVerticalStretch()
+*/
+
+/*!
+ \fn Qt::Orientations QSizePolicy::expandingDirections() const
+
+ Returns whether a widget can make use of more space than the
+ QWidget::sizeHint() function indicates.
+
+ A value of Qt::Horizontal or Qt::Vertical means that the widget
+ can grow horizontally or vertically (i.e., the horizontal or
+ vertical policy is \l Expanding or \l MinimumExpanding), whereas
+ Qt::Horizontal | Qt::Vertical means that it can grow in both
+ dimensions.
+
+ \sa horizontalPolicy(), verticalPolicy()
+*/
+
+/*!
+ \fn ControlType QSizePolicy::controlType() const
+ \since 4.3
+
+ Returns the control type associated with the widget for which
+ this size policy applies.
+*/
+
+/*!
+ \fn void QSizePolicy::setControlType(ControlType type)
+ \since 4.3
+
+ Sets the control type associated with the widget for which this
+ size policy applies to \a type.
+
+ The control type specifies the type of the widget for which this
+ size policy applies. It is used by some styles, notably
+ QMacStyle, to insert proper spacing between widgets. For example,
+ the Mac OS X Aqua guidelines specify that push buttons should be
+ separated by 12 pixels, whereas vertically stacked radio buttons
+ only require 6 pixels.
+
+ \sa QStyle::layoutSpacing()
+*/
+
+/*!
+ \fn void QSizePolicy::setHeightForWidth(bool dependent)
+
+ Sets the flag determining whether the widget's preferred height
+ depends on its width, to \a dependent.
+
+ \sa hasHeightForWidth()
+*/
+
+/*!
+ \fn bool QSizePolicy::hasHeightForWidth() const
+
+ Returns true if the widget's preferred height depends on its
+ width; otherwise returns false.
+
+ \sa setHeightForWidth()
+*/
+
+/*!
+ \fn bool QSizePolicy::operator==(const QSizePolicy &other) const
+
+ Returns true if this policy is equal to \a other; otherwise
+ returns false.
+
+ \sa operator!=()
+*/
+
+/*!
+ \fn bool QSizePolicy::operator!=(const QSizePolicy &other) const
+
+ Returns true if this policy is different from \a other; otherwise
+ returns false.
+
+ \sa operator==()
+*/
+
+/*!
+ \fn int QSizePolicy::horizontalStretch() const
+
+ Returns the horizontal stretch factor of the size policy.
+
+ \sa setHorizontalStretch(), verticalStretch(), horizontalPolicy()
+*/
+
+/*!
+ \fn int QSizePolicy::verticalStretch() const
+
+ Returns the vertical stretch factor of the size policy.
+
+ \sa setVerticalStretch(), horizontalStretch(), verticalPolicy()
+*/
+
+/*!
+ \fn void QSizePolicy::setHorizontalStretch(uchar stretchFactor)
+
+ Sets the horizontal stretch factor of the size policy to the given \a
+ stretchFactor.
+
+ \sa horizontalStretch(), setVerticalStretch(), setHorizontalPolicy()
+*/
+
+/*!
+ \fn void QSizePolicy::setVerticalStretch(uchar stretchFactor)
+
+ Sets the vertical stretch factor of the size policy to the given
+ \a stretchFactor.
+
+ \sa verticalStretch(), setHorizontalStretch(), setVerticalPolicy()
+*/
+
+/*!
+ \fn void QSizePolicy::transpose()
+
+ Swaps the horizontal and vertical policies and stretches.
+*/
+
+/*!
+ \enum QSizePolicy::ControlType
+ \since 4.3
+
+ This enum specifies the different types of widgets in terms of
+ layout interaction:
+
+ \value DefaultType The default type, when none is specified.
+ \value ButtonBox A QDialogButtonBox instance.
+ \value CheckBox A QCheckBox instance.
+ \value ComboBox A QComboBox instance.
+ \value Frame A QFrame instance.
+ \value GroupBox A QGroupBox instance.
+ \value Label A QLabel instance.
+ \value Line A QFrame instance with QFrame::HLine or QFrame::VLine.
+ \value LineEdit A QLineEdit instance.
+ \value PushButton A QPushButton instance.
+ \value RadioButton A QRadioButton instance.
+ \value Slider A QAbstractSlider instance.
+ \value SpinBox A QAbstractSpinBox instance.
+ \value TabWidget A QTabWidget instance.
+ \value ToolButton A QToolButton instance.
+
+ \sa setControlType(), controlType()
+*/
+
+#ifdef QT3_SUPPORT
+/*!
+ \typedef QSizePolicy::SizeType
+ \compat
+
+ Use the QSizePolicy::Policy enum instead.
+*/
+
+/*!
+ \enum QSizePolicy::ExpandData
+ \compat
+
+ Use the Qt::Orientations enum instead.
+
+ \value NoDirection Use 0 instead.
+ \value Horizontally Use Qt::Horizontal instead.
+ \value Vertically Use Qt::Vertical instead.
+ \value BothDirections Use Qt::Horizontal | Qt::Vertical instead.
+*/
+
+/*!
+ \fn bool QSizePolicy::mayShrinkHorizontally() const
+
+ Use the horizontalPolicy() function combined with the
+ QSizePolicy::PolicyFlag enum instead.
+
+ \oldcode
+ bool policy = mayShrinkHorizontally();
+ \newcode
+ bool policy = horizontalPolicy() & QSizePolicy::ShrinkFlag;
+ \endcode
+*/
+
+/*!
+ \fn bool QSizePolicy::mayShrinkVertically() const
+
+ Use the verticalPolicy() function combined with the
+ QSizePolicy::PolicyFlag enum instead.
+
+ \oldcode
+ bool policy = mayShrinkVertically();
+ \newcode
+ bool policy = verticalPolicy() & QSizePolicy::ShrinkFlag;
+ \endcode
+*/
+
+/*!
+ \fn bool QSizePolicy::mayGrowHorizontally() const
+
+ Use the horizontalPolicy() function combined with the
+ QSizePolicy::PolicyFlag enum instead.
+
+ \oldcode
+ bool policy = mayGrowHorizontally();
+ \newcode
+ bool policy = horizontalPolicy() & QSizePolicy::GrowFlag;
+ \endcode
+*/
+
+/*!
+ \fn bool QSizePolicy::mayGrowVertically() const
+
+ Use the verticalPolicy() function combined with the
+ QSizePolicy::PolicyFlag enum instead.
+
+ \oldcode
+ bool policy = mayGrowVertically();
+ \newcode
+ bool policy = verticalPolicy() & QSizePolicy::GrowFlag;
+ \endcode
+*/
+
+/*!
+ \fn Qt::QSizePolicy::Orientations QSizePolicy::expanding() const
+
+ Use expandingDirections() instead.
+*/
+
+/*!
+ \fn QSizePolicy::QSizePolicy(Policy horizontal, Policy vertical, bool dependent)
+
+ Use the QSizePolicy() constructor and the setHeightForWidth()
+ function instead.
+
+ \oldcode
+ QSizePolicy *policy = new QSizePolicy(horizontal, vertical, dependent);
+ \newcode
+ QSizePolicy *policy = new QSizePolicy(horizontal, vertical);
+ policy->setHeightForWidth(dependent);
+ \endcode
+*/
+
+/*!
+ \fn QSizePolicy::QSizePolicy(Policy horizontal, Policy vertical, uchar horizontalStretch,
+ uchar verticalStretch, bool dependent)
+
+ Use the QSizePolicy() constructor and call the
+ setHorizontalStretch(), setVerticalStretch(), and
+ setHeightForWidth() functions instead.
+
+ \oldcode
+ QSizePolicy *policy = new QSizePolicy(horizontal, vertical,
+ horizontalStretch, verticalStretch,
+ dependent);
+ \newcode
+ QSizePolicy *policy = new QSizePolicy(horizontal, vertical);
+ policy->setHorizontalStretch(horizontalStretch);
+ policy->setVerticalStretch(verticalStretch);
+ policy->setHeightForWidth(dependent);
+ \endcode
+*/
+
+/*!
+ \fn QSizePolicy::Policy QSizePolicy::horData() const
+
+ Use horizontalPolicy() instead.
+*/
+
+/*!
+ \fn QSizePolicy::Policy QSizePolicy::verData() const
+
+ Use verticalPolicy() instead.
+*/
+
+/*!
+ \fn void QSizePolicy::setHorData(Policy policy)
+
+ Use setHorizontalPolicy() instead.
+*/
+
+/*!
+ \fn void QSizePolicy::setVerData(Policy policy)
+
+ Use setVerticalPolicy() instead.
+*/
+
+/*!
+ \fn uint QSizePolicy::horStretch() const
+
+ Use horizontalStretch() instead.
+*/
+
+/*!
+ \fn uint QSizePolicy::verStretch() const
+
+ Use verticalStretch() instead.
+*/
+
+/*!
+ \fn void QSizePolicy::setHorStretch(uchar stretch)
+
+ Use setHorizontalStretch() instead.
+*/
+
+/*!
+ \fn void QSizePolicy::setVerStretch(uchar stretch)
+
+ Use setVerticalStretch() instead.
+*/
+#endif
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
new file mode 100644
index 000000000..1acc9b376
--- /dev/null
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -0,0 +1,304 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qapplication.h"
+#include "qevent.h"
+#ifdef Q_WS_S60
+#include "qstyle.h"
+#include "private/qt_s60_p.h"
+#endif
+#include "private/qsoftkeymanager_p.h"
+#include "private/qobject_p.h"
+
+#ifndef QT_NO_SOFTKEYMANAGER
+QT_BEGIN_NAMESPACE
+
+#ifdef Q_WS_S60
+static const int s60CommandStart = 6000;
+#endif
+
+class QSoftKeyManagerPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QSoftKeyManager)
+
+public:
+ static void updateSoftKeys_sys(const QList<QAction*> &softKeys);
+
+private:
+ QHash<QAction*, Qt::Key> keyedActions;
+ static QSoftKeyManager *self;
+ static QWidget *softKeySource;
+};
+
+QWidget *QSoftKeyManagerPrivate::softKeySource = 0;
+QSoftKeyManager *QSoftKeyManagerPrivate::self = 0;
+
+const char *QSoftKeyManager::standardSoftKeyText(StandardSoftKey standardKey)
+{
+ const char *softKeyText = 0;
+ switch (standardKey) {
+ case OkSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Ok");
+ break;
+ case SelectSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Select");
+ break;
+ case DoneSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Done");
+ break;
+ case MenuSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Options");
+ break;
+ case CancelSoftKey:
+ softKeyText = QT_TRANSLATE_NOOP("QSoftKeyManager", "Cancel");
+ break;
+ default:
+ break;
+ };
+
+ return softKeyText;
+}
+
+QSoftKeyManager *QSoftKeyManager::instance()
+{
+ if (!QSoftKeyManagerPrivate::self)
+ QSoftKeyManagerPrivate::self = new QSoftKeyManager;
+
+ return QSoftKeyManagerPrivate::self;
+}
+
+QSoftKeyManager::QSoftKeyManager() : QObject(*(new QSoftKeyManagerPrivate), 0)
+{
+}
+
+QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget)
+{
+ const char* text = standardSoftKeyText(standardKey);
+ QAction *action = new QAction(QSoftKeyManager::tr(text), actionWidget);
+ QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey;
+ switch (standardKey) {
+ case OkSoftKey:
+ case SelectSoftKey:
+ case DoneSoftKey:
+ case MenuSoftKey:
+ softKeyRole = QAction::PositiveSoftKey;
+ break;
+ case CancelSoftKey:
+ softKeyRole = QAction::NegativeSoftKey;
+ break;
+ }
+ action->setSoftKeyRole(softKeyRole);
+ return action;
+}
+
+/*! \internal
+
+ Creates a QAction and registers the 'triggered' signal to send the given key event to
+ \a actionWidget as a convenience.
+
+*/
+QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget)
+{
+#ifndef QT_NO_ACTION
+ QScopedPointer<QAction> action(createAction(standardKey, actionWidget));
+
+ connect(action.data(), SIGNAL(triggered()), QSoftKeyManager::instance(), SLOT(sendKeyEvent()));
+ connect(action.data(), SIGNAL(destroyed(QObject*)), QSoftKeyManager::instance(), SLOT(cleanupHash(QObject*)));
+ QSoftKeyManager::instance()->d_func()->keyedActions.insert(action.data(), key);
+ return action.take();
+#endif //QT_NO_ACTION
+}
+
+void QSoftKeyManager::cleanupHash(QObject* obj)
+{
+ Q_D(QSoftKeyManager);
+ QAction *action = qobject_cast<QAction*>(obj);
+ d->keyedActions.remove(action);
+}
+
+void QSoftKeyManager::sendKeyEvent()
+{
+ Q_D(QSoftKeyManager);
+ QAction *action = qobject_cast<QAction*>(sender());
+
+ if (!action)
+ return;
+
+ Qt::Key keyToSend = d->keyedActions.value(action, Qt::Key_unknown);
+
+ if (keyToSend != Qt::Key_unknown)
+ QApplication::postEvent(action->parentWidget(),
+ new QKeyEvent(QEvent::KeyPress, keyToSend, Qt::NoModifier));
+}
+
+void QSoftKeyManager::updateSoftKeys()
+{
+ QEvent *event = new QEvent(QEvent::UpdateSoftKeys);
+ QApplication::postEvent(QSoftKeyManager::instance(), event);
+}
+
+bool QSoftKeyManager::event(QEvent *e)
+{
+#ifndef QT_NO_ACTION
+ if (e->type() == QEvent::UpdateSoftKeys) {
+ QList<QAction*> softKeys;
+ QWidget *source = QApplication::focusWidget();
+ do {
+ if (source) {
+ QList<QAction*> actions = source->actions();
+ for (int i = 0; i < actions.count(); ++i) {
+ if (actions.at(i)->softKeyRole() != QAction::NoSoftKey)
+ softKeys.append(actions.at(i));
+ }
+
+ QWidget *parent = source->parentWidget();
+ if (parent && softKeys.isEmpty() && !source->isWindow())
+ source = parent;
+ else
+ break;
+ } else {
+ source = QApplication::activeWindow();
+ }
+ } while (source);
+
+ QSoftKeyManagerPrivate::softKeySource = source;
+ QSoftKeyManagerPrivate::updateSoftKeys_sys(softKeys);
+ return true;
+ }
+#endif //QT_NO_ACTION
+ return false;
+}
+
+#ifdef Q_WS_S60
+void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys)
+{
+ // lets not update softkeys if s60 native dialog or menu is shown
+ if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog())
+ return;
+
+ CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer();
+ nativeContainer->DrawableWindow()->SetOrdinalPosition(0);
+ nativeContainer->DrawableWindow()->SetPointerCapturePriority(1); //keep softkeys available in modal dialog
+ nativeContainer->DrawableWindow()->SetFaded(EFalse, RWindowTreeNode::EFadeIncludeChildren);
+
+ int position = -1;
+ bool needsExitButton = true;
+ QT_TRAP_THROWING(
+ //Using -1 instead of EAknSoftkeyEmpty to avoid flickering.
+ nativeContainer->SetCommandL(0, -1, KNullDesC);
+ nativeContainer->SetCommandL(2, -1, KNullDesC);
+ );
+
+ for (int index = 0; index < softkeys.count(); index++) {
+ const QAction* softKeyAction = softkeys.at(index);
+ switch (softKeyAction->softKeyRole()) {
+ // Positive Actions on the LSK
+ case QAction::PositiveSoftKey:
+ position = 0;
+ break;
+ case QAction::SelectSoftKey:
+ position = 0;
+ break;
+ // Negative Actions on the RSK
+ case QAction::NegativeSoftKey:
+ needsExitButton = false;
+ position = 2;
+ break;
+ default:
+ break;
+ }
+
+ int command = (softKeyAction->objectName().contains("_q_menuSoftKeyAction"))
+ ? EAknSoftkeyOptions
+ : s60CommandStart + index;
+
+ if (position != -1) {
+ const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut);
+ QString iconText = softKeyAction->iconText();
+ TPtrC text = qt_QString2TPtrC( underlineShortCut ? softKeyAction->text() : iconText);
+ QT_TRAP_THROWING(nativeContainer->SetCommandL(position, command, text));
+ }
+ }
+
+ const Qt::WindowType sourceWindowType = QSoftKeyManagerPrivate::softKeySource
+ ? QSoftKeyManagerPrivate::softKeySource->window()->windowType()
+ : Qt::Widget;
+
+ if (needsExitButton && sourceWindowType != Qt::Dialog && sourceWindowType != Qt::Popup)
+ QT_TRAP_THROWING(
+ nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QSoftKeyManager::tr("Exit"))));
+
+ nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation
+}
+
+bool QSoftKeyManager::handleCommand(int command)
+{
+ if (command >= s60CommandStart && QSoftKeyManagerPrivate::softKeySource) {
+ int index = command - s60CommandStart;
+ const QList<QAction*>& softKeys = QSoftKeyManagerPrivate::softKeySource->actions();
+ for (int i = 0, j = 0; i < softKeys.count(); ++i) {
+ QAction *action = softKeys.at(i);
+ if (action->softKeyRole() != QAction::NoSoftKey) {
+ if (j == index) {
+ QWidget *parent = action->parentWidget();
+ if (parent && parent->isEnabled()) {
+ action->activate(QAction::Trigger);
+ return true;
+ }
+ }
+ j++;
+ }
+ }
+ }
+
+ return false;
+}
+
+#else
+
+void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &)
+{
+}
+
+#endif
+
+QT_END_NAMESPACE
+#endif //QT_NO_SOFTKEYMANAGER
diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h
new file mode 100644
index 000000000..796e080d7
--- /dev/null
+++ b/src/gui/kernel/qsoftkeymanager_p.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSOFTKEYMANAGER_P_H
+#define QSOFTKEYMANAGER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include "QtGui/qaction.h"
+
+QT_BEGIN_HEADER
+
+#ifndef QT_NO_SOFTKEYMANAGER
+QT_BEGIN_NAMESPACE
+
+class QSoftKeyManagerPrivate;
+
+class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QSoftKeyManager)
+
+public:
+
+ enum StandardSoftKey {
+ OkSoftKey,
+ SelectSoftKey,
+ DoneSoftKey,
+ MenuSoftKey,
+ CancelSoftKey
+ };
+
+ static void updateSoftKeys();
+ static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget);
+ static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget);
+
+#ifdef Q_WS_S60
+ static bool handleCommand(int);
+#endif
+
+private:
+ QSoftKeyManager();
+ static QSoftKeyManager *instance();
+ static const char *standardSoftKeyText(StandardSoftKey standardKey);
+
+protected:
+ bool event(QEvent *e);
+
+ Q_DISABLE_COPY(QSoftKeyManager)
+
+private Q_SLOTS:
+ void cleanupHash(QObject* obj);
+ void sendKeyEvent();
+};
+
+QT_END_NAMESPACE
+#endif //QT_NO_SOFTKEYMANAGER
+
+QT_END_HEADER
+
+#endif //QSOFTKEYMANAGER_P_H
diff --git a/src/gui/kernel/qsound.cpp b/src/gui/kernel/qsound.cpp
index 3fb750e77..141439bf7 100644
--- a/src/gui/kernel/qsound.cpp
+++ b/src/gui/kernel/qsound.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -106,7 +106,7 @@ public:
\brief The QSound class provides access to the platform audio facilities.
\ingroup multimedia
- \mainclass
+
Qt provides the most commonly required audio operation in GUI
applications: asynchronously playing a sound file. This is most
@@ -153,6 +153,9 @@ public:
\o Qt for Embedded Linux
\o A built-in mixing sound server is used, accessing \c /dev/dsp
directly. Only the WAVE format is supported.
+ \o Symbian
+ \o CMdaAudioPlayerUtility is used. All formats that Symbian OS or devices support
+ are supported also by Qt.
\endtable
Note that QSound does not support \l{resources.html}{resources}.
diff --git a/src/gui/kernel/qsound.h b/src/gui/kernel/qsound.h
index 2b35074cd..fe72972d3 100644
--- a/src/gui/kernel/qsound.h
+++ b/src/gui/kernel/qsound.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qsound_mac.mm b/src/gui/kernel/qsound_mac.mm
index 284bafa19..8312ff69d 100644
--- a/src/gui/kernel/qsound_mac.mm
+++ b/src/gui/kernel/qsound_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qsound_p.h b/src/gui/kernel/qsound_p.h
index c0be0d430..daadd0dba 100644
--- a/src/gui/kernel/qsound_p.h
+++ b/src/gui/kernel/qsound_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qsound_qws.cpp b/src/gui/kernel/qsound_qws.cpp
index fa32dcd04..8595faafd 100644
--- a/src/gui/kernel/qsound_qws.cpp
+++ b/src/gui/kernel/qsound_qws.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,16 +53,16 @@
#include "qhash.h"
#include "qfileinfo.h"
-#ifdef MEDIA_SERVER
#include "qbytearray.h"
#include "quuid.h"
#include "qdatastream.h"
#include "qcopchannel_qws.h"
#include "qbuffer.h"
+
QT_BEGIN_NAMESPACE
-QT_USE_NAMESPACE
+#ifdef MEDIA_SERVER
#define SERVER_CHANNEL "QPE/MediaServer"
@@ -279,7 +279,7 @@ QAuBucketQWS::QAuBucketQWS( QAuServerQWS *server, QSound *sound, QObject* parent
sound->setObjectName( m_id.toString() );
- m_channel = new QCopChannel(QLatin1String("QPE/QSound/") + m_id ), this );
+ m_channel = new QCopChannel(QLatin1String("QPE/QSound/") + m_id, this );
connect( m_channel, SIGNAL(received(QString,QByteArray)),
this, SLOT(processMessage(QString,QByteArray)) );
diff --git a/src/gui/kernel/qsound_s60.cpp b/src/gui/kernel/qsound_s60.cpp
new file mode 100644
index 000000000..af0fae60e
--- /dev/null
+++ b/src/gui/kernel/qsound_s60.cpp
@@ -0,0 +1,224 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+
+#ifndef QT_NO_SOUND
+
+#include "qdir.h"
+#include "qapplication.h"
+#include "qsound.h"
+#include "qsound_p.h"
+#include "qfileinfo.h"
+#include <private/qcore_symbian_p.h>
+
+#include <e32std.h>
+#include <MdaAudioSamplePlayer.h>
+
+QT_BEGIN_NAMESPACE
+
+class QAuServerS60;
+
+class QAuBucketS60 : public QAuBucket, public MMdaAudioPlayerCallback
+{
+public:
+ QAuBucketS60(QAuServerS60 *server, QSound *sound);
+ ~QAuBucketS60();
+
+ void play();
+ void stop();
+
+ inline QSound *sound() const { return m_sound; }
+
+public: // from MMdaAudioPlayerCallback
+ void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
+ void MapcPlayComplete(TInt aError);
+
+private:
+ QSound *m_sound;
+ QAuServerS60 *m_server;
+ bool m_prepared;
+ bool m_playCalled;
+ CMdaAudioPlayerUtility *m_playUtility;
+};
+
+
+class QAuServerS60 : public QAuServer
+{
+public:
+ QAuServerS60(QObject *parent);
+
+ void init(QSound *s)
+ {
+ QAuBucketS60 *bucket = new QAuBucketS60(this, s);
+ setBucket(s, bucket);
+ }
+
+ void play(QSound *s)
+ {
+ bucket(s)->play();
+ }
+
+ void stop(QSound *s)
+ {
+ bucket(s)->stop();
+ }
+
+ bool okay() { return true; }
+
+ void play(const QString& filename);
+
+protected:
+ void playCompleted(QAuBucketS60 *bucket, int error);
+
+protected:
+ QAuBucketS60 *bucket(QSound *s)
+ {
+ return (QAuBucketS60 *)QAuServer::bucket( s );
+ }
+
+ friend class QAuBucketS60;
+
+ // static QSound::play(filename) cannot be stopped, meaning that playCompleted
+ // will get always called and QSound gets removed form this list.
+ QList<QSound *> staticPlayingSounds;
+};
+
+QAuServerS60::QAuServerS60(QObject *parent) :
+ QAuServer(parent)
+{
+ setObjectName(QLatin1String("QAuServerS60"));
+}
+
+void QAuServerS60::play(const QString& filename)
+{
+ QSound *s = new QSound(filename);
+ staticPlayingSounds.append(s);
+ play(s);
+}
+
+void QAuServerS60::playCompleted(QAuBucketS60 *bucket, int error)
+{
+ QSound *sound = bucket->sound();
+ if (!error) {
+ // We need to handle repeats by ourselves, since with Symbian API we don't
+ // know how many loops have been played when user asks it
+ if (decLoop(sound)) {
+ play(sound);
+ } else {
+ if (staticPlayingSounds.removeAll(sound))
+ delete sound;
+ }
+ } else {
+ // We don't have a way to inform about errors -> just decrement loops
+ // in order that QSound::isFinished will return true;
+ while (decLoop(sound)) {}
+ if (staticPlayingSounds.removeAll(sound))
+ delete sound;
+ }
+}
+
+QAuServer *qt_new_audio_server()
+{
+ return new QAuServerS60(qApp);
+}
+
+QAuBucketS60::QAuBucketS60(QAuServerS60 *server, QSound *sound)
+ : m_sound(sound), m_server(server), m_prepared(false), m_playCalled(false)
+{
+ QString filepath = QFileInfo(m_sound->fileName()).absoluteFilePath();
+ filepath = QDir::toNativeSeparators(filepath);
+ TPtrC filepathPtr(qt_QString2TPtrC(filepath));
+ TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this);
+ m_playUtility->OpenFileL(filepathPtr));
+ if (err) {
+ m_server->playCompleted(this, err);
+ }
+}
+
+void QAuBucketS60::play()
+{
+ if (m_prepared) {
+ // OpenFileL call is completed we can start playing immediately
+ m_playUtility->Play();
+ } else {
+ m_playCalled = true;
+ }
+
+}
+
+void QAuBucketS60::stop()
+{
+ m_playCalled = false;
+ m_playUtility->Stop();
+}
+
+void QAuBucketS60::MapcPlayComplete(TInt aError)
+{
+ m_server->playCompleted(this, aError);
+}
+
+void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
+{
+ if (aError) {
+ m_server->playCompleted(this, aError);
+ } else {
+ m_prepared = true;
+ if (m_playCalled){
+ play();
+ }
+ }
+}
+
+QAuBucketS60::~QAuBucketS60()
+{
+ if (m_playUtility){
+ m_playUtility->Stop();
+ m_playUtility->Close();
+ }
+
+ delete m_playUtility;
+}
+
+
+#endif // QT_NO_SOUND
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qsound_win.cpp b/src/gui/kernel/qsound_win.cpp
index 4eb8244d8..50510175e 100644
--- a/src/gui/kernel/qsound_win.cpp
+++ b/src/gui/kernel/qsound_win.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qsound_x11.cpp b/src/gui/kernel/qsound_x11.cpp
index d881e4dd4..5bd96633c 100644
--- a/src/gui/kernel/qsound_x11.cpp
+++ b/src/gui/kernel/qsound_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qstackedlayout.cpp b/src/gui/kernel/qstackedlayout.cpp
index 4025b73f1..98f203254 100644
--- a/src/gui/kernel/qstackedlayout.cpp
+++ b/src/gui/kernel/qstackedlayout.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -65,8 +65,6 @@ public:
only one widget is visible at a time.
\ingroup geomanagement
- \ingroup appearance
- \mainclass
QStackedLayout can be used to create a user interface similar to
the one provided by QTabWidget. There is also a convenience
diff --git a/src/gui/kernel/qstackedlayout.h b/src/gui/kernel/qstackedlayout.h
index e95861888..f7d43295d 100644
--- a/src/gui/kernel/qstackedlayout.h
+++ b/src/gui/kernel/qstackedlayout.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 47f314643..6b0441bd8 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,464 +21,546 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qstandardgestures.h"
#include "qstandardgestures_p.h"
-
-#include <qabstractscrollarea.h>
-#include <qscrollbar.h>
-#include <private/qapplication_p.h>
-#include <private/qevent_p.h>
-#include <private/qwidget_p.h>
+#include "qgesture.h"
+#include "qgesture_p.h"
+#include "qevent.h"
+#include "qwidget.h"
+#include "qabstractscrollarea.h"
+#include "qdebug.h"
QT_BEGIN_NAMESPACE
-#ifdef Q_WS_WIN
-QWidgetPrivate *qt_widget_private(QWidget *widget);
-#endif
-
-/*!
- \class QPanGesture
- \since 4.6
-
- \brief The QPanGesture class represents a Pan gesture,
- providing additional information related to panning.
-*/
-
-/*!
- Creates a new Pan gesture handler object and marks it as a child of \a
- parent.
+QPanGestureRecognizer::QPanGestureRecognizer()
+{
+}
- On some platform like Windows it's necessary to provide a non-null widget
- as \a parent to get native gesture support.
-*/
-QPanGesture::QPanGesture(QWidget *parent)
- : QGesture(*new QPanGesturePrivate, parent)
+QGesture *QPanGestureRecognizer::create(QObject *target)
{
- if (parent) {
- QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
- qAppPriv->widgetGestures[parent].pan = this;
-#ifdef Q_WS_WIN
- qt_widget_private(parent)->winSetupGestures();
+ if (target && target->isWidgetType()) {
+#if defined(Q_OS_WIN) && !defined(QT_NO_NATIVE_GESTURES)
+ // for scroll areas on Windows we want to use native gestures instead
+ if (!qobject_cast<QAbstractScrollArea *>(target->parent()))
+ static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents);
+#else
+ static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents);
#endif
}
+ return new QPanGesture;
}
-/*! \internal */
-bool QPanGesture::event(QEvent *event)
+QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state,
+ QObject *,
+ QEvent *event)
{
+ QPanGesture *q = static_cast<QPanGesture *>(state);
+ QPanGesturePrivate *d = q->d_func();
+
+ const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
+
+ QGestureRecognizer::Result result;
switch (event->type()) {
- case QEvent::ParentAboutToChange:
- if (QWidget *w = qobject_cast<QWidget*>(parent())) {
- QApplicationPrivate::instance()->widgetGestures[w].pan = 0;
-#ifdef Q_WS_WIN
- qt_widget_private(w)->winSetupGestures();
-#endif
+ case QEvent::TouchBegin: {
+ result = QGestureRecognizer::MayBeGesture;
+ QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
+ d->lastOffset = d->offset = QPointF();
+ break;
+ }
+ case QEvent::TouchEnd: {
+ if (q->state() != Qt::NoGesture) {
+ if (ev->touchPoints().size() == 2) {
+ QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0);
+ QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
+ d->lastOffset = d->offset;
+ d->offset =
+ QPointF(p1.pos().x() - p1.startPos().x() + p2.pos().x() - p2.startPos().x(),
+ p1.pos().y() - p1.startPos().y() + p2.pos().y() - p2.startPos().y()) / 2;
+ }
+ result = QGestureRecognizer::FinishGesture;
+ } else {
+ result = QGestureRecognizer::CancelGesture;
}
break;
- case QEvent::ParentChange:
- if (QWidget *w = qobject_cast<QWidget*>(parent())) {
- QApplicationPrivate::instance()->widgetGestures[w].pan = this;
-#ifdef Q_WS_WIN
- qt_widget_private(w)->winSetupGestures();
-#endif
+ }
+ case QEvent::TouchUpdate: {
+ if (ev->touchPoints().size() >= 2) {
+ QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0);
+ QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
+ d->lastOffset = d->offset;
+ d->offset =
+ QPointF(p1.pos().x() - p1.startPos().x() + p2.pos().x() - p2.startPos().x(),
+ p1.pos().y() - p1.startPos().y() + p2.pos().y() - p2.startPos().y()) / 2;
+ if (d->offset.x() > 10 || d->offset.y() > 10 ||
+ d->offset.x() < -10 || d->offset.y() < -10) {
+ result = QGestureRecognizer::TriggerGesture;
+ } else {
+ result = QGestureRecognizer::MayBeGesture;
+ }
}
break;
+ }
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonRelease:
+ result = QGestureRecognizer::Ignore;
+ break;
default:
+ result = QGestureRecognizer::Ignore;
break;
}
+ return result;
+}
-#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA)
- Q_D(QPanGesture);
- if (event->type() == QEvent::Timer) {
- const QTimerEvent *te = static_cast<QTimerEvent *>(event);
- if (te->timerId() == d->panFinishedTimer) {
- killTimer(d->panFinishedTimer);
- d->panFinishedTimer = 0;
- d->lastOffset = QSize(0, 0);
- updateState(Qt::GestureFinished);
- }
- }
-#endif
+void QPanGestureRecognizer::reset(QGesture *state)
+{
+ QPanGesture *pan = static_cast<QPanGesture*>(state);
+ QPanGesturePrivate *d = pan->d_func();
+
+ d->lastOffset = d->offset = QPointF();
+ d->acceleration = 0;
- return QObject::event(event);
+ QGestureRecognizer::reset(state);
}
-bool QPanGesture::eventFilter(QObject *receiver, QEvent *event)
+
+//
+// QPinchGestureRecognizer
+//
+
+QPinchGestureRecognizer::QPinchGestureRecognizer()
{
-#ifdef Q_WS_WIN
- Q_D(QPanGesture);
- if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) {
- QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
- QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
- QApplicationPrivate::WidgetStandardGesturesMap::iterator it;
- it = qAppPriv->widgetGestures.find(static_cast<QWidget*>(receiver));
- if (it == qAppPriv->widgetGestures.end())
- return false;
- if (this != it.value().pan)
- return false;
- Qt::GestureState nextState = Qt::NoGesture;
- switch(ev->gestureType) {
- case QNativeGestureEvent::GestureBegin:
- // next we might receive the first gesture update event, so we
- // prepare for it.
- d->state = Qt::NoGesture;
- return false;
- case QNativeGestureEvent::Pan:
- nextState = Qt::GestureUpdated;
- event->accept();
- break;
- case QNativeGestureEvent::GestureEnd:
- if (state() == Qt::NoGesture)
- return false; // some other gesture has ended
- nextState = Qt::GestureFinished;
- break;
- default:
- return false;
- }
- if (state() == Qt::NoGesture) {
- d->lastOffset = d->totalOffset = QSize();
- } else {
- d->lastOffset = QSize(ev->position.x() - d->lastPosition.x(),
- ev->position.y() - d->lastPosition.y());
- d->totalOffset += d->lastOffset;
- }
- d->lastPosition = ev->position;
- updateState(nextState);
- return true;
+}
+
+QGesture *QPinchGestureRecognizer::create(QObject *target)
+{
+ if (target && target->isWidgetType()) {
+ static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents);
}
-#endif
- return QGesture::eventFilter(receiver, event);
+ return new QPinchGesture;
}
-/*! \internal */
-bool QPanGesture::filterEvent(QEvent *event)
+QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state,
+ QObject *,
+ QEvent *event)
{
- Q_D(QPanGesture);
- if (!event->spontaneous())
- return false;
- const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
- if (event->type() == QEvent::TouchBegin) {
- QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
- d->lastPosition = p.pos().toPoint();
- d->lastOffset = d->totalOffset = QSize();
- } else if (event->type() == QEvent::TouchEnd) {
- if (state() != Qt::NoGesture) {
- if (!ev->touchPoints().isEmpty()) {
- QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
- const QPoint pos = p.pos().toPoint();
- const QPoint lastPos = p.lastPos().toPoint();
- const QPoint startPos = p.startPos().toPoint();
- d->lastOffset = QSize(pos.x() - lastPos.x(), pos.y() - lastPos.y());
- d->totalOffset = QSize(pos.x() - startPos.x(), pos.y() - startPos.y());
- }
- updateState(Qt::GestureFinished);
- }
- reset();
- } else if (event->type() == QEvent::TouchUpdate) {
- QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
- const QPoint pos = p.pos().toPoint();
- const QPoint lastPos = p.lastPos().toPoint();
- const QPoint startPos = p.startPos().toPoint();
- d->lastOffset = QSize(pos.x() - lastPos.x(), pos.y() - lastPos.y());
- d->totalOffset = QSize(pos.x() - startPos.x(), pos.y() - startPos.y());
- if (d->totalOffset.width() > 10 || d->totalOffset.height() > 10 ||
- d->totalOffset.width() < -10 || d->totalOffset.height() < -10) {
- updateState(Qt::GestureUpdated);
+ QPinchGesture *q = static_cast<QPinchGesture *>(state);
+ QPinchGesturePrivate *d = q->d_func();
+
+ const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
+
+ QGestureRecognizer::Result result;
+
+ switch (event->type()) {
+ case QEvent::TouchBegin: {
+ result = QGestureRecognizer::MayBeGesture;
+ break;
+ }
+ case QEvent::TouchEnd: {
+ if (q->state() != Qt::NoGesture) {
+ result = QGestureRecognizer::FinishGesture;
+ } else {
+ result = QGestureRecognizer::CancelGesture;
}
+ break;
}
-#ifdef Q_OS_MAC
- else if (event->type() == QEvent::Wheel) {
- // On Mac, there is really no native panning gesture. Instead, a two
- // finger pan is delivered as mouse wheel events. Otoh, on Windows, you
- // either get mouse wheel events or pan events. We have decided to make this
- // the Qt behaviour as well, meaning that on Mac, wheel
- // events will be masked away when listening for pan events.
-#ifndef QT_MAC_USE_COCOA
- // In Carbon we receive neither touch-, nor pan gesture events.
- // So we create pan gestures by converting wheel events. After all, this
- // is how things are supposed to work on mac in the first place.
- const QWheelEvent *wev = static_cast<const QWheelEvent*>(event);
- int offset = wev->delta() / -120;
- d->lastOffset = wev->orientation() == Qt::Horizontal ? QSize(offset, 0) : QSize(0, offset);
-
- if (state() == Qt::NoGesture) {
- d->totalOffset = d->lastOffset;
+ case QEvent::TouchUpdate: {
+ d->changeFlags = 0;
+ if (ev->touchPoints().size() == 2) {
+ QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0);
+ QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
+
+ d->hotSpot = p1.screenPos();
+ d->isHotSpotSet = true;
+
+ if (d->isNewSequence) {
+ d->startPosition[0] = p1.screenPos();
+ d->startPosition[1] = p2.screenPos();
+ }
+ QLineF line(p1.screenPos(), p2.screenPos());
+ QLineF tmp(line);
+ tmp.setLength(line.length() / 2.);
+ QPointF centerPoint = tmp.p2();
+
+ d->lastCenterPoint = d->centerPoint;
+ d->centerPoint = centerPoint;
+ d->changeFlags |= QPinchGesture::CenterPointChanged;
+
+ const qreal scaleFactor =
+ QLineF(p1.screenPos(), p2.screenPos()).length()
+ / QLineF(d->startPosition[0], d->startPosition[1]).length();
+ if (d->isNewSequence) {
+ d->lastScaleFactor = scaleFactor;
+ } else {
+ d->lastScaleFactor = d->scaleFactor;
+ }
+ d->scaleFactor = scaleFactor;
+ d->totalScaleFactor += d->scaleFactor - d->lastScaleFactor;
+ d->changeFlags |= QPinchGesture::ScaleFactorChanged;
+
+ qreal angle = QLineF(p1.screenPos(), p2.screenPos()).angle();
+ if (angle > 180)
+ angle -= 360;
+ qreal startAngle = QLineF(p1.startScreenPos(), p2.startScreenPos()).angle();
+ if (startAngle > 180)
+ startAngle -= 360;
+ const qreal rotationAngle = startAngle - angle;
+ if (d->isNewSequence)
+ d->lastRotationAngle = rotationAngle;
+ else
+ d->lastRotationAngle = d->rotationAngle;
+ d->rotationAngle = rotationAngle;
+ d->totalRotationAngle += d->rotationAngle - d->lastRotationAngle;
+ d->changeFlags |= QPinchGesture::RotationAngleChanged;
+
+ d->totalChangeFlags |= d->changeFlags;
+ d->isNewSequence = false;
+ result = QGestureRecognizer::TriggerGesture;
} else {
- d->totalOffset += d->lastOffset;
+ d->isNewSequence = true;
+ if (q->state() == Qt::NoGesture)
+ result = QGestureRecognizer::Ignore;
+ else
+ result = QGestureRecognizer::FinishGesture;
}
-
- killTimer(d->panFinishedTimer);
- d->panFinishedTimer = startTimer(200);
- updateState(Qt::GestureUpdated);
-#endif
- return true;
+ break;
}
-#endif
- return false;
-}
-
-/*! \internal */
-void QPanGesture::reset()
-{
- Q_D(QPanGesture);
- d->lastOffset = d->totalOffset = QSize();
- d->lastPosition = QPoint();
-#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA)
- if (d->panFinishedTimer) {
- killTimer(d->panFinishedTimer);
- d->panFinishedTimer = 0;
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonRelease:
+ result = QGestureRecognizer::Ignore;
+ break;
+ default:
+ result = QGestureRecognizer::Ignore;
+ break;
}
-#endif
- QGesture::reset();
+ return result;
}
-/*!
- \property QPanGesture::totalOffset
-
- Specifies a total pan offset since the start of the gesture.
-*/
-QSize QPanGesture::totalOffset() const
+void QPinchGestureRecognizer::reset(QGesture *state)
{
- Q_D(const QPanGesture);
- return d->totalOffset;
-}
+ QPinchGesture *pinch = static_cast<QPinchGesture *>(state);
+ QPinchGesturePrivate *d = pinch->d_func();
-/*!
- \property QPanGesture::lastOffset
+ d->totalChangeFlags = d->changeFlags = 0;
- Specifies a pan offset since the last time the gesture was
- triggered.
-*/
-QSize QPanGesture::lastOffset() const
-{
- Q_D(const QPanGesture);
- return d->lastOffset;
-}
+ d->startCenterPoint = d->lastCenterPoint = d->centerPoint = QPointF();
+ d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 0;
+ d->totalRotationAngle = d->lastRotationAngle = d->rotationAngle = 0;
+ d->isNewSequence = true;
+ d->startPosition[0] = d->startPosition[1] = QPointF();
-/*!
- \class QPinchGesture
- \since 4.6
+ QGestureRecognizer::reset(state);
+}
- \brief The QPinchGesture class represents a Pinch gesture,
- providing additional information related to zooming and/or rotation.
-*/
+//
+// QSwipeGestureRecognizer
+//
-/*!
- Creates a new Pinch gesture handler object and marks it as a child of \a
- parent.
+QSwipeGestureRecognizer::QSwipeGestureRecognizer()
+{
+}
- On some platform like Windows it's necessary to provide a non-null widget
- as \a parent to get native gesture support.
-*/
-QPinchGesture::QPinchGesture(QWidget *parent)
- : QGesture(*new QPinchGesturePrivate, parent)
+QGesture *QSwipeGestureRecognizer::create(QObject *target)
{
- if (parent) {
- QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
- qAppPriv->widgetGestures[parent].pinch = this;
-#ifdef Q_WS_WIN
- qt_widget_private(parent)->winSetupGestures();
-#endif
+ if (target && target->isWidgetType()) {
+ static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents);
}
+ return new QSwipeGesture;
}
-/*! \internal */
-bool QPinchGesture::event(QEvent *event)
+QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state,
+ QObject *,
+ QEvent *event)
{
+ QSwipeGesture *q = static_cast<QSwipeGesture *>(state);
+ QSwipeGesturePrivate *d = q->d_func();
+
+ const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
+
+ QGestureRecognizer::Result result;
+
switch (event->type()) {
- case QEvent::ParentAboutToChange:
- if (QWidget *w = qobject_cast<QWidget*>(parent())) {
- QApplicationPrivate::instance()->widgetGestures[w].pinch = 0;
-#ifdef Q_WS_WIN
- qt_widget_private(w)->winSetupGestures();
-#endif
+ case QEvent::TouchBegin: {
+ d->speed = 1;
+ d->time = QTime::currentTime();
+ d->started = true;
+ result = QGestureRecognizer::MayBeGesture;
+ break;
+ }
+ case QEvent::TouchEnd: {
+ if (q->state() != Qt::NoGesture) {
+ result = QGestureRecognizer::FinishGesture;
+ } else {
+ result = QGestureRecognizer::CancelGesture;
}
break;
- case QEvent::ParentChange:
- if (QWidget *w = qobject_cast<QWidget*>(parent())) {
- QApplicationPrivate::instance()->widgetGestures[w].pinch = this;
-#ifdef Q_WS_WIN
- qt_widget_private(w)->winSetupGestures();
-#endif
+ }
+ case QEvent::TouchUpdate: {
+ if (!d->started)
+ result = QGestureRecognizer::CancelGesture;
+ else if (ev->touchPoints().size() == 3) {
+ QTouchEvent::TouchPoint p1 = ev->touchPoints().at(0);
+ QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1);
+ QTouchEvent::TouchPoint p3 = ev->touchPoints().at(2);
+
+ if (d->lastPositions[0].isNull()) {
+ d->lastPositions[0] = p1.startScreenPos().toPoint();
+ d->lastPositions[1] = p2.startScreenPos().toPoint();
+ d->lastPositions[2] = p3.startScreenPos().toPoint();
+ }
+ d->hotSpot = p1.screenPos();
+ d->isHotSpotSet = true;
+
+ int xDistance = (p1.screenPos().x() - d->lastPositions[0].x() +
+ p2.screenPos().x() - d->lastPositions[1].x() +
+ p3.screenPos().x() - d->lastPositions[2].x()) / 3;
+ int yDistance = (p1.screenPos().y() - d->lastPositions[0].y() +
+ p2.screenPos().y() - d->lastPositions[1].y() +
+ p3.screenPos().y() - d->lastPositions[2].y()) / 3;
+
+ const int distance = xDistance >= yDistance ? xDistance : yDistance;
+ int elapsedTime = d->time.msecsTo(QTime::currentTime());
+ if (!elapsedTime)
+ elapsedTime = 1;
+ d->speed = 0.9 * d->speed + distance / elapsedTime;
+ d->time = QTime::currentTime();
+ d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle();
+
+ static const int MoveThreshold = 50;
+ if (xDistance > MoveThreshold || yDistance > MoveThreshold) {
+ // measure the distance to check if the direction changed
+ d->lastPositions[0] = p1.screenPos().toPoint();
+ d->lastPositions[1] = p2.screenPos().toPoint();
+ d->lastPositions[2] = p3.screenPos().toPoint();
+ QSwipeGesture::SwipeDirection horizontal =
+ xDistance > 0 ? QSwipeGesture::Right : QSwipeGesture::Left;
+ QSwipeGesture::SwipeDirection vertical =
+ yDistance > 0 ? QSwipeGesture::Down : QSwipeGesture::Up;
+ if (d->verticalDirection == QSwipeGesture::NoDirection)
+ d->verticalDirection = vertical;
+ if (d->horizontalDirection == QSwipeGesture::NoDirection)
+ d->horizontalDirection = horizontal;
+ if (d->verticalDirection != vertical || d->horizontalDirection != horizontal) {
+ // the user has changed the direction!
+ result = QGestureRecognizer::CancelGesture;
+ }
+ result = QGestureRecognizer::TriggerGesture;
+ } else {
+ if (q->state() != Qt::NoGesture)
+ result = QGestureRecognizer::TriggerGesture;
+ else
+ result = QGestureRecognizer::MayBeGesture;
+ }
+ } else if (ev->touchPoints().size() > 3) {
+ result = QGestureRecognizer::CancelGesture;
+ } else { // less than 3 touch points
+ if (d->started && (ev->touchPointStates() & Qt::TouchPointPressed))
+ result = QGestureRecognizer::CancelGesture;
+ else if (d->started)
+ result = QGestureRecognizer::Ignore;
+ else
+ result = QGestureRecognizer::MayBeGesture;
}
break;
+ }
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonRelease:
+ result = QGestureRecognizer::Ignore;
+ break;
default:
+ result = QGestureRecognizer::Ignore;
break;
}
- return QObject::event(event);
+ return result;
}
-bool QPinchGesture::eventFilter(QObject *receiver, QEvent *event)
+void QSwipeGestureRecognizer::reset(QGesture *state)
{
-#ifdef Q_WS_WIN
- Q_D(QPinchGesture);
- if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) {
- QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
- QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
- QApplicationPrivate::WidgetStandardGesturesMap::iterator it;
- it = qAppPriv->widgetGestures.find(static_cast<QWidget*>(receiver));
- if (it == qAppPriv->widgetGestures.end())
- return false;
- if (this != it.value().pinch)
- return false;
- Qt::GestureState nextState = Qt::NoGesture;
- switch(ev->gestureType) {
- case QNativeGestureEvent::GestureBegin:
- // next we might receive the first gesture update event, so we
- // prepare for it.
- d->state = Qt::NoGesture;
- d->scaleFactor = d->lastScaleFactor = 1;
- d->rotationAngle = d->lastRotationAngle = 0;
- d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint();
- d->initialDistance = 0;
- return false;
- case QNativeGestureEvent::Rotate:
- d->lastRotationAngle = d->rotationAngle;
- d->rotationAngle = -1 * GID_ROTATE_ANGLE_FROM_ARGUMENT(ev->argument);
- nextState = Qt::GestureUpdated;
- event->accept();
- break;
- case QNativeGestureEvent::Zoom:
- if (d->initialDistance != 0) {
- d->lastScaleFactor = d->scaleFactor;
- int distance = int(qint64(ev->argument));
- d->scaleFactor = (qreal) distance / d->initialDistance;
- } else {
- d->initialDistance = int(qint64(ev->argument));
- }
- nextState = Qt::GestureUpdated;
- event->accept();
- break;
- case QNativeGestureEvent::GestureEnd:
- if (state() == Qt::NoGesture)
- return false; // some other gesture has ended
- nextState = Qt::GestureFinished;
- break;
- default:
- return false;
- }
- if (d->startCenterPoint.isNull())
- d->startCenterPoint = d->centerPoint;
- d->lastCenterPoint = d->centerPoint;
- d->centerPoint = static_cast<QWidget*>(receiver)->mapFromGlobal(ev->position);
- updateState(nextState);
- return true;
- }
-#endif
- return QGesture::eventFilter(receiver, event);
+ QSwipeGesture *q = static_cast<QSwipeGesture *>(state);
+ QSwipeGesturePrivate *d = q->d_func();
+
+ d->verticalDirection = d->horizontalDirection = QSwipeGesture::NoDirection;
+ d->swipeAngle = 0;
+
+ d->lastPositions[0] = d->lastPositions[1] = d->lastPositions[2] = QPoint();
+ d->started = false;
+ d->speed = 0;
+ d->time = QTime();
+
+ QGestureRecognizer::reset(state);
}
-/*! \internal */
-bool QPinchGesture::filterEvent(QEvent *event)
+//
+// QTapGestureRecognizer
+//
+
+QTapGestureRecognizer::QTapGestureRecognizer()
{
- Q_UNUSED(event);
- return false;
}
-/*! \internal */
-void QPinchGesture::reset()
+QGesture *QTapGestureRecognizer::create(QObject *target)
{
- Q_D(QPinchGesture);
- d->scaleFactor = d->lastScaleFactor = 0;
- d->rotationAngle = d->lastRotationAngle = 0;
- d->startCenterPoint = d->centerPoint = d->lastCenterPoint = QPoint();
- QGesture::reset();
+ if (target && target->isWidgetType()) {
+ static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents);
+ }
+ return new QTapGesture;
}
-/*!
- \property QPinchGesture::scaleFactor
-
- Specifies a scale factor of the pinch gesture.
-*/
-qreal QPinchGesture::scaleFactor() const
+QGestureRecognizer::Result QTapGestureRecognizer::recognize(QGesture *state,
+ QObject *,
+ QEvent *event)
{
- return d_func()->scaleFactor;
-}
+ QTapGesture *q = static_cast<QTapGesture *>(state);
+ QTapGesturePrivate *d = q->d_func();
-/*!
- \property QPinchGesture::lastScaleFactor
+ const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
- Specifies a previous scale factor of the pinch gesture.
-*/
-qreal QPinchGesture::lastScaleFactor() const
-{
- return d_func()->lastScaleFactor;
-}
+ QGestureRecognizer::Result result = QGestureRecognizer::CancelGesture;
-/*!
- \property QPinchGesture::rotationAngle
+ switch (event->type()) {
+ case QEvent::TouchBegin: {
+ d->position = ev->touchPoints().at(0).pos();
+ result = QGestureRecognizer::TriggerGesture;
+ break;
+ }
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd: {
+ if (q->state() != Qt::NoGesture && ev->touchPoints().size() == 1) {
+ QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
+ QPoint delta = p.pos().toPoint() - p.startPos().toPoint();
+ enum { TapRadius = 40 };
+ if (delta.manhattanLength() <= TapRadius) {
+ if (event->type() == QEvent::TouchEnd)
+ result = QGestureRecognizer::FinishGesture;
+ else
+ result = QGestureRecognizer::TriggerGesture;
+ }
+ }
+ break;
+ }
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonRelease:
+ result = QGestureRecognizer::Ignore;
+ break;
+ default:
+ result = QGestureRecognizer::Ignore;
+ break;
+ }
+ return result;
+}
- Specifies a rotation angle of the gesture.
-*/
-qreal QPinchGesture::rotationAngle() const
+void QTapGestureRecognizer::reset(QGesture *state)
{
- return d_func()->rotationAngle;
-}
+ QTapGesture *q = static_cast<QTapGesture *>(state);
+ QTapGesturePrivate *d = q->d_func();
-/*!
- \property QPinchGesture::lastRotationAngle
+ d->position = QPointF();
- Specifies a previous rotation angle of the gesture.
-*/
-qreal QPinchGesture::lastRotationAngle() const
-{
- return d_func()->lastRotationAngle;
+ QGestureRecognizer::reset(state);
}
-/*!
- \property QPinchGesture::centerPoint
+//
+// QTapAndHoldGestureRecognizer
+//
- Specifies a center point of the gesture. The point can be used as a center
- point that the object is rotated around.
-*/
-QPoint QPinchGesture::centerPoint() const
+QTapAndHoldGestureRecognizer::QTapAndHoldGestureRecognizer()
{
- return d_func()->centerPoint;
}
-/*!
- \property QPinchGesture::lastCenterPoint
-
- Specifies a previous center point of the gesture.
-*/
-QPoint QPinchGesture::lastCenterPoint() const
+QGesture *QTapAndHoldGestureRecognizer::create(QObject *target)
{
- return d_func()->lastCenterPoint;
+ if (target && target->isWidgetType()) {
+ static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents);
+ }
+ return new QTapAndHoldGesture;
}
-/*!
- \property QPinchGesture::startCenterPoint
-
- Specifies an initial center point of the gesture. Difference between the
- startCenterPoint and the centerPoint is the distance at which pinching
- fingers has shifted.
-*/
-QPoint QPinchGesture::startCenterPoint() const
+QGestureRecognizer::Result
+QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
+ QEvent *event)
{
- return d_func()->startCenterPoint;
+ QTapAndHoldGesture *q = static_cast<QTapAndHoldGesture *>(state);
+ QTapAndHoldGesturePrivate *d = q->d_func();
+
+ if (object == state && event->type() == QEvent::Timer) {
+ q->killTimer(d->timerId);
+ d->timerId = 0;
+ return QGestureRecognizer::Ignore | QGestureRecognizer::ConsumeEventHint;
+ }
+
+ const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
+
+ QGestureRecognizer::Result result = QGestureRecognizer::CancelGesture;
+
+ enum { TimerInterval = 2000 };
+ enum { TapRadius = 40 };
+
+ switch (event->type()) {
+ case QEvent::TouchBegin:
+ d->position = ev->touchPoints().at(0).pos();
+ if (d->timerId)
+ q->killTimer(d->timerId);
+ d->timerId = q->startTimer(TimerInterval);
+ result = QGestureRecognizer::TriggerGesture;
+ break;
+ case QEvent::TouchEnd:
+ if (d->timerId)
+ result = QGestureRecognizer::CancelGesture;
+ else
+ result = QGestureRecognizer::FinishGesture;
+ break;
+ case QEvent::TouchUpdate:
+ if (q->state() != Qt::NoGesture && ev->touchPoints().size() == 1) {
+ QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
+ QPoint delta = p.pos().toPoint() - p.startPos().toPoint();
+ if (delta.manhattanLength() <= TapRadius)
+ result = QGestureRecognizer::TriggerGesture;
+ }
+ break;
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonRelease:
+ result = QGestureRecognizer::Ignore;
+ break;
+ default:
+ result = QGestureRecognizer::Ignore;
+ break;
+ }
+ return result;
}
-QT_END_NAMESPACE
+void QTapAndHoldGestureRecognizer::reset(QGesture *state)
+{
+ QTapAndHoldGesture *q = static_cast<QTapAndHoldGesture *>(state);
+ QTapAndHoldGesturePrivate *d = q->d_func();
+
+ d->position = QPointF();
+ if (d->timerId)
+ q->killTimer(d->timerId);
+ d->timerId = 0;
-#include "moc_qstandardgestures.cpp"
+ QGestureRecognizer::reset(state);
+}
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstandardgestures.h b/src/gui/kernel/qstandardgestures.h
deleted file mode 100644
index 8b5421b66..000000000
--- a/src/gui/kernel/qstandardgestures.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSTANDARDGESTURES_H
-#define QSTANDARDGESTURES_H
-
-#include <QtGui/qevent.h>
-#include <QtCore/qbasictimer.h>
-
-#include <QtGui/qgesture.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QPanGesturePrivate;
-class Q_GUI_EXPORT QPanGesture : public QGesture
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QPanGesture)
-
- Q_PROPERTY(QSize totalOffset READ totalOffset)
- Q_PROPERTY(QSize lastOffset READ lastOffset)
-
-public:
- QPanGesture(QWidget *parent);
-
- bool filterEvent(QEvent *event);
-
- QSize totalOffset() const;
- QSize lastOffset() const;
-
-protected:
- void reset();
-
-private:
- bool event(QEvent *event);
- bool eventFilter(QObject *receiver, QEvent *event);
-
- friend class QWidget;
-};
-
-class QPinchGesturePrivate;
-class Q_GUI_EXPORT QPinchGesture : public QGesture
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QPinchGesture)
-
- Q_PROPERTY(qreal scaleFactor READ scaleFactor)
- Q_PROPERTY(qreal lastScaleFactor READ lastScaleFactor)
-
- Q_PROPERTY(qreal rotationAngle READ rotationAngle)
- Q_PROPERTY(qreal lastRotationAngle READ lastRotationAngle)
-
- Q_PROPERTY(QPoint startCenterPoint READ startCenterPoint)
- Q_PROPERTY(QPoint lastCenterPoint READ lastCenterPoint)
- Q_PROPERTY(QPoint centerPoint READ centerPoint)
-
-public:
- QPinchGesture(QWidget *parent);
-
- bool filterEvent(QEvent *event);
- void reset();
-
- QPoint startCenterPoint() const;
- QPoint lastCenterPoint() const;
- QPoint centerPoint() const;
-
- qreal scaleFactor() const;
- qreal lastScaleFactor() const;
-
- qreal rotationAngle() const;
- qreal lastRotationAngle() const;
-
-private:
- bool event(QEvent *event);
- bool eventFilter(QObject *receiver, QEvent *event);
-
- friend class QWidget;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSTANDARDGESTURES_H
diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h
index c52d16bb2..8fea2bc30 100644
--- a/src/gui/kernel/qstandardgestures_p.h
+++ b/src/gui/kernel/qstandardgestures_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,61 +53,59 @@
// We mean it.
//
-#include "qevent.h"
-#include "qbasictimer.h"
-#include "qdebug.h"
+#include "qgesturerecognizer.h"
+#include "private/qgesture_p.h"
-#include "qgesture.h"
-#include "qgesture_p.h"
+QT_BEGIN_NAMESPACE
-#include "qstandardgestures.h"
+class QPanGestureRecognizer : public QGestureRecognizer
+{
+public:
+ QPanGestureRecognizer();
-QT_BEGIN_NAMESPACE
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
+ void reset(QGesture *state);
+};
-class QPanGesturePrivate : public QGesturePrivate
+class QPinchGestureRecognizer : public QGestureRecognizer
{
- Q_DECLARE_PUBLIC(QPanGesture)
+public:
+ QPinchGestureRecognizer();
+
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
+ void reset(QGesture *state);
+};
+class QSwipeGestureRecognizer : public QGestureRecognizer
+{
public:
- QPanGesturePrivate()
- {
-#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA)
- panFinishedTimer = 0;
-#endif
- }
-
- QSize totalOffset;
- QSize lastOffset;
- QPoint lastPosition;
-
-#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA)
- int panFinishedTimer;
-#endif
+ QSwipeGestureRecognizer();
+
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
+ void reset(QGesture *state);
};
-class QPinchGesturePrivate : public QGesturePrivate
+class QTapGestureRecognizer : public QGestureRecognizer
{
- Q_DECLARE_PUBLIC(QPinchGesture)
+public:
+ QTapGestureRecognizer();
+
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
+ void reset(QGesture *state);
+};
+class QTapAndHoldGestureRecognizer : public QGestureRecognizer
+{
public:
- QPinchGesturePrivate()
- : scaleFactor(0), lastScaleFactor(0),
- rotationAngle(0), lastRotationAngle(0)
-#ifdef Q_WS_WIN
- ,initialDistance(0)
-#endif
- {
- }
- qreal scaleFactor;
- qreal lastScaleFactor;
- qreal rotationAngle;
- qreal lastRotationAngle;
- QPoint startCenterPoint;
- QPoint lastCenterPoint;
- QPoint centerPoint;
-#ifdef Q_WS_WIN
- int initialDistance;
-#endif
+ QTapAndHoldGestureRecognizer();
+
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
+ void reset(QGesture *state);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 7596802ed..ef680a462 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -139,6 +139,7 @@ void QMacWindowFader::performFade()
extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); // qapplication.cpp;
extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm
extern QWidget * mac_mouse_grabber;
+extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds)
{
@@ -748,7 +749,11 @@ void qt_mac_dispatchNCMouseMessage(void * /* NSWindow* */eventWindow, void * /*
NSRect frameRect = [window frame];
if (fakeNCEvents || NSMouseInRect(globalPoint, frameRect, NO)) {
NSRect contentRect = [window contentRectForFrameRect:frameRect];
- if (fakeNCEvents || !NSMouseInRect(globalPoint, contentRect, NO)) {
+ qglobalPoint = QPoint(flipPoint(globalPoint).toPoint());
+ QWidget *w = widgetToGetEvent->childAt(widgetToGetEvent->mapFromGlobal(qglobalPoint));
+ // check that the mouse pointer is on the non-client area and
+ // there are not widgets in it.
+ if (fakeNCEvents || (!NSMouseInRect(globalPoint, contentRect, NO) && !w)) {
qglobalPoint = QPoint(flipPoint(globalPoint).toPoint());
qlocalPoint = widgetToGetEvent->mapFromGlobal(qglobalPoint);
processThisEvent = true;
@@ -759,8 +764,11 @@ void qt_mac_dispatchNCMouseMessage(void * /* NSWindow* */eventWindow, void * /*
// This is not an NC area mouse message.
if (!processThisEvent)
return;
+
// If the window is frame less, generate fake mouse events instead. (floating QToolBar)
- if (fakeNCEvents && (widgetToGetEvent->window()->windowFlags() & Qt::FramelessWindowHint))
+ // or if someone already got an explicit or implicit grab
+ if (mac_mouse_grabber || qt_button_down ||
+ (fakeNCEvents && (widgetToGetEvent->window()->windowFlags() & Qt::FramelessWindowHint)))
fakeMouseEvents = true;
Qt::MouseButton button;
@@ -838,8 +846,15 @@ void qt_mac_dispatchNCMouseMessage(void * /* NSWindow* */eventWindow, void * /*
leftButtonIsRightButton = false;
}
}
+
QMouseEvent qme(eventType, qlocalPoint, qglobalPoint, button, button, keyMods);
qt_sendSpontaneousEvent(widgetToGetEvent, &qme);
+
+ // We don't need to set the implicit grab widget here because we won't
+ // reach this point if then event type is Press over a Qt widget.
+ // However we might need to unset it if the event is Release.
+ if (eventType == QEvent::MouseButtonRelease)
+ qt_button_down = 0;
#endif
}
@@ -873,11 +888,12 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev
// Find the widget that *should* get the event (e.g., maybe it was a pop-up,
// they always get the mouse event).
QWidget *qwidget = [theView qt_qwidget];
- QWidget *widgetToGetMouse = qwidget;
+ QWidget *widgetToGetMouse = 0;
+ NSView *tmpView = 0;
QWidget *popup = qAppInstance()->activePopupWidget();
- NSView *tmpView = theView;
+ QPoint qglobalPoint(flipPoint(globalPoint).toPoint());
- if (popup && popup != qwidget->window()) {
+ if (popup) {
widgetToGetMouse = popup;
tmpView = qt_mac_nativeview_for(popup);
windowPoint = [[tmpView window] convertScreenToBase:globalPoint];
@@ -895,7 +911,17 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev
widgetToGetMouse =
[static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(tmpView) qt_qwidget];
}
+ } else {
+ extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
+ QPoint pos;
+ widgetToGetMouse = QApplicationPrivate::pickMouseReceiver(qwidget, qglobalPoint,
+ pos, eventType,
+ button, qt_button_down, 0);
+ if (widgetToGetMouse)
+ tmpView = qt_mac_nativeview_for(widgetToGetMouse);
}
+ if (!widgetToGetMouse)
+ return false;
NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil];
QPoint qlocalPoint(localPoint.x, localPoint.y);
@@ -941,14 +967,13 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev
break;
}
[QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->localPoint = localPoint;
- QPoint qglobalPoint(flipPoint(globalPoint).toPoint());
QMouseEvent qme(eventType, qlocalPoint, qglobalPoint, button, buttons, keyMods);
qt_sendSpontaneousEvent(widgetToGetMouse, &qme);
if (eventType == QEvent::MouseButtonPress && button == Qt::RightButton) {
QContextMenuEvent qcme(QContextMenuEvent::Mouse, qlocalPoint, qglobalPoint, keyMods);
qt_sendSpontaneousEvent(widgetToGetMouse, &qcme);
}
- return qme.isAccepted();
+ return true;
#endif
}
@@ -1148,16 +1173,23 @@ CGFloat qt_mac_get_scalefactor()
#endif
}
-QString qt_mac_get_pasteboardString()
+QString qt_mac_get_pasteboardString(OSPasteboardRef paste)
{
QMacCocoaAutoReleasePool pool;
- NSPasteboard *pb = [NSPasteboard generalPasteboard];
- NSString *text = [pb stringForType:NSStringPboardType];
- if (text) {
- return qt_mac_NSStringToQString(text);
+ NSPasteboard *pb = nil;
+ CFStringRef pbname;
+ if (PasteboardCopyName (paste, &pbname)) {
+ pb = [NSPasteboard generalPasteboard];
} else {
- return QString();
+ pb = [NSPasteboard pasteboardWithName:reinterpret_cast<const NSString *>(pbname)];
+ CFRelease (pbname);
+ }
+ if (pb) {
+ NSString *text = [pb stringForType:NSStringPboardType];
+ if (text)
+ return qt_mac_NSStringToQString(text);
}
+ return QString();
}
QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height)
@@ -1238,4 +1270,12 @@ void qt_mac_menu_collapseSeparators(void */*NSMenu **/ theMenu, bool collapse)
}
}
+#ifdef QT_MAC_USE_COCOA
+void qt_cocoaChangeOverrideCursor(const QCursor &cursor)
+{
+ QMacCocoaAutoReleasePool pool;
+ [static_cast<NSCursor *>(qt_mac_nsCursorForQCursor(cursor)) set];
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index 24d709687..f11ccc56d 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -116,7 +116,7 @@ typedef struct CGPoint NSPoint;
QT_BEGIN_NAMESPACE
Qt::MouseButtons qt_mac_get_buttons(int buttons);
Qt::MouseButton qt_mac_get_button(EventMouseButton button);
-void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds = 0);
+void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds = 0.15);
bool macWindowIsTextured(void * /*OSWindowRef*/ window);
void macWindowToolbarShow(const QWidget *widget, bool show );
void macWindowToolbarSet( void * /*OSWindowRef*/ window, void* toolbarRef );
@@ -133,6 +133,7 @@ bool qt_mac_checkForNativeSizeGrip(const QWidget *widget);
void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent);
#ifdef QT_MAC_USE_COCOA
bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent);
+void qt_cocoaChangeOverrideCursor(const QCursor &cursor);
#endif
void qt_mac_menu_collapseSeparators(void * /*NSMenu */ menu, bool collapse);
bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent);
@@ -169,7 +170,7 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list);
void qt_syncCocoaTitleBarButtons(OSWindowRef window, QWidget *widgetForWindow);
CGFloat qt_mac_get_scalefactor();
-QString qt_mac_get_pasteboardString();
+QString qt_mac_get_pasteboardString(OSPasteboardRef paste);
#ifdef __OBJC__
inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist)
diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h
index 6ddd9a242..fa084ff90 100644
--- a/src/gui/kernel/qt_gui_pch.h
+++ b/src/gui/kernel/qt_gui_pch.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qt_mac.cpp b/src/gui/kernel/qt_mac.cpp
index 642aa5cec..79b869f6c 100644
--- a/src/gui/kernel/qt_mac.cpp
+++ b/src/gui/kernel/qt_mac.cpp
@@ -1,16 +1,17 @@
/****************************************************************************
- **
- ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
- **
- ** This file is part of the QtGui module of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,27 +21,23 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
- **
- ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- **
- ****************************************************************************/
+**
+****************************************************************************/
#include <private/qt_mac_p.h>
#include <private/qpixmap_mac_p.h>
diff --git a/src/gui/kernel/qt_mac_p.h b/src/gui/kernel/qt_mac_p.h
index 568867146..a28cfa373 100644
--- a/src/gui/kernel/qt_mac_p.h
+++ b/src/gui/kernel/qt_mac_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
new file mode 100644
index 000000000..08f8bb516
--- /dev/null
+++ b/src/gui/kernel/qt_s60_p.h
@@ -0,0 +1,352 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT_S60_P_H
+#define QT_S60_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "QtGui/qwindowdefs.h"
+#include "private/qcore_symbian_p.h"
+#include "qhash.h"
+#include "qpoint.h"
+#include "QtGui/qfont.h"
+#include "QtGui/qimage.h"
+#include "QtGui/qevent.h"
+#include "qpointer.h"
+#include "qapplication.h"
+#include <w32std.h>
+#include <coecntrl.h>
+#include <eikenv.h>
+#include <eikappui.h>
+
+#ifdef Q_WS_S60
+#include <aknutils.h> // AknLayoutUtils
+#include <avkon.hrh> // EEikStatusPaneUidTitle
+#include <akntitle.h> // CAknTitlePane
+#include <akncontext.h> // CAknContextPane
+#include <eikspane.h> // CEikStatusPane
+#include <aknpopupfader.h> // MAknFadedComponent and TAknPopupFader
+#endif
+
+QT_BEGIN_NAMESPACE
+
+// Application internal HandleResourceChangeL events,
+// system events seems to start with 0x10
+const TInt KInternalStatusPaneChange = 0x50000000;
+
+//this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2
+#define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13)
+
+class QS60Data
+{
+public:
+ QS60Data();
+ TUid uid;
+ int screenDepth;
+ QPoint lastCursorPos;
+ QPoint lastPointerEventPos;
+ QPointer<QWidget> lastPointerEventTarget;
+ QPointer<QWidget> mousePressTarget;
+ int screenWidthInPixels;
+ int screenHeightInPixels;
+ int screenWidthInTwips;
+ int screenHeightInTwips;
+ int defaultDpiX;
+ int defaultDpiY;
+ WId curWin;
+ int virtualMouseLastKey;
+ int virtualMouseAccel;
+ int virtualMouseMaxAccel;
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ int brokenPointerCursors : 1;
+#endif
+ int hasTouchscreen : 1;
+ int mouseInteractionEnabled : 1;
+ int virtualMouseRequired : 1;
+ int qtOwnsS60Environment : 1;
+ int supportsPremultipliedAlpha : 1;
+ QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
+ static inline void updateScreenSize();
+ static inline RWsSession& wsSession();
+ static inline RWindowGroup& windowGroup();
+ static inline CWsScreenDevice* screenDevice();
+ static inline CCoeAppUi* appUi();
+#ifdef Q_WS_S60
+ static inline CEikStatusPane* statusPane();
+ static inline CCoeControl* statusPaneSubPane(TInt aPaneId);
+ static inline CAknTitlePane* titlePane();
+ static inline CAknContextPane* contextPane();
+ static inline CEikButtonGroupContainer* buttonGroupContainer();
+
+ TTrapHandler *s60InstalledTrapHandler;
+#endif
+};
+
+QS60Data* qGlobalS60Data();
+#define S60 qGlobalS60Data()
+
+class QAbstractLongTapObserver
+{
+public:
+ virtual void HandleLongTapEventL( const TPoint& aPenEventLocation,
+ const TPoint& aPenEventScreenLocation ) = 0;
+};
+class QLongTapTimer;
+
+
+class QSymbianControl : public CCoeControl, public QAbstractLongTapObserver
+#ifdef Q_WS_S60
+, public MAknFadedComponent
+#endif
+{
+public:
+ DECLARE_TYPE_ID(0x51740000) // Fun fact: the two first values are "Qt" in ASCII.
+
+public:
+ QSymbianControl(QWidget *w);
+ void ConstructL(bool isWindowOwning = false, bool desktop = false);
+ ~QSymbianControl();
+ void HandleResourceChange(int resourceType);
+ void HandlePointerEventL(const TPointerEvent& aPointerEvent);
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
+#if !defined(QT_NO_IM) && defined(Q_WS_S60)
+ TCoeInputCapabilities InputCapabilities() const;
+#endif
+ TTypeUid::Ptr MopSupplyObject(TTypeUid id);
+
+ inline QWidget* widget() const { return qwidget; }
+ void setWidget(QWidget *w);
+ void sendInputEvent(QWidget *widget, QInputEvent *inputEvent);
+ void setIgnoreFocusChanged(bool enabled) { m_ignoreFocusChanged = enabled; }
+ void CancelLongTapTimer();
+
+ void setFocusSafely(bool focus);
+
+#ifdef Q_WS_S60
+ void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); }
+
+protected: // from MAknFadedComponent
+ TInt CountFadedComponents() {return 1;}
+ CCoeControl* FadedComponent(TInt /*aIndex*/) {return this;}
+#else
+ #warning No fallback implementation for QSymbianControl::FadeBehindPopup
+ void FadeBehindPopup(bool /*fade*/){ }
+#endif
+
+protected:
+ void Draw(const TRect& aRect) const;
+ void SizeChanged();
+ void PositionChanged();
+ void FocusChanged(TDrawNow aDrawNow);
+
+private:
+ void HandlePointerEvent(const TPointerEvent& aPointerEvent);
+ TKeyResponse OfferKeyEvent(const TKeyEvent& aKeyEvent,TEventCode aType);
+ TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent);
+ bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent);
+ void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
+#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
+ void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event);
+#endif
+
+private:
+ static QSymbianControl *lastFocusedControl;
+
+private:
+ QWidget *qwidget;
+ QLongTapTimer* m_longTapDetector;
+ bool m_ignoreFocusChanged : 1;
+ bool m_symbianPopupIsOpen : 1;
+
+#ifdef Q_WS_S60
+ // Fader object used to fade everything except this menu and the CBA.
+ TAknPopupFader popupFader;
+#endif
+};
+
+inline QS60Data::QS60Data()
+{
+ memclr(this, sizeof(QS60Data)); //zero init data
+}
+
+inline void QS60Data::updateScreenSize()
+{
+ TPixelsTwipsAndRotation params;
+ int mode = S60->screenDevice()->CurrentScreenMode();
+ S60->screenDevice()->GetScreenModeSizeAndRotation(mode, params);
+ S60->screenWidthInPixels = params.iPixelSize.iWidth;
+ S60->screenHeightInPixels = params.iPixelSize.iHeight;
+ S60->screenWidthInTwips = params.iTwipsSize.iWidth;
+ S60->screenHeightInTwips = params.iTwipsSize.iHeight;
+
+ S60->virtualMouseMaxAccel = qMax(S60->screenHeightInPixels, S60->screenWidthInPixels) / 20;
+
+ TReal inches = S60->screenHeightInTwips / (TReal)KTwipsPerInch;
+ S60->defaultDpiY = S60->screenHeightInPixels / inches;
+ inches = S60->screenWidthInTwips / (TReal)KTwipsPerInch;
+ S60->defaultDpiX = S60->screenWidthInPixels / inches;
+}
+
+inline RWsSession& QS60Data::wsSession()
+{
+ return CCoeEnv::Static()->WsSession();
+}
+
+inline RWindowGroup& QS60Data::windowGroup()
+{
+ return CCoeEnv::Static()->RootWin();
+}
+
+inline CWsScreenDevice* QS60Data::screenDevice()
+{
+ return CCoeEnv::Static()->ScreenDevice();
+}
+
+inline CCoeAppUi* QS60Data::appUi()
+{
+ return CCoeEnv::Static()-> AppUi();
+}
+
+#ifdef Q_WS_S60
+inline CEikStatusPane* QS60Data::statusPane()
+{
+ return CEikonEnv::Static()->AppUiFactory()->StatusPane();
+}
+
+// Returns the application's status pane control, if not present returns NULL.
+inline CCoeControl* QS60Data::statusPaneSubPane( TInt aPaneId )
+{
+ const TUid paneUid = { aPaneId };
+ CEikStatusPane* statusPane = S60->statusPane();
+ if (statusPane && statusPane->PaneCapabilities(paneUid).IsPresent()) {
+ CCoeControl* control = NULL;
+ // ControlL shouldn't leave because the pane is present
+ TRAPD(err, control = statusPane->ControlL(paneUid));
+ return err != KErrNone ? NULL : control;
+ }
+ return NULL;
+}
+
+// Returns the application's title pane, if not present returns NULL.
+inline CAknTitlePane* QS60Data::titlePane()
+{
+ return static_cast<CAknTitlePane*>(S60->statusPaneSubPane(EEikStatusPaneUidTitle));
+}
+
+// Returns the application's title pane, if not present returns NULL.
+inline CAknContextPane* QS60Data::contextPane()
+{
+ return static_cast<CAknContextPane*>(S60->statusPaneSubPane(EEikStatusPaneUidContext));
+}
+
+inline CEikButtonGroupContainer* QS60Data::buttonGroupContainer()
+{
+ return CEikonEnv::Static()->AppUiFactory()->Cba();
+}
+#endif // Q_WS_S60
+
+static inline QFont qt_TFontSpec2QFontL(const TFontSpec &fontSpec)
+{
+ return QFont(
+ qt_TDesC2QString(fontSpec.iTypeface.iName),
+ fontSpec.iHeight / KTwipsPerPoint,
+ fontSpec.iFontStyle.StrokeWeight() == EStrokeWeightNormal ? QFont::Normal : QFont::Bold,
+ fontSpec.iFontStyle.Posture() == EPostureItalic
+ );
+}
+
+static inline QImage::Format qt_TDisplayMode2Format(TDisplayMode mode)
+{
+ QImage::Format format;
+ switch(mode) {
+ case EGray2:
+ format = QImage::Format_MonoLSB;
+ break;
+ case EColor256:
+ case EGray256:
+ format = QImage::Format_Indexed8;
+ break;
+ case EColor4K:
+ format = QImage::Format_RGB444;
+ break;
+ case EColor64K:
+ format = QImage::Format_RGB16;
+ break;
+ case EColor16M:
+ format = QImage::Format_RGB888;
+ break;
+ case EColor16MU:
+ format = QImage::Format_RGB32;
+ break;
+ case EColor16MA:
+ format = QImage::Format_ARGB32;
+ break;
+ case Q_SYMBIAN_ECOLOR16MAP:
+ format = QImage::Format_ARGB32_Premultiplied;
+ break;
+ default:
+ format = QImage::Format_Invalid;
+ break;
+ }
+ return format;
+}
+
+#ifndef QT_NO_CURSOR
+void qt_symbian_setWindowCursor(const QCursor &cursor, const CCoeControl* wid);
+void qt_symbian_setWindowGroupCursor(const QCursor &cursor, RWindowTreeNode &node);
+void qt_symbian_setGlobalCursor(const QCursor &cursor);
+void qt_symbian_set_cursor_visible(bool visible);
+bool qt_symbian_is_cursor_visible();
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QT_S60_P_H
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index c9597fd56..9e4cf60b4 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -163,7 +163,9 @@ extern "C" {
#endif // QT_NO_XRENDER
#ifndef QT_NO_XSYNC
+extern "C" {
# include "X11/extensions/sync.h"
+}
#endif
// #define QT_NO_XKB
@@ -428,6 +430,7 @@ struct QX11Data
// true if Qt is compiled w/ MIT-SHM support and MIT-SHM is supported on the connected Display
bool use_mitshm;
+ bool use_mitshm_pixmaps;
int mitshm_major;
// true if Qt is compiled w/ Tablet support and we have a tablet.
@@ -544,10 +547,12 @@ struct QX11Data
TARGETS,
MULTIPLE,
TIMESTAMP,
+ SAVE_TARGETS,
CLIP_TEMPORARY,
_QT_SELECTION,
_QT_CLIPBOARD_SENTINEL,
_QT_SELECTION_SENTINEL,
+ CLIPBOARD_MANAGER,
RESOURCE_MANAGER,
diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp
index 3ea9cb405..4261808b1 100644
--- a/src/gui/kernel/qtooltip.cpp
+++ b/src/gui/kernel/qtooltip.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
widget.
\ingroup helpsystem
- \mainclass
+
The tip is a short piece of text reminding the user of the
widget's function. It is drawn immediately below the given
@@ -183,7 +183,6 @@ QTipLabel::QTipLabel(const QString &text, QWidget *w)
setFrameStyle(QFrame::NoFrame);
setAlignment(Qt::AlignLeft);
setIndent(1);
- setWordWrap(Qt::mightBeRichText(text));
qApp->installEventFilter(this);
setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
setMouseTracking(true);
@@ -208,6 +207,7 @@ void QTipLabel::reuseTip(const QString &text)
}
#endif
+ setWordWrap(Qt::mightBeRichText(text));
setText(text);
QFontMetrics fm(font());
QSize extra(1, 0);
@@ -290,8 +290,8 @@ void QTipLabel::timerEvent(QTimerEvent *e)
// Fade out tip on mac (makes it invisible).
// The tip will not be deleted until a new tip is shown.
- // DRSWAT - Cocoa
- macWindowFade(qt_mac_window_for(this));
+ // DRSWAT - Cocoa
+ macWindowFade(qt_mac_window_for(this));
QTipLabel::instance->fadingOut = true; // will never be false again.
}
else
@@ -431,7 +431,7 @@ bool QTipLabel::tipChanged(const QPoint &pos, const QString &text, QObject *o)
void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect)
{
- if (QTipLabel::instance){ // a tip does already exist
+ if (QTipLabel::instance && QTipLabel::instance->isVisible()){ // a tip does already exist
if (text.isEmpty()){ // empty text means hide current tip
QTipLabel::instance->hideTip();
return;
diff --git a/src/gui/kernel/qtooltip.h b/src/gui/kernel/qtooltip.h
index 21989b8c3..237cb135b 100644
--- a/src/gui/kernel/qtooltip.h
+++ b/src/gui/kernel/qtooltip.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp
index 5a37801e6..0da3a9bb2 100644
--- a/src/gui/kernel/qwhatsthis.cpp
+++ b/src/gui/kernel/qwhatsthis.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE
widget, i.e. answering the question "What's This?".
\ingroup helpsystem
- \mainclass
+
"What's This?" help is part of an application's online help
system, and provides users with information about the
@@ -194,9 +194,9 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor
#ifndef QT_NO_CURSOR
setCursor(Qt::ArrowCursor);
#endif
-
QRect r;
doc = 0;
+ ensurePolished(); // Ensures style sheet font before size calc
if (Qt::mightBeRichText(text)) {
doc = new QTextDocument();
doc->setUndoRedoEnabled(false);
diff --git a/src/gui/kernel/qwhatsthis.h b/src/gui/kernel/qwhatsthis.h
index a041ccfc7..2b1496a31 100644
--- a/src/gui/kernel/qwhatsthis.h
+++ b/src/gui/kernel/qwhatsthis.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index c00f953d9..685d7ec89 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -82,8 +82,7 @@
#include "private/qstyle_p.h"
#include "private/qinputcontext_p.h"
#include "qfileinfo.h"
-#include "qstandardgestures.h"
-#include "qstandardgestures_p.h"
+#include "private/qsoftkeymanager_p.h"
#if defined (Q_WS_WIN)
# include <private/qwininputcontext_p.h>
@@ -94,6 +93,7 @@
# include "qx11info_x11.h"
#endif
+#include <private/qgraphicseffect_p.h>
#include <private/qwindowsurface_p.h>
#include <private/qbackingstore_p.h>
#ifdef Q_WS_MAC
@@ -101,6 +101,10 @@
#endif
#include <private/qpaintengine_raster_p.h>
+#if defined(Q_OS_SYMBIAN)
+#include "private/qt_s60_p.h"
+#endif
+
#include "qwidget_p.h"
#include "qaction_p.h"
#include "qlayout_p.h"
@@ -112,6 +116,7 @@
#include "private/qevent_p.h"
#include "private/qgraphicssystem_p.h"
+#include "private/qgesturemanager_p.h"
// widget/widget data creation count
//#define QWIDGET_EXTRA_DEBUG
@@ -145,24 +150,6 @@ static inline bool hasBackingStoreSupport()
#endif
}
-/*!
- \internal
-
- Returns true if \a p or any of its parents enable the
- Qt::BypassGraphicsProxyWidget window flag. Used in QWidget::show() and
- QWidget::setParent() to determine whether it's necessary to embed the
- widget into a QGraphicsProxyWidget or not.
-*/
-static inline bool bypassGraphicsProxyWidget(QWidget *p)
-{
- while (p) {
- if (p->windowFlags() & Qt::BypassGraphicsProxyWidget)
- return true;
- p = p->parentWidget();
- }
- return false;
-}
-
#ifdef Q_WS_MAC
# define QT_NO_PAINT_DEBUG
#endif
@@ -182,6 +169,10 @@ QWidgetPrivate::QWidgetPrivate(int version)
, widgetItem(0)
, extraPaintEngine(0)
, polished(0)
+ , graphicsEffect(0)
+#if !defined(QT_NO_IM)
+ , imHints(Qt::ImhNone)
+#endif
, inheritedFontResolveMask(0)
, inheritedPaletteResolveMask(0)
, leftmargin(0)
@@ -206,6 +197,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
, picture(0)
#elif defined(Q_WS_WIN)
, noPaintOnScreen(0)
+ , nativeGesturePanEnabled(0)
#elif defined(Q_WS_MAC)
, needWindowChange(0)
, isGLWidget(0)
@@ -237,6 +229,10 @@ QWidgetPrivate::~QWidgetPrivate()
if (extra)
deleteExtra();
+
+#ifndef QT_NO_GRAPHICSEFFECT
+ delete graphicsEffect;
+#endif //QT_NO_GRAPHICSEFFECT
}
QWindowSurface *QWidgetPrivate::createDefaultWindowSurface()
@@ -370,7 +366,8 @@ bool QWidget::hasEditFocus() const
normally; otherwise, Qt::Key_Up and Qt::Key_Down are used to
change focus.
- This feature is only available in Qt for Embedded Linux.
+ This feature is only available in Qt for Embedded Linux and Qt
+ for Symbian.
\sa hasEditFocus(), QApplication::keypadNavigationEnabled()
*/
@@ -454,7 +451,7 @@ void QWidget::setAutoFillBackground(bool enabled)
\brief The QWidget class is the base class of all user interface objects.
\ingroup basicwidgets
- \mainclass
+
The widget is the atom of the user interface: it receives mouse, keyboard
and other events from the window system, and paints a representation of
@@ -890,10 +887,35 @@ void QWidget::setAutoFillBackground(bool enabled)
\endlist
\sa QEvent, QPainter, QGridLayout, QBoxLayout
+
+ \section1 Softkeys
+
+ Since Qt 4.6, Softkeys are usually physical keys on a device that have a corresponding label or
+ other visual representation on the screen that is generally located next to its
+ physical counterpart. They are most often found on mobile phone platforms. In
+ modern touch based user interfaces it is also possible to have softkeys that do
+ not correspond to any physical keys. Softkeys differ from other onscreen labels
+ in that they are contextual.
+
+ In Qt, contextual softkeys are added to a widget by calling addAction() and
+ passing a \c QAction with a softkey role set on it. When the widget
+ containing the softkey actions has focus, its softkeys should appear in
+ the user interface. Softkeys are discovered by traversing the widget
+ hierarchy so it is possible to define a single set of softkeys that are
+ present at all times by calling addAction() for a given top level widget.
+
+ On some platforms, this concept overlaps with \c QMenuBar such that if no
+ other softkeys are found and the top level widget is a QMainWindow containing
+ a QMenuBar, the menubar actions may appear on one of the softkeys.
+
+ Note: Currently softkeys are only supported on the Symbian Platform.
+
+ \sa addAction(), QAction, QMenuBar
+
*/
-QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid
-QWidgetSet *QWidgetPrivate::uncreatedWidgets = 0; // widgets with no wid
+QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid
+QWidgetSet *QWidgetPrivate::allWidgets = 0; // widgets with no wid
/*****************************************************************************
@@ -933,6 +955,26 @@ QRegion qt_dirtyRegion(QWidget *widget)
\endlist
*/
+struct QWidgetExceptionCleaner
+{
+ /* this cleans up when the constructor throws an exception */
+ static inline void cleanup(QWidget *that, QWidgetPrivate *d)
+ {
+#ifdef QT_NO_EXCEPTIONS
+ Q_UNUSED(that);
+ Q_UNUSED(d);
+#else
+ QWidgetPrivate::allWidgets->remove(that);
+ if (d->focus_next != that) {
+ if (d->focus_next)
+ d->focus_next->d_func()->focus_prev = d->focus_prev;
+ if (d->focus_prev)
+ d->focus_prev->d_func()->focus_next = d->focus_next;
+ }
+#endif
+ }
+};
+
/*!
Constructs a widget which is a child of \a parent, with widget
flags set to \a f.
@@ -962,7 +1004,12 @@ QRegion qt_dirtyRegion(QWidget *widget)
QWidget::QWidget(QWidget *parent, Qt::WindowFlags f)
: QObject(*new QWidgetPrivate, 0), QPaintDevice()
{
- d_func()->init(parent, f);
+ QT_TRY {
+ d_func()->init(parent, f);
+ } QT_CATCH(...) {
+ QWidgetExceptionCleaner::cleanup(this, d_func());
+ QT_RETHROW;
+ }
}
#ifdef QT3_SUPPORT
@@ -973,8 +1020,13 @@ QWidget::QWidget(QWidget *parent, Qt::WindowFlags f)
QWidget::QWidget(QWidget *parent, const char *name, Qt::WindowFlags f)
: QObject(*new QWidgetPrivate, 0), QPaintDevice()
{
- d_func()->init(parent , f);
- setObjectName(QString::fromAscii(name));
+ QT_TRY {
+ d_func()->init(parent , f);
+ setObjectName(QString::fromAscii(name));
+ } QT_CATCH(...) {
+ QWidgetExceptionCleaner::cleanup(this, d_func());
+ QT_RETHROW;
+ }
}
#endif
@@ -983,7 +1035,13 @@ QWidget::QWidget(QWidget *parent, const char *name, Qt::WindowFlags f)
QWidget::QWidget(QWidgetPrivate &dd, QWidget* parent, Qt::WindowFlags f)
: QObject(dd, 0), QPaintDevice()
{
- d_func()->init(parent, f);
+ Q_D(QWidget);
+ QT_TRY {
+ d->init(parent, f);
+ } QT_CATCH(...) {
+ QWidgetExceptionCleaner::cleanup(this, d_func());
+ QT_RETHROW;
+ }
}
/*!
@@ -1058,8 +1116,8 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
if (QApplication::type() == QApplication::Tty)
qFatal("QWidget: Cannot create a QWidget when no GUI is being used");
- Q_ASSERT(uncreatedWidgets);
- uncreatedWidgets->insert(q);
+ Q_ASSERT(allWidgets);
+ allWidgets->insert(q);
QWidget *desktopWidget = 0;
if (parentWidget && parentWidget->windowType() == Qt::Desktop) {
@@ -1106,10 +1164,6 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
if (f & Qt::MSWindowsOwnDC)
q->setAttribute(Qt::WA_NativeWindow);
-#ifdef Q_WS_WINCE
- data.window_state_internal = 0;
-#endif
-
q->setAttribute(Qt::WA_QuitOnClose); // might be cleared in adjustQuitOnCloseAttribute()
adjustQuitOnCloseAttribute();
@@ -1265,7 +1319,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
d->create_sys(window, initializeWindow, destroyOldWindow);
// a real toplevel window needs a backing store
- if (isWindow()) {
+ if (isWindow() && windowType() != Qt::Desktop) {
delete d->topData()->backingStore;
// QWidgetBackingStore will check this variable, hence it must be 0
d->topData()->backingStore = 0;
@@ -1288,6 +1342,8 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
d->setWindowIcon_sys(true);
if (isWindow() && !d->topData()->iconText.isEmpty())
d->setWindowIconText_helper(d->topData()->iconText);
+ if (isWindow() && !d->topData()->caption.isEmpty())
+ d->setWindowTitle_helper(d->topData()->caption);
if (windowType() != Qt::Desktop) {
d->updateSystemBackground();
@@ -1352,16 +1408,36 @@ QWidget::~QWidget()
}
#endif
- clearFocus();
+ QT_TRY {
+ clearFocus();
+ } QT_CATCH(...) {
+ // swallow this problem because we are in a destructor
+ }
d->setDirtyOpaqueRegion();
- if (isWindow() && isVisible() && internalWinId())
- d->close_helper(QWidgetPrivate::CloseNoEvent);
-#if defined(Q_WS_WIN) || defined(Q_WS_X11)
- else if (!internalWinId() && isVisible())
+ if (isWindow() && isVisible() && internalWinId()) {
+ QT_TRY {
+ d->close_helper(QWidgetPrivate::CloseNoEvent);
+ } QT_CATCH(...) {
+ // if we're out of memory, at least hide the window.
+ QT_TRY {
+ hide();
+ } QT_CATCH(...) {
+ // and if that also doesn't work, then give up
+ }
+ }
+ }
+
+#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS)
+ else if (!internalWinId() && isVisible()) {
+ qApp->d_func()->sendSyntheticEnterLeave(this);
+#ifdef Q_WS_QWS
+ } else if (isVisible()) {
qApp->d_func()->sendSyntheticEnterLeave(this);
#endif
+ }
+#endif
if (QWidgetBackingStore *bs = d->maybeBackingStore()) {
bs->removeDirtyWidget(this);
@@ -1385,12 +1461,15 @@ QWidget::~QWidget()
QApplication::removePostedEvents(this);
- destroy(); // platform-dependent cleanup
-
+ QT_TRY {
+ destroy(); // platform-dependent cleanup
+ } QT_CATCH(...) {
+ // if this fails we can't do anything about it but at least we are not allowed to throw.
+ }
--QWidgetPrivate::instanceCounter;
- if (QWidgetPrivate::uncreatedWidgets) // might have been deleted by ~QApplication
- QWidgetPrivate::uncreatedWidgets->remove(this);
+ if (QWidgetPrivate::allWidgets) // might have been deleted by ~QApplication
+ QWidgetPrivate::allWidgets->remove(this);
QEvent e(QEvent::Destroy);
QCoreApplication::sendEvent(this, &e);
@@ -1410,16 +1489,26 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier
bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop;
if (mapper && data.winid && !userDesktopWidget) {
mapper->remove(data.winid);
- uncreatedWidgets->insert(q);
}
+ const WId oldWinId = data.winid;
+
data.winid = id;
#if defined(Q_WS_X11)
hd = id; // X11: hd == ident
#endif
if (mapper && id && !userDesktopWidget) {
mapper->insert(data.winid, q);
- uncreatedWidgets->remove(q);
+ }
+
+ if(oldWinId != id) {
+ // Do not emit an event when the old winId is destroyed. This only
+ // happens (a) during widget destruction, and (b) immediately prior
+ // to creation of a new winId, for example as a result of re-parenting.
+ if(id != 0) {
+ QEvent e(QEvent::WinIdChange);
+ QCoreApplication::sendEvent(q, &e);
+ }
}
}
@@ -1464,7 +1553,9 @@ void QWidgetPrivate::createExtra()
extra = new QWExtra;
extra->glContext = 0;
extra->topextra = 0;
+#ifndef QT_NO_GRAPHICSVIEW
extra->proxyWidget = 0;
+#endif
#ifndef QT_NO_CURSOR
extra->curs = 0;
#endif
@@ -1548,9 +1639,9 @@ bool QWidgetPrivate::isOverlapped(const QRect &rect) const
continue;
}
- if (qRectIntersects(sibling->data->crect, r)) {
+ if (qRectIntersects(sibling->d_func()->effectiveRectFor(sibling->data->crect), r)) {
const QWExtra *siblingExtra = sibling->d_func()->extra;
- if (siblingExtra && siblingExtra->hasMask
+ if (siblingExtra && siblingExtra->hasMask && !sibling->d_func()->graphicsEffect
&& !siblingExtra->mask.translated(sibling->data->crect.topLeft()).intersects(r)) {
continue;
}
@@ -1614,12 +1705,13 @@ void QWidgetPrivate::propagatePaletteChange()
{
Q_Q(QWidget);
// Propagate a new inherited mask to all children.
- if (!q->parentWidget() && extra && extra->proxyWidget) {
#ifndef QT_NO_GRAPHICSVIEW
+ if (!q->parentWidget() && extra && extra->proxyWidget) {
QGraphicsProxyWidget *p = extra->proxyWidget;
inheritedPaletteResolveMask = p->d_func()->inheritedPaletteResolveMask | p->palette().resolve();
+ } else
#endif //QT_NO_GRAPHICSVIEW
- } else if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
+ if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
inheritedPaletteResolveMask = 0;
}
int mask = data.pal.resolve() | inheritedPaletteResolveMask;
@@ -1649,7 +1741,7 @@ QRect QWidgetPrivate::clipRect() const
const QWidget * w = q;
if (!w->isVisible())
return QRect();
- QRect r = q->rect();
+ QRect r = effectiveRectFor(q->rect());
int ox = 0;
int oy = 0;
while (w
@@ -1704,12 +1796,33 @@ QRegion QWidgetPrivate::clipRegion() const
return r;
}
+#ifndef QT_NO_GRAPHICSEFFECT
+void QWidgetPrivate::invalidateGraphicsEffectsRecursively()
+{
+ Q_Q(QWidget);
+ QWidget *w = q;
+ do {
+ if (w->graphicsEffect()) {
+ QWidgetEffectSourcePrivate *sourced =
+ static_cast<QWidgetEffectSourcePrivate *>(w->graphicsEffect()->source()->d_func());
+ if (!sourced->updateDueToGraphicsEffect)
+ w->graphicsEffect()->source()->d_func()->invalidateCache();
+ }
+ w = w->parentWidget();
+ } while (w);
+}
+#endif //QT_NO_GRAPHICSEFFECT
+
void QWidgetPrivate::setDirtyOpaqueRegion()
{
Q_Q(QWidget);
dirtyOpaqueChildren = true;
+#ifndef QT_NO_GRAPHICSEFFECT
+ invalidateGraphicsEffectsRecursively();
+#endif //QT_NO_GRAPHICSEFFECT
+
if (q->isWindow())
return;
@@ -1723,18 +1836,6 @@ void QWidgetPrivate::setDirtyOpaqueRegion()
pd->setDirtyOpaqueRegion();
}
-QRegion QWidgetPrivate::getOpaqueRegion() const
-{
- Q_Q(const QWidget);
-
- QRegion r = isOpaque ? q->rect() : getOpaqueChildren();
- if (extra && extra->hasMask)
- r &= extra->mask;
- if (r.isEmpty())
- return r;
- return r & clipRect();
-}
-
const QRegion &QWidgetPrivate::getOpaqueChildren() const
{
if (!dirtyOpaqueChildren)
@@ -1749,9 +1850,17 @@ const QRegion &QWidgetPrivate::getOpaqueChildren() const
continue;
const QPoint offset = child->geometry().topLeft();
- that->opaqueChildren += child->d_func()->getOpaqueRegion().translated(offset);
+ QWidgetPrivate *childd = child->d_func();
+ QRegion r = childd->isOpaque ? child->rect() : childd->getOpaqueChildren();
+ if (childd->extra && childd->extra->hasMask)
+ r &= childd->extra->mask;
+ if (r.isEmpty())
+ continue;
+ r.translate(offset);
+ that->opaqueChildren += r;
}
+ that->opaqueChildren &= q_func()->rect();
that->dirtyOpaqueChildren = false;
return that->opaqueChildren;
@@ -1791,12 +1900,14 @@ void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirt
break;
QWidgetPrivate *pd = w->parentWidget()->d_func();
const int myIndex = pd->children.indexOf(const_cast<QWidget *>(w));
+ const QRect widgetGeometry = w->d_func()->effectiveRectFor(w->data->crect);
for (int i = myIndex + 1; i < pd->children.size(); ++i) {
QWidget *sibling = qobject_cast<QWidget *>(pd->children.at(i));
if (!sibling || !sibling->isVisible() || sibling->isWindow())
continue;
- if (!qRectIntersects(sibling->data->crect, w->data->crect))
+ const QRect siblingGeometry = sibling->d_func()->effectiveRectFor(sibling->data->crect);
+ if (!qRectIntersects(siblingGeometry, widgetGeometry))
continue;
if (dirtyClipBoundingRect) {
@@ -1804,7 +1915,7 @@ void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirt
dirtyClipBoundingRect = false;
}
- if (!qRectIntersects(sibling->data->crect, clipBoundingRect.translated(parentOffset)))
+ if (!qRectIntersects(siblingGeometry, clipBoundingRect.translated(parentOffset)))
continue;
if (dirtyParentClip) {
@@ -1816,7 +1927,8 @@ void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirt
const QRect siblingClipRect(sibling->d_func()->clipRect());
QRegion siblingDirty(parentClip);
siblingDirty &= (siblingClipRect.translated(siblingPos));
- const bool hasMask = sibling->d_func()->extra && sibling->d_func()->extra->hasMask;
+ const bool hasMask = sibling->d_func()->extra && sibling->d_func()->extra->hasMask
+ && !sibling->d_func()->graphicsEffect;
if (hasMask)
siblingDirty &= sibling->d_func()->extra->mask.translated(siblingPos);
if (siblingDirty.isEmpty())
@@ -1827,7 +1939,7 @@ void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirt
siblingDirty.translate(-parentOffset);
sourceRegion -= siblingDirty;
} else {
- sourceRegion -= sibling->data->crect.translated(-parentOffset);
+ sourceRegion -= siblingGeometry.translated(-parentOffset);
}
} else {
if (hasDirtySiblingsAbove)
@@ -1858,6 +1970,13 @@ void QWidgetPrivate::clipToEffectiveMask(QRegion &region) const
const QWidget *w = q;
QPoint offset;
+#ifndef QT_NO_GRAPHICSEFFECT
+ if (graphicsEffect) {
+ w = q->parentWidget();
+ offset -= data.crect.topLeft();
+ }
+#endif //QT_NO_GRAPHICSEFFECT
+
while (w) {
const QWidgetPrivate *wd = w->d_func();
if (wd->extra && wd->extra->hasMask)
@@ -1891,6 +2010,14 @@ void QWidgetPrivate::updateIsOpaque()
// hw: todo: only needed if opacity actually changed
setDirtyOpaqueRegion();
+#ifndef QT_NO_GRAPHICSEFFECT
+ if (graphicsEffect) {
+ // ### We should probably add QGraphicsEffect::isOpaque at some point.
+ setOpaque(false);
+ return;
+ }
+#endif //QT_NO_GRAPHICSEFFECT
+
Q_Q(QWidget);
#ifdef Q_WS_X11
if (q->testAttribute(Qt::WA_X11OpenGLOverlay)) {
@@ -1938,6 +2065,9 @@ void QWidgetPrivate::setOpaque(bool opaque)
#ifdef Q_WS_WIN
winUpdateIsOpaque();
#endif
+#ifdef Q_OS_SYMBIAN
+ s60UpdateIsOpaque();
+#endif
}
void QWidgetPrivate::updateIsTranslucent()
@@ -1951,6 +2081,9 @@ void QWidgetPrivate::updateIsTranslucent()
#ifdef Q_WS_WIN
winUpdateIsOpaque();
#endif
+#ifdef Q_OS_SYMBIAN
+ s60UpdateIsOpaque();
+#endif
}
/*!
@@ -1985,10 +2118,24 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus
extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush);
qt_mac_fill_background(painter, rgn, brush);
#else
- const QRect rect(rgn.boundingRect());
+#if !defined(QT_NO_STYLE_S60)
+ // Defined in qs60style.cpp
+ extern bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush);
+ if (!qt_s60_fill_background(painter, rgn, brush))
+#endif // !defined(QT_NO_STYLE_S60)
+ {
+ const QRect rect(rgn.boundingRect());
+ painter->setClipRegion(rgn);
+ painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
+ }
+#endif // Q_WS_MAC
+
+ } else if (brush.gradient()
+ && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) {
+ painter->save();
painter->setClipRegion(rgn);
- painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
-#endif
+ painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush);
+ painter->restore();
} else {
const QVector<QRect> &rects = rgn.rects();
for (int i = 0; i < rects.size(); ++i)
@@ -2006,7 +2153,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
//If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture
QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent);
if (scrollArea && scrollArea->viewport() == q) {
- QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr;
+ QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr.data();
QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate);
oldBrushOrigin = painter->brushOrigin();
resetBrushOrigin = true;
@@ -2029,7 +2176,6 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
if (q->autoFillBackground())
fillRegion(painter, rgn, autoFillBrush);
-
if (q->testAttribute(Qt::WA_StyledBackground)) {
painter->setClipRegion(rgn);
QStyleOption opt;
@@ -2106,8 +2252,8 @@ QWidget *QWidget::find(WId id)
against. If Qt is using Carbon, the {WId} is actually an HIViewRef. If Qt
is using Cocoa, {WId} is a pointer to an NSView.
- \note We recommend that you do not store this value as it is likely to
- change at run-time.
+ This value may change at run-time. An event with type QEvent::WinIdChange
+ will be sent to the widget following a change in window system identifier.
\sa find()
*/
@@ -2581,7 +2727,7 @@ bool QWidget::isMaximized() const
*/
Qt::WindowStates QWidget::windowState() const
{
- return (Qt::WindowStates)data->window_state;
+ return Qt::WindowStates(data->window_state);
}
/*!\internal
@@ -2593,7 +2739,7 @@ Qt::WindowStates QWidget::windowState() const
*/
void QWidget::overrideWindowState(Qt::WindowStates newstate)
{
- QWindowStateChangeEvent e((Qt::WindowStates)data->window_state, true);
+ QWindowStateChangeEvent e(Qt::WindowStates(data->window_state), true);
data->window_state = newstate;
QApplication::sendEvent(this, &e);
}
@@ -2692,7 +2838,7 @@ void QWidget::showFullScreen()
Calling this function only affects \l{isWindow()}{windows}.
On X11, this function may not work properly with certain window
- managers. See \l{geometry.html}{Window Geometry} for an explanation.
+ managers. See the \l{Window Geometry} documentation for an explanation.
\sa setWindowState(), showNormal(), showMinimized(), show(), hide(), isVisible()
*/
@@ -2931,22 +3077,24 @@ void QWidgetPrivate::setEnabled_helper(bool enable)
if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) {
// enforce the windows behavior of clearing the cursor on
// disabled widgets
- extern void qt_x11_enforce_cursor(QWidget * w); // defined in qwidget_x11.cpp
qt_x11_enforce_cursor(q);
}
#endif
#if defined(Q_WS_MAC)
setEnabled_helper_sys(enable);
#endif
+#ifndef QT_NO_IM
if (q->testAttribute(Qt::WA_InputMethodEnabled) && q->hasFocus()) {
- QInputContext *qic = inputContext();
+ QWidget *focusWidget = effectiveFocusWidget();
+ QInputContext *qic = focusWidget->d_func()->inputContext();
if (enable) {
- qic->setFocusWidget(q);
+ qic->setFocusWidget(focusWidget);
} else {
qic->reset();
qic->setFocusWidget(0);
}
}
+#endif //QT_NO_IM
QEvent e(QEvent::EnabledChange);
QApplication::sendEvent(q, &e);
#ifdef QT3_SUPPORT
@@ -3041,8 +3189,8 @@ void QWidget::setDisabled(bool disable)
\brief geometry of the widget relative to its parent including any
window frame
- See the \link geometry.html Window Geometry documentation\endlink
- for an overview of geometry issues with windows.
+ See the \l{Window Geometry} documentation for an overview of geometry
+ issues with windows.
By default, this property contains a value that depends on the user's
platform and screen geometry.
@@ -3068,8 +3216,8 @@ QRect QWidget::frameGeometry() const
\brief the x coordinate of the widget relative to its parent including
any window frame
- See the \link geometry.html Window Geometry documentation\endlink
- for an overview of window geometry.
+ See the \l{Window Geometry} documentation for an overview of geometry
+ issues with windows.
By default, this property has a value of 0.
@@ -3088,8 +3236,8 @@ int QWidget::x() const
\brief the y coordinate of the widget relative to its parent and
including any window frame
- See the \link geometry.html Window Geometry documentation\endlink
- for an overview of window geometry.
+ See the \l{Window Geometry} documentation for an overview of geometry
+ issues with windows.
By default, this property has a value of 0.
@@ -3121,8 +3269,8 @@ int QWidget::y() const
\warning Calling move() or setGeometry() inside moveEvent() can
lead to infinite recursion.
- See the \link geometry.html Window Geometry documentation\endlink
- for an overview of window geometry.
+ See the \l{Window Geometry} documentation for an overview of geometry
+ issues with windows.
\sa frameGeometry, size x(), y()
*/
@@ -3152,8 +3300,8 @@ QPoint QWidget::pos() const
\warning Calling setGeometry() inside resizeEvent() or moveEvent()
can lead to infinite recursion.
- See the \link geometry.html Window Geometry documentation\endlink
- for an overview of window geometry.
+ See the \l{Window Geometry} documentation for an overview of geometry
+ issues with windows.
By default, this property contains a value that depends on the user's
platform and screen geometry.
@@ -3202,12 +3350,12 @@ QPoint QWidget::pos() const
\property QWidget::width
\brief the width of the widget excluding any window frame
- See the \link geometry.html Window Geometry documentation\endlink
- for an overview of window geometry.
+ See the \l{Window Geometry} documentation for an overview of geometry
+ issues with windows.
\note Do not use this function to find the width of a screen on
a \l{QDesktopWidget}{multiple screen desktop}. Read
- \l{multiple screens note}{this note} for details.
+ \l{QDesktopWidget#Screen Geometry}{this note} for details.
By default, this property contains a value that depends on the user's
platform and screen geometry.
@@ -3219,12 +3367,12 @@ QPoint QWidget::pos() const
\property QWidget::height
\brief the height of the widget excluding any window frame
- See the \link geometry.html Window Geometry documentation\endlink
- for an overview of window geometry.
+ See the \l{Window Geometry} documentation for an overview of geometry
+ issues with windows.
\note Do not use this function to find the height of a screen
- on a \l {QDesktopWidget} {multiple screen desktop}. Read
- \l {multiple screens note} {this note} for details.
+ on a \l{QDesktopWidget}{multiple screen desktop}. Read
+ \l{QDesktopWidget#Screen Geometry}{this note} for details.
By default, this property contains a value that depends on the user's
platform and screen geometry.
@@ -3239,8 +3387,8 @@ QPoint QWidget::pos() const
The rect property equals QRect(0, 0, width(), height()).
- See the \link geometry.html Window Geometry documentation\endlink
- for an overview of window geometry.
+ See the \l{Window Geometry} documentation for an overview of geometry
+ issues with windows.
By default, this property contains a value that depends on the user's
platform and screen geometry.
@@ -4062,6 +4210,10 @@ QPalette::ColorRole QWidget::backgroundRole() const
If \a role is QPalette::NoRole, then the widget inherits its
parent's background role.
+ Note that styles are free to choose any color from the palette.
+ You can modify the palette or set a style sheet if you don't
+ achieve the result you want with setBackgroundRole().
+
\sa backgroundRole(), foregroundRole()
*/
@@ -4124,6 +4276,10 @@ QPalette::ColorRole QWidget::foregroundRole() const
If \a role is QPalette::NoRole, the widget uses a foreground role
that contrasts with the background role.
+ Note that styles are free to choose any color from the palette.
+ You can modify the palette or set a style sheet if you don't
+ achieve the result you want with setForegroundRole().
+
\sa foregroundRole(), backgroundRole()
*/
void QWidget::setForegroundRole(QPalette::ColorRole role)
@@ -4237,7 +4393,11 @@ QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const
Q_Q(const QWidget);
QPalette naturalPalette = QApplication::palette(q);
if (!q->testAttribute(Qt::WA_StyleSheet)
- && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation) || (extra && extra->proxyWidget))) {
+ && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation)
+#ifndef QT_NO_GRAPHICSVIEW
+ || (extra && extra->proxyWidget)
+#endif //QT_NO_GRAPHICSVIEW
+ )) {
if (QWidget *p = q->parentWidget()) {
if (!p->testAttribute(Qt::WA_StyleSheet)) {
if (!naturalPalette.isCopyOf(QApplication::palette())) {
@@ -4248,13 +4408,14 @@ QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const
naturalPalette = p->palette();
}
}
- } else if (extra && extra->proxyWidget) {
+ }
#ifndef QT_NO_GRAPHICSVIEW
+ else if (extra && extra->proxyWidget) {
QPalette inheritedPalette = extra->proxyWidget->palette();
inheritedPalette.resolve(inheritedMask);
naturalPalette = inheritedPalette.resolve(naturalPalette);
-#endif //QT_NO_GRAPHICSVIEW
}
+#endif //QT_NO_GRAPHICSVIEW
}
naturalPalette.resolve(0);
return naturalPalette;
@@ -4372,7 +4533,11 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const
Q_Q(const QWidget);
QFont naturalFont = QApplication::font(q);
if (!q->testAttribute(Qt::WA_StyleSheet)
- && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation) || (extra && extra->proxyWidget))) {
+ && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation)
+#ifndef QT_NO_GRAPHICSVIEW
+ || (extra && extra->proxyWidget)
+#endif //QT_NO_GRAPHICSVIEW
+ )) {
if (QWidget *p = q->parentWidget()) {
if (!p->testAttribute(Qt::WA_StyleSheet)) {
if (!naturalFont.isCopyOf(QApplication::font())) {
@@ -4383,13 +4548,14 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const
naturalFont = p->font();
}
}
- } else if (extra && extra->proxyWidget) {
+ }
#ifndef QT_NO_GRAPHICSVIEW
+ else if (extra && extra->proxyWidget) {
QFont inheritedFont = extra->proxyWidget->font();
inheritedFont.resolve(inheritedMask);
naturalFont = inheritedFont.resolve(naturalFont);
-#endif //QT_NO_GRAPHICSVIEW
}
+#endif //QT_NO_GRAPHICSVIEW
}
naturalFont.resolve(0);
return naturalFont;
@@ -4436,12 +4602,13 @@ void QWidgetPrivate::updateFont(const QFont &font)
data.fnt.x11SetScreen(xinfo.screen());
#endif
// Combine new mask with natural mask and propagate to children.
- if (!q->parentWidget() && extra && extra->proxyWidget) {
#ifndef QT_NO_GRAPHICSVIEW
+ if (!q->parentWidget() && extra && extra->proxyWidget) {
QGraphicsProxyWidget *p = extra->proxyWidget;
inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve();
+ } else
#endif //QT_NO_GRAPHICSVIEW
- } else if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
+ if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
inheritedFontResolveMask = 0;
}
uint newMask = data.fnt.resolve() | inheritedFontResolveMask;
@@ -4511,8 +4678,10 @@ void QWidgetPrivate::resolveLayoutDirection()
By default, this property is set to Qt::LeftToRight.
When the layout direction is set on a widget, it will propagate to
- the widget's children. Children added after the call to \c
- setLayoutDirection() will not inherit the parent's layout
+ the widget's children, but not to a child that is a window and not
+ to a child for which setLayoutDirection() has been explicitly
+ called. Also, child widgets added \e after setLayoutDirection()
+ has been called for the parent do not inherit the parent's layout
direction.
\sa QApplication::layoutDirection
@@ -4604,8 +4773,9 @@ void QWidget::setCursor(const QCursor &cursor)
#endif
{
d->createExtra();
+ QCursor *newCursor = new QCursor(cursor);
delete d->extra->curs;
- d->extra->curs = new QCursor(cursor);
+ d->extra->curs = newCursor;
}
setAttribute(Qt::WA_SetCursor);
d->setCursor_sys(cursor);
@@ -4672,90 +4842,7 @@ void QWidget::unsetCursor()
void QWidget::render(QPaintDevice *target, const QPoint &targetOffset,
const QRegion &sourceRegion, RenderFlags renderFlags)
{
- Q_D(QWidget);
- if (!target) {
- qWarning("QWidget::render: null pointer to paint device");
- return;
- }
-
- const bool inRenderWithPainter = d->extra && d->extra->inRenderWithPainter;
- QRegion paintRegion = !inRenderWithPainter ? d->prepareToRender(sourceRegion, renderFlags)
- : sourceRegion;
- if (paintRegion.isEmpty())
- return;
-
-#ifndef Q_WS_MAC
- QPainter *oldSharedPainter = inRenderWithPainter ? d->sharedPainter() : 0;
-
- // Use the target's shared painter if set (typically set when doing
- // "other->render(widget);" in the widget's paintEvent.
- if (target->devType() == QInternal::Widget) {
- QWidgetPrivate *targetPrivate = static_cast<QWidget *>(target)->d_func();
- if (targetPrivate->extra && targetPrivate->extra->inRenderWithPainter) {
- QPainter *targetPainter = targetPrivate->sharedPainter();
- if (targetPainter && targetPainter->isActive())
- d->setSharedPainter(targetPainter);
- }
- }
-#endif
-
- // Use the target's redirected device if set and adjust offset and paint
- // region accordingly. This is typically the case when people call render
- // from the paintEvent.
- QPoint offset = targetOffset;
- offset -= paintRegion.boundingRect().topLeft();
- QPoint redirectionOffset;
- QPaintDevice *redirected = 0;
-
- if (target->devType() == QInternal::Widget)
- redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset);
- if (!redirected)
- redirected = QPainter::redirected(target, &redirectionOffset);
-
- if (redirected) {
- target = redirected;
- offset -= redirectionOffset;
- }
-
- if (!inRenderWithPainter) { // Clip handled by shared painter (in qpainter.cpp).
- if (QPaintEngine *targetEngine = target->paintEngine()) {
- const QRegion targetSystemClip = targetEngine->systemClip();
- if (!targetSystemClip.isEmpty())
- paintRegion &= targetSystemClip.translated(-offset);
- }
- }
-
- // Set backingstore flags.
- int flags = QWidgetPrivate::DrawPaintOnScreen | QWidgetPrivate::DrawInvisible;
- if (renderFlags & DrawWindowBackground)
- flags |= QWidgetPrivate::DrawAsRoot;
-
- if (renderFlags & DrawChildren)
- flags |= QWidgetPrivate::DrawRecursive;
- else
- flags |= QWidgetPrivate::DontSubtractOpaqueChildren;
-
-#ifdef Q_WS_QWS
- flags |= QWidgetPrivate::DontSetCompositionMode;
-#endif
-
- if (target->devType() == QInternal::Printer) {
- QPainter p(target);
- d->render_helper(&p, targetOffset, paintRegion, renderFlags);
- return;
- }
-
-#ifndef Q_WS_MAC
- // Render via backingstore.
- d->drawWidget(target, paintRegion, offset, flags, d->sharedPainter());
-
- // Restore shared painter.
- if (oldSharedPainter)
- d->setSharedPainter(oldSharedPainter);
-#else
- // Render via backingstore (no shared painter).
- d->drawWidget(target, paintRegion, offset, flags, 0);
-#endif
+ d_func()->render(target, targetOffset, sourceRegion, renderFlags, false);
}
/*!
@@ -4847,6 +4934,73 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset,
d->extra->inRenderWithPainter = false;
}
+/*!
+ \brief The graphicsEffect function returns a pointer to the
+ widget's graphics effect.
+
+ If the widget has no graphics effect, 0 is returned.
+
+ \since 4.6
+
+ \sa setGraphicsEffect()
+*/
+#ifndef QT_NO_GRAPHICSEFFECT
+QGraphicsEffect *QWidget::graphicsEffect() const
+{
+ Q_D(const QWidget);
+ return d->graphicsEffect;
+}
+#endif //QT_NO_GRAPHICSEFFECT
+
+/*!
+
+ \brief The setGraphicsEffect function is for setting the widget's graphics effect.
+
+ Sets \a effect as the widget's effect. If there already is an effect installed
+ on this widget, QWidget will delete the existing effect before installing
+ the new \a effect.
+
+ If \a effect is the installed on a different widget, setGraphicsEffect() will remove
+ the effect from the widget and install it on this widget.
+
+ \note This function will apply the effect on itself and all its children.
+
+ \since 4.6
+
+ \sa graphicsEffect()
+*/
+#ifndef QT_NO_GRAPHICSEFFECT
+void QWidget::setGraphicsEffect(QGraphicsEffect *effect)
+{
+ Q_D(QWidget);
+ if (d->graphicsEffect == effect)
+ return;
+
+ if (d->graphicsEffect && effect) {
+ delete d->graphicsEffect;
+ d->graphicsEffect = 0;
+ }
+
+ if (!effect) {
+ // Unset current effect.
+ QGraphicsEffectPrivate *oldEffectPrivate = d->graphicsEffect->d_func();
+ d->graphicsEffect = 0;
+ if (oldEffectPrivate) {
+ oldEffectPrivate->setGraphicsEffectSource(0); // deletes the current source.
+ }
+ } else {
+ // Set new effect.
+ QGraphicsEffectSourcePrivate *sourced = new QWidgetEffectSourcePrivate(this);
+ QGraphicsEffectSource *source = new QGraphicsEffectSource(*sourced);
+ d->graphicsEffect = effect;
+ effect->d_func()->setGraphicsEffectSource(source);
+ }
+
+ d->updateIsOpaque();
+ update();
+}
+#endif //QT_NO_GRAPHICSEFFECT
+
bool QWidgetPrivate::isAboutToShow() const
{
if (data.in_show)
@@ -4938,7 +5092,7 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset
return;
QPixmap pixmap(size);
- if (!(renderFlags & QWidget::DrawWindowBackground))
+ if (!(renderFlags & QWidget::DrawWindowBackground) || !isOpaque)
pixmap.fill(Qt::transparent);
q->render(&pixmap, QPoint(), toBePainted, renderFlags);
@@ -4991,6 +5145,39 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
return;
Q_Q(QWidget);
+#ifndef QT_NO_GRAPHICSEFFECT
+ if (graphicsEffect && graphicsEffect->isEnabled()) {
+ QGraphicsEffectSource *source = graphicsEffect->d_func()->source;
+ QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>
+ (source->d_func());
+ if (!sourced->context) {
+ QWidgetPaintContext context(pdev, rgn, offset, flags, sharedPainter, backingStore);
+ sourced->context = &context;
+ if (!sharedPainter) {
+ QPaintEngine *paintEngine = pdev->paintEngine();
+ paintEngine->d_func()->systemClip = rgn.translated(offset);
+ QPainter p(pdev);
+ p.translate(offset);
+ context.painter = &p;
+ graphicsEffect->draw(&p);
+ paintEngine->d_func()->systemClip = QRegion();
+ } else {
+ context.painter = sharedPainter;
+ if (sharedPainter->worldTransform() != sourced->lastEffectTransform) {
+ sourced->invalidateCache();
+ sourced->lastEffectTransform = sharedPainter->worldTransform();
+ }
+ sharedPainter->save();
+ sharedPainter->translate(offset);
+ graphicsEffect->draw(sharedPainter);
+ sharedPainter->restore();
+ }
+ sourced->context = 0;
+ return;
+ }
+ }
+#endif //QT_NO_GRAFFICSEFFECT
+
const bool asRoot = flags & DrawAsRoot;
const bool alsoOnScreen = flags & DrawPaintOnScreen;
const bool recursive = flags & DrawRecursive;
@@ -5023,7 +5210,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
if (sharedPainter)
paintEngine->d_func()->systemClip = toBePainted;
else
- paintEngine->setSystemRect(q->data->crect);
+ paintEngine->d_func()->systemRect = q->data->crect;
//paint the background
if ((asRoot || q->autoFillBackground() || onScreen || q->testAttribute(Qt::WA_StyledBackground))
@@ -5062,7 +5249,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
if (paintEngine) {
restoreRedirected();
if (!sharedPainter)
- paintEngine->setSystemRect(QRect());
+ paintEngine->d_func()->systemRect = QRect();
else
paintEngine->d_func()->currentClipWidget = 0;
paintEngine->d_func()->systemClip = QRegion();
@@ -5105,6 +5292,97 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
}
}
+void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset,
+ const QRegion &sourceRegion, QWidget::RenderFlags renderFlags,
+ bool readyToRender)
+{
+ Q_Q(QWidget);
+ if (!target) {
+ qWarning("QWidget::render: null pointer to paint device");
+ return;
+ }
+
+ const bool inRenderWithPainter = extra && extra->inRenderWithPainter;
+ QRegion paintRegion = !inRenderWithPainter && !readyToRender
+ ? prepareToRender(sourceRegion, renderFlags)
+ : sourceRegion;
+ if (paintRegion.isEmpty())
+ return;
+
+#ifndef Q_WS_MAC
+ QPainter *oldSharedPainter = inRenderWithPainter ? sharedPainter() : 0;
+
+ // Use the target's shared painter if set (typically set when doing
+ // "other->render(widget);" in the widget's paintEvent.
+ if (target->devType() == QInternal::Widget) {
+ QWidgetPrivate *targetPrivate = static_cast<QWidget *>(target)->d_func();
+ if (targetPrivate->extra && targetPrivate->extra->inRenderWithPainter) {
+ QPainter *targetPainter = targetPrivate->sharedPainter();
+ if (targetPainter && targetPainter->isActive())
+ setSharedPainter(targetPainter);
+ }
+ }
+#endif
+
+ // Use the target's redirected device if set and adjust offset and paint
+ // region accordingly. This is typically the case when people call render
+ // from the paintEvent.
+ QPoint offset = targetOffset;
+ offset -= paintRegion.boundingRect().topLeft();
+ QPoint redirectionOffset;
+ QPaintDevice *redirected = 0;
+
+ if (target->devType() == QInternal::Widget)
+ redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset);
+ if (!redirected)
+ redirected = QPainter::redirected(target, &redirectionOffset);
+
+ if (redirected) {
+ target = redirected;
+ offset -= redirectionOffset;
+ }
+
+ if (!inRenderWithPainter) { // Clip handled by shared painter (in qpainter.cpp).
+ if (QPaintEngine *targetEngine = target->paintEngine()) {
+ const QRegion targetSystemClip = targetEngine->systemClip();
+ if (!targetSystemClip.isEmpty())
+ paintRegion &= targetSystemClip.translated(-offset);
+ }
+ }
+
+ // Set backingstore flags.
+ int flags = DrawPaintOnScreen | DrawInvisible;
+ if (renderFlags & QWidget::DrawWindowBackground)
+ flags |= DrawAsRoot;
+
+ if (renderFlags & QWidget::DrawChildren)
+ flags |= DrawRecursive;
+ else
+ flags |= DontSubtractOpaqueChildren;
+
+#ifdef Q_WS_QWS
+ flags |= DontSetCompositionMode;
+#endif
+
+ if (target->devType() == QInternal::Printer) {
+ QPainter p(target);
+ render_helper(&p, targetOffset, paintRegion, renderFlags);
+ return;
+ }
+
+#ifndef Q_WS_MAC
+ // Render via backingstore.
+ drawWidget(target, paintRegion, offset, flags, sharedPainter());
+
+ // Restore shared painter.
+ if (oldSharedPainter)
+ setSharedPainter(oldSharedPainter);
+#else
+ // Render via backingstore (no shared painter).
+ drawWidget(target, paintRegion, offset, flags, 0);
+#endif
+}
+
void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& siblings, int index, const QRegion &rgn,
const QPoint &offset, int flags
#ifdef Q_BACKINGSTORE_SUBSURFACES
@@ -5125,7 +5403,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
dirtyBoundingRect = false;
}
- if (qRectIntersects(boundingRect, x->data->crect)) {
+ if (qRectIntersects(boundingRect, x->d_func()->effectiveRectFor(x->data->crect))) {
#ifdef Q_BACKINGSTORE_SUBSURFACES
if (x->windowSurface() == currentSurface)
#endif
@@ -5143,8 +5421,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
QWidgetPrivate *wd = w->d_func();
const QPoint widgetPos(w->data->crect.topLeft());
- const bool hasMask = wd->extra && wd->extra->hasMask;
-
+ const bool hasMask = wd->extra && wd->extra->hasMask && !wd->graphicsEffect;
if (index > 0) {
QRegion wr(rgn);
if (wd->isOpaque)
@@ -5156,9 +5433,13 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
, sharedPainter, backingStore);
}
- if (w->updatesEnabled() && (!w->d_func()->extra || !w->d_func()->extra->proxyWidget)) {
+ if (w->updatesEnabled()
+#ifndef QT_NO_GRAPHICSVIEW
+ && (!w->d_func()->extra || !w->d_func()->extra->proxyWidget)
+#endif //QT_NO_GRAPHICSVIEW
+ ) {
QRegion wRegion(rgn);
- wRegion &= w->data->crect;
+ wRegion &= wd->effectiveRectFor(w->data->crect);
wRegion.translate(-widgetPos);
if (hasMask)
wRegion &= wd->extra->mask;
@@ -5166,6 +5447,110 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
}
}
+#ifndef QT_NO_GRAPHICSEFFECT
+QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const
+{
+ if (system != Qt::DeviceCoordinates)
+ return m_widget->rect();
+
+ if (!context) {
+ // Device coordinates without context not yet supported.
+ qWarning("QGraphicsEffectSource::boundingRect: Not yet implemented, lacking device context");
+ return QRectF();
+ }
+
+ return context->painter->worldTransform().mapRect(m_widget->rect());
+}
+
+void QWidgetEffectSourcePrivate::draw(QPainter *painter)
+{
+ if (!context || context->painter != painter) {
+ m_widget->render(painter);
+ return;
+ }
+
+ // The region saved in the context is neither clipped to the rect
+ // nor the mask, so we have to clip it here before calling drawWidget.
+ QRegion toBePainted = context->rgn;
+ toBePainted &= m_widget->rect();
+ QWidgetPrivate *wd = qt_widget_private(m_widget);
+ if (wd->extra && wd->extra->hasMask)
+ toBePainted &= wd->extra->mask;
+
+ wd->drawWidget(context->pdev, toBePainted, context->offset, context->flags,
+ context->sharedPainter, context->backingStore);
+}
+
+QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset,
+ QGraphicsEffect::PixmapPadMode mode) const
+{
+ const bool deviceCoordinates = (system == Qt::DeviceCoordinates);
+ if (!context && deviceCoordinates) {
+ // Device coordinates without context not yet supported.
+ qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");
+ return QPixmap();
+ }
+
+ QPoint pixmapOffset;
+ QRectF sourceRect = m_widget->rect();
+
+ if (deviceCoordinates) {
+ const QTransform &painterTransform = context->painter->worldTransform();
+ sourceRect = painterTransform.mapRect(sourceRect);
+ pixmapOffset = painterTransform.map(pixmapOffset);
+ }
+
+
+ QRect effectRect;
+
+ if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) {
+ effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect();
+
+ } else if (mode == QGraphicsEffect::PadToTransparentBorder) {
+ effectRect = sourceRect.adjusted(-1, -1, 1, 1).toAlignedRect();
+
+ } else {
+ effectRect = sourceRect.toAlignedRect();
+
+ }
+
+ if (offset)
+ *offset = effectRect.topLeft();
+
+ if (deviceCoordinates) {
+ // Clip to device rect.
+ int left, top, right, bottom;
+ effectRect.getCoords(&left, &top, &right, &bottom);
+ if (left < 0) {
+ if (offset)
+ offset->rx() += -left;
+ effectRect.setX(0);
+ }
+ if (top < 0) {
+ if (offset)
+ offset->ry() += -top;
+ effectRect.setY(0);
+ }
+ // NB! We use +-1 for historical reasons (see QRect documentation).
+ QPaintDevice *device = context->painter->device();
+ const int deviceWidth = device->width();
+ const int deviceHeight = device->height();
+ if (right + 1 > deviceWidth)
+ effectRect.setRight(deviceWidth - 1);
+ if (bottom + 1 > deviceHeight)
+ effectRect.setBottom(deviceHeight -1);
+ }
+
+ pixmapOffset -= effectRect.topLeft();
+
+ QPixmap pixmap(effectRect.size());
+ pixmap.fill(Qt::transparent);
+ m_widget->render(&pixmap, pixmapOffset);
+ return pixmap;
+}
+#endif //QT_NO_GRAPHICSEFFECT
+
+#ifndef QT_NO_GRAPHICSVIEW
/*!
\internal
@@ -5174,7 +5559,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
If successful, the function returns the proxy that embeds the widget, or 0 if no embedded
widget was found.
*/
-QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(QWidget *origin)
+QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(const QWidget *origin)
{
if (origin) {
QWExtra *extra = origin->d_func()->extra;
@@ -5184,6 +5569,7 @@ QGraphicsProxyWidget * QWidgetPrivate::nearestGraphicsProxyWidget(QWidget *origi
}
return 0;
}
+#endif
/*!
\property QWidget::locale
@@ -5299,6 +5685,17 @@ QString QWidget::windowTitle() const
return QString();
}
+/*!
+ Returns a modified window title with the [*] place holder
+ replaced according to the rules described in QWidget::setWindowTitle
+
+ This function assumes that "[*]" can be quoted by another
+ "[*]", so it will replace two place holders by one and
+ a single last one by either "*" or nothing depending on
+ the modified flag.
+
+ \internal
+*/
QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widget)
{
Q_ASSERT(widget);
@@ -5310,16 +5707,21 @@ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widg
QString cap = title;
#endif
- QString placeHolder(QLatin1String("[*]"));
+ if (cap.isEmpty())
+ return cap;
+
+ QLatin1String placeHolder("[*]");
+ int placeHolderLength = 3; // QLatin1String doesn't have length()
int index = cap.indexOf(placeHolder);
+ // here the magic begins
while (index != -1) {
- index += placeHolder.length();
+ index += placeHolderLength;
int count = 1;
while (cap.indexOf(placeHolder, index) == index) {
++count;
- index += placeHolder.length();
+ index += placeHolderLength;
}
if (count%2) { // odd number of [*] -> replace last one
@@ -5334,7 +5736,7 @@ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widg
index = cap.indexOf(placeHolder, index);
}
- cap.replace(QLatin1String("[*][*]"), QLatin1String("[*]"));
+ cap.replace(QLatin1String("[*][*]"), placeHolder);
return cap;
}
@@ -5342,9 +5744,8 @@ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widg
void QWidgetPrivate::setWindowTitle_helper(const QString &title)
{
Q_Q(QWidget);
- if (!q->testAttribute(Qt::WA_WState_Created))
- createWinId();
- setWindowTitle_sys(qt_setWindowTitle_helperHelper(title, q));
+ if (q->testAttribute(Qt::WA_WState_Created))
+ setWindowTitle_sys(qt_setWindowTitle_helperHelper(title, q));
}
void QWidgetPrivate::setWindowIconText_helper(const QString &title)
@@ -5369,7 +5770,7 @@ void QWidget::setWindowIconText(const QString &iconText)
void QWidget::setWindowTitle(const QString &title)
{
- if (QWidget::windowTitle() == title)
+ if (QWidget::windowTitle() == title && !title.isEmpty() && !title.isNull())
return;
Q_D(QWidget);
@@ -5644,6 +6045,8 @@ bool QWidget::hasFocus() const
isActiveWindow() active window\endlink. The \a reason argument will
be passed into any focus event sent from this function, it is used
to give an explanation of what caused the widget to get focus.
+ If the window is not active, the widget will be given the focus when
+ the window becomes active.
First, a focus out event is sent to the focus widget (if any) to
tell it that it is about to lose the focus. Then a focus in event
@@ -5651,6 +6054,11 @@ bool QWidget::hasFocus() const
(Nothing happens if the focus in and focus out widgets are the
same.)
+ \note On embedded platforms, setFocus() will not cause an input panel
+ to be opened by the input method. If you want this to happen, you
+ have to send a QEvent::RequestSoftwareInputPanel event to the
+ widget yourself.
+
setFocus() gives focus to a widget regardless of its focus policy,
but does not clear any keyboard grab (see grabKeyboard()).
@@ -5663,7 +6071,7 @@ bool QWidget::hasFocus() const
\sa hasFocus(), clearFocus(), focusInEvent(), focusOutEvent(),
setFocusPolicy(), focusWidget(), QApplication::focusWidget(), grabKeyboard(),
- grabMouse(), {Keyboard Focus}
+ grabMouse(), {Keyboard Focus}, QEvent::RequestSoftwareInputPanel
*/
void QWidget::setFocus(Qt::FocusReason reason)
@@ -5891,7 +6299,8 @@ QWidget *QWidget::nextInFocusChain() const
}
/*!
- Returns the previous widget in this widget's focus chain.
+ \brief The previousInFocusChain function returns the previous
+ widget in this widget's focus chain.
\sa nextInFocusChain()
@@ -5935,6 +6344,10 @@ bool QWidget::isActiveWindow() const
if(qt_mac_is_macdrawer(tlw) &&
tlw->parentWidget() && tlw->parentWidget()->isActiveWindow())
return true;
+
+ extern bool qt_mac_insideKeyWindow(const QWidget *); //qwidget_mac.cpp
+ if (QApplication::testAttribute(Qt::AA_MacPluginApplication) && qt_mac_insideKeyWindow(tlw))
+ return true;
#endif
if(style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)) {
if(tlw->windowType() == Qt::Tool &&
@@ -6124,6 +6537,8 @@ void QWidgetPrivate::reparentFocusWidgets(QWidget * oldtlw)
This function is called from QDesktopwidget::screen(QPoint) to find the
closest screen for a point.
+ In directional KeypadNavigation, it is called to find the closest
+ widget to the current focus widget center.
*/
int QWidgetPrivate::pointToRect(const QPoint &p, const QRect &r)
{
@@ -6228,8 +6643,8 @@ void QWidget::setGeometry(const QRect &r)
\snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 11
- See the \link geometry.html Window Geometry documentation\endlink
- for an overview of geometry issues with windows.
+ See the \l{Window Geometry} documentation for an overview of geometry
+ issues with windows.
Use QMainWindow::saveState() to save the geometry and the state of
toolbars and dock widgets.
@@ -6270,8 +6685,8 @@ QByteArray QWidget::saveGeometry() const
\snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 12
- See the \link geometry.html Window Geometry documentation\endlink
- for an overview of geometry issues with windows.
+ See the \l{Window Geometry} documentation for an overview of geometry
+ issues with windows.
Use QMainWindow::restoreState() to restore the geometry and the
state of toolbars and dock widgets.
@@ -6388,14 +6803,14 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
*/
/*!
- Sets the margins around the contents of the widget to have the
- sizes \a left, \a top, \a right, and \a bottom. The margins are
- used by the layout system, and may be used by subclasses to
- specify the area to draw in (e.g. excluding the frame).
+ Sets the margins around the contents of the widget to have the sizes
+ \a left, \a top, \a right, and \a bottom. The margins are used by
+ the layout system, and may be used by subclasses to specify the area
+ to draw in (e.g. excluding the frame).
- Changing the margins will trigger a resizeEvent().
+ Changing the margins will trigger a resizeEvent().
- \sa contentsRect(), getContentsMargins()
+ \sa contentsRect(), getContentsMargins()
*/
void QWidget::setContentsMargins(int left, int top, int right, int bottom)
{
@@ -6426,7 +6841,30 @@ void QWidget::setContentsMargins(int left, int top, int right, int bottom)
QApplication::sendEvent(this, &e);
}
-/*! Returns the widget's contents margins for \a left, \a top, \a
+/*!
+ \overload
+ \since 4.6
+
+ \brief The setContentsMargins function sets the margins around the
+ widget's contents.
+
+ Sets the margins around the contents of the widget to have the
+ sizes determined by \a margins. The margins are
+ used by the layout system, and may be used by subclasses to
+ specify the area to draw in (e.g. excluding the frame).
+
+ Changing the margins will trigger a resizeEvent().
+
+ \sa contentsRect(), getContentsMargins()
+*/
+void QWidget::setContentsMargins(const QMargins &margins)
+{
+ setContentsMargins(margins.left(), margins.top(),
+ margins.right(), margins.bottom());
+}
+
+/*!
+ Returns the widget's contents margins for \a left, \a top, \a
right, and \a bottom.
\sa setContentsMargins(), contentsRect()
@@ -6445,6 +6883,20 @@ void QWidget::getContentsMargins(int *left, int *top, int *right, int *bottom) c
}
/*!
+ \since 4.6
+
+ \brief The contentsMargins function returns the widget's contents margins.
+
+ \sa getContentsMargins(), setContentsMargins(), contentsRect()
+ */
+QMargins QWidget::contentsMargins() const
+{
+ Q_D(const QWidget);
+ return QMargins(d->leftmargin, d->topmargin, d->rightmargin, d->bottommargin);
+}
+
+
+/*!
Returns the area inside the widget's margins.
\sa setContentsMargins(), getContentsMargins()
@@ -6726,7 +7178,7 @@ void QWidgetPrivate::show_helper()
// On Windows, show the popup now so that our own focus handling
// stores the correct old focus widget even if it's stolen in the
// showevent
-#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
+#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN)
if (!isEmbedded && q->windowType() == Qt::Popup)
qApp->d_func()->openPopup(q);
#endif
@@ -6743,7 +7195,7 @@ void QWidgetPrivate::show_helper()
show_sys();
-#if !defined(Q_WS_WIN) && !defined(Q_WS_MAC)
+#if !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN)
if (!isEmbedded && q->windowType() == Qt::Popup)
qApp->d_func()->openPopup(q);
#endif
@@ -6825,7 +7277,7 @@ void QWidgetPrivate::hide_helper()
// next bit tries to move the focus if the focus widget is now
// hidden.
if (wasVisible) {
-#if defined(Q_WS_WIN) || defined(Q_WS_X11)
+#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS)
qApp->d_func()->sendSyntheticEnterLeave(q);
#endif
@@ -6932,7 +7384,7 @@ void QWidget::setVisible(bool visible)
break;
parent = parent->parentWidget();
}
- if (parent && !d->getOpaqueRegion().isEmpty())
+ if (parent)
parent->d_func()->setDirtyOpaqueRegion();
}
@@ -6957,7 +7409,7 @@ void QWidget::setVisible(bool visible)
d->show_helper();
-#if defined(Q_WS_WIN) || defined(Q_WS_X11)
+#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS)
qApp->d_func()->sendSyntheticEnterLeave(this);
#endif
}
@@ -7072,7 +7524,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous)
widget->d_func()->hide_sys();
}
}
-#if defined(Q_WS_WIN) || defined(Q_WS_X11)
+#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS)
qApp->d_func()->sendSyntheticEnterLeave(widget);
#endif
#ifndef QT_NO_ACCESSIBILITY
@@ -7315,7 +7767,7 @@ QSize QWidgetPrivate::adjustedSize() const
#else // all others
QRect screen = QApplication::desktop()->screenGeometry(q->pos());
#endif
-#if defined (Q_WS_WINCE)
+#if defined (Q_WS_WINCE) || defined (Q_OS_SYMBIAN)
s.setWidth(qMin(s.width(), screen.width()));
s.setHeight(qMin(s.height(), screen.height()));
#else
@@ -7357,6 +7809,10 @@ void QWidget::adjustSize()
Q_D(QWidget);
ensurePolished();
QSize s = d->adjustedSize();
+
+ if (d->layout)
+ d->layout->activate();
+
if (s.isValid())
resize(s);
}
@@ -7570,10 +8026,21 @@ bool QWidget::event(QEvent *event)
#ifdef QT_KEYPAD_NAVIGATION
if (!k->isAccepted() && QApplication::keypadNavigationEnabled()
&& !(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::ShiftModifier))) {
- if (k->key() == Qt::Key_Up)
- res = focusNextPrevChild(false);
- else if (k->key() == Qt::Key_Down)
- res = focusNextPrevChild(true);
+ if (QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder) {
+ if (k->key() == Qt::Key_Up)
+ res = focusNextPrevChild(false);
+ else if (k->key() == Qt::Key_Down)
+ res = focusNextPrevChild(true);
+ } else if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) {
+ if (k->key() == Qt::Key_Up)
+ res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionNorth);
+ else if (k->key() == Qt::Key_Right)
+ res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionEast);
+ else if (k->key() == Qt::Key_Down)
+ res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionSouth);
+ else if (k->key() == Qt::Key_Left)
+ res = QWidgetPrivate::navigateToDirection(QWidgetPrivate::DirectionWest);
+ }
if (res) {
k->accept();
break;
@@ -7626,6 +8093,9 @@ bool QWidget::event(QEvent *event)
}
break;
case QEvent::FocusIn:
+#ifdef QT_SOFTKEYS_ENABLED
+ QSoftKeyManager::updateSoftKeys();
+#endif
focusInEvent((QFocusEvent*)event);
break;
@@ -7775,6 +8245,12 @@ bool QWidget::event(QEvent *event)
if (w && w->isVisible() && !w->isWindow())
QApplication::sendEvent(w, event);
}
+
+#ifdef QT_SOFTKEYS_ENABLED
+ if (isWindow() && isActiveWindow())
+ QSoftKeyManager::updateSoftKeys();
+#endif
+
break; }
case QEvent::LanguageChange:
@@ -7786,7 +8262,8 @@ bool QWidget::event(QEvent *event)
QList<QObject*> childList = d->children;
for (int i = 0; i < childList.size(); ++i) {
QObject *o = childList.at(i);
- QApplication::sendEvent(o, event);
+ if (o)
+ QApplication::sendEvent(o, event);
}
}
update();
@@ -7815,7 +8292,7 @@ bool QWidget::event(QEvent *event)
QList<QObject*> childList = d->children;
for (int i = 0; i < childList.size(); ++i) {
QObject *o = childList.at(i);
- if (o != QApplication::activeModalWidget()) {
+ if (o && o != QApplication::activeModalWidget()) {
if (qobject_cast<QWidget *>(o) && static_cast<QWidget *>(o)->isWindow()) {
// do not forward the event to child windows,
// QApplication does this for us
@@ -7882,6 +8359,9 @@ bool QWidget::event(QEvent *event)
case QEvent::ActionAdded:
case QEvent::ActionRemoved:
case QEvent::ActionChanged:
+#ifdef QT_SOFTKEYS_ENABLED
+ QSoftKeyManager::updateSoftKeys();
+#endif
actionEvent((QActionEvent*)event);
break;
#endif
@@ -7908,9 +8388,10 @@ bool QWidget::event(QEvent *event)
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
{
+#ifndef Q_WS_MAC
QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event);
const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().first();
- if (touchPoint.isPrimary())
+ if (touchPoint.isPrimary() || touchEvent->deviceType() == QTouchEvent::TouchPad)
break;
// fake a mouse event!
@@ -7939,8 +8420,12 @@ bool QWidget::event(QEvent *event)
Qt::LeftButton,
touchEvent->modifiers());
(void) QApplication::sendEvent(this, &mouseEvent);
+#endif // Q_WS_MAC
break;
}
+ case QEvent::Gesture:
+ event->ignore();
+ break;
#ifndef QT_NO_PROPERTIES
case QEvent::DynamicPropertyChange: {
const QByteArray &propName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName();
@@ -8107,8 +8592,10 @@ void QWidget::mouseReleaseEvent(QMouseEvent *event)
The default implementation generates a normal mouse press event.
- Note that the widgets gets a mousePressEvent() and a
- mouseReleaseEvent() before the mouseDoubleClickEvent().
+ \note The widget will also receive mouse press and mouse release
+ events in addition to the double click event. It is up to the
+ developer to ensure that the application interprets these events
+ correctly.
\sa mousePressEvent(), mouseReleaseEvent() mouseMoveEvent(),
event(), QMouseEvent
@@ -8489,7 +8976,7 @@ void QWidget::inputMethodEvent(QInputMethodEvent *event)
\a query specifies which property is queried.
- \sa inputMethodEvent(), QInputMethodEvent, QInputContext
+ \sa inputMethodEvent(), QInputMethodEvent, QInputContext, inputMethodHints
*/
QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const
{
@@ -8498,11 +8985,60 @@ QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const
return QRect(width()/2, 0, 1, height());
case Qt::ImFont:
return font();
+ case Qt::ImAnchorPosition:
+ // Fallback.
+ return inputMethodQuery(Qt::ImCursorPosition);
default:
return QVariant();
}
}
+/*!
+ \property QWidget::inputMethodHints
+ \brief What input method specific hints the widget has.
+
+ This is only relevant for input widgets. It is used by
+ the input method to retrieve hints as to how the input method
+ should operate. For example, if the Qt::ImhFormattedNumbersOnly flag
+ is set, the input method may change its visual components to reflect
+ that only numbers can be entered.
+
+ \note The flags are only hints, so the particular input method
+ implementation is free to ignore them. If you want to be
+ sure that a certain type of characters are entered,
+ you should also set a QValidator on the widget.
+
+ The default value is Qt::ImhNone.
+
+ \since 4.6
+
+ \sa inputMethodQuery(), QInputContext
+*/
+Qt::InputMethodHints QWidget::inputMethodHints() const
+{
+ Q_D(const QWidget);
+#ifndef QT_NO_IM
+ return d->imHints;
+#else //QT_NO_IM
+ return 0;
+#endif //QT_NO_IM
+}
+
+void QWidget::setInputMethodHints(Qt::InputMethodHints hints)
+{
+#ifndef QT_NO_IM
+ Q_D(QWidget);
+ d->imHints = hints;
+ // Optimisation to update input context only it has already been created.
+ if (d->ic || qApp->d_func()->inputContext) {
+ QInputContext *ic = inputContext();
+ if (ic)
+ ic->update();
+ }
+#endif //QT_NO_IM
+}
+
+
#ifndef QT_NO_DRAGANDDROP
/*!
@@ -9377,13 +9913,13 @@ void QWidget::scroll(int dx, int dy)
Q_D(QWidget);
#ifndef QT_NO_GRAPHICSVIEW
if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
- // Graphics View maintains its own dirty region as a list of rects;
- // until we can connect item updates directly to the view, we must
- // separately add a translated dirty region.
- if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects())
- proxy->update(rect);
- }
+ // Graphics View maintains its own dirty region as a list of rects;
+ // until we can connect item updates directly to the view, we must
+ // separately add a translated dirty region.
+ if (!d->dirty.isEmpty()) {
+ foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects())
+ proxy->update(rect);
+ }
proxy->scroll(dx, dy, proxy->subWidgetRect(this));
return;
}
@@ -9412,13 +9948,13 @@ void QWidget::scroll(int dx, int dy, const QRect &r)
Q_D(QWidget);
#ifndef QT_NO_GRAPHICSVIEW
if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
- // Graphics View maintains its own dirty region as a list of rects;
- // until we can connect item updates directly to the view, we must
- // separately add a translated dirty region.
- if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects())
- proxy->update(rect);
- }
+ // Graphics View maintains its own dirty region as a list of rects;
+ // until we can connect item updates directly to the view, we must
+ // separately add a translated dirty region.
+ if (!d->dirty.isEmpty()) {
+ foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects())
+ proxy->update(rect);
+ }
proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint()));
return;
}
@@ -9701,7 +10237,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
"QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute");
#ifdef Q_WS_WIN
- if (attribute == Qt::WA_PaintOnScreen && on) {
+ // ### Don't use PaintOnScreen+paintEngine() to do native painting in 5.0
+ if (attribute == Qt::WA_PaintOnScreen && on && !inherits("QGLWidget")) {
// see qwidget_win.cpp, ::paintEngine for details
paintEngine();
if (d->noPaintOnScreen)
@@ -9830,9 +10367,11 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
QApplication::sendEvent(this, &e);
break; }
case Qt::WA_NativeWindow: {
+#ifndef QT_NO_IM
+ QWidget *focusWidget = d->effectiveFocusWidget();
QInputContext *ic = 0;
if (on && !internalWinId() && testAttribute(Qt::WA_InputMethodEnabled) && hasFocus()) {
- ic = d->inputContext();
+ ic = focusWidget->d_func()->inputContext();
ic->reset();
ic->setFocusWidget(0);
}
@@ -9841,7 +10380,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created))
d->createWinId();
if (ic && isEnabled())
- ic->setFocusWidget(this);
+ ic->setFocusWidget(focusWidget);
+#endif //QT_NO_IM
break;
}
case Qt::WA_PaintOnScreen:
@@ -9871,17 +10411,20 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
#endif
break;
case Qt::WA_InputMethodEnabled: {
- QInputContext *ic = d->ic;
+#ifndef QT_NO_IM
+ QWidget *focusWidget = d->effectiveFocusWidget();
+ QInputContext *ic = focusWidget->d_func()->ic;
if (!ic && (!on || hasFocus()))
- ic = d->inputContext();
+ ic = focusWidget->d_func()->inputContext();
if (ic) {
- if (on && hasFocus() && ic->focusWidget() != this && isEnabled()) {
- ic->setFocusWidget(this);
- } else if (!on && ic->focusWidget() == this) {
+ if (on && hasFocus() && ic->focusWidget() != focusWidget && isEnabled()) {
+ ic->setFocusWidget(focusWidget);
+ } else if (!on && ic->focusWidget() == focusWidget) {
ic->reset();
ic->setFocusWidget(0);
}
}
+#endif //QT_NO_IM
break;
}
case Qt::WA_WindowPropagation:
@@ -9953,7 +10496,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
case Qt::WA_AcceptTouchEvents:
-#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
+#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_S60)
if (on)
d->registerTouchWindow();
#endif
@@ -10313,7 +10856,7 @@ void QWidget::setShortcutAutoRepeat(int id, bool enable)
*/
void QWidget::updateMicroFocus()
{
-#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS))
+#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN))
Q_D(QWidget);
// and optimisation to update input context only it has already been created.
if (d->ic || qApp->d_func()->inputContext) {
@@ -10941,6 +11484,17 @@ void QWidget::languageChange() { } // compat
\sa QWidget::setMaximumSize()
*/
+/*!
+ \fn QWidget::setupUi(QWidget *widget)
+
+ Sets up the user interface for the specified \a widget.
+
+ \note This function is available with widgets that derive from user
+ interface descriptions created using \l{uic}.
+
+ \sa {Using a Designer UI File in Your Application}
+*/
+
QRect QWidgetPrivate::frameStrut() const
{
Q_Q(const QWidget);
@@ -10960,6 +11514,91 @@ QRect QWidgetPrivate::frameStrut() const
return maybeTopData() ? maybeTopData()->frameStrut : QRect();
}
+#ifdef QT_KEYPAD_NAVIGATION
+/*!
+ \internal
+
+ Changes the focus from the current focusWidget to a widget in
+ the \a direction.
+
+ Returns true, if there was a widget in that direction
+*/
+bool QWidgetPrivate::navigateToDirection(Direction direction)
+{
+ QWidget *targetWidget = widgetInNavigationDirection(direction);
+ if (targetWidget)
+ targetWidget->setFocus();
+ return (targetWidget != 0);
+}
+
+/*!
+ \internal
+
+ Searches for a widget that is positioned in the \a direction, starting
+ from the current focusWidget.
+
+ Returns the pointer to a found widget or 0, if there was no widget in
+ that direction.
+*/
+QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction)
+{
+ const QWidget *sourceWidget = QApplication::focusWidget();
+ if (!sourceWidget)
+ return 0;
+ const QRect sourceRect = sourceWidget->rect().translated(sourceWidget->mapToGlobal(QPoint()));
+ const int sourceX =
+ (direction == DirectionNorth || direction == DirectionSouth) ?
+ (sourceRect.left() + (sourceRect.right() - sourceRect.left()) / 2)
+ :(direction == DirectionEast ? sourceRect.right() : sourceRect.left());
+ const int sourceY =
+ (direction == DirectionEast || direction == DirectionWest) ?
+ (sourceRect.top() + (sourceRect.bottom() - sourceRect.top()) / 2)
+ :(direction == DirectionSouth ? sourceRect.bottom() : sourceRect.top());
+ const QPoint sourcePoint(sourceX, sourceY);
+ const QPoint sourceCenter = sourceRect.center();
+ const QWidget *sourceWindow = sourceWidget->window();
+
+ QWidget *targetWidget = 0;
+ int shortestDistance = INT_MAX;
+ foreach(QWidget *targetCandidate, QApplication::allWidgets()) {
+
+ const QRect targetCandidateRect = targetCandidate->rect().translated(targetCandidate->mapToGlobal(QPoint()));
+
+ // For focus proxies, the child widget handling the focus can have keypad navigation focus,
+ // but the owner of the proxy cannot.
+ // Additionally, empty widgets should be ignored.
+ if (targetCandidate->focusProxy() || targetCandidateRect.isEmpty())
+ continue;
+
+ // Only navigate to a target widget that...
+ if ( targetCandidate != sourceWidget
+ // ...takes the focus,
+ && targetCandidate->focusPolicy() & Qt::TabFocus
+ // ...is above if DirectionNorth,
+ && !(direction == DirectionNorth && targetCandidateRect.bottom() > sourceRect.top())
+ // ...is on the right if DirectionEast,
+ && !(direction == DirectionEast && targetCandidateRect.left() < sourceRect.right())
+ // ...is below if DirectionSouth,
+ && !(direction == DirectionSouth && targetCandidateRect.top() < sourceRect.bottom())
+ // ...is on the left if DirectionWest,
+ && !(direction == DirectionWest && targetCandidateRect.right() > sourceRect.left())
+ // ...is enabled,
+ && targetCandidate->isEnabled()
+ // ...is visible,
+ && targetCandidate->isVisible()
+ // ...is in the same window,
+ && targetCandidate->window() == sourceWindow) {
+ const int targetCandidateDistance = pointToRect(sourcePoint, targetCandidateRect);
+ if (targetCandidateDistance < shortestDistance) {
+ shortestDistance = targetCandidateDistance;
+ targetWidget = targetCandidate;
+ }
+ }
+ }
+ return targetWidget;
+}
+#endif
+
/*!
\preliminary
\since 4.2
@@ -11146,9 +11785,34 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const
Synonym for QList<QWidget *>.
*/
-QT_END_NAMESPACE
+/*!
+ Subscribes the widget to a given \a gesture with specific \a flags.
+
+ \sa ungrabGesture(), QGestureEvent
+ \since 4.6
+*/
+void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags)
+{
+ Q_D(QWidget);
+ d->gestureContext.insert(gesture, flags);
+ (void)QGestureManager::instance(); // create a gesture manager
+}
+
+/*!
+ Unsubscribes the widget from a given \a gesture type
+
+ \sa grabGesture(), QGestureEvent
+ \since 4.6
+*/
+void QWidget::ungrabGesture(Qt::GestureType gesture)
+{
+ Q_D(QWidget);
+ if (d->gestureContext.remove(gesture)) {
+ QGestureManager *manager = QGestureManager::instance();
+ manager->cleanupCachedGestures(this, gesture);
+ }
+}
-#include "moc_qwidget.cpp"
/*!
\typedef WId
@@ -11224,8 +11888,7 @@ QT_END_NAMESPACE
isVisible() returns false for a widget, that widget cannot call
grabMouse().
- \sa releaseMouse() grabKeyboard() releaseKeyboard() grabKeyboard()
- focusWidget()
+ \sa releaseMouse() grabKeyboard() releaseKeyboard()
*/
/*!
@@ -11459,3 +12122,15 @@ void QWidget::clearMask()
XRender extension is not supported on the X11 display, or if the
handle could not be created.
*/
+
+#ifdef Q_OS_SYMBIAN
+void QWidgetPrivate::_q_delayedDestroy(WId winId)
+{
+ delete winId;
+}
+#endif
+
+QT_END_NAMESPACE
+
+#include "moc_qwidget.cpp"
+
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 6f3088322..5ba1d231a 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -44,6 +44,7 @@
#include <QtGui/qwindowdefs.h>
#include <QtCore/qobject.h>
+#include <QtCore/qmargins.h>
#include <QtGui/qpaintdevice.h>
#include <QtGui/qpalette.h>
#include <QtGui/qfont.h>
@@ -95,7 +96,7 @@ class QIcon;
class QWindowSurface;
class QLocale;
class QGraphicsProxyWidget;
-class QGestureManager;
+class QGraphicsEffect;
#if defined(Q_WS_X11)
class QX11Info;
#endif
@@ -131,9 +132,6 @@ public:
int alloc_region_index;
// int alloc_region_revision;
#endif
-#if defined(Q_WS_WINCE)
- uint window_state_internal : 4;
-#endif
QRect wrect;
};
@@ -213,6 +211,7 @@ class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice
#endif
Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET unsetLocale)
Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath DESIGNABLE isWindow)
+ Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
public:
enum RenderFlag {
@@ -289,6 +288,10 @@ public:
void setMaximumWidth(int maxw);
void setMaximumHeight(int maxh);
+#ifdef Q_QDOC
+ void setupUi(QWidget *widget);
+#endif
+
QSize sizeIncrement() const;
void setSizeIncrement(const QSize &);
void setSizeIncrement(int w, int h);
@@ -352,6 +355,14 @@ public:
const QRegion &sourceRegion = QRegion(),
RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren));
+#ifndef QT_NO_GRAPHICSEFFECT
+ QGraphicsEffect *graphicsEffect() const;
+ void setGraphicsEffect(QGraphicsEffect *effect);
+#endif //QT_NO_GRAPHICSEFFECT
+
+ void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
+ void ungrabGesture(Qt::GestureType type);
+
public Q_SLOTS:
void setWindowTitle(const QString &);
#ifndef QT_NO_STYLE_STYLESHEET
@@ -522,7 +533,10 @@ public:
QRegion visibleRegion() const;
void setContentsMargins(int left, int top, int right, int bottom);
+ void setContentsMargins(const QMargins &margins);
void getContentsMargins(int *left, int *top, int *right, int *bottom) const;
+ QMargins contentsMargins() const;
+
QRect contentsRect() const;
public:
@@ -675,6 +689,10 @@ protected:
virtual void inputMethodEvent(QInputMethodEvent *);
public:
virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const;
+
+ Qt::InputMethodHints inputMethodHints() const;
+ void setInputMethodHints(Qt::InputMethodHints hints);
+
protected:
void resetInputContext();
protected Q_SLOTS:
@@ -715,16 +733,17 @@ private:
friend class QGLContext;
friend class QGLWidget;
friend class QGLWindowSurface;
- friend class QVGWindowSurface;
friend class QX11PaintEngine;
friend class QWin32PaintEngine;
friend class QShortcutPrivate;
friend class QShortcutMap;
friend class QWindowSurface;
- friend class QD3DWindowSurface;
friend class QGraphicsProxyWidget;
friend class QGraphicsProxyWidgetPrivate;
friend class QStyleSheetStyle;
+ friend struct QWidgetExceptionCleaner;
+ friend class QGestureManager;
+ friend class QWinNativePanGestureRecognizer;
#ifdef Q_WS_MAC
friend class QCoreGraphicsPaintEnginePrivate;
@@ -746,6 +765,10 @@ private:
friend bool isWidgetOpaque(const QWidget *);
friend class QGLWidgetPrivate;
#endif
+#ifdef Q_OS_SYMBIAN
+ friend class QSymbianControl;
+ friend class QS60WindowSurface;
+#endif
#ifdef Q_WS_X11
friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp);
friend void qt_net_remove_user_time(QWidget *tlw);
@@ -757,6 +780,9 @@ private:
private:
Q_DISABLE_COPY(QWidget)
Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden())
+#ifdef Q_OS_SYMBIAN
+ Q_PRIVATE_SLOT(d_func(), void _q_delayedDestroy(WId winId))
+#endif
QWidgetData *data;
@@ -809,7 +835,7 @@ public:
inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); }
inline QT3_SUPPORT void setPalette(const QPalette &p, bool) { setPalette(p); }
enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin };
- inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin){};
+ inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin) {}
inline QT3_SUPPORT BackgroundOrigin backgroundOrigin() const { return WindowOrigin; }
inline QT3_SUPPORT QPoint backgroundOffset() const { return QPoint(); }
inline QT3_SUPPORT void repaint(bool) { repaint(); }
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 5bf140c9a..c75358d5a 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -107,6 +107,7 @@
#include <private/qcocoapanel_mac_p.h>
#include "qwidget_p.h"
+#include "qevent_p.h"
#include "qdnd_p.h"
#include <QtGui/qgraphicsproxywidget.h>
@@ -119,7 +120,7 @@ QT_BEGIN_NAMESPACE
extern "C" {
extern OSStatus _HIViewScrollRectWithOptions(HIViewRef, const HIRect *, CGFloat, CGFloat,
- OptionBits);
+ OptionBits) __attribute__ ((weak));
}
#define kHIViewScrollRectAdjustInvalid 1
#define kHIViewScrollRectDontInvalidateRevealedArea 2
@@ -300,6 +301,16 @@ bool qt_mac_is_macdrawer(const QWidget *w)
return (w && w->parentWidget() && w->windowType() == Qt::Drawer);
}
+bool qt_mac_insideKeyWindow(const QWidget *w)
+{
+#ifdef QT_MAC_USE_COCOA
+ return [[reinterpret_cast<NSView *>(w->winId()) window] isKeyWindow];
+#else
+ Q_UNUSED(w);
+#endif
+ return false;
+}
+
bool qt_mac_set_drawer_preferred_edge(QWidget *w, Qt::DockWidgetArea where) //users of Qt for Mac OS X can use this..
{
if(!qt_mac_is_macdrawer(w))
@@ -714,11 +725,29 @@ static OSWindowRef qt_mac_create_window(QWidget *, WindowClass wclass, WindowAtt
return window;
}
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
+/* We build the release package against the 10.4 SDK.
+ So, to enable gestures for applications running on
+ 10.6+, we define the missing constants here: */
+enum {
+ kEventClassGesture = 'gest',
+ kEventGestureStarted = 1,
+ kEventGestureEnded = 2,
+ kEventGestureMagnify = 4,
+ kEventGestureSwipe = 5,
+ kEventGestureRotate = 6,
+ kEventParamRotationAmount = 'rota',
+ kEventParamSwipeDirection = 'swip',
+ kEventParamMagnificationAmount = 'magn'
+};
+#endif
+
// window events
static EventTypeSpec window_events[] = {
{ kEventClassWindow, kEventWindowClose },
{ kEventClassWindow, kEventWindowExpanded },
{ kEventClassWindow, kEventWindowHidden },
+ { kEventClassWindow, kEventWindowZoom },
{ kEventClassWindow, kEventWindowZoomed },
{ kEventClassWindow, kEventWindowCollapsed },
{ kEventClassWindow, kEventWindowToolbarSwitchMode },
@@ -729,6 +758,11 @@ static EventTypeSpec window_events[] = {
{ kEventClassWindow, kEventWindowGetRegion },
{ kEventClassWindow, kEventWindowGetClickModality },
{ kEventClassWindow, kEventWindowTransitionCompleted },
+ { kEventClassGesture, kEventGestureStarted },
+ { kEventClassGesture, kEventGestureEnded },
+ { kEventClassGesture, kEventGestureMagnify },
+ { kEventClassGesture, kEventGestureSwipe },
+ { kEventClassGesture, kEventGestureRotate },
{ kEventClassMouse, kEventMouseDown }
};
static EventHandlerUPP mac_win_eventUPP = 0;
@@ -794,6 +828,9 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
QShowEvent qse;
QApplication::sendSpontaneousEvent(widget, &qse);
+ } else if(ekind == kEventWindowZoom) {
+ widget->d_func()->topData()->normalGeometry = widget->geometry();
+ handled_event = false;
} else if(ekind == kEventWindowZoomed) {
WindowPartCode windowPart;
GetEventParameter(event, kEventParamWindowPartCode,
@@ -1013,6 +1050,74 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
return SendEventToApplication(event);
handled_event = false;
break; }
+
+ case kEventClassGesture: {
+ // First, find the widget that was under
+ // the mouse when the gesture happened:
+ HIPoint screenLocation;
+ if (GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, 0,
+ sizeof(screenLocation), 0, &screenLocation) != noErr) {
+ handled_event = false;
+ break;
+ }
+ QWidget *widget = QApplication::widgetAt(screenLocation.x, screenLocation.y);
+ if (!widget) {
+ handled_event = false;
+ break;
+ }
+
+ QNativeGestureEvent qNGEvent;
+ qNGEvent.position = QPoint(screenLocation.x, screenLocation.y);
+
+ switch (ekind) {
+ case kEventGestureStarted:
+ qNGEvent.gestureType = QNativeGestureEvent::GestureBegin;
+ break;
+ case kEventGestureEnded:
+ qNGEvent.gestureType = QNativeGestureEvent::GestureEnd;
+ break;
+ case kEventGestureRotate: {
+ CGFloat amount;
+ if (GetEventParameter(event, kEventParamRotationAmount, 'cgfl', 0,
+ sizeof(amount), 0, &amount) != noErr) {
+ handled_event = false;
+ break;
+ }
+ qNGEvent.gestureType = QNativeGestureEvent::Rotate;
+ qNGEvent.percentage = float(-amount);
+ break; }
+ case kEventGestureSwipe: {
+ HIPoint swipeDirection;
+ if (GetEventParameter(event, kEventParamSwipeDirection, typeHIPoint, 0,
+ sizeof(swipeDirection), 0, &swipeDirection) != noErr) {
+ handled_event = false;
+ break;
+ }
+ qNGEvent.gestureType = QNativeGestureEvent::Swipe;
+ if (swipeDirection.x == 1)
+ qNGEvent.angle = 180.0f;
+ else if (swipeDirection.x == -1)
+ qNGEvent.angle = 0.0f;
+ else if (swipeDirection.y == 1)
+ qNGEvent.angle = 90.0f;
+ else if (swipeDirection.y == -1)
+ qNGEvent.angle = 270.0f;
+ break; }
+ case kEventGestureMagnify: {
+ CGFloat amount;
+ if (GetEventParameter(event, kEventParamMagnificationAmount, 'cgfl', 0,
+ sizeof(amount), 0, &amount) != noErr) {
+ handled_event = false;
+ break;
+ }
+ qNGEvent.gestureType = QNativeGestureEvent::Zoom;
+ qNGEvent.percentage = float(amount);
+ break; }
+ }
+
+ QApplication::sendSpontaneousEvent(widget, &qNGEvent);
+ break; }
+
default:
handled_event = false;
}
@@ -2496,7 +2601,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
Q_D(QWidget);
if (!isWindow() && parentWidget())
- parentWidget()->d_func()->invalidateBuffer(geometry());
+ parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
d->deactivateWidgetCleanup();
qt_mac_event_release(this);
if(testAttribute(Qt::WA_WState_Created)) {
@@ -2512,8 +2617,6 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
releaseMouse();
if(mac_keyboard_grabber == this)
releaseKeyboard();
- if(acceptDrops())
- setAcceptDrops(false);
if(testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal
QApplicationPrivate::leaveModal(this);
@@ -2547,7 +2650,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
qt_mac_destructWindow(window);
}
}
- d->setWinId(0);
+ QT_TRY {
+ d->setWinId(0);
+ } QT_CATCH (const std::bad_alloc &) {
+ // swallow - destructors must not throw
+ }
}
}
@@ -2577,7 +2684,10 @@ void QWidgetPrivate::transferChildren()
// site disabled until it is part of the new hierarchy.
bool oldRegistered = w->testAttribute(Qt::WA_DropSiteRegistered);
w->setAttribute(Qt::WA_DropSiteRegistered, false);
+ [qt_mac_nativeview_for(w) retain];
+ [qt_mac_nativeview_for(w) removeFromSuperview];
[qt_mac_nativeview_for(q) addSubview:qt_mac_nativeview_for(w)];
+ [qt_mac_nativeview_for(w) release];
w->setAttribute(Qt::WA_DropSiteRegistered, oldRegistered);
#endif
}
@@ -2598,7 +2708,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
OSViewRef old_id = 0;
if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
- q->parentWidget()->d_func()->invalidateBuffer(q->geometry());
+ q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
// Maintain the glWidgets list on parent change: remove "our" gl widgets
// from the list on the old parent and grandparents.
@@ -2804,6 +2914,7 @@ void QWidgetPrivate::setCursor_sys(const QCursor &)
#else
Q_Q(QWidget);
if (q->testAttribute(Qt::WA_WState_Created)) {
+ QMacCocoaAutoReleasePool pool;
[qt_mac_window_for(q) invalidateCursorRectsForView:qt_mac_nativeview_for(q)];
}
#endif
@@ -2816,6 +2927,7 @@ void QWidgetPrivate::unsetCursor_sys()
#else
Q_Q(QWidget);
if (q->testAttribute(Qt::WA_WState_Created)) {
+ QMacCocoaAutoReleasePool pool;
[qt_mac_window_for(q) invalidateCursorRectsForView:qt_mac_nativeview_for(q)];
}
#endif
@@ -2923,10 +3035,17 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
#else
QMacCocoaAutoReleasePool pool;
NSButton *iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
+ if (iconButton == nil) {
+ QCFString string(q->windowTitle());
+ const NSString *tmpString = reinterpret_cast<const NSString *>((CFStringRef)string);
+ [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:tmpString]];
+ iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
+ }
if (icon.isNull()) {
[iconButton setImage:nil];
} else {
- NSImage *image = static_cast<NSImage *>(qt_mac_create_nsimage(*pm));
+ QPixmap scaled = pm->scaled(QSize(16,16), Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ NSImage *image = static_cast<NSImage *>(qt_mac_create_nsimage(scaled));
[iconButton setImage:image];
[image release];
}
@@ -2956,6 +3075,7 @@ void QWidget::grabMouse()
}
}
+#ifndef QT_NO_CURSOR
void QWidget::grabMouse(const QCursor &)
{
if(isVisible() && !qt_nograb()) {
@@ -2964,6 +3084,7 @@ void QWidget::grabMouse(const QCursor &)
mac_mouse_grabber=this;
}
}
+#endif
void QWidget::releaseMouse()
{
@@ -3211,7 +3332,11 @@ void QWidgetPrivate::show_sys()
[window miniaturize:window];
#endif
} else if (!q->testAttribute(Qt::WA_ShowWithoutActivating)) {
+#ifndef QT_MAC_USE_COCOA
qt_event_request_activate(q);
+#else
+ [qt_mac_window_for(q) makeKeyWindow];
+#endif
}
} else if(topData()->embedded || !q->parentWidget() || q->parentWidget()->isVisible()) {
#ifndef QT_MAC_USE_COCOA
@@ -3292,12 +3417,19 @@ void QWidgetPrivate::hide_sys()
w = q->parentWidget()->window();
if(!w || (!w->isVisible() && !w->isMinimized())) {
#ifndef QT_MAC_USE_COCOA
- for(WindowPtr wp = GetFrontWindowOfClass(kDocumentWindowClass, true);
- wp; wp = GetNextWindowOfClass(wp, kDocumentWindowClass, true)) {
+ for (WindowPtr wp = GetFrontWindowOfClass(kMovableModalWindowClass, true);
+ wp; wp = GetNextWindowOfClass(wp, kMovableModalWindowClass, true)) {
if((w = qt_mac_find_window(wp)))
break;
}
if (!w){
+ for (WindowPtr wp = GetFrontWindowOfClass(kDocumentWindowClass, true);
+ wp; wp = GetNextWindowOfClass(wp, kDocumentWindowClass, true)) {
+ if((w = qt_mac_find_window(wp)))
+ break;
+ }
+ }
+ if (!w){
for(WindowPtr wp = GetFrontWindowOfClass(kSimpleWindowClass, true);
wp; wp = GetNextWindowOfClass(wp, kSimpleWindowClass, true)) {
if((w = qt_mac_find_window(wp)))
@@ -3314,8 +3446,13 @@ void QWidgetPrivate::hide_sys()
}
#endif
}
- if(w && w->isVisible() && !w->isMinimized())
- qt_event_request_activate(w);
+ if(w && w->isVisible() && !w->isMinimized()) {
+#ifndef QT_MAC_USE_COCOA
+ qt_event_request_activate(w);
+#else
+ [qt_mac_window_for(w) makeKeyWindow];
+#endif
+ }
}
} else {
invalidateBuffer(q->rect());
@@ -3368,10 +3505,10 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
qt_mac_set_fullscreen_mode(true);
} else {
needShow = isVisible();
- setParent(parentWidget(), d->topData()->savedFlags);
- setGeometry(d->topData()->normalGeometry);
if(!qApp->desktop()->screenNumber(this))
qt_mac_set_fullscreen_mode(false);
+ setParent(parentWidget(), d->topData()->savedFlags);
+ setGeometry(d->topData()->normalGeometry);
d->topData()->normalGeometry.setRect(0, 0, -1, -1);
}
}
@@ -3473,7 +3610,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
[window zoom:window];
#endif
needSendStateChange = oldstate == windowState(); // Zoom didn't change flags.
- } else if(oldstate & Qt::WindowMaximized) {
+ } else if(oldstate & Qt::WindowMaximized && !(oldstate & Qt::WindowFullScreen)) {
#ifndef QT_MAC_USE_COCOA
Point idealSize;
ZoomWindowIdeal(window, inZoomIn, &idealSize);
@@ -3527,7 +3664,7 @@ void QWidgetPrivate::raise_sys()
QMacCocoaAutoReleasePool pool;
if (isRealWindow()) {
// Calling orderFront shows the window on Cocoa too.
- if (!q->testAttribute(Qt::WA_DontShowOnScreen)) {
+ if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) {
[qt_mac_window_for(q) orderFront:qt_mac_window_for(q)];
}
if (qt_mac_raise_process) { //we get to be the active process now
@@ -3668,7 +3805,7 @@ void QWidgetPrivate::stackUnder_sys(QWidget *w)
/*
Modifies the bounds for a widgets backing HIView during moves and resizes. Also updates the
widget, either by scrolling its contents or repainting, depending on the WA_StaticContents
- and QWidgetPrivate::isOpaque flags.
+ flag
*/
static void qt_mac_update_widget_posisiton(QWidget *q, QRect oldRect, QRect newRect)
{
@@ -3685,8 +3822,8 @@ static void qt_mac_update_widget_posisiton(QWidget *q, QRect oldRect, QRect newR
// Perform a normal (complete repaint) update in some cases:
if (
- // move-by-scroll requires QWidgetPrivate::isOpaque set
- (isMove && q->testAttribute(Qt::WA_OpaquePaintEvent) == false) ||
+ // always repaint on move.
+ (isMove) ||
// limited update on resize requires WA_StaticContents.
(isResize && q->testAttribute(Qt::WA_StaticContents) == false) ||
@@ -3695,7 +3832,10 @@ static void qt_mac_update_widget_posisiton(QWidget *q, QRect oldRect, QRect newR
(oldRect.isValid() == false || newRect.isValid() == false) ||
// the position update is a part of a drag-and-drop operation
- QDragManager::self()->object
+ QDragManager::self()->object ||
+
+ // we are on Panther (no HIViewSetNeedsDisplayInRect)
+ QSysInfo::MacintoshVersion < QSysInfo::MV_10_4
){
HIViewSetFrame(view, &bounds);
return;
@@ -4094,12 +4234,12 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
setWSGeometry(false, oldRect);
if (isResize && QApplicationPrivate::graphicsSystem()) {
invalidateBuffer(q->rect());
- if (extra && !extra->mask.isEmpty()) {
+ if (extra && !graphicsEffect && !extra->mask.isEmpty()) {
QRegion oldRegion(extra->mask.translated(oldp));
oldRegion &= oldRect;
q->parentWidget()->d_func()->invalidateBuffer(oldRegion);
} else {
- q->parentWidget()->d_func()->invalidateBuffer(oldRect);
+ q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(oldRect));
}
}
}
@@ -4414,9 +4554,12 @@ void QWidgetPrivate::registerDropSite(bool on)
#ifndef QT_MAC_USE_COCOA
SetControlDragTrackingEnabled(qt_mac_nativeview_for(q), on);
#else
- NSView *view = qt_mac_nativeview_for(q);
- if (on && [view isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) {
- [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(view) registerDragTypes];
+ NSWindow *win = qt_mac_window_for(q);
+ if (on) {
+ if ([win isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaWindow) class]])
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaWindow) *>(win) registerDragTypes];
+ else if ([win isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaPanel) class]])
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaPanel) *>(win) registerDragTypes];
}
#endif
}
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index a3f4f6fe3..64e3290d9 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -61,6 +61,12 @@
#include "QtGui/qregion.h"
#include "QtGui/qsizepolicy.h"
#include "QtGui/qstyle.h"
+#include "QtGui/qapplication.h"
+#include <private/qgraphicseffect_p.h>
+#include "QtGui/qgraphicsproxywidget.h"
+#include "QtGui/qgraphicsscene.h"
+#include "QtGui/qgraphicsview.h"
+#include <private/qgesture_p.h>
#ifdef Q_WS_WIN
#include "QtCore/qt_windows.h"
@@ -80,6 +86,11 @@
#include "QtGui/qscreen_qws.h"
#endif
+#if defined(Q_OS_SYMBIAN)
+class RDrawableWindow;
+class CCoeControl;
+#endif
+
QT_BEGIN_NAMESPACE
// Extra QWidget data
@@ -171,7 +182,9 @@ struct QWExtra {
// Regular pointers (keep them together to avoid gaps on 64 bits architectures).
void *glContext; // if the widget is hijacked by QGLWindowSurface
QTLWExtra *topextra; // only useful for TLWs
+#ifndef QT_NO_GRAPHICSVIEW
QGraphicsProxyWidget *proxyWidget; // if the widget is embedded
+#endif
#ifndef QT_NO_CURSOR
QCursor *curs;
#endif
@@ -214,9 +227,66 @@ struct QWExtra {
QImage maskBits;
CGImageRef imageMask;
#endif
+#elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian
+ uint activated : 1; // RWindowBase::Activated has been called
+
+ /**
+ * Defines the behaviour of QSymbianControl::Draw.
+ */
+ enum NativePaintMode {
+ /**
+ * Normal drawing mode: blits the required region of the backing store
+ * via WSERV.
+ */
+ Blit,
+
+ /**
+ * Disable drawing for this widget.
+ */
+ Disable,
+
+ /**
+ * Paint zeros into the WSERV framebuffer, using BitGDI APIs. For windows
+ * with an EColor16MU display mode, zero is written only into the R, G and B
+ * channels of the pixel.
+ */
+ ZeroFill,
+
+ Default = Blit
+ };
+
+ NativePaintMode nativePaintMode : 2;
+
+ /**
+ * If this bit is set, each native widget receives the signals from the
+ * Symbian control immediately before and immediately after draw ops are
+ * sent to the window server for this control:
+ * void beginNativePaintEvent(const QRect &paintRect);
+ * void endNativePaintEvent(const QRect &paintRect);
+ */
+ uint receiveNativePaintEvents : 1;
+
#endif
};
+/*!
+ \internal
+
+ Returns true if \a p or any of its parents enable the
+ Qt::BypassGraphicsProxyWidget window flag. Used in QWidget::show() and
+ QWidget::setParent() to determine whether it's necessary to embed the
+ widget into a QGraphicsProxyWidget or not.
+*/
+static inline bool bypassGraphicsProxyWidget(const QWidget *p)
+{
+ while (p) {
+ if (p->windowFlags() & Qt::BypassGraphicsProxyWidget)
+ return true;
+ p = p->parentWidget();
+ }
+ return false;
+}
+
class Q_GUI_EXPORT QWidgetPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QWidget)
@@ -239,6 +309,13 @@ public:
CloseWithSpontaneousEvent
};
+ enum Direction {
+ DirectionNorth = 0x01,
+ DirectionEast = 0x10,
+ DirectionSouth = 0x02,
+ DirectionWest = 0x20
+ };
+
// Functions.
explicit QWidgetPrivate(int version = QObjectPrivateVersion);
~QWidgetPrivate();
@@ -269,6 +346,12 @@ public:
QPalette naturalWidgetPalette(uint inheritedMask) const;
void setMask_sys(const QRegion &);
+#ifdef Q_OS_SYMBIAN
+ void setSoftKeys_sys(const QList<QAction*> &softkeys);
+ void activateSymbianWindow(WId wid = 0);
+ void _q_delayedDestroy(WId winId);
+#endif
+
void raise_sys();
void lower_sys();
void stackUnder_sys(QWidget *);
@@ -300,6 +383,8 @@ public:
QRegion prepareToRender(const QRegion &region, QWidget::RenderFlags renderFlags);
void render_helper(QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion,
QWidget::RenderFlags renderFlags);
+ void render(QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion,
+ QWidget::RenderFlags renderFlags, bool readyToRender);
void drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags,
QPainter *sharedPainter = 0, QWidgetBackingStore *backingStore = 0);
@@ -314,7 +399,9 @@ public:
QPainter *beginSharedPainter();
bool endSharedPainter();
- static QGraphicsProxyWidget * nearestGraphicsProxyWidget(QWidget *origin);
+#ifndef QT_NO_GRAPHICSVIEW
+ static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin);
+#endif
QWindowSurface *createDefaultWindowSurface();
QWindowSurface *createDefaultWindowSurface_sys();
void repaint_sys(const QRegion &rgn);
@@ -329,8 +416,10 @@ public:
void setOpaque(bool opaque);
void updateIsTranslucent();
bool paintOnScreen() const;
+#ifndef QT_NO_GRAPHICSEFFECT
+ void invalidateGraphicsEffectsRecursively();
+#endif //QT_NO_GRAPHICSEFFECT
- QRegion getOpaqueRegion() const;
const QRegion &getOpaqueChildren() const;
void setDirtyOpaqueRegion();
@@ -380,6 +469,11 @@ public:
void updateFrameStrut();
QRect frameStrut() const;
+#ifdef QT_KEYPAD_NAVIGATION
+ static bool navigateToDirection(Direction direction);
+ static QWidget *widgetInNavigationDirection(Direction direction);
+#endif
+
void setWindowIconText_sys(const QString &cap);
void setWindowIconText_helper(const QString &cap);
void setWindowTitle_sys(const QString &cap);
@@ -403,9 +497,40 @@ public:
void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0);
QInputContext *inputContext() const;
+ inline QWidget *effectiveFocusWidget() {
+ QWidget *w = q_func();
+ while (w->focusProxy())
+ w = w->focusProxy();
+ return w;
+ }
void setModal_sys();
+ // This is an helper function that return the available geometry for
+ // a widget and takes care is this one is in QGraphicsView.
+ // If the widget is not embed in a scene then the geometry available is
+ // null, we let QDesktopWidget decide for us.
+ static QRect screenGeometry(const QWidget *widget)
+ {
+ QRect screen;
+#ifndef QT_NO_GRAPHICSVIEW
+ QGraphicsProxyWidget *ancestorProxy = widget->d_func()->nearestGraphicsProxyWidget(widget);
+ //It's embedded if it has an ancestor
+ if (ancestorProxy) {
+ if (!bypassGraphicsProxyWidget(widget) && ancestorProxy->scene() != 0) {
+ // One view, let be smart and return the viewport rect then the popup is aligned
+ if (ancestorProxy->scene()->views().size() == 1) {
+ QGraphicsView *view = ancestorProxy->scene()->views().at(0);
+ screen = view->mapToScene(view->viewport()->rect()).boundingRect().toRect();
+ } else {
+ screen = ancestorProxy->scene()->sceneRect().toRect();
+ }
+ }
+ }
+#endif
+ return screen;
+ }
+
inline void setRedirected(QPaintDevice *replacement, const QPoint &offset)
{
Q_ASSERT(q_func()->testAttribute(Qt::WA_WState_InPaintEvent));
@@ -443,8 +568,30 @@ public:
return extra ? extra->nativeChildrenForced : false;
}
+ inline QRect effectiveRectFor(const QRect &rect) const
+ {
+#ifndef QT_NO_GRAPHICSEFFECT
+ if (graphicsEffect && graphicsEffect->isEnabled())
+ return graphicsEffect->boundingRectFor(rect).toAlignedRect();
+#endif //QT_NO_GRAPHICSEFFECT
+ return rect;
+ }
+
QSize adjustedSize() const;
+ inline void handleSoftwareInputPanel(Qt::MouseButton button, bool clickCausedFocus)
+ {
+ Q_Q(QWidget);
+ if (button == Qt::LeftButton && qApp->autoSipEnabled()) {
+ QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
+ q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
+ if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
+ QEvent event(QEvent::RequestSoftwareInputPanel);
+ QApplication::sendEvent(q, &event);
+ }
+ }
+ }
+
#ifndef Q_WS_QWS // Almost cross-platform :-)
void setWSGeometry(bool dontShow=false, const QRect &oldRect = QRect());
@@ -473,12 +620,15 @@ public:
QWidgetItemV2 *widgetItem;
QPaintEngine *extraPaintEngine;
mutable const QMetaObject *polished;
- // All widgets are initially added into the uncreatedWidgets set. Once
- // they receive a window id they are removed and added to the mapper
+ QGraphicsEffect *graphicsEffect;
+ // All widgets are added into the allWidgets set. Once
+ // they receive a window id they are also added to the mapper.
+ // This should just ensure that all widgets are deleted by QApplication
static QWidgetMapper *mapper;
- static QWidgetSet *uncreatedWidgets;
+ static QWidgetSet *allWidgets;
#if !defined(QT_NO_IM)
QPointer<QInputContext> ic;
+ Qt::InputMethodHints imHints;
#endif
#ifdef QT_KEYPAD_NAVIGATION
static QPointer<QWidget> editingWidget;
@@ -522,6 +672,7 @@ public:
#ifndef QT_NO_ACTION
QList<QAction*> actions;
#endif
+ QMap<Qt::GestureType, Qt::GestureFlags> gestureContext;
// Bit fields.
uint high_attributes[3]; // the low ones are in QWidget::widget_attributes
@@ -548,6 +699,7 @@ public:
bool isBackgroundInherited() const;
#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN
uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine()
+ uint nativeGesturePanEnabled : 1;
bool shouldShowMaximizeButton();
void winUpdateIsOpaque();
@@ -639,8 +791,85 @@ public:
void updateCursor() const;
#endif
QScreen* getScreen() const;
+#elif defined(Q_OS_SYMBIAN) // <--------------------------------------------------------- SYMBIAN
+ static QWidget *mouseGrabber;
+ static QWidget *keyboardGrabber;
+ void s60UpdateIsOpaque();
+ void reparentChildren();
+ void registerTouchWindow();
#endif
+
+};
+
+struct QWidgetPaintContext
+{
+ inline QWidgetPaintContext(QPaintDevice *d, const QRegion &r, const QPoint &o, int f,
+ QPainter *p, QWidgetBackingStore *b)
+ : pdev(d), rgn(r), offset(o), flags(f), sharedPainter(p), backingStore(b), painter(0) {}
+
+ QPaintDevice *pdev;
+ QRegion rgn;
+ QPoint offset;
+ int flags;
+ QPainter *sharedPainter;
+ QWidgetBackingStore *backingStore;
+ QPainter *painter;
+};
+
+#ifndef QT_NO_GRAPHICSEFFECT
+class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate
+{
+public:
+ QWidgetEffectSourcePrivate(QWidget *widget)
+ : QGraphicsEffectSourcePrivate(), m_widget(widget), context(0), updateDueToGraphicsEffect(false)
+ {}
+
+ inline void detach()
+ { m_widget->setGraphicsEffect(0); }
+
+ inline const QGraphicsItem *graphicsItem() const
+ { return 0; }
+
+ inline const QWidget *widget() const
+ { return m_widget; }
+
+ inline void update()
+ {
+ updateDueToGraphicsEffect = true;
+ m_widget->update();
+ updateDueToGraphicsEffect = false;
+ }
+
+ inline bool isPixmap() const
+ { return false; }
+
+ inline void effectBoundingRectChanged()
+ {
+ // ### This function should take a rect parameter; then we can avoid
+ // updating too much on the parent widget.
+ if (QWidget *parent = m_widget->parentWidget())
+ parent->update();
+ else
+ update();
+ }
+
+ inline const QStyleOption *styleOption() const
+ { return 0; }
+
+ inline QRect deviceRect() const
+ { return m_widget->window()->rect(); }
+
+ QRectF boundingRect(Qt::CoordinateSystem system) const;
+ void draw(QPainter *p);
+ QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset,
+ QGraphicsEffect::PixmapPadMode mode) const;
+
+ QWidget *m_widget;
+ QWidgetPaintContext *context;
+ QTransform lastEffectTransform;
+ bool updateDueToGraphicsEffect;
};
+#endif //QT_NO_GRAPHICSEFFECT
inline QWExtra *QWidgetPrivate::extraData() const
{
diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp
index ea3cef2bc..e299c6e2e 100644
--- a/src/gui/kernel/qwidget_qws.cpp
+++ b/src/gui/kernel/qwidget_qws.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -258,7 +258,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
Q_D(QWidget);
if (!isWindow() && parentWidget())
- parentWidget()->d_func()->invalidateBuffer(geometry());
+ parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
d->deactivateWidgetCleanup();
if (testAttribute(Qt::WA_WState_Created)) {
@@ -280,7 +280,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
QApplicationPrivate::leaveModal(this);
else if ((windowType() == Qt::Popup))
qApp->d_func()->closePopup(this);
-
+#ifndef QT_NO_IM
if (d->ic) {
delete d->ic;
d->ic =0;
@@ -291,6 +291,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
if (qic)
qic->widgetDestroyed(this);
}
+#endif //QT_NO_IM
if ((windowType() == Qt::Desktop)) {
} else {
@@ -298,11 +299,16 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
d->hide_sys();
}
if (destroyWindow && isWindow()) {
- d->extra->topextra->backingStore->windowSurface->setGeometry(QRect());
+ if (d->extra && d->extra->topextra && d->extra->topextra->backingStore)
+ d->extra->topextra->backingStore->windowSurface->setGeometry(QRect());
qwsDisplay()->destroyRegion(internalWinId());
}
}
- d->setWinId(0);
+ QT_TRY {
+ d->setWinId(0);
+ } QT_CATCH (const std::bad_alloc &) {
+ // swallow - destructors must not throw
+ }
}
}
@@ -312,7 +318,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
Q_Q(QWidget);
bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
- q->parentWidget()->d_func()->invalidateBuffer(q->geometry());
+ q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
#ifndef QT_NO_CURSOR
QCursor oldcurs;
bool setcurs=q->testAttribute(Qt::WA_SetCursor);
@@ -576,6 +582,15 @@ void QWidgetPrivate::show_sys()
if (q->isWindow()) {
+
+ if (!q->testAttribute(Qt::WA_ShowWithoutActivating)
+ && q->windowType() != Qt::Popup
+ && q->windowType() != Qt::Tool
+ && q->windowType() != Qt::ToolTip) {
+ QWidget::qwsDisplay()->requestFocus(data.winid,true);
+ }
+
+
if (QWindowSurface *surface = q->windowSurface()) {
const QRect frameRect = q->frameGeometry();
if (surface->geometry() != frameRect)
@@ -592,12 +607,6 @@ void QWidgetPrivate::show_sys()
#endif
data.fstrut_dirty = true;
invalidateBuffer(r);
- if (!q->testAttribute(Qt::WA_ShowWithoutActivating)
- && q->windowType() != Qt::Popup
- && q->windowType() != Qt::Tool
- && q->windowType() != Qt::ToolTip) {
- QWidget::qwsDisplay()->requestFocus(data.winid,true);
- }
bool staysontop =
(q->windowFlags() & Qt::WindowStaysOnTopHint)
|| q->windowType() == Qt::Popup;
@@ -638,7 +647,8 @@ void QWidgetPrivate::hide_sys()
q->releaseMouse();
// requestWindowRegion(QRegion());
- extra->topextra->backingStore->releaseBuffer();
+ if (extra->topextra->backingStore)
+ extra->topextra->backingStore->releaseBuffer();
QWidget::qwsDisplay()->requestFocus(data.winid,false);
@@ -805,7 +815,7 @@ void QWidgetPrivate::lower_sys()
QWSChangeAltitudeCommand::Lower);
} else if (QWidget *p = q->parentWidget()) {
setDirtyOpaqueRegion();
- p->d_func()->invalidateBuffer(q->geometry());
+ p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
}
}
@@ -814,7 +824,7 @@ void QWidgetPrivate::stackUnder_sys(QWidget*)
Q_Q(QWidget);
if (QWidget *p = q->parentWidget()) {
setDirtyOpaqueRegion();
- p->d_func()->invalidateBuffer(q->geometry());
+ p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
}
}
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
new file mode 100644
index 000000000..37614c755
--- /dev/null
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -0,0 +1,1295 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwidget_p.h"
+#include "qdesktopwidget.h"
+#include "qapplication.h"
+#include "qapplication_p.h"
+#include "private/qbackingstore_p.h"
+#include "qevent.h"
+#include "qt_s60_p.h"
+
+#include "qbitmap.h"
+#include "private/qwindowsurface_s60_p.h"
+
+#include <qinputcontext.h>
+
+#ifdef Q_WS_S60
+#include <aknappui.h>
+#endif
+
+// This is necessary in order to be able to perform delayed invokation on slots
+// which take arguments of type WId. One example is
+// QWidgetPrivate::_q_delayedDestroy, which is used to delay destruction of
+// CCoeControl objects until after the CONE event handler has finished running.
+Q_DECLARE_METATYPE(WId)
+
+QT_BEGIN_NAMESPACE
+
+extern bool qt_nograb();
+
+QWidget *QWidgetPrivate::mouseGrabber = 0;
+QWidget *QWidgetPrivate::keyboardGrabber = 0;
+
+static bool isEqual(const QList<QAction*>& a, const QList<QAction*>& b)
+{
+ if ( a.count() != b.count())
+ return false;
+ int index=0;
+ while (index<a.count()) {
+ if (a.at(index)->softKeyRole() != b.at(index)->softKeyRole())
+ return false;
+ if (a.at(index)->text().compare(b.at(index)->text())!=0)
+ return false;
+ index++;
+ }
+ return true;
+}
+
+void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &)
+{
+ // Note: based on x11 implementation
+
+ static const int XCOORD_MAX = 16383;
+ static const int WRECT_MAX = 16383;
+
+ Q_Q(QWidget);
+
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+
+ /*
+ There are up to four different coordinate systems here:
+ Qt coordinate system for this widget.
+ Symbian coordinate system for this widget (relative to wrect).
+ Qt coordinate system for parent
+ Symbian coordinate system for parent (relative to parent's wrect).
+ */
+
+ QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX);
+ QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX);
+ QRect wrect;
+ //xrect is the Symbian geometry of my widget. (starts out in parent's Qt coord sys, and ends up in parent's Symbian coord sys)
+ QRect xrect = data.crect;
+
+ const QWidget *const parent = q->parentWidget();
+ QRect parentWRect = parent->data->wrect;
+
+ if (parentWRect.isValid()) {
+ // parent is clipped, and we have to clip to the same limit as parent
+ if (!parentWRect.contains(xrect)) {
+ xrect &= parentWRect;
+ wrect = xrect;
+ //translate from parent's to my Qt coord sys
+ wrect.translate(-data.crect.topLeft());
+ }
+ //translate from parent's Qt coords to parent's X coords
+ xrect.translate(-parentWRect.topLeft());
+
+ } else {
+ // parent is not clipped, we may or may not have to clip
+
+ if (data.wrect.isValid() && QRect(QPoint(),data.crect.size()).contains(data.wrect)) {
+ // This is where the main optimization is: we are already
+ // clipped, and if our clip is still valid, we can just
+ // move our window, and do not need to move or clip
+ // children
+
+ QRect vrect = xrect & parent->rect();
+ vrect.translate(-data.crect.topLeft()); //the part of me that's visible through parent, in my Qt coords
+ if (data.wrect.contains(vrect)) {
+ xrect = data.wrect;
+ xrect.translate(data.crect.topLeft());
+ if (data.winid)
+ data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height()));
+ return;
+ }
+ }
+
+ if (!validRange.contains(xrect)) {
+ // we are too big, and must clip
+ xrect &=wrectRange;
+ wrect = xrect;
+ wrect.translate(-data.crect.topLeft());
+ //parent's X coord system is equal to parent's Qt coord
+ //sys, so we don't need to map xrect.
+ }
+ }
+
+ // unmap if we are outside the valid window system coord system
+ bool outsideRange = !xrect.isValid();
+ bool mapWindow = false;
+ if (q->testAttribute(Qt::WA_OutsideWSRange) != outsideRange) {
+ q->setAttribute(Qt::WA_OutsideWSRange, outsideRange);
+ if (outsideRange) {
+ if (data.winid)
+ data.winid->DrawableWindow()->SetVisible(EFalse);
+ q->setAttribute(Qt::WA_Mapped, false);
+ } else if (!q->isHidden()) {
+ mapWindow = true;
+ }
+ }
+
+ if (outsideRange)
+ return;
+
+ bool jump = (data.wrect != wrect);
+ data.wrect = wrect;
+
+ // and now recursively for all children...
+ for (int i = 0; i < children.size(); ++i) {
+ QObject *object = children.at(i);
+ if (object->isWidgetType()) {
+ QWidget *w = static_cast<QWidget *>(object);
+ if (!w->isWindow() && w->testAttribute(Qt::WA_WState_Created))
+ w->d_func()->setWSGeometry(jump);
+ }
+ }
+
+ if (data.winid) {
+ // move ourselves to the new position and map (if necessary) after
+ // the movement. Rationale: moving unmapped windows is much faster
+ // than moving mapped windows
+ if (!parent->internalWinId())
+ xrect.translate(parent->mapTo(q->nativeParentWidget(), QPoint(0, 0)));
+
+ data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height()));
+ }
+
+ if (mapWindow and !dontShow) {
+ q->setAttribute(Qt::WA_Mapped);
+ if (q->internalWinId())
+ q->internalWinId()->DrawableWindow()->SetVisible(ETrue);
+ }
+
+ if (jump && data.winid) {
+ RWindow *const window = static_cast<RWindow *>(data.winid->DrawableWindow());
+ window->Invalidate(TRect(0, 0, wrect.width(), wrect.height()));
+ }
+}
+
+void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
+{
+ Q_Q(QWidget);
+
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+
+ if ((q->windowType() == Qt::Desktop))
+ return;
+
+ QPoint oldPos(q->pos());
+ QSize oldSize(q->size());
+ QRect oldGeom(data.crect);
+
+ // Lose maximized status if deliberate resize
+ if (w != oldSize.width() || h != oldSize.height())
+ data.window_state &= ~Qt::WindowMaximized;
+
+ if (extra) { // any size restrictions?
+ w = qMin(w,extra->maxw);
+ h = qMin(h,extra->maxh);
+ w = qMax(w,extra->minw);
+ h = qMax(h,extra->minh);
+ }
+
+ if (q->isWindow())
+ topData()->normalGeometry = QRect(0, 0, -1, -1);
+ else {
+ uint s = data.window_state;
+ s &= ~(Qt::WindowMaximized | Qt::WindowFullScreen);
+ data.window_state = s;
+ }
+
+ bool isResize = w != oldSize.width() || h != oldSize.height();
+ if (!isMove && !isResize)
+ return;
+
+ if (q->isWindow()) {
+ if (w == 0 || h == 0) {
+ q->setAttribute(Qt::WA_OutsideWSRange, true);
+ if (q->isVisible() && q->testAttribute(Qt::WA_Mapped))
+ hide_sys();
+ data.crect = QRect(x, y, w, h);
+ data.window_state &= ~Qt::WindowFullScreen;
+ } else if (q->isVisible() && q->testAttribute(Qt::WA_OutsideWSRange)) {
+ q->setAttribute(Qt::WA_OutsideWSRange, false);
+
+ // put the window in its place and show it
+ q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h)));
+ data.crect.setRect(x, y, w, h);
+ show_sys();
+ } else {
+ QRect r = QRect(x, y, w, h);
+ data.crect = r;
+ q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h)));
+ topData()->normalGeometry = data.crect;
+ }
+ } else {
+ data.crect.setRect(x, y, w, h);
+
+ QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
+ const bool inTopLevelResize = tlwExtra ? tlwExtra->inTopLevelResize : false;
+
+ if (q->isVisible() && (!inTopLevelResize || q->internalWinId())) {
+ // Top-level resize optimization does not work for native child widgets;
+ // disable it for this particular widget.
+ if (inTopLevelResize)
+ tlwExtra->inTopLevelResize = false;
+ if (!isResize && maybeBackingStore())
+ moveRect(QRect(oldPos, oldSize), x - oldPos.x(), y - oldPos.y());
+ else
+ invalidateBuffer_resizeHelper(oldPos, oldSize);
+
+ if (inTopLevelResize)
+ tlwExtra->inTopLevelResize = true;
+ }
+ if (q->testAttribute(Qt::WA_WState_Created))
+ setWSGeometry();
+ }
+
+ if (q->isVisible()) {
+ if (isMove && q->pos() != oldPos) {
+ QMoveEvent e(q->pos(), oldPos);
+ QApplication::sendEvent(q, &e);
+ }
+ if (isResize) {
+ bool slowResize = qgetenv("QT_SLOW_TOPLEVEL_RESIZE").toInt();
+ const bool setTopLevelResize = !slowResize && q->isWindow() && extra && extra->topextra
+ && !extra->topextra->inTopLevelResize;
+ if (setTopLevelResize)
+ extra->topextra->inTopLevelResize = true;
+ QResizeEvent e(q->size(), oldSize);
+ QApplication::sendEvent(q, &e);
+ if (!q->testAttribute(Qt::WA_StaticContents) && q->internalWinId())
+ q->internalWinId()->DrawDeferred();
+ if (setTopLevelResize)
+ extra->topextra->inTopLevelResize = false;
+ }
+ } else {
+ if (isMove && q->pos() != oldPos)
+ q->setAttribute(Qt::WA_PendingMoveEvent, true);
+ if (isResize)
+ q->setAttribute(Qt::WA_PendingResizeEvent, true);
+ }
+}
+
+void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool destroyOldWindow)
+{
+ Q_Q(QWidget);
+
+ Qt::WindowType type = q->windowType();
+ Qt::WindowFlags &flags = data.window_flags;
+ QWidget *parentWidget = q->parentWidget();
+
+ bool topLevel = (flags & Qt::Window);
+ bool popup = (type == Qt::Popup);
+ bool dialog = (type == Qt::Dialog
+ || type == Qt::Sheet
+ || (flags & Qt::MSWindowsFixedSizeDialogHint));
+ bool desktop = (type == Qt::Desktop);
+ //bool tool = (type == Qt::Tool || type == Qt::Drawer);
+
+ if (popup)
+ flags |= Qt::WindowStaysOnTopHint; // a popup stays on top
+
+ TRect clientRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ int sw = clientRect.Width();
+ int sh = clientRect.Height();
+
+ if (desktop) {
+ TSize screenSize = S60->screenDevice()->SizeInPixels();
+ data.crect.setRect(0, 0, screenSize.iWidth, screenSize.iHeight);
+ q->setAttribute(Qt::WA_DontShowOnScreen);
+ } else if (topLevel && !q->testAttribute(Qt::WA_Resized)){
+ int width = sw;
+ int height = sh;
+ if (extra) {
+ width = qMax(qMin(width, extra->maxw), extra->minw);
+ height = qMax(qMin(height, extra->maxh), extra->minh);
+ }
+ data.crect.setSize(QSize(width, height));
+ }
+
+ CCoeControl *const destroyw = destroyOldWindow ? data.winid : 0;
+
+ createExtra();
+ if (window) {
+ setWinId(window);
+ TRect tr = window->Rect();
+ data.crect.setRect(tr.iTl.iX, tr.iTl.iY, tr.Width(), tr.Height());
+
+ } else if (topLevel) {
+ if (!q->testAttribute(Qt::WA_Moved) && !q->testAttribute(Qt::WA_DontShowOnScreen))
+ data.crect.moveTopLeft(QPoint(clientRect.iTl.iX, clientRect.iTl.iY));
+
+ QScopedPointer<QSymbianControl> control( q_check_ptr(new QSymbianControl(q)) );
+ QT_TRAP_THROWING(control->ConstructL(true, desktop));
+ control->SetMopParent(static_cast<CEikAppUi*>(S60->appUi()));
+
+ // Symbian windows are always created in an inactive state
+ // We perform this assignment for the case where the window is being re-created
+ // as aa result of a call to setParent_sys, on either this widget or one of its
+ // ancestors.
+ extra->activated = 0;
+
+ if (!desktop) {
+ TInt stackingFlags;
+ if ((q->windowType() & Qt::Popup) == Qt::Popup) {
+ stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus;
+ } else {
+ stackingFlags = ECoeStackFlagStandard;
+ }
+ control->MakeVisible(false);
+ QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control.data(), ECoeStackPriorityDefault, stackingFlags));
+ // Avoid keyboard focus to a hidden window.
+ control->setFocusSafely(false);
+
+ RDrawableWindow *const drawableWindow = control->DrawableWindow();
+ // Request mouse move events.
+ drawableWindow->PointerFilter(EPointerFilterEnterExit
+ | EPointerFilterMove | EPointerFilterDrag, 0);
+ drawableWindow->EnableVisibilityChangeEvents();
+
+ if (!isOpaque) {
+ RWindow *const window = static_cast<RWindow *>(drawableWindow);
+ const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
+ if (window->SetTransparencyAlphaChannel() == KErrNone)
+ window->SetBackgroundColor(TRgb(255, 255, 255, 0));
+ }
+ }
+
+ q->setAttribute(Qt::WA_WState_Created);
+
+ int x, y, w, h;
+ data.crect.getRect(&x, &y, &w, &h);
+ control->SetRect(TRect(TPoint(x, y), TSize(w, h)));
+
+ // We wait until the control is fully constructed before calling setWinId, because
+ // this generates a WinIdChanged event.
+ setWinId(control.take());
+
+ } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget
+
+ QScopedPointer<QSymbianControl> control( q_check_ptr(new QSymbianControl(q)) );
+ QT_TRAP_THROWING(control->ConstructL(!parentWidget));
+
+ // Symbian windows are always created in an inactive state
+ // We perform this assignment for the case where the window is being re-created
+ // as aa result of a call to setParent_sys, on either this widget or one of its
+ // ancestors.
+ extra->activated = 0;
+
+ TInt stackingFlags;
+ if ((q->windowType() & Qt::Popup) == Qt::Popup) {
+ stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus;
+ } else {
+ stackingFlags = ECoeStackFlagStandard;
+ }
+ control->MakeVisible(false);
+ QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control.data(), ECoeStackPriorityDefault, stackingFlags));
+ // Avoid keyboard focus to a hidden window.
+ control->setFocusSafely(false);
+
+ q->setAttribute(Qt::WA_WState_Created);
+ int x, y, w, h;
+ data.crect.getRect(&x, &y, &w, &h);
+ control->SetRect(TRect(TPoint(x, y), TSize(w, h)));
+
+ RDrawableWindow *const drawableWindow = control->DrawableWindow();
+ // Request mouse move events.
+ drawableWindow->PointerFilter(EPointerFilterEnterExit
+ | EPointerFilterMove | EPointerFilterDrag, 0);
+
+ if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) {
+ activateSymbianWindow(control.data());
+ control->MakeVisible(true);
+ }
+
+ // We wait until the control is fully constructed before calling setWinId, because
+ // this generates a WinIdChanged event.
+ setWinId(control.take());
+ }
+
+ if (destroyw) {
+ destroyw->ControlEnv()->AppUi()->RemoveFromStack(destroyw);
+
+ // Delay deletion of the control in case this function is called in the
+ // context of a CONE event handler such as
+ // CCoeControl::ProcessPointerEventL
+ QMetaObject::invokeMethod(q, "_q_delayedDestroy",
+ Qt::QueuedConnection, Q_ARG(WId, destroyw));
+ }
+
+ if (q->testAttribute(Qt::WA_AcceptTouchEvents))
+ registerTouchWindow();
+}
+
+
+void QWidgetPrivate::show_sys()
+{
+ Q_Q(QWidget);
+
+ if (q->testAttribute(Qt::WA_OutsideWSRange))
+ return;
+
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+
+ q->setAttribute(Qt::WA_Mapped);
+
+ if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
+ invalidateBuffer(q->rect());
+ return;
+ }
+
+ if (q->internalWinId()) {
+ if (!extra->activated)
+ activateSymbianWindow();
+
+ QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
+
+ id->MakeVisible(true);
+
+ if(q->isWindow())
+ id->setFocusSafely(true);
+ }
+
+ invalidateBuffer(q->rect());
+}
+
+void QWidgetPrivate::activateSymbianWindow(WId wid)
+{
+ Q_Q(QWidget);
+
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+ Q_ASSERT(q->testAttribute(Qt::WA_Mapped));
+ Q_ASSERT(!extra->activated);
+
+ if(!wid)
+ wid = q->internalWinId();
+
+ Q_ASSERT(wid);
+
+ QT_TRAP_THROWING(wid->ActivateL());
+ extra->activated = 1;
+}
+
+void QWidgetPrivate::hide_sys()
+{
+ Q_Q(QWidget);
+
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+ deactivateWidgetCleanup();
+ QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
+
+ if (id) {
+ //Incorrect optimisation - for popup windows, Qt's focus is moved before
+ //hide_sys is called, resulting in the popup window keeping its elevated
+ //position in the CONE control stack.
+ //This can result in keyboard focus being in an invisible widget in some
+ //conditions - e.g. QTBUG-4733
+ //if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
+ id->setFocusSafely(false);
+ id->MakeVisible(false);
+ if (QWidgetBackingStore *bs = maybeBackingStore())
+ bs->releaseBuffer();
+ } else {
+ invalidateBuffer(q->rect());
+ }
+
+ q->setAttribute(Qt::WA_Mapped, false);
+}
+
+void QWidgetPrivate::setFocus_sys()
+{
+ Q_Q(QWidget);
+ if (q->testAttribute(Qt::WA_WState_Created) && q->window()->windowType() != Qt::Popup)
+ if (!q->effectiveWinId()->IsFocused()) // Avoid unnecessry calls to FocusChanged()
+ static_cast<QSymbianControl *>(q->effectiveWinId())->setFocusSafely(true);
+}
+
+void QWidgetPrivate::raise_sys()
+{
+ Q_Q(QWidget);
+
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+ if (q->internalWinId()) {
+ q->internalWinId()->DrawableWindow()->SetOrdinalPosition(0);
+
+ // If toplevel widget, raise app to foreground
+ if (q->isWindow())
+ S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup().Identifier(), 0);
+ }
+}
+
+void QWidgetPrivate::lower_sys()
+{
+ Q_Q(QWidget);
+
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+ if (q->internalWinId()) {
+ // If toplevel widget, lower app to background
+ if (q->isWindow())
+ S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup().Identifier(), -1);
+ else
+ q->internalWinId()->DrawableWindow()->SetOrdinalPosition(-1);
+ }
+
+ if (!q->isWindow())
+ invalidateBuffer(q->rect());
+}
+
+void QWidgetPrivate::setModal_sys()
+{
+
+}
+
+void QWidgetPrivate::stackUnder_sys(QWidget* w)
+{
+ Q_Q(QWidget);
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+
+ if (q->internalWinId() && w->internalWinId()) {
+ RDrawableWindow *const thisWindow = q->internalWinId()->DrawableWindow();
+ RDrawableWindow *const otherWindow = w->internalWinId()->DrawableWindow();
+ thisWindow->SetOrdinalPosition(otherWindow->OrdinalPosition() + 1);
+ }
+
+ if (!q->isWindow() || !w->internalWinId())
+ invalidateBuffer(q->rect());
+}
+
+void QWidgetPrivate::reparentChildren()
+{
+ Q_Q(QWidget);
+
+ QObjectList chlist = q->children();
+ for (int i = 0; i < chlist.size(); ++i) { // reparent children
+ QObject *obj = chlist.at(i);
+ if (obj->isWidgetType()) {
+ QWidget *w = (QWidget *)obj;
+ if (!w->testAttribute(Qt::WA_WState_Created))
+ continue;
+ if (!w->isWindow()) {
+ w->d_func()->invalidateBuffer(w->rect());
+ WId parent = q->effectiveWinId();
+ WId child = w->effectiveWinId();
+ if (parent != child) {
+ // Child widget is native. Because Symbian windows cannot be
+ // re-parented, we must re-create the window.
+ const WId window = 0;
+ const bool initializeWindow = false;
+ const bool destroyOldWindow = true;
+ w->d_func()->create_sys(window, initializeWindow, destroyOldWindow);
+ }
+ // ### TODO: We probably also need to update the component array here
+ w->d_func()->reparentChildren();
+ } else {
+ bool showIt = w->isVisible();
+ QPoint old_pos = w->pos();
+ w->setParent(q, w->windowFlags());
+ w->move(old_pos);
+ if (showIt)
+ w->show();
+ }
+ }
+ }
+}
+
+void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
+{
+ Q_Q(QWidget);
+
+ bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
+
+ if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
+ q->parentWidget()->d_func()->invalidateBuffer(q->geometry());
+
+ if (q->testAttribute(Qt::WA_DropSiteRegistered))
+ q->setAttribute(Qt::WA_DropSiteRegistered, false);
+
+ QSymbianControl *old_winid = static_cast<QSymbianControl *>(wasCreated ? data.winid : 0);
+ if ((q->windowType() == Qt::Desktop))
+ old_winid = 0;
+ setWinId(0);
+
+ // hide and reparent our own window away. Otherwise we might get
+ // destroyed when emitting the child remove event below. See QWorkspace.
+ if (wasCreated && old_winid) {
+ old_winid->MakeVisible(false);
+ if (old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged()
+ old_winid->setFocusSafely(false);
+ old_winid->SetParent(0);
+ }
+
+ QObjectPrivate::setParent_helper(parent);
+ bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide);
+
+ data.window_flags = f;
+ data.fstrut_dirty = true;
+ q->setAttribute(Qt::WA_WState_Created, false);
+ q->setAttribute(Qt::WA_WState_Visible, false);
+ q->setAttribute(Qt::WA_WState_Hidden, false);
+ adjustFlags(data.window_flags, q);
+ // keep compatibility with previous versions, we need to preserve the created state
+ // (but we recreate the winId for the widget being reparented, again for compatibility)
+ if (wasCreated || (!q->isWindow() && parent->testAttribute(Qt::WA_WState_Created)))
+ createWinId();
+ if (q->isWindow() || (!parent || parent->isVisible()) || explicitlyHidden)
+ q->setAttribute(Qt::WA_WState_Hidden);
+ q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden);
+
+ if (wasCreated)
+ reparentChildren();
+
+ if (old_winid) {
+ CBase::Delete(old_winid);
+ }
+
+ if (q->testAttribute(Qt::WA_AcceptDrops)
+ || (!q->isWindow() && q->parentWidget() && q->parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)))
+ q->setAttribute(Qt::WA_DropSiteRegistered, true);
+
+ invalidateBuffer(q->rect());
+}
+
+void QWidgetPrivate::setConstraints_sys()
+{
+
+}
+
+
+void QWidgetPrivate::s60UpdateIsOpaque()
+{
+ Q_Q(QWidget);
+
+ if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground))
+ return;
+
+ if ((data.window_flags & Qt::FramelessWindowHint) == 0)
+ return;
+
+ RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
+
+ if (!isOpaque) {
+ const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
+ if (window->SetTransparencyAlphaChannel() == KErrNone)
+ window->SetBackgroundColor(TRgb(255, 255, 255, 0));
+ } else
+ window->SetTransparentRegion(TRegionFix<1>());
+}
+
+void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
+{
+#ifdef Q_WS_S60
+ Q_Q(QWidget);
+
+ if (!q->testAttribute(Qt::WA_WState_Created) || !q->isWindow() )
+ return;
+
+ QTLWExtra* topData = this->topData();
+ if (topData->iconPixmap && !forceReset)
+ // already been set
+ return;
+
+ TRect cPaneRect;
+ TBool found = AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EContextPane, cPaneRect );
+ CAknContextPane* contextPane = S60->contextPane();
+ if (found && contextPane) { // We have context pane with valid metrics
+ QIcon icon = q->windowIcon();
+ if (!icon.isNull()) {
+ // Valid icon -> set it as an context pane picture
+ QSize size = icon.actualSize(QSize(cPaneRect.Size().iWidth, cPaneRect.Size().iHeight));
+ QPixmap pm = icon.pixmap(size);
+ QBitmap mask = pm.mask();
+ if (mask.isNull()) {
+ mask = QBitmap(pm.size());
+ mask.fill(Qt::color1);
+ }
+
+ CFbsBitmap* nBitmap = pm.toSymbianCFbsBitmap();
+ CFbsBitmap* nMask = mask.toSymbianCFbsBitmap();
+ contextPane->SetPicture(nBitmap,nMask);
+ } else {
+ // Icon set to null -> set context pane picture to default
+ QT_TRAP_THROWING(contextPane->SetPictureToDefaultL());
+ }
+ } else {
+ // Context pane does not exist, try setting small icon to title pane
+ TRect titlePaneRect;
+ TBool found = AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ETitlePane, titlePaneRect );
+ CAknTitlePane* titlePane = S60->titlePane();
+ if (found && titlePane) { // We have title pane with valid metrics
+ // The API to get title_pane graphics size is not public -> assume square space based
+ // on titlebar font height. CAknBitmap would be optimum, wihtout setting the size, since
+ // then title pane would automatically scale the bitmap. Unfortunately it is not public API
+ // Also this function is leaving, although it is not named as such.
+ const CFont * font;
+ QT_TRAP_THROWING(font = AknLayoutUtils::FontFromId(EAknLogicalFontTitleFont));
+ TSize iconSize(font->HeightInPixels(), font->HeightInPixels());
+
+ QIcon icon = q->windowIcon();
+ if (!icon.isNull()) {
+ // Valid icon -> set it as an title pane small picture
+ QSize size = icon.actualSize(QSize(iconSize.iWidth, iconSize.iHeight));
+ QPixmap pm = icon.pixmap(size);
+ QBitmap mask = pm.mask();
+ if (mask.isNull()) {
+ mask = QBitmap(pm.size());
+ mask.fill(Qt::color1);
+ }
+
+ CFbsBitmap* nBitmap = pm.toSymbianCFbsBitmap();
+ CFbsBitmap* nMask = mask.toSymbianCFbsBitmap();
+ titlePane->SetSmallPicture( nBitmap, nMask, ETrue );
+ } else {
+ // Icon set to null -> set context pane picture to default
+ titlePane->SetSmallPicture( NULL, NULL, EFalse );
+ }
+ }
+ }
+
+#else
+ Q_UNUSED(forceReset)
+#endif
+}
+
+void QWidgetPrivate::setWindowTitle_sys(const QString &caption)
+{
+#ifdef Q_WS_S60
+ Q_Q(QWidget);
+ if (q->isWindow()) {
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+ CAknTitlePane* titlePane = S60->titlePane();
+ if (titlePane) {
+ if (caption.isEmpty()) {
+ QT_TRAP_THROWING(titlePane->SetTextToDefaultL());
+ } else {
+ QT_TRAP_THROWING(titlePane->SetTextL(qt_QString2TPtrC(caption)));
+ }
+ }
+ }
+#else
+ Q_UNUSED(caption)
+#endif
+}
+
+void QWidgetPrivate::setWindowIconText_sys(const QString & /*iconText */)
+{
+
+}
+
+void QWidgetPrivate::scroll_sys(int dx, int dy)
+{
+ Q_Q(QWidget);
+
+ scrollChildren(dx, dy);
+ if (!paintOnScreen() || !q->internalWinId() || !q->internalWinId()->OwnsWindow()) {
+ scrollRect(q->rect(), dx, dy);
+ } else {
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+ RDrawableWindow *const window = q->internalWinId()->DrawableWindow();
+ window->Scroll(TPoint(dx, dy));
+ }
+}
+
+void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
+{
+ Q_Q(QWidget);
+
+ if (!paintOnScreen() || !q->internalWinId() || !q->internalWinId()->OwnsWindow()) {
+ scrollRect(r, dx, dy);
+ } else {
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+ RDrawableWindow *const window = q->internalWinId()->DrawableWindow();
+ window->Scroll(TPoint(dx, dy), qt_QRect2TRect(r));
+ }
+}
+
+/*!
+ For this function to work in the emulator, you must add:
+ TRANSPARENCY
+ To a line in the wsini.ini file.
+*/
+void QWidgetPrivate::setWindowOpacity_sys(qreal)
+{
+ // ### TODO: Implement uniform window transparency
+}
+
+void QWidgetPrivate::updateFrameStrut()
+{
+
+}
+
+void QWidgetPrivate::updateSystemBackground()
+{
+
+}
+
+void QWidgetPrivate::registerDropSite(bool /* on */)
+{
+
+}
+
+void QWidgetPrivate::createTLSysExtra()
+{
+ extra->topextra->backingStore = 0;
+}
+
+void QWidgetPrivate::deleteTLSysExtra()
+{
+ delete extra->topextra->backingStore;
+ extra->topextra->backingStore = 0;
+}
+
+void QWidgetPrivate::createSysExtra()
+{
+ extra->activated = 0;
+ extra->nativePaintMode = QWExtra::Default;
+ extra->receiveNativePaintEvents = 0;
+}
+
+void QWidgetPrivate::deleteSysExtra()
+{
+ // this should only be non-zero if destroy() has not run due to constructor fail
+ if (data.winid) {
+ data.winid->ControlEnv()->AppUi()->RemoveFromStack(data.winid);
+ delete data.winid;
+ data.winid = 0;
+ }
+}
+
+QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys()
+{
+ return new QS60WindowSurface(q_func());
+}
+
+void QWidgetPrivate::setMask_sys(const QRegion& /* region */)
+{
+
+}
+
+void QWidgetPrivate::registerTouchWindow()
+{
+#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
+ Q_Q(QWidget);
+ if (q->testAttribute(Qt::WA_WState_Created) && q->windowType() != Qt::Desktop) {
+ RWindow *rwindow = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
+ rwindow->EnableAdvancedPointers();
+ }
+#endif
+}
+
+int QWidget::metric(PaintDeviceMetric m) const
+{
+ Q_D(const QWidget);
+ int val;
+ if (m == PdmWidth) {
+ val = data->crect.width();
+ } else if (m == PdmHeight) {
+ val = data->crect.height();
+ } else {
+ CWsScreenDevice *scr = S60->screenDevice();
+ switch(m) {
+ case PdmDpiX:
+ case PdmPhysicalDpiX:
+ if (d->extra && d->extra->customDpiX) {
+ val = d->extra->customDpiX;
+ } else {
+ const QWidgetPrivate *p = d;
+ while (p->parent) {
+ p = static_cast<const QWidget *>(p->parent)->d_func();
+ if (p->extra && p->extra->customDpiX) {
+ val = p->extra->customDpiX;
+ break;
+ }
+ }
+ if (p == d || !(p->extra && p->extra->customDpiX))
+ val = S60->defaultDpiX;
+ }
+ break;
+ case PdmDpiY:
+ case PdmPhysicalDpiY:
+ if (d->extra && d->extra->customDpiY) {
+ val = d->extra->customDpiY;
+ } else {
+ const QWidgetPrivate *p = d;
+ while (p->parent) {
+ p = static_cast<const QWidget *>(p->parent)->d_func();
+ if (p->extra && p->extra->customDpiY) {
+ val = p->extra->customDpiY;
+ break;
+ }
+ }
+ if (p == d || !(p->extra && p->extra->customDpiY))
+ val = S60->defaultDpiY;
+ }
+ break;
+ case PdmWidthMM:
+ {
+ TInt twips = scr->HorizontalPixelsToTwips(data->crect.width());
+ val = (int)(twips * (25.4/KTwipsPerInch));
+ break;
+ }
+ case PdmHeightMM:
+ {
+ TInt twips = scr->VerticalPixelsToTwips(data->crect.height());
+ val = (int)(twips * (25.4/KTwipsPerInch));
+ break;
+ }
+ case PdmNumColors:
+ val = TDisplayModeUtils::NumDisplayModeColors(scr->DisplayMode());
+ break;
+ case PdmDepth:
+ val = TDisplayModeUtils::NumDisplayModeBitsPerPixel(scr->DisplayMode());
+ break;
+ default:
+ val = 0;
+ qWarning("QWidget::metric: Invalid metric command");
+ }
+ }
+ return val;
+}
+
+QPaintEngine *QWidget::paintEngine() const
+{
+ return 0;
+}
+
+QPoint QWidget::mapToGlobal(const QPoint &pos) const
+{
+ Q_D(const QWidget);
+ if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) {
+
+ QPoint p = pos + data->crect.topLeft();
+ return (isWindow() || !parentWidget()) ? p : parentWidget()->mapToGlobal(p);
+
+ } else if ((d->data.window_flags & Qt::Window) && internalWinId()) { //toplevel
+ QPoint tp = geometry().topLeft();
+ return pos + tp;
+ }
+
+ // Native window case
+ const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen();
+ const QPoint globalPos = QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY) + pos;
+ return globalPos;
+}
+
+QPoint QWidget::mapFromGlobal(const QPoint &pos) const
+{
+ Q_D(const QWidget);
+ if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) {
+ QPoint p = (isWindow() || !parentWidget()) ? pos : parentWidget()->mapFromGlobal(pos);
+ return p - data->crect.topLeft();
+ } else if ((d->data.window_flags & Qt::Window) && internalWinId()) { //toplevel
+ QPoint tp = geometry().topLeft();
+ return pos - tp;
+ }
+
+ // Native window case
+ const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen();
+ const QPoint widgetPos = pos - QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY);
+ return widgetPos;
+}
+
+void QWidget::setWindowState(Qt::WindowStates newstate)
+{
+ Q_D(QWidget);
+
+ Qt::WindowStates oldstate = windowState();
+ if (oldstate == newstate)
+ return;
+
+ if (isWindow()) {
+#ifdef Q_WS_S60
+ // Change window decoration visibility if switching to or from fullsccreen
+ // In addition decoration visibility is changed when the initial has been
+ // WindowNoState.
+ // The window decoration visibility has to be changed before doing actual
+ // window state change since in that order the availableGeometry will return
+ // directly the right size and we will avoid unnecessarty redraws
+ if ((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen) ||
+ oldstate == Qt::WindowNoState) {
+ CEikStatusPane* statusPane = S60->statusPane();
+ CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
+ if (newstate & Qt::WindowFullScreen) {
+ if (statusPane)
+ statusPane->MakeVisible(false);
+ if (buttonGroup)
+ buttonGroup->MakeVisible(false);
+ } else {
+ if (statusPane)
+ statusPane->MakeVisible(true);
+ if (buttonGroup)
+ buttonGroup->MakeVisible(true);
+ }
+
+ }
+#endif // Q_WS_S60
+
+ createWinId();
+ Q_ASSERT(testAttribute(Qt::WA_WState_Created));
+ QTLWExtra *top = d->topData();
+
+ // Ensure the initial size is valid, since we store it as normalGeometry below.
+ if (!testAttribute(Qt::WA_Resized) && !isVisible())
+ adjustSize();
+
+ if ((oldstate & Qt::WindowMaximized) != (newstate & Qt::WindowMaximized)) {
+ if ((newstate & Qt::WindowMaximized)) {
+ const QRect normalGeometry = geometry();
+
+ const QRect r = top->normalGeometry;
+ setGeometry(qApp->desktop()->availableGeometry(this));
+ top->normalGeometry = r;
+
+ if (top->normalGeometry.width() < 0)
+ top->normalGeometry = normalGeometry;
+ } else {
+ // restore original geometry
+ setGeometry(top->normalGeometry);
+ }
+ }
+ if ((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen)) {
+ if (newstate & Qt::WindowFullScreen) {
+ const QRect normalGeometry = geometry();
+ const QRect r = top->normalGeometry;
+ setGeometry(qApp->desktop()->screenGeometry(this));
+
+ top->normalGeometry = r;
+ if (top->normalGeometry.width() < 0)
+ top->normalGeometry = normalGeometry;
+ } else {
+ if (newstate & Qt::WindowMaximized) {
+ const QRect r = top->normalGeometry;
+ setGeometry(qApp->desktop()->availableGeometry(this));
+ top->normalGeometry = r;
+ } else {
+ setGeometry(top->normalGeometry);
+ }
+ }
+ }
+ if ((oldstate & Qt::WindowMinimized) != (newstate & Qt::WindowMinimized)) {
+ if (newstate & Qt::WindowMinimized) {
+ if (isVisible()) {
+ QSymbianControl *id = static_cast<QSymbianControl *>(effectiveWinId());
+ if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
+ id->setFocusSafely(false);
+ id->MakeVisible(false);
+ }
+ } else {
+ if (isVisible()) {
+ QSymbianControl *id = static_cast<QSymbianControl *>(effectiveWinId());
+ id->MakeVisible(true);
+ if (!id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
+ id->setFocusSafely(true);
+ }
+ const QRect normalGeometry = geometry();
+ const QRect r = top->normalGeometry;
+ top->normalGeometry = r;
+ if (top->normalGeometry.width() < 0)
+ top->normalGeometry = normalGeometry;
+ }
+ }
+ }
+
+ data->window_state = newstate;
+
+ if (newstate & Qt::WindowActive)
+ activateWindow();
+
+ QWindowStateChangeEvent e(oldstate);
+ QApplication::sendEvent(this, &e);
+}
+
+
+void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
+{
+ Q_D(QWidget);
+ if (!isWindow() && parentWidget())
+ parentWidget()->d_func()->invalidateBuffer(geometry());
+ d->deactivateWidgetCleanup();
+ QSymbianControl *id = static_cast<QSymbianControl *>(internalWinId());
+ if (testAttribute(Qt::WA_WState_Created)) {
+
+#ifndef QT_NO_IM
+ if (d->ic) {
+ delete d->ic;
+ } else {
+ QInputContext *ic = inputContext();
+ if (ic) {
+ ic->widgetDestroyed(this);
+ }
+ }
+#endif
+
+ if (QWidgetPrivate::mouseGrabber == this)
+ releaseMouse();
+ if (QWidgetPrivate::keyboardGrabber == this)
+ releaseKeyboard();
+ setAttribute(Qt::WA_WState_Created, false);
+ QObjectList childList = children();
+ for (int i = 0; i < childList.size(); ++i) { // destroy all widget children
+ register QObject *obj = childList.at(i);
+ if (obj->isWidgetType())
+ static_cast<QWidget*>(obj)->destroy(destroySubWindows,
+ destroySubWindows);
+ }
+ if (destroyWindow && !(windowType() == Qt::Desktop) && id) {
+ if (id->IsFocused()) // Avoid unnecessry calls to FocusChanged()
+ id->setFocusSafely(false);
+ id->ControlEnv()->AppUi()->RemoveFromStack(id);
+ }
+ }
+
+ QT_TRY {
+ d->setWinId(0);
+ } QT_CATCH (const std::bad_alloc &) {
+ // swallow - destructors must not throw
+ }
+
+ if (destroyWindow) {
+ delete id;
+ }
+}
+
+QWidget *QWidget::mouseGrabber()
+{
+ return QWidgetPrivate::mouseGrabber;
+}
+
+QWidget *QWidget::keyboardGrabber()
+{
+ return QWidgetPrivate::keyboardGrabber;
+}
+
+void QWidget::grabKeyboard()
+{
+ if (!qt_nograb()) {
+ if (QWidgetPrivate::keyboardGrabber && QWidgetPrivate::keyboardGrabber != this)
+ QWidgetPrivate::keyboardGrabber->releaseKeyboard();
+
+ // ### TODO: Native keyboard grab
+
+ QWidgetPrivate::keyboardGrabber = this;
+ }
+}
+
+void QWidget::releaseKeyboard()
+{
+ if (!qt_nograb() && QWidgetPrivate::keyboardGrabber == this) {
+ // ### TODO: Native keyboard release
+ QWidgetPrivate::keyboardGrabber = 0;
+ }
+}
+
+void QWidget::grabMouse()
+{
+ if (isVisible() && !qt_nograb()) {
+ if (QWidgetPrivate::mouseGrabber && QWidgetPrivate::mouseGrabber != this)
+ QWidgetPrivate::mouseGrabber->releaseMouse();
+ Q_ASSERT(testAttribute(Qt::WA_WState_Created));
+ WId id = effectiveWinId();
+ id->SetPointerCapture(true);
+ QWidgetPrivate::mouseGrabber = this;
+
+#ifndef QT_NO_CURSOR
+ QApplication::setOverrideCursor(cursor());
+#endif
+ }
+}
+
+#ifndef QT_NO_CURSOR
+void QWidget::grabMouse(const QCursor &cursor)
+{
+ if (isVisible() && !qt_nograb()) {
+ if (QWidgetPrivate::mouseGrabber && QWidgetPrivate::mouseGrabber != this)
+ QWidgetPrivate::mouseGrabber->releaseMouse();
+ Q_ASSERT(testAttribute(Qt::WA_WState_Created));
+ WId id = effectiveWinId();
+ id->SetPointerCapture(true);
+ QWidgetPrivate::mouseGrabber = this;
+
+ QApplication::setOverrideCursor(cursor);
+ }
+}
+#endif
+
+void QWidget::releaseMouse()
+{
+ if (!qt_nograb() && QWidgetPrivate::mouseGrabber == this) {
+ Q_ASSERT(testAttribute(Qt::WA_WState_Created));
+ WId id = effectiveWinId();
+ id->SetPointerCapture(false);
+ QWidgetPrivate::mouseGrabber = 0;
+#ifndef QT_NO_CURSOR
+ QApplication::restoreOverrideCursor();
+#endif
+ }
+}
+
+void QWidget::activateWindow()
+{
+ Q_D(QWidget);
+
+ QWidget *tlw = window();
+ if (tlw->isVisible()) {
+ window()->createWinId();
+ QSymbianControl *id = static_cast<QSymbianControl *>(tlw->internalWinId());
+ id->setFocusSafely(true);
+ }
+}
+
+#ifndef QT_NO_CURSOR
+
+void QWidgetPrivate::setCursor_sys(const QCursor &cursor)
+{
+ Q_UNUSED(cursor);
+ Q_Q(QWidget);
+ qt_symbian_set_cursor(q, false);
+}
+
+void QWidgetPrivate::unsetCursor_sys()
+{
+ Q_Q(QWidget);
+ qt_symbian_set_cursor(q, false);
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 77ab590ed..fde0d4512 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -161,6 +161,9 @@ static void qt_tablet_init()
qt_tablet_widget = new QWidget(0);
qt_tablet_widget->createWinId();
qt_tablet_widget->setObjectName(QLatin1String("Qt internal tablet widget"));
+ // We dont need this internal widget to appear in QApplication::topLevelWidgets()
+ if (QWidgetPrivate::allWidgets)
+ QWidgetPrivate::allWidgets->remove(qt_tablet_widget);
LOGCONTEXT lcMine;
qAddPostRoutine(qt_tablet_cleanup);
struct tagAXIS tpOri[3];
@@ -535,7 +538,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
Q_D(QWidget);
if (!isWindow() && parentWidget())
- parentWidget()->d_func()->invalidateBuffer(geometry());
+ parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
d->deactivateWidgetCleanup();
if (testAttribute(Qt::WA_WState_Created)) {
setAttribute(Qt::WA_WState_Created, false);
@@ -562,7 +565,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
}
#endif
- d->setWinId(0);
+ QT_TRY {
+ d->setWinId(0);
+ } QT_CATCH (const std::bad_alloc &) {
+ // swallow - destructors must not throw
+ }
}
}
@@ -597,7 +604,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
Q_Q(QWidget);
bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
- q->parentWidget()->d_func()->invalidateBuffer(q->geometry());
+ q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
WId old_winid = data.winid;
// hide and reparent our own window away. Otherwise we might get
@@ -670,7 +677,11 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const
QWidget *parentWindow = window();
QWExtra *extra = parentWindow->d_func()->extra;
if (!isVisible() || parentWindow->isMinimized() || !testAttribute(Qt::WA_WState_Created) || !internalWinId()
- || (extra && extra->proxyWidget)) {
+ || (extra
+#ifndef QT_NO_GRAPHICSVIEW
+ && extra->proxyWidget
+#endif //QT_NO_GRAPHICSVIEW
+ )) {
if (extra && extra->topextra && extra->topextra->embedded) {
QPoint pt = mapTo(parentWindow, pos);
POINT p = {pt.x(), pt.y()};
@@ -697,7 +708,11 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const
QWidget *parentWindow = window();
QWExtra *extra = parentWindow->d_func()->extra;
if (!isVisible() || parentWindow->isMinimized() || !testAttribute(Qt::WA_WState_Created) || !internalWinId()
- || (extra && extra->proxyWidget)) {
+ || (extra
+#ifndef QT_NO_GRAPHICSVIEW
+ && extra->proxyWidget
+#endif //QT_NO_GRAPHICSVIEW
+ )) {
if (extra && extra->topextra && extra->topextra->embedded) {
POINT p = {pos.x(), pos.y()};
ScreenToClient(parentWindow->effectiveWinId(), &p);
@@ -718,8 +733,6 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const
void QWidgetPrivate::updateSystemBackground() {}
-extern void qt_win_set_cursor(QWidget *, bool); // qapplication_win.cpp
-
#ifndef QT_NO_CURSOR
void QWidgetPrivate::setCursor_sys(const QCursor &cursor)
{
@@ -745,25 +758,6 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption)
SetWindowText(q->internalWinId(), (wchar_t*)caption.utf16());
}
-/*
- Create an icon mask the way Windows wants it using CreateBitmap.
-*/
-
-HBITMAP qt_createIconMask(const QBitmap &bitmap)
-{
- QImage bm = bitmap.toImage().convertToFormat(QImage::Format_Mono);
- int w = bm.width();
- int h = bm.height();
- int bpl = ((w+15)/16)*2; // bpl, 16 bit alignment
- uchar *bits = new uchar[bpl*h];
- bm.invertPixels();
- for (int y=0; y<h; y++)
- memcpy(bits+y*bpl, bm.scanLine(y), bpl);
- HBITMAP hbm = CreateBitmap(w, h, 1, 1, bits);
- delete [] bits;
- return hbm;
-}
-
HICON qt_createIcon(QIcon icon, int xSize, int ySize, QPixmap **cache)
{
HICON result = 0;
@@ -773,27 +767,12 @@ HICON qt_createIcon(QIcon icon, int xSize, int ySize, QPixmap **cache)
if (pm.isNull())
return 0;
- QBitmap mask = pm.mask();
- if (mask.isNull()) {
- mask = QBitmap(pm.size());
- mask.fill(Qt::color1);
- }
-
- HBITMAP im = qt_createIconMask(mask);
- ICONINFO ii;
- ii.fIcon = true;
- ii.hbmMask = im;
- ii.hbmColor = pm.toWinHBITMAP(QPixmap::Alpha);
- ii.xHotspot = 0;
- ii.yHotspot = 0;
- result = CreateIconIndirect(&ii);
+ result = pm.toWinHICON();
if (cache) {
delete *cache;
*cache = new QPixmap(pm);;
}
- DeleteObject(ii.hbmColor);
- DeleteObject(im);
}
return result;
}
@@ -883,10 +862,13 @@ void QWidget::grabMouse()
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
SetCapture(effectiveWinId());
mouseGrb = this;
+#ifndef QT_NO_CURSOR
mouseGrbCur = new QCursor(mouseGrb->cursor());
+#endif
}
}
+#ifndef QT_NO_CURSOR
void QWidget::grabMouse(const QCursor &cursor)
{
if (!qt_nograb()) {
@@ -900,6 +882,7 @@ void QWidget::grabMouse(const QCursor &cursor)
mouseGrb = this;
}
}
+#endif
void QWidget::releaseMouse()
{
@@ -1356,8 +1339,15 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
if (isResize && !q->testAttribute(Qt::WA_StaticContents) && q->internalWinId())
ValidateRgn(q->internalWinId(), 0);
+#ifdef Q_WS_WINCE
+ // On Windows CE we can't just fiddle around with the window state.
+ // Too much magic in setWindowState.
+ if (isResize && q->isMaximized())
+ q->setWindowState(q->windowState() & ~Qt::WindowMaximized);
+#else
if (isResize)
data.window_state &= ~Qt::WindowMaximized;
+#endif
if (data.window_state & Qt::WindowFullScreen) {
QTLWExtra *top = topData();
@@ -1434,7 +1424,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
SetWindowPlacement(q->internalWinId(), &wndpl);
} else {
#else
- if (data.window_state_internal & Qt::WindowMaximized) {
+ if (data.window_state & Qt::WindowMaximized) {
qt_wince_maximize(q);
} else {
#endif
@@ -2057,22 +2047,22 @@ void QWidgetPrivate::registerTouchWindow()
void QWidgetPrivate::winSetupGestures()
{
+#if !defined(QT_NO_NATIVE_GESTURES)
Q_Q(QWidget);
- if (!q)
- return;
- q->setAttribute(Qt::WA_DontCreateNativeAncestors);
- q->setAttribute(Qt::WA_NativeWindow);
- if (!q->isVisible())
+ if (!q || !q->isVisible() || !nativeGesturePanEnabled)
return;
+
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
+ if (!qAppPriv->SetGestureConfig)
+ return;
+ WId winid = q->internalWinId();
+
bool needh = false;
bool needv = false;
bool singleFingerPanEnabled = false;
- QStandardGestures gestures = qAppPriv->widgetGestures[q];
- WId winid = 0;
- if (QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea*>(q)) {
- winid = asa->viewport()->winId();
+#ifndef QT_NO_SCROLLAREA
+ if (QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea*>(q->parent())) {
QScrollBar *hbar = asa->horizontalScrollBar();
QScrollBar *vbar = asa->verticalScrollBar();
Qt::ScrollBarPolicy hbarpolicy = asa->horizontalScrollBarPolicy();
@@ -2082,14 +2072,16 @@ void QWidgetPrivate::winSetupGestures()
needv = (vbarpolicy == Qt::ScrollBarAlwaysOn ||
(vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum()));
singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled;
- } else {
- winid = q->winId();
+ if (!winid) {
+ winid = q->winId(); // enforces the native winid on the viewport
+ }
}
- if (qAppPriv->SetGestureConfig) {
- GESTURECONFIG gc[3];
+#endif //QT_NO_SCROLLAREA
+ if (winid) {
+ GESTURECONFIG gc[1];
memset(gc, 0, sizeof(gc));
gc[0].dwID = GID_PAN;
- if (gestures.pan) {
+ if (nativeGesturePanEnabled) {
gc[0].dwWant = GC_PAN;
if (needv && singleFingerPanEnabled)
gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
@@ -2103,20 +2095,9 @@ void QWidgetPrivate::winSetupGestures()
gc[0].dwBlock = GC_PAN;
}
- gc[1].dwID = GID_ZOOM;
- if (gestures.pinch)
- gc[1].dwWant = GC_ZOOM;
- else
- gc[1].dwBlock = GC_ZOOM;
- gc[2].dwID = GID_ROTATE;
- if (gestures.pinch)
- gc[2].dwWant = GC_ROTATE;
- else
- gc[2].dwBlock = GC_ROTATE;
-
- Q_ASSERT(winid);
qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0]));
}
+#endif
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp
index bcc9cfd34..2fe69e4aa 100644
--- a/src/gui/kernel/qwidget_wince.cpp
+++ b/src/gui/kernel/qwidget_wince.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -316,7 +316,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (desktop) {
q->setAttribute(Qt::WA_WState_Visible);
- } else if (topLevel) {
+ } else if (topLevel && !q->testAttribute(Qt::WA_DontShowOnScreen)) {
RECT cr;
GetClientRect(id, &cr);
// one cannot trust cr.left and cr.top, use a correction POINT instead
@@ -416,6 +416,10 @@ void QWidgetPrivate::show_sys() {
SetWindowLong(q->internalWinId(), GWL_STYLE, style | WS_MAXIMIZEBOX);
}
} else
+#else
+ // Imitate minimizing on Windows mobile by hiding the widget.
+ if (q->isMinimized())
+ sm = SW_HIDE;
#endif
if (q->isHidden()) {
sm = SW_HIDE;
@@ -428,8 +432,7 @@ void QWidgetPrivate::show_sys() {
sm = SW_SHOWNOACTIVATE;
}
- if (!(data.window_state & Qt::WindowMinimized))
- ShowWindow(q->internalWinId(), sm);
+ ShowWindow(q->internalWinId(), sm);
if (q->isMaximized() && q->isWindow())
qt_wince_maximize(q);
@@ -438,7 +441,7 @@ void QWidgetPrivate::show_sys() {
if (!qt_wince_is_mobile() && q->isFullScreen()) {
HWND handle = FindWindow(L"HHTaskBar", L"");
if (handle) {
- ShowWindow(handle, 0);
+ ShowWindow(handle, SW_HIDE);
EnableWindow(handle, false);
}
}
@@ -468,21 +471,15 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
return;
int max = SW_SHOWNORMAL;
- int min = SW_SHOWNOACTIVATE;
-
int normal = SW_SHOWNOACTIVATE;
if ((oldstate & Qt::WindowMinimized) && !(newstate & Qt::WindowMinimized))
- newstate |= Qt::WindowActive;
- if (newstate & Qt::WindowActive) {
- max = SW_SHOWNORMAL;
- min = SW_SHOWNORMAL;
+ newstate |= Qt::WindowActive;
+ if (newstate & Qt::WindowActive)
normal = SW_SHOWNORMAL;
- }
if (isWindow()) {
createWinId();
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
- data->window_state_internal = newstate;
// Ensure the initial size is valid, since we store it as normalGeometry below.
if ((!testAttribute(Qt::WA_Resized) && !isVisible()))
adjustSize();
@@ -493,13 +490,13 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
d->topData()->normalGeometry = geometry();
}
if ((oldstate & Qt::WindowMaximized) != (newstate & Qt::WindowMaximized)) {
- if (!(newstate & Qt::WindowMaximized)) {
+ if (!(newstate & Qt::WindowMaximized)) {
int style = GetWindowLong(internalWinId(), GWL_STYLE) | WS_BORDER | WS_POPUP | WS_CAPTION;
SetWindowLong(internalWinId(), GWL_STYLE, style);
SetWindowLong(internalWinId(), GWL_EXSTYLE, GetWindowLong (internalWinId(), GWL_EXSTYLE) & ~ WS_EX_NODRAG);
}
- if (isVisible() && newstate & Qt::WindowMaximized)
- qt_wince_maximize(this);
+ if (isVisible() && newstate & Qt::WindowMaximized)
+ qt_wince_maximize(this);
if (isVisible() && !(newstate & Qt::WindowMinimized)) {
ShowWindow(internalWinId(), (newstate & Qt::WindowMaximized) ? max : normal);
if (!(newstate & Qt::WindowFullScreen)) {
@@ -556,28 +553,17 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
}
}
if ((oldstate & Qt::WindowMinimized) != (newstate & Qt::WindowMinimized)) {
- if (isVisible()) {
- ShowWindow(internalWinId(), (newstate & Qt::WindowMinimized) ? min :
- (newstate & Qt::WindowMaximized) ? max : normal);
- if (newstate & Qt::WindowMaximized)
- qt_wince_maximize(this);
if (newstate & Qt::WindowMinimized)
qt_wince_minimize(internalWinId());
+ else if (newstate & Qt::WindowMaximized) {
+ ShowWindow(internalWinId(), max);
+ qt_wince_maximize(this);
+ } else {
+ ShowWindow(internalWinId(), normal);
}
}
- if ((newstate & Qt::WindowMaximized) && !(newstate & Qt::WindowFullScreen)) {
- QRect r = d->topData()->normalGeometry;
-#ifdef Q_WS_WINCE_WM
- if (!inherits("QDialog") && !inherits("QMdiArea") && !isVisible()) {
- d->data.crect.setRect(0, 0, -1, -1);
- }
-#else
- qt_wince_maximize(this);
-#endif
- }
}
data->window_state = newstate;
- data->window_state_internal = newstate;
QWindowStateChangeEvent e(oldstate);
QApplication::sendEvent(this, &e);
}
@@ -588,7 +574,7 @@ void QWidgetPrivate::deleteSysExtra()
if (!qt_wince_is_mobile() && q->isFullScreen()) {
HWND handle = FindWindow(L"HHTaskBar", L"");
if (handle) {
- ShowWindow(handle, 1);
+ ShowWindow(handle, SW_SHOWNORMAL);
EnableWindow(handle, true);
}
}
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index de38b4c41..0bc9cbcea 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -346,6 +346,10 @@ Q_GUI_EXPORT void qt_x11_enforce_cursor(QWidget * w)
qt_x11_enforce_cursor(w, false);
}
+static Bool checkForConfigureAndExpose(Display *, XEvent *e, XPointer)
+{
+ return e->type == ConfigureNotify || e->type == Expose;
+}
Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w)
{
@@ -355,18 +359,42 @@ Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w)
XEvent ev;
QTime t;
t.start();
+ static const int maximumWaitTime = 2000;
if (!w->testAttribute(Qt::WA_WState_Created))
return;
- while (!XCheckTypedWindowEvent(X11->display, w->effectiveWinId(), ReparentNotify, &ev)) {
- if (XCheckTypedWindowEvent(X11->display, w->effectiveWinId(), MapNotify, &ev))
- break;
- if (t.elapsed() > 500)
- return; // give up, no event available
+
+ if (!(w->windowFlags() & Qt::X11BypassWindowManagerHint)) {
+ // if the window is not override-redirect, then the window manager
+ // will reparent us to the frame decoration window.
+ while (!XCheckTypedWindowEvent(X11->display, w->effectiveWinId(), ReparentNotify, &ev)) {
+ if (t.elapsed() > maximumWaitTime)
+ return;
+ qApp->syncX(); // non-busy wait
+ }
+ }
+
+ while (!XCheckTypedWindowEvent(X11->display, w->effectiveWinId(), MapNotify, &ev)) {
+ if (t.elapsed() > maximumWaitTime)
+ return;
qApp->syncX(); // non-busy wait
}
+
qApp->x11ProcessEvent(&ev);
- if (XCheckTypedWindowEvent(X11->display, w->effectiveWinId(), ConfigureNotify, &ev))
- qApp->x11ProcessEvent(&ev);
+
+ // ok, seems like the window manager successfully reparented us, we'll wait
+ // for the first paint event to arrive, while handling ConfigureNotify in
+ // the arrival order
+ while(1)
+ {
+ if (XCheckIfEvent(X11->display, &ev, checkForConfigureAndExpose, 0)) {
+ qApp->x11ProcessEvent(&ev);
+ if (ev.type == Expose)
+ return;
+ }
+ if (t.elapsed() > maximumWaitTime)
+ return;
+ qApp->syncX(); // non-busy wait
+ }
}
void qt_change_net_wm_state(const QWidget* w, bool set, Atom one, Atom two = 0)
@@ -490,14 +518,23 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
if (!window)
initializeWindow = true;
+ QX11Info *parentXinfo = parentWidget ? &parentWidget->d_func()->xinfo : 0;
+
if (desktop &&
qt_x11_create_desktop_on_screen >= 0 &&
qt_x11_create_desktop_on_screen != xinfo.screen()) {
// desktop on a certain screen other than the default requested
QX11InfoData *xd = &X11->screens[qt_x11_create_desktop_on_screen];
xinfo.setX11Data(xd);
- } else if (parentWidget && parentWidget->d_func()->xinfo.screen() != xinfo.screen()) {
- xinfo = parentWidget->d_func()->xinfo;
+ } else if (parentXinfo && (parentXinfo->screen() != xinfo.screen()
+ || (parentXinfo->visual() != xinfo.visual()
+ && !q->inherits("QGLWidget"))))
+ {
+ // QGLWidgets have to be excluded here as they have a
+ // specially crafted QX11Info structure which can't be swapped
+ // out with the parent widgets QX11Info. The parent visual,
+ // for instance, might not even be GL capable.
+ xinfo = *parentXinfo;
}
//get display, screen number, root window and desktop geometry for
@@ -892,6 +929,43 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
#endif
}
+static void qt_x11_recreateWidget(QWidget *widget)
+{
+ if (widget->inherits("QGLWidget")) {
+ // We send QGLWidgets a ParentChange event which causes them to
+ // recreate their GL context, which in turn causes them to choose
+ // their visual again. Now that WA_TranslucentBackground is set,
+ // QGLContext::chooseVisual will select an ARGB visual.
+ QEvent e(QEvent::ParentChange);
+ QApplication::sendEvent(widget, &e);
+ } else {
+ // For regular widgets, reparent them with their parent which
+ // also triggers a recreation of the native window
+ QPoint pos = widget->pos();
+ bool visible = widget->isVisible();
+ if (visible)
+ widget->hide();
+
+ widget->setParent(widget->parentWidget(), widget->windowFlags());
+ widget->move(pos);
+ if (visible)
+ widget->show();
+ }
+}
+
+static void qt_x11_recreateNativeWidgetsRecursive(QWidget *widget)
+{
+ if (widget->internalWinId())
+ qt_x11_recreateWidget(widget);
+
+ const QObjectList &children = widget->children();
+ for (int i = 0; i < children.size(); ++i) {
+ QWidget *child = qobject_cast<QWidget*>(children.at(i));
+ if (child)
+ qt_x11_recreateNativeWidgetsRecursive(child);
+ }
+}
+
void QWidgetPrivate::x11UpdateIsOpaque()
{
#ifndef QT_NO_XRENDER
@@ -902,29 +976,9 @@ void QWidgetPrivate::x11UpdateIsOpaque()
bool topLevel = (data.window_flags & Qt::Window);
int screen = xinfo.screen();
if (topLevel && X11->use_xrender
- && X11->argbVisuals[screen] && xinfo.depth() != 32) {
-
- if (q->inherits("QGLWidget")) {
- // We send QGLWidgets a ParentChange event which causes them to
- // recreate their GL context, which in turn causes them to choose
- // their visual again. Now that WA_TranslucentBackground is set,
- // QGLContext::chooseVisual will select an ARGB visual.
- QEvent e(QEvent::ParentChange);
- QApplication::sendEvent(q, &e);
- }
- else {
- // For regular widgets, reparent them with their parent which
- // also triggers a recreation of the native window
- QPoint pos = q->pos();
- bool visible = q->isVisible();
- if (visible)
- q->hide();
-
- q->setParent(q->parentWidget(), q->windowFlags());
- q->move(pos);
- if (visible)
- q->show();
- }
+ && X11->argbVisuals[screen] && xinfo.depth() != 32)
+ {
+ qt_x11_recreateNativeWidgetsRecursive(q);
}
#endif
}
@@ -971,7 +1025,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
Q_D(QWidget);
if (!isWindow() && parentWidget())
- parentWidget()->d_func()->invalidateBuffer(geometry());
+ parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
d->deactivateWidgetCleanup();
if (testAttribute(Qt::WA_WState_Created)) {
setAttribute(Qt::WA_WState_Created, false);
@@ -1015,7 +1069,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
if (destroyWindow)
qt_XDestroyWindow(this, X11->display, data->winid);
}
- d->setWinId(0);
+ QT_TRY {
+ d->setWinId(0);
+ } QT_CATCH (const std::bad_alloc &) {
+ // swallow - destructors must not throw
+ }
extern void qPRCleanup(QWidget *widget); // from qapplication_x11.cpp
if (testAttribute(Qt::WA_WState_Reparented))
@@ -1050,7 +1108,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
QTLWExtra *topData = maybeTopData();
bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
- q->parentWidget()->d_func()->invalidateBuffer(q->geometry());
+ q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
extern void qPRCreate(const QWidget *, Window);
#ifndef QT_NO_CURSOR
QCursor oldcurs;
@@ -1276,7 +1334,7 @@ void QWidgetPrivate::updateSystemBackground()
else if (brush.style() == Qt::TexturePattern) {
extern QPixmap qt_toX11Pixmap(const QPixmap &pixmap); // qpixmap_x11.cpp
XSetWindowBackgroundPixmap(X11->display, q->internalWinId(),
- static_cast<QX11PixmapData*>(qt_toX11Pixmap(brush.texture()).data)->x11ConvertToDefaultDepth());
+ static_cast<QX11PixmapData*>(qt_toX11Pixmap(brush.texture()).data.data())->x11ConvertToDefaultDepth());
} else
XSetWindowBackground(X11->display, q->internalWinId(),
QColormap::instance(xinfo.screen()).pixel(brush.color()));
@@ -1392,7 +1450,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
icon_data[pos++] = image.width();
icon_data[pos++] = image.height();
if (sizeof(long) == sizeof(quint32)) {
- memcpy(icon_data.data() + pos, image.scanLine(0), image.numBytes());
+ memcpy(icon_data.data() + pos, image.scanLine(0), image.byteCount());
} else {
for (int y = 0; y < image.height(); ++y) {
uint *scanLine = reinterpret_cast<uint *>(image.scanLine(y));
@@ -1422,7 +1480,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
// violates the ICCCM), since this works on all DEs known to Qt
if (!forceReset || !topData->iconPixmap)
topData->iconPixmap = new QPixmap(qt_toX11Pixmap(icon.pixmap(QSize(64,64))));
- pixmap_handle = static_cast<QX11PixmapData*>(topData->iconPixmap->data)->x11ConvertToDefaultDepth();
+ pixmap_handle = static_cast<QX11PixmapData*>(topData->iconPixmap->data.data())->x11ConvertToDefaultDepth();
}
}
}
diff --git a/src/gui/kernel/qwidgetaction.cpp b/src/gui/kernel/qwidgetaction.cpp
index 911d33224..b72a41a4f 100644
--- a/src/gui/kernel/qwidgetaction.cpp
+++ b/src/gui/kernel/qwidgetaction.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE
for inserting custom widgets into action based containers, such
as toolbars.
+ \ingroup mainwindow-classes
+
Most actions in an application are represented as items in menus or
buttons in toolbars. However sometimes more complex widgets are
necessary. For example a zoom action in a word processor may be
@@ -100,9 +102,6 @@ QT_BEGIN_NAMESPACE
DirectConnection.
\endlist
- \ingroup application
- \mainclass
-
\sa QAction, QActionGroup, QWidget
*/
@@ -213,8 +212,8 @@ void QWidgetAction::releaseWidget(QWidget *widget)
if (!d->createdWidgets.contains(widget))
return;
- disconnect(widget, SIGNAL(destroyed(QObject *)),
- this, SLOT(_q_widgetDestroyed(QObject *)));
+ disconnect(widget, SIGNAL(destroyed(QObject*)),
+ this, SLOT(_q_widgetDestroyed(QObject*)));
d->createdWidgets.removeAll(widget);
deleteWidget(widget);
}
diff --git a/src/gui/kernel/qwidgetaction.h b/src/gui/kernel/qwidgetaction.h
index e65ec183b..482cd2b41 100644
--- a/src/gui/kernel/qwidgetaction.h
+++ b/src/gui/kernel/qwidgetaction.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qwidgetaction_p.h b/src/gui/kernel/qwidgetaction_p.h
index 99b52a06d..1a1794082 100644
--- a/src/gui/kernel/qwidgetaction_p.h
+++ b/src/gui/kernel/qwidgetaction_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qwidgetcreate_x11.cpp b/src/gui/kernel/qwidgetcreate_x11.cpp
index e89ebd586..ba6bf2d3a 100644
--- a/src/gui/kernel/qwidgetcreate_x11.cpp
+++ b/src/gui/kernel/qwidgetcreate_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h
index 8b44d385f..260c8b7f3 100644
--- a/src/gui/kernel/qwindowdefs.h
+++ b/src/gui/kernel/qwindowdefs.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -131,6 +131,11 @@ QT_END_HEADER
#endif // Q_WS_QWS
+#if defined(Q_OS_SYMBIAN)
+class CCoeControl;
+typedef CCoeControl * WId;
+#endif // Q_OS_SYMBIAN
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h
index 0951b28f5..cfaf4bc4e 100644
--- a/src/gui/kernel/qwindowdefs_win.h
+++ b/src/gui/kernel/qwindowdefs_win.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp
new file mode 100644
index 000000000..7dff54317
--- /dev/null
+++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "private/qwinnativepangesturerecognizer_win_p.h"
+
+#include "qevent.h"
+#include "qgraphicsitem.h"
+#include "qgesture.h"
+
+#include "private/qgesture_p.h"
+#include "private/qevent_p.h"
+#include "private/qapplication_p.h"
+#include "private/qwidget_p.h"
+
+QT_BEGIN_NAMESPACE
+
+#if !defined(QT_NO_NATIVE_GESTURES)
+
+QWinNativePanGestureRecognizer::QWinNativePanGestureRecognizer()
+{
+}
+
+QGesture *QWinNativePanGestureRecognizer::create(QObject *target)
+{
+ if (!target)
+ return new QPanGesture; // a special case
+ if (!target->isWidgetType())
+ return 0;
+ if (qobject_cast<QGraphicsObject *>(target))
+ return 0;
+
+ QWidget *q = static_cast<QWidget *>(target);
+ QWidgetPrivate *d = q->d_func();
+ d->nativeGesturePanEnabled = true;
+ d->winSetupGestures();
+
+ return new QPanGesture;
+}
+
+QGestureRecognizer::Result QWinNativePanGestureRecognizer::recognize(QGesture *state,
+ QObject *,
+ QEvent *event)
+{
+ QPanGesture *q = static_cast<QPanGesture*>(state);
+ QPanGesturePrivate *d = q->d_func();
+
+ QGestureRecognizer::Result result = QGestureRecognizer::Ignore;
+ if (event->type() == QEvent::NativeGesture) {
+ QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
+ switch(ev->gestureType) {
+ case QNativeGestureEvent::GestureBegin:
+ break;
+ case QNativeGestureEvent::Pan:
+ result = QGestureRecognizer::TriggerGesture;
+ event->accept();
+ break;
+ case QNativeGestureEvent::GestureEnd:
+ if (q->state() == Qt::NoGesture)
+ return QGestureRecognizer::Ignore; // some other gesture has ended
+ result = QGestureRecognizer::FinishGesture;
+ break;
+ default:
+ return QGestureRecognizer::Ignore;
+ }
+ if (q->state() == Qt::NoGesture) {
+ d->lastOffset = d->offset = QPointF();
+ d->startPosition = ev->position;
+ } else {
+ d->lastOffset = d->offset;
+ d->offset = QPointF(ev->position.x() - d->startPosition.x(),
+ ev->position.y() - d->startPosition.y());
+ }
+ }
+ return result;
+}
+
+void QWinNativePanGestureRecognizer::reset(QGesture *state)
+{
+ QPanGesture *pan = static_cast<QPanGesture*>(state);
+ QPanGesturePrivate *d = pan->d_func();
+
+ d->lastOffset = d->offset = QPointF();
+ d->startPosition = QPoint();
+ d->acceleration = 0;
+
+ QGestureRecognizer::reset(state);
+}
+
+#endif // QT_NO_NATIVE_GESTURES
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
new file mode 100644
index 000000000..7d53ed2b5
--- /dev/null
+++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINNATIVEPANGESTURERECOGNIZER_WIN_P_H
+#define QWINNATIVEPANGESTURERECOGNIZER_WIN_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QGestureRecognizer>
+
+QT_BEGIN_NAMESPACE
+
+#if !defined(QT_NO_NATIVE_GESTURES)
+
+class QWinNativePanGestureRecognizer : public QGestureRecognizer
+{
+public:
+ QWinNativePanGestureRecognizer();
+
+ QGesture *create(QObject *target);
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
+ void reset(QGesture *state);
+};
+
+#endif // QT_NO_NATIVE_GESTURES
+
+QT_END_NAMESPACE
+
+#endif // QWINNATIVEPANGESTURERECOGNIZER_WIN_P_H
diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp
index 85eb60f8b..8333fbb93 100644
--- a/src/gui/kernel/qx11embed_x11.cpp
+++ b/src/gui/kernel/qx11embed_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -123,8 +123,8 @@ QT_BEGIN_NAMESPACE
emitted.
There are XEmbed widgets available for KDE and GTK+. The GTK+
- equivalent of QX11EmbedWidget is GtkPlug. The KDE widget is called
- QXEmbed.
+ equivalent of QX11EmbedWidget is GtkPlug. The corresponding KDE 3
+ widget is called QXEmbed.
\sa QX11EmbedContainer, {XEmbed Specification}
*/
@@ -177,8 +177,8 @@ QT_BEGIN_NAMESPACE
features such as window activation and focus handling are then
lost.
- The GTK+ equivalent of QX11EmbedContainer is GtkSocket. The KDE
- widget is called QXEmbed.
+ The GTK+ equivalent of QX11EmbedContainer is GtkSocket. The
+ corresponding KDE 3 widget is called QXEmbed.
\sa QX11EmbedWidget, {XEmbed Specification}
*/
diff --git a/src/gui/kernel/qx11embed_x11.h b/src/gui/kernel/qx11embed_x11.h
index e640ebf92..706acd641 100644
--- a/src/gui/kernel/qx11embed_x11.h
+++ b/src/gui/kernel/qx11embed_x11.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qx11info_x11.cpp b/src/gui/kernel/qx11info_x11.cpp
index 136f7f8b3..2fed654e2 100644
--- a/src/gui/kernel/qx11info_x11.cpp
+++ b/src/gui/kernel/qx11info_x11.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qx11info_x11.h b/src/gui/kernel/qx11info_x11.h
index 42e5c1846..f46b6c423 100644
--- a/src/gui/kernel/qx11info_x11.h
+++ b/src/gui/kernel/qx11info_x11.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** 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.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/symbian.pri b/src/gui/kernel/symbian.pri
new file mode 100644
index 000000000..69422dd02
--- /dev/null
+++ b/src/gui/kernel/symbian.pri
@@ -0,0 +1,7 @@
+symbian {
+ contains(QT_CONFIG, s60): LIBS+= $$QMAKE_LIBS_S60
+ RESOURCES += symbian/symbianresources.qrc
+
+ HEADERS += symbian/qsymbianevent.h
+ SOURCES += symbian/qsymbianevent.cpp
+}