diff options
195 files changed, 4100 insertions, 1513 deletions
diff --git a/configure.exe b/configure.exe Binary files differindex 7c11fec..13d0673 100755 --- a/configure.exe +++ b/configure.exe diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 887e93e..7596943 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -24,6 +24,11 @@ information about a particular change. now 0.93. +Third party components +---------------------- + + - Updated FreeType to version 2.3.9 + **************************************************************************** * Library * **************************************************************************** @@ -34,18 +39,131 @@ information about a particular change. * Since the 4.6 beta Qt::RenderHint has been moved to QGraphicsBlurEffect::BlurHint. +QtCore + - QVariant * Many optimisations * Added QVariant::toFloat() and QVariant::toReal() * Added QVariant(float) constructor + * qvariant_cast<QVariant> and qVariantFromValue<QVariant> are now + identify functions - Qt::escape * now escape the double quote (") + - QScopedPointer + * New pointer class for cleaning up objects when leaving the + current scope + + - QFile + * Make QFile::resize() more robust when operating on buffered files + + - QObject + * Added the possibility to pass the flag Qt::UniqueConnection to QObject::connect + * Fixed race conditions that occured when moving object to threads while connecting + +- QTextStream + * [221316] Fixed crash on large input. + +QtGui + +- QGraphicsItem + * Fixed bug and improved accuracy of QGraphicsItem::childrenBoundingRect(). + * Many optimizations. + * Introduced QGraphicsItem::ItemHasNoContents + * Introduced QGraphicsItem::ItemSendsGeometryChanges (see Behavioral Changes) + * Introduced QGraphicsItem::focusProxy(), focus proxy support + * Introduced QGraphicsItem::ItemNegativeZStacksBehindParent + * Introduced QGraphicsItem::ItemIsPanel, light-weight window support + * Introduced activation support. + * Introduced QGraphicsItem::stackBefore() + * Cached items are now always invalidated when update() is called. + +- QGraphicsObject + * New class; inherits QGraphicsItem and adds notification signals and property declarations. + +- QGraphicsProxyWidget + * [251407] Fixed window flag handling. Now QGraphicsProxyWidget's flags win. + * Fix Qt::ClickFocus policy + + - QGraphicsScene + * [245317] Fixes to mouse grabbing behavior. + * Fixed delivery of double-click events after explicit grab and then ungrab. + * Rewrote the internal rendering to use a recursive instead of an iterative approach. + * Many optimizations. + * Ensure hover enter events are delivered when an item is pressed. + * Introduced activation support. + * Fixed bugs in initial focus support. + +- QGraphicsTextItem + * Now inherits from QGraphicsObject instead + + - QGraphicsTransform + * New class; eases animation of transformations for QGraphicsItem. + +- QGraphicsView + * Fix mapToScene(QRect) to avoid extra unnecessary adjustments. + * Many optimizations. + * Introduced QGraphicsView::isTransformed() + * [QTBUG-4151] Items with parent that sets ItemClipsChildrenToShape were sometimes invisible. + +- QGraphicsWidget + * Now inherits from QGraphicsObject instead + + - QTreeView + * [234930] Be able to use :has-children and :has-sibillings in a stylesheet + * [252616] Set QStyleOptionViewItemV4::OnlyOne flag when painting spanning columns + + - QTableView + * [191545] Selections work more similarly to well-known spreadsheets + * [234926] Fixed sorting after changing QTableView header + * [244651] [245327] [250193] [QTBUG-5062] Spans get plenty of love with + speed-up, support for rows/columns insertion/removal, and better keyboard + navigation + + - QTabBar + * [196326] Fixed having a stylesheet on a QTabBar resulted in some tab names + to be slightly clipped. + * [241383] Added ability to style the close tab button with style sheet + + - QComboBox + * [220195] Fixed keyboard search when current index is -1 + +- QPixmap + * Optimized width(), height(), isNull() and depth(). + +- QRegion + * Minor optimizations. + + - QSpinBox + * [259226] Fixed setting a stylesheet on a QSpinBox to change the arrow possition + + - QStandardItemModel + * [255652] Fixed crash while using takeRow with a QSortFilterProxyModel + + - QGraphicsItem + * Added a new set of properties to set a transformation on a item + + - QMenu + * [252610] Fixed position of the shortcut text while setting a stylesheet on menu items + + - QSortFilterProxyModel + * [251296] Fixed bugs in which filtered items could not be filtered. + + - QSplitter + * [206494] Added ability to style pressed slided with stylesheet + + - QWidget + * [201649] Added QWidget::previousInFocusChain + + **************************************************************************** * Platform Specific Changes * **************************************************************************** + - Added community supported Qt ports for QNX and VxWorks. See platform + notes in the Qt documentation for details. + - Significant external contribution from Milan Burda for planned removal of (non-unicode) Windows 9x/ME support. @@ -65,6 +183,36 @@ information about a particular change. - On Windows CE the link time code geration has been disabled by default to be consistent with win32-msvc200x. + - Added QMAKE_LIBS_OPENGL_ES1, QMAKE_LIBS_OPENGL_ES1CL and + QMAKE_LIBS_OPENGL_ES2 qmake variables for specifying OpenGL ES + specific libraries. + + - KDE Integration: Improved the integration into KDE desktop (loading of KDE + palette, usage of KColorDialog and KFileDialog) using the GuiPlatformPlugin + +**************************************************************************** +* Tools * +**************************************************************************** + +- Designer + + - [233683] Promoted Widgets are now stored correctly in scratchpad. + - [249823] Added search functionality to the resource browser. + - [254282] Enabled the use of promoted widgets in form templates. + - [254824] Made it possible to override the createAction()/createWidget() + functions of QUiLoader. + - [256332] Enabled deleting all pages of a QTabWidget or QStackedWidget. + - [259238] Fixed menubar/menu editing in right-to-left mode. + - [259918] Fixed setting of object names for container pages not to use + localized strings. + - [260658] Fixed saving of alpha values set in the palette editor. + - It is now possible to further specify the kind of custom widget + string properties using XML tags. + +- uic3 + + - [128859] Fixed code generation of QLabel's wordWrap property. + **************************************************************************** * DirectFB * **************************************************************************** @@ -210,3 +358,7 @@ information about a particular change. function setFloatingPointPrecision(). Set Qt_4_5 as the version of the QDataStream to get the behavior of previous versions. + - On Mac OS X, QDesktopServices::storageLocation(DataLocation) now includes + QCoreApplication::organizationName() and QCoreApplication::applicationName() + if those are set. This matches the behavior on the other platforms. + diff --git a/doc/src/examples/ftp.qdoc b/doc/src/examples/ftp.qdoc index 782613c..68fb0d7 100644 --- a/doc/src/examples/ftp.qdoc +++ b/doc/src/examples/ftp.qdoc @@ -90,12 +90,12 @@ the FTP server, and registers whether an entry represents a directory or a file. We use the QFile object to download files from the FTP server. - + \section1 FtpWindow Class Implementation We skip the \c FtpWindow constructor as it only contains code for setting up the GUI, which is explained in other examples. - + We move on to the slots, starting with \c connectOrDisconnect(). \snippet examples/network/qftp/ftpwindow.cpp 0 @@ -137,7 +137,7 @@ \snippet examples/network/qftp/ftpwindow.cpp 3 \dots \snippet examples/network/qftp/ftpwindow.cpp 4 - + We first fetch the name of the file, which we find in the selected item of \c fileList. We then start the download by using QFtp::get(). QFtp will send progress signals during the download @@ -153,7 +153,7 @@ finished a QFtp::Command. If an error occurred during the command, QFtp will set \c error to one of the values in the QFtp::Error enum; otherwise, \c error is zero. - + \snippet examples/network/qftp/ftpwindow.cpp 7 After login, the QFtp::list() function will list the top-level @@ -165,7 +165,7 @@ When a \l{QFtp::}{Get} command is finished, a file has finished downloading (or an error occurred during the download). - + \snippet examples/network/qftp/ftpwindow.cpp 9 After a \l{QFtp::}{List} command is performed, we have to check if diff --git a/doc/src/examples/imagegestures.qdoc b/doc/src/examples/imagegestures.qdoc new file mode 100644 index 0000000..33c1ace --- /dev/null +++ b/doc/src/examples/imagegestures.qdoc @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/*! + \example gestures/imagegestures + \title Image Gestures Example + + This example shows how to enable gestures for a widget and use gesture input + to perform actions. + + \image imagegestures-example.png Screenshot of the Image Gestures example. + + We use two classes to create the user interface for the application: \c MainWidget + and \c ImageWidget. The \c MainWidget class is simply used as a container for the + \c ImageWidget class, which we will configure to accept gesture input. Since we + are interested in the way gestures are used, we will concentrate on the + implementation of the \c ImageWidget class. + + \section1 ImageWidget Class Definition + + The \c ImageWidget class is a simple QWidget subclass that reimplements the general + QWidget::event() handler function in addition to several more specific event handlers: + + \snippet examples/gestures/imagegestures/imagewidget.h class definition begin + \dots + \snippet examples/gestures/imagegestures/imagewidget.h class definition end + + We also implement a private helper function, \c gestureEvent(), to help manage + gesture events delivered to the widget, and three functions to perform actions + based on gestures: \c panTriggered(), \c pinchTriggered() and \c swipeTriggered(). + + \section1 ImageWidget Class Implementation + + In the widget's constructor, we begin by setting up various parameters that will + be used to control the way images are displayed. + + \snippet examples/gestures/imagegestures/imagewidget.cpp constructor + + We enable three of the standard gestures for the widget by calling QWidget::grabGesture() + with the types of gesture we need. These will be recognized by the application's + default gesture recognizer, and events will be delivered to our widget. + + Since QWidget does not define a specific event handler for gestures, the widget + needs to reimplement the general QWidget::event() to receive gesture events. + + \snippet examples/gestures/imagegestures/imagewidget.cpp event handler + + We implement the event handler to delegate gesture events to a private function + specifically written for the task, and pass all other events to QWidget's + implementation. + + The \c gestureHandler() function examines the gestures supplied by the + newly-delivered QGestureEvent. Since only one gesture of a given type can be + used on a widget at any particular time, we can check for each gesture type + using the QGestureEvent::gesture() function: + + \snippet examples/gestures/imagegestures/imagewidget.cpp gesture event handler + + If a QGesture object is supplied for a certain type of gesture, we call a special + purpose function to deal with it, casting the gesture object to the appropriate + QGesture subclass. + + To illustrate how a standard gesture can be interpreted by an application, we + show the implementation of the \c swipeTriggered() function, which handles the + gesture associated with a brushing or swiping motion on the user's display or + input device: + + \snippet examples/gestures/imagegestures/imagewidget.cpp swipe function + + The QSwipeGesture class provides specialized functions and defines a enum + to make it more convenient for developers to discover which direction, if + any, the user swiped the display. Here, we simply navigate to the previous + image in the collection if the user swiped upwards or to the left; otherwise + we navigate to the next image in the collection. + + The other gestures are also handled by special purpose functions, but use + the values of properties held by the QGesture object passed to them. +*/ diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index a619fe8..2fa8dab 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -122,7 +122,7 @@ \section2 Filtering Input Events - The \l{QGestureRecognizer::}{filterEvent()} function must be reimplemented. + The \l{QGestureRecognizer::}{recognize()} function must be reimplemented. This function handles and filters the incoming input events for the target objects and determines whether or not they correspond to the gesture the recognizer is looking for. @@ -132,15 +132,15 @@ persistent information about the state of the recognition process in the QGesture object supplied. - Your \l{QGestureRecognizer::}{filterEvent()} function must return a value of - Qt::GestureState that indicates the state of recognition for a given gesture and + Your \l{QGestureRecognizer::}{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. \section2 Custom Gestures If you choose to represent a gesture by a custom QGesture subclass, you will need to - reimplement the \l{QGestureRecognizer::}{createGesture()} function to construct + reimplement the \l{QGestureRecognizer::}{create()} function to construct instances of your gesture class instead of standard QGesture instances. Alternatively, you may want to use standard QGesture instances, but add additional dynamic properties to them to express specific details of the gesture you want to handle. @@ -152,7 +152,7 @@ \l{QGestureRecognizer::}{reset()} function to perform these special tasks. Note that QGesture objects are only created once for each combination of target object - and gesture type, and they are reused every time the user attempts to perform the + and gesture type, and they might be reused every time the user attempts to perform the same gesture type on the target object. As a result, it can be useful to reimplement the \l{QGestureRecognizer::}{reset()} function to clean up after each previous attempt at recognizing a gesture. @@ -162,12 +162,12 @@ To use a gesture recognizer, construct an instance of your QGestureRecognizer subclass, and register it with the application with - QApplication::registerGestureRecognizer(). A recognizer for a given type of - gesture can be removed with QApplication::unregisterGestureRecognizer(). + QGestureRecognizer::registerRecognizer(). A recognizer for a given type of + gesture can be removed with QGestureRecognizer::unregisterRecognizer(). \section1 Further Reading - The \l{Image Gestures Example} shows how to enable gestures for a widget in - a simple image viewer application. + The \l{gestures/imagegestures}{Image Gestures Example} shows how to enable + gestures for a widget in a simple image viewer application. */ diff --git a/doc/src/images/platformHWAcc.png b/doc/src/images/platformHWAcc.png Binary files differnew file mode 100644 index 0000000..76a5a48 --- /dev/null +++ b/doc/src/images/platformHWAcc.png diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index ea5a9dc..ac264d0 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -226,10 +226,11 @@ The QtOpenGL module is part of the \l{Qt Full Framework Edition} and the \l{Open Source Versions of Qt}. It is available on Windows, X11, and Mac OS X. - \l{Qt for Embedded Linux} supports OpenGL ES (OpenGL for Embedded Systems). - To be able to use the OpenGL API in \l{Qt for Embedded Linux}, it must be + \l{Qt for Embedded and OpenGL} supports OpenGL ES (OpenGL for Embedded Systems). + \note To be able to use the OpenGL API in \l{Qt for Embedded Linux}, it must be integrated with the Q Window System (QWS). See the \l{Qt for Embedded Linux and OpenGL} documentation for details. + */ /*! diff --git a/doc/src/network-programming/qtnetwork.qdoc b/doc/src/network-programming/qtnetwork.qdoc index b44b84f..c20adaf 100644 --- a/doc/src/network-programming/qtnetwork.qdoc +++ b/doc/src/network-programming/qtnetwork.qdoc @@ -101,7 +101,7 @@ Each application or library can create one or more instances of QNetworkAccessManager to handle network communication. - + \section1 Writing FTP Clients with QFtp FTP (File Transfer Protocol) is a protocol used almost exclusively diff --git a/doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc b/doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc new file mode 100644 index 0000000..9c18d87 --- /dev/null +++ b/doc/src/platforms/emb-HwAcc-LinuxEmbedded.qdoc @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/*! + + \page qt-embeddedLinux-accel.html + + \target Hardware Acceleration with Qt for Embedded Linux + + \title Qt for Embedded Linux Hardware Accelerated Graphics + \ingroup qt-embedded-linux + + + \input platforms/emb-hardwareacceleration.qdocinc + +\section1 Supported Hardware Accelerated Graphics APIs + +This list shows which Hardware Accelerated Graphics APIs currently +supported by Qt. + + \table + \header + \o Supported Hardware Accelerated Graphics APIs + \row + \o \l {Qt for Embedded Linux and OpenGL}{OpenGL ES} + \row + \o \l {Qt for Embedded Linux and OpenVG}{OpenVG} + \row + \o \l {Qt for Embedded Linux and DirectFB}{DirectFB} + \endtable + + +*/ diff --git a/doc/src/platforms/emb-HwAcc-WinCE.qdoc b/doc/src/platforms/emb-HwAcc-WinCE.qdoc new file mode 100644 index 0000000..66b6948 --- /dev/null +++ b/doc/src/platforms/emb-HwAcc-WinCE.qdoc @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/*! + \page qt-embeddedWinCE-accel.html + + \target Hardware Acceleration with Qt for Windows CE + + \title Qt for Windows CE Hardware Accelerated Graphics + \ingroup qtce + + + \input platforms/emb-hardwareacceleration.qdocinc + + \section1 Supported Hardware Accelerated Graphics APIs + + This list shows which Hardware Accelerated Graphics APIs currently +supported by Qt. + + \table + \header + \o Supported Hardware Accelerated Graphics APIs + \row + \o \l {Qt for Windows CE and OpenGL ES}{OpenGL ES} + \row + \o \l {Qt for Windows CE and OpenVG}{OpenVG} + \endtable + + + +*/ diff --git a/doc/src/platforms/emb-directfb-EmbLinux.qdoc b/doc/src/platforms/emb-directfb-EmbLinux.qdoc new file mode 100644 index 0000000..b863951 --- /dev/null +++ b/doc/src/platforms/emb-directfb-EmbLinux.qdoc @@ -0,0 +1,340 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/*! +\page qt-embeddedLinux-directfb.html + +\title Qt for Embedded Linux and DirectFB + +\ingroup qt-embedded-linux + +\section1 Introduction + +DirectFB is an open source LGPL licensed project founded by Denis Oliver Kropp +and generally chip vendors start out with the official version and +implement their own plugins to optimize the operations their hardware +supports. + +We recommend using Qt 4.6 with DirectFB. DirectFB support was introduced +already into Qt for Embedded Linux as a labs project for Qt 4.3 and folded +into Qt as a screen driver for Qt 4.4, but not supported fully. In Qt 4.5, +major changes were made to make it work with the optimized raster paint +engine. And in Qt 4.6 these have been further improved. + +\tableofcontents + +\section1 Using DirectFB with Qt +DirectFB is centered around \l +{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBSurface.html}{Surfaces} +which is the equivalent of a QPaintDevice. In the Qt/DirectFB plugin, +DirectFB maps onto either a QPixmap or a QWindowSurface which essentially +means that drawing onto QPixmap or a QWidget can be accelerated and drawing +onto any other paint device (e.g. QImage) cannot. + +\section2 Configure + +When configuring Qt there are two options, from which you can choose: + +\code + ./configure -plugin-gfx-directfb + ./configure -qt-gfx-directfb + +\endcode + +With either mode, Qt will try the following to look for the DirectFB +includes/libs. + +\list + \o Use pkg-config + \o Use directfb-config + \o Check in your qmake.conf +\endlist + +Often the values returned from pkg-config/directfb-config indicates the +locations of the libs/headers on the target rootfs, rather than their +location on your host. The safest option is usually to explicitly populate +these variables in your qmake.conf like this: + +\code + +QT_CFLAGS_DIRECTFB = +/opt/toolchain/gcc4.3_mipsel_linux/usr/include/directfb -D_REENTRANT +QT_LIBS_DIRECTFB = -L/opt/toolchain/gcc4.3_mipsel_linux/usr/lib/-ldirect +-ldirectfb -lfusion + +\note While DirectFB supports a multi-process setup through a +kernel-extension called Fusion this setup is not well tested with Qt. + +\section2 Supported graphics operations + +IDirectFBSurface supports blitting, filling, drawing lines rects etc, but +it does not support everything Qt allows you to do. E.g. painter paths, +polygons, complex transformations, antialiasing, gradients. Some of these +things are handled in newer versions of DirectFB and could be supported by +Qt. They are seemingly optional at the driver level, so you need to have +fall back code paths for older drivers and drivers on which this is not +implemented. + +The QDirectFBPaintEngine is a subclass of the QRasterPaintEngine, thus +essentially supporting everything QRasterPaintEngine supports. This means +that it supports all graphical operations that Qt supports, but certain +operations will have to fall back to software rendering and that should be +avoided due to performance issues. Instead, these operations should be +rendered into a QPixmap once, and then reuse the pixmap. + +Note: Fallbacks to software rendering should be avoided. If unsupported +operations are used, the paint engine must fallback to the +QRasterPaintEngine engine. A good debugging tip is to make Qt warn you when +such fall backs occur, and to disable the fall back and only return. +Debugging options are listed below. + +\section2 DirectFB driver +DirectFB also provides an abstraction for keyboard and mouse drivers. This +simplifies the process of getting the target hardware up and running. It +also brings us to a feature fragmentation issue between different versions +of DirectFB. + +The Qt DirectFB driver currently supports DirectFB versions >= 0.9. Still, +there are large differences in what each actual implementation handles +correctly. It is relatively common not to properly support +\l{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBWindow}{DirectFB +windows}, so Qt needs to handle this case with a different code path. In +addition, certain drivers do not properly support DirectFB's cursor +handling. This means Qt has to have a code path for rendering the cursor +itself when this is the case. Some drivers do not let us create \l +{http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceDescription}{preallocated +surfaces} which means we have to have a conditional code path for that +case. + +\section2 Optimize performance using define options + +Qt/DirectFB comes with a number of defines that can be either +uncommented in directfb.pri or added to the QT_DEFINES_DIRECTFB variable in +your qmake.conf. + +\note The defines have been moved from \i +{src/plugins/gfxdrivers/directfb/directfb.pro} to \i +{src/gui/embedded/directfb.pri} + +\code + +#DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP| + DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON| + DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS|DRAW_ROUNDED_RECT + + #DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" + #DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" + +\endcode + +As demonstrated above, you need to Qt which drawing operations you want to +warn/disable. Since there are varying implementations of DirectFB from +manufacturer to manufacture, different operations will be optimized. This +require you to define the operations you want to warn about or disable. +These are listed above in the DIRECTFB_DRAWINGOPERATIONS variable. + +Following is a table showing which options you have. + +\table + \header + \o Define option + \o Description + \row + \o QT_DIRECTFB_IMAGECACHE + \o Defining this means that Qt will cache an IDirectFBSurface per +QImage you draw based on its \l +{http://doc.trolltech.com/4.5/qimage.html#cacheKey}{cacheKey}. +Use this define if your application draws many QImages that +remain the same. Note that if you in this situation draw an image and then +change it, by calling bits() or opening a QPainter on it, the cache will +not benefit you. You can control the cache size with the imageCacheSize +connect option. + + \row + \o QT_NO_DIRECTFB_WM + \o If your DirectFB implementation does not support windows, you +have to define this to make Qt work properly. You can test this by checking +if the \l { +http://www.directfb.org/index.php?path=Main%2FDownloads&page=1}{df_window +example} runs well. +This means that all drawing operations onto a QWidget involves +an extra blitting step since Qt essentially first has to draw into an +off-screen buffer and then blit this buffer to the back buffer of the +primary surface. Finally, Qt must flip the back buffer to the front buffer, +which usually involves another blit. Still, blits are usually very fast +with DirectFB. + +To work around this you can make your widget paint on screen, \l +Qt::WA_PaintOnScreen but this comes with other limitations. This should be +avoided if you want more than one full-screen window in your application. +In addition, it will not work without proper DirectFB mouse support from the +layer. Also, see QT_NO_DIRECTFB_LAYER for more. + + \row + \o QT_NO_DIRECTFB_LAYER + \o If your DirectFB display layer cannot be used for e.g. drawing +mouse cursor, creating windows you have to define this. Defining this also +requires defining QT_NO_DIRECTFB_WM and involves making Qt render the +cursor rather than letting DirectFB do it. + + \row + \o QT_NO_DIRECTFB_PALETTE + \o Define this if your DirectFB driver does not support surfaces +with \l +{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFBPalette.html}{color +tables}. +The effect of defining this is that Qt will have to convert +images with \l QImage::Format_Indexed8 format to another format before +rendering them. + + \row + \o QT_NO_DIRECTFB_PREALLOCATED + \o Define this if your DirectFB driver does not support creating a +surface with preallocated data. This will make a more frequent use of \l +{http://www.cplusplus.com/reference/clibrary/cstring/memcpy/}{memcpy()} +when drawing images. If you define this, you might want to consider +defining QT_DIRECTFB_IMAGECACHE for better image rendering performance. + + \row + \o QT_NO_DIRECTFB_MOUSE and QT_NO_DIRECTFB_KEYBOARD + \o Define this if your driver does not provide keyboard/mouse +events through \l +{http://www.directfb.org/docs/DirectFB_Reference_1_4/IDirectFB_CreateInputEventBuffer.html}{CreateInputEventBuffer}. +This means that Qt cannot use DirectFB to receive keyboard/mouse events and +if you want such events in your application, you will have to provide +another driver. For more info see \l {Qt for Embedded Linux Pointer +Handling}{Qt for Embedded Linux Pointer Handling} and \l{Qt for Embedded +Linux Character Input}{Qt for Embedded Linux Character Input} + + \row + \o QT_DIRECTFB_TIMING + \o Define this when debugging to get output on stderr about the +frames per second. + + \row + \o QT_NO_DIRECTFB_OPAQUE_DETECTION + \o When blitting a surface Qt has to decide whether to set the \l +{http://www.directfb.org/docs/DirectFB_Reference_1_4/types.html#DFBSurfaceBlittingFlags}{DSBLIT_BLEND_ALPHACHANNEL} +flag. If you load an image from file or network data that has a format that +includes an alpha channel, the image might still be completely opaque. +Normally Qt runs through every pixel to check if there really is an alpha +channel there. This involves some overhead but usually pays off in the end +because blitting is cheaper than blending. If you define this Qt will +assume that an image with a format that has alpha channel contains at least +one pixel with an alpha value != 255. + + \row + \o QT_DIRECTFB_SUBSURFACE + \o Defining this enables a mode that tries to minimize overhead from +locking/unlocking surfaces. Note that this currently is experimental. + + \row + \o QT_DIRECTFB_WINDOW_AS_CURSOR + \o Define this if your DirectFB implementation supports windows but +can not render the cursor properly. This involves creating a small top level +window and moving it around when the cursor moves. It does not always +perform well. + + \row + \o QT_NO_DIRECTFB_IMAGEPROVIDER + \o By default Qt will use DirectFB to load QPixmaps from disk/memory. If +your DirectFB implementation does not support this it might make sense to +define this. + + \row + \o QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE + \o Define this to make sure Qt always keeps at least one \l +{http://directfb.org/docs/DirectFB_Reference_1_4/IDirectFBImageProvider.html}{IDirectFBImageProvider} +object alive. This is to avoid considerable overhead when the first +IDirectFBImageProvider is created, the last IDirectFBImageProvider is +removed. + +\endtable + +\section2 Unsupported graphics operations + +There are a number of unsupported operations causing fallbacks. DirectFB +does not support the following functions. + + + +\table + \header + \o Functions + \row + \o QPainter::strokePath(const QPainterPath & path, const QPen & pen) + \row + \o QPainter::drawPath(const QPainterPath & path) + \row + \o QPainter::fillPath(const QPainterPath & path, const QBrush & brush) + \row + \o QPainter::drawPoints(const QPointF * points, int pointCount) + \row + \o QPainter::drawEllipse(const QRectF & rectangle) + \row + \o QPainter::drawPolygon(const QPointF * points, int pointCount, + Qt::FillRule fillRule = Qt::OddEvenFill) + \row + \o QPainter::drawText(const QPointF & position, const QString & text) + \row + \o QGradient + \endtable + +\section2 Avoiding fallbacks +To avoid fallbacks make sure that the following points are true: + +\list + \o QPen::isSolid() returns true and uses a color with a one pixel +width. (QPen::width() returns 1. + \o QTransform::TransformationType() <= QTransform::TxScale are not +supported. + \o Clipping must be a simple rectangle or a QRegion. +\endlist + +\section2 When painting images +\note You should use QPixmap instead of QImage. QImages are drawn by +the QRasterPaintEngine. To get a warning for every fallback to the +QRasterPaintEngine, use QT_DIRECTFB_WARN_ON_RASTERFALLBACKS. If +QT_DIRECTFB_DISABLE_RASTERFALLBACKS is defined, DirectFB will only return +instead of falling back to QRasterPaintEngine. Please note that these +defines should only be used when optimizing the application. + +*/ diff --git a/doc/src/platforms/emb-hardwareacceleration.qdocinc b/doc/src/platforms/emb-hardwareacceleration.qdocinc new file mode 100644 index 0000000..3851628 --- /dev/null +++ b/doc/src/platforms/emb-hardwareacceleration.qdocinc @@ -0,0 +1,129 @@ + +\section1 Hardware Acceleration + +When designing applications for embedded devices the choice often stands +between graphics effects and performance. On most devices, you cannot have +both simply because the hardware needed for such operations just is not +there. Still a growing number of devices use hardware dedicated to graphics +operations to improve performance. + +Using graphics acceleration hardware is more power efficient than using the +CPU. The reason for this is that the CPU might require a clock speed that +is up to 20 times higher than the GPU, achieving the same results. E.g. a +typical hardware accelerated mobile graphics unit can rasterize one or two +bilinear texture fetches in one cycle, while a software implementation +takes easily more than 20 cycles. Graphics hardware generally have a much +lower clock speed and memory bandwidth and different level of acceleration +than desktop GPUs. One example is that many GPUs leave out transformation +and lighting from the graphics pipeline and only implements rasterization. + +So the key to write good applications for devices is therefore to limit the +wow factor down to what the target hardware can handle, and to take +advantage of any graphics dedicated hardware. Qt provides several ways to +both render advanced effects on the screen and speed up your application +using hardware accelerated graphics. + +\tableofcontents + +\section2 Qt for Embedded Graphics pipeline + +Qt uses QPainter for all graphics operations. By using the same API +regardless of platform, the code can be reused on different devices. +QPainter use different paint engines implemented in the QPaintEngine API to +do the actual painting. + +The QPaintEngine API provides paint engines for each window system and +painting framework supported by Qt. In regards to Qt for Embedded, this +also includes implementations for OpenGL ES versions 1.1 and 2.0, as well +as OpenVG and DirectFB(Embedded Linux only). + +By using one of these paint engines, you will be able to improve the +graphics performance of your Qt application. However, if the graphics +operations used are not supported, this might as well be a trap, slowing +down your application significantly. This all depends on what kind of +graphics operations that are supported by the target devices hardware +configuration. + +\image platformHWAcc.png + +The paint engine will direct all graphics operations supported by the +devices hardware to the GPU, and from there they are sent to the +framebuffer. Unsupported graphics operations falls back to the +QRasterPaintEngine and are handled by the CPU before sent to the +framebuffer. In the end, the operating system sends the paint updates off +to the screen/display. The fallback operation is quite expensive in regards +to memory consumption, and should be avoided. + +\section2 Hardware configuration requirements + +Before implementing any application using hardware acceleration, it is wise +to get an overview of what kind of hardware accelerated graphics operations +that are available for the target device. + +\note On devices with no hardware acceleration, Qt will use +QRasterPaintEngine, which handles the acceleration using software. On +devices supporting OpenGL ES, OpenVG or DirectFB(not supported by Windows +CE), Qt will use the +respective paint engines to accelerate painting. However, hardware +configurations that only support a limited set of hardware acceleration +features, might slow the application graphics down rather than speeding it +up when using unsupported operations that must fall back to the raster +engine. + +\section3 Different architectures + +Based on the architecture used in a device we can make a recommendation on +which hardware acceleration techniques to use. There are mainly two +different architectures on embedded devices. These are devices with a +Unified Memory Architecture (UMA), and devices with dedicated graphics +memory. Generally, high-end devices will have dedicated graphics memory. +Low-end devices will just use system memory, sometimes reserving a memory +region and sometimes not. + +In addition to this, we can categorize the devices into five types based on +the different graphics operations supported by their hardware. + +\list 1 + \o No support for graphics acceleration. + \o Support for blitter and alpha blending. + \o Support for path based 2D vector graphics. + \o Support for fixed function 3D graphics. + \o Support for programmable 3D graphics. +\endlist + +Based on these characteristics the table below recommends which paint +engines to use with the different types of hardware configurations. + +\section3 Recommended use of hardware acceleration based on hardware + + \table + \header + \o Type + \o UMA + \o Non-UMA + \row + \o \bold {None} + \o Qt Raster Engine + \o Qt Raster Engine + \row + \o \bold {Blitter} + \o DirectFB + \o DirectFB + \row + \o \bold {2D Vector} + \o OpenVG + \o OpenVG + \row + \o \bold {Fixed 3D} + \o OpenGL (ES) 1.x + \o OpenGL (ES) 1.x + \row + \o \bold {Programmable 3D} + \o OpenGL (ES) 2.x + \o OpenGL (ES) 2.x + + \endtable + +\note Since the DirectFB API is quite primitive, the raster paint engine +handles most of the operations. +\note Blitter and Alpha blending is currently not supported on Windows CE. diff --git a/doc/src/platforms/emb-opengl.qdoc b/doc/src/platforms/emb-opengl-EmbLinux.qdoc index 2ed5d04..bede2ca 100644 --- a/doc/src/platforms/emb-opengl.qdoc +++ b/doc/src/platforms/emb-opengl-EmbLinux.qdoc @@ -40,31 +40,24 @@ ****************************************************************************/ /*! -\page qt-embedded-opengl.html +\page qt-embeddedLinux-opengl.html \title Qt for Embedded Linux and OpenGL -\ingroup qt-embedded-linux -\section1 Introduction +\ingroup qt-embedded-linux -\l {http://www.opengl.org}{OpenGL} is an industry standard API for -2D/3D graphics. It provides a powerful, low-level interface between -software and acceleration hardware, and it is operating system and -window system independent. +\input platforms/emb-opengl.qdocinc -\l {http://www.khronos.org/opengles}{OpenGL ES} is a subset -of the \l {http://www.opengl.org}{OpenGL} standard. -Because it is meant for use in embedded systems, it has a smaller, -more constrained API. +\section1 Using OpenGL with Qt for Embedded Linux +Qt for Embedded Linux provides support for integrating OpenGL ES for +drawing into a QGLWidget. The current implementation supports OpenGL and 2D +painting within a QGLWidget. Using OpenGL to accelerate regular widgets and +compositing top-level windows with OpenGL are not currently supported. -For reference, Nokia provides support for integrating \l -{http://www.khronos.org/opengles}{OpenGL ES} with Qt for Embedded Linux -for drawing into a QGLWidget. +\note OpenGL rendering only works with QGLWidget under QWS. Regular +widgets cannot currently support it. -The current implementation supports OpenGL and 2D painting within a -QGLWidget. Using OpenGL to accelerate regular widgets and compositing -top-level windows with OpenGL are not currently supported. These issues -will be addressed in future versions of Qt. +\section2 Configure It is recommended that Qt for Embedded Linux is configured with the \c{-DQT_QWS_CLIENTBLIT} and \c{-DQT_NO_QWS_CURSOR} options for optimum @@ -72,58 +65,11 @@ performance. OpenGL is rendered direct to the screen and these options prevent Qt for Embedded Linux from trying to do its own non-OpenGL compositing on the QGLWidget contents. -\section2 Using OpenGL 3D Graphics in Applications - -The \l {QtOpenGL module} offers classes that make it easy to draw 3D -graphics in GUI applications. The module API is cross-platform, so it -is also available on Windows, X11, and Mac OS X. - -To use OpenGL-enabled widgets in a Qt for Embedded Linux application, -all that is required is to subclass the QGLWidget and draw into instances of -the subclass with standard OpenGL functions. - -Note that on most embedded hardware, the OpenGL implementation is -actually \l{http://www.khronos.org/opengles/1_X/}{OpenGL/ES 1.1} or -\l{http://www.khronos.org/opengles/2_X/}{OpenGL/ES 2.0}. When painting -within a QGLWidget::paintGL() override, it is necessary to limit the -application to only the features that are present in the OpenGL/ES -implementation. - -\section2 Using OpenGL to Accelerate Normal 2D Painting - -Qt provides a subclass of QPaintEngine that translates QPainter operations -into OpenGL calls (there are actually two subclasses, one for OpenGL/ES 1.1 -and another for OpenGL/ES 2.0). This specialized paint engine can be used -to improve 2D rendering performance on appropriate hardware. It can also -overlay controls and decorations onto 3D scenes drawn using OpenGL. - -As mentioned above, the OpenGL paint engine is not currently supported -in regular widgets. However, any application that uses QGraphicsView -can set a QGLWidget as the viewport and obtain access to the -OpenGL paint engine that way: - -\code -QGraphicsView view(&scene); -view.setViewport(new QGLWidget); -view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate); -view.showFullScreen(); -\endcode - -It is recommended that the QGraphicsView::FullViewportUpdate flag -be set because the default double-buffered behavior of QGLWidget -does not support partial updates. It is also recommended that the -window be shown full-screen because that usually has the best -performance on current OpenGL/ES implementations. - -Once a QGraphicsView has been initialized as above, regular widgets -can be added to the canvas using QGraphicsProxyWidget if the -application requires them. - \section2 Using OpenGL to Implement Window Compositing and Effects -Compositing effects can be simulated by adjusting the opacity and -other parameters of the items within a QGraphicsView canvas on a -QGLWidget viewport. +Compositing effects can be simulated by adjusting the opacity and other +parameters of the items within a QGraphicsView canvas on a QGLWidget +viewport. While Qt for Embedded Linux does include a complete windowing system, using OpenGL to composite regular window surfaces can be quite difficult. @@ -135,23 +81,20 @@ which is why we do not recommend implementing that form of compositing. We intend to address this problem in future versions of Qt. \section1 Integrating OpenGL/ES into Qt for Embedded Linux - \section2 Reference Integration - -The reference integration for OpenGL into Qt for Embedded Linux -is for the PowerVR chipset from \l{http://www.imgtec.com/}{Imagination -Technologies}. It consists of two components: \c{pvreglscreen} which -provides the Qt for Embedded Linux screen driver, and \c{QWSWSEGL} -which implements a plug-in to the PowerVR EGL implementation to -implement low-level OpenGL drawing surfaces. +The reference integration for OpenGL into Qt for Embedded Linux is for the +PowerVR chipset from \l{http://www.imgtec.com/}{Imagination Technologies}. +It consists of two components: \c{pvreglscreen}, which provides the Qt for +Embedded Linux screen driver, and \c{QWSWSEGL}, which implements a plug-in +to the PowerVR EGL implementation to implement low-level OpenGL drawing +surfaces. \section2 Integrating Other Chipsets - -In this section we discuss the essential features of the reference +In this section, we discuss the essential features of the reference integration that need to be provided for any other chipset integration. The QtOpenGL module assumes that a QGLWidget can be represented -by a \c EGLNativeWindowType value in some underlying window system +by an \c EGLNativeWindowType value in some underlying window system implementation, and that \c{eglSwapBuffers()} is sufficient to copy the contents of the native window to the screen when requested. @@ -159,7 +102,7 @@ However, many EGL implementations do not have a pre-existing window system. Usually only a single full-screen window is provided, and everything else must be simulated some other way. This can be a problem because of QtOpenGL's assumptions. We intend to address these assumptions in a -future version of Qt, but for now it is the responsibility of the integrator +future version of Qt, but for now, it is the responsibility of the integrator to provide a rudimentary window system within the EGL implementation. This is the purpose of \c{QWSWSEGL} in the reference integration. @@ -218,13 +161,4 @@ In the case of PowerVR, the rudimentary window system in \c{QWSWSEGL} provides a \c PvrQwsDrawable object to represent the \c EGLNativeWindowType value for the widget. -\section1 OpenVG Support - -\l {http://www.khronos.org/openvg} {OpenVG} is a dedicated API for 2D -graphics on mobile devices. It is therefore more likely to be a better -alternative for 2D acceleration than OpenGL/ES. Acceleration of -regular widgets is supported with OpenVG, unlike with OpenGL/ES. -See \l{OpenVG Rendering in Qt} for more information on the -OpenVG support in Qt. - */ diff --git a/doc/src/platforms/emb-opengl.qdocinc b/doc/src/platforms/emb-opengl.qdocinc new file mode 100644 index 0000000..dac5379 --- /dev/null +++ b/doc/src/platforms/emb-opengl.qdocinc @@ -0,0 +1,85 @@ +\section1 Introduction + +\l {http://www.opengl.org}{OpenGL} is an industry standard API for +2D/3D graphics. It provides a powerful, low-level interface between +software and acceleration hardware, and it is operating system and +window system independent. \l {http://www.khronos.org/opengles}{OpenGL ES} +is a subset of the \l {http://www.opengl.org}{OpenGL} standard. Because it +is designed for use with embedded systems, it has a smaller, more +constrained API. + +\l {http://www.khronos.org/opengles/1_X}{OpenGL ES version 1.x} is designed for +fixed function hardware, while its successor \l +{http://www.khronos.org/opengles/2_X}{OpenGL ES version 2.x} is designed for +programmable hardware. It is worth noting that there is a significant +difference between the two, and that they are not compatible with each +other. OpenGL ES 1.x limits processing to a pre-defined set of fixed +options for drawing and lighting objects. OpenGL 2.x has a significantly +shorter graphics pipeline than 1.x. Instead of using function +transformation and a fragment pipeline, 2.x uses the \l +{http://www.khronos.org/registry/gles/specs/2.0/GLSL_ES_Specification_1.0.17.pdf}{OpenGL +ES Shading Language (GLSL ES)}. Instead of using the pre-defined functions, +the programmer writes small shader programs telling the hardware in detail +how to render each object. + +The \l {QtOpenGL module} offers classes that make it easy to draw 3D +graphics in GUI applications using OpenGL ES. Qt provides a plugin that +integrates both OpenGL ES versions \l +{http://www.khronos.org/opengles/1_X}{1.x} and \l +{http://www.khronos.org/opengles/2_X}{2.x} with Qt for Embedded. However, +Qt for Embedded can be adapted to a wide range of OpenGL versions. + +To translate QPainter operations into OpenGL ES calls (there are actually +two subclasses, one for OpenGL/ES 1.1 and another for OpenGL/ES 2.0), Qt +uses a subclass of QPaintEngine. This specialized paint engine can be used +to improve 2D rendering performance on appropriate hardware. It can also +overlay controls and decorations onto 3D scenes drawn using OpenGL. + +\tableofcontents + +\section1 Using OpenGL ES with Qt +To use OpenGL-enabled widgets in a Qt for Embedded application, all that is +required is to subclass QGLWidget and draw into instances of the subclass +with standard OpenGL functions. The current implementation only +supports OpenGL ES and 2D painting within a QGLWidget. Using OpenGL ES to +accelerate regular widgets as well as compositing top-level windows with +OpenGL ES are not currently supported. These issues will be addressed in +future versions of Qt. + +\note The OpenGL paint engine is not currently supported in regular +widgets. However, any application that uses QGraphicsView can set a +QGLWidget as the viewport and obtain access to the OpenGL paint engine that +way: + +\code + QGraphicsView view(&scene); + view.setViewport(new QGLWidget()); + view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate); + view.setFrameStyle(0); + view.showFullScreen(); +\endcode + +It is recommended that the QGraphicsView::FullViewportUpdate flag +be set because the default double-buffered behavior of QGLWidget +does not support partial updates. It is also recommended that the +window be shown full-screen because that usually has the best +performance on current OpenGL ES implementations. + +Once a QGraphicsView has been initialized as above, regular widgets +can be added to the canvas using QGraphicsProxyWidget if the +application requires them. + +\note OpenGL ES 2.X does not support PBuffers, so QGLPixelBuffer will not +work. In this case, QGLFramebufferObject should be used instead. However, +OpenGL ES 1.X does not support Framebuffer objects, with the exception of +some OpenGL ES 1.X extensions. In this case, please use QGLPixelBuffer. + +\note On most embedded hardware, the OpenGL implementation is +actually \l{http://www.khronos.org/opengles/1_X/}{OpenGL/ES 1.1} or +\l{http://www.khronos.org/opengles/2_X/}{OpenGL/ES 2.0}. When painting +within a QGLWidget::paintGL() override, it is necessary to limit the +application to only the features that are present in the OpenGL/ES +implementation. + diff --git a/doc/src/platforms/emb-openvg-EmbLinux.qdoc b/doc/src/platforms/emb-openvg-EmbLinux.qdoc new file mode 100644 index 0000000..abdb617 --- /dev/null +++ b/doc/src/platforms/emb-openvg-EmbLinux.qdoc @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/*! +\page qt-embeddedLinux-openvg.html + +\title Qt for Embedded Linux and OpenVG + +\ingroup qt-embedded-linux + +\input platforms/emb-openvg.qdocinc + + + +*/ diff --git a/doc/src/platforms/emb-openvg.qdocinc b/doc/src/platforms/emb-openvg.qdocinc new file mode 100644 index 0000000..37ccb9c --- /dev/null +++ b/doc/src/platforms/emb-openvg.qdocinc @@ -0,0 +1,288 @@ +\section1 Introduction + +\l {http://www.khronos.org/openvg}{OpenVG} is a standard API from the +\l{http://www.khronos.org/openvg}{Khronos Group} for accelerated 2D vector +graphics and raster graphics. It is a dedicated API for 2D graphics on +mobile devices. It is therefore more likely to be a better alternative for +2D acceleration than OpenGL/ES. + +\tableofcontents + +\section1 Using OpenVG with Qt +The QtOpenVG plugin provides support for OpenVG painting. OpenVG is +optimized for 2D vector operations, and closely matches the functionality +in QPainter. To translate QPainter operations into OpenVG calls, Qt uses a +subclass of QPaintEngine. Unlike with OpenGL ES, OpenVG can be used for +acceleration of regular widgets. It can therefore be an excellent substitute +for the default raster-based QPaintEngine on hardware that supports the +OpenVG API. + +\section2 Configure +OpenVG support can be enabled by passing the \c{-openvg} option to +configure. It is assumed that the following qmake variables are set to +appropriate values in the qmake.conf file for your platform: + + \list + \o QMAKE_INCDIR_OPENVG + \o QMAKE_LIBDIR_OPENVG + \o QMAKE_LIBS_OPENVG + \endlist + +Most OpenVG implementations are based on EGL, so the following variables +may also need to be set: + + \list + \o QMAKE_INCDIR_EGL + \o QMAKE_LIBDIR_EGL + \o QMAKE_LIBS_EGL + \endlist + +See \l{qmake Variable Reference} for more information on these variables. + +\section2 Supported OpenVG Engines + +Two kinds of OpenVG engines are currently supported: EGL based, and engines +built on top of OpenGL such as +\l{http://sourceforge.net/projects/shivavg}{ShivaVG}. EGL based engines are +preferred. + +It is assumed that the EGL implementation has some way to turn a +QWidget::winId() into an EGL rendering surface with +\c{eglCreateWindowSurface()}. If this is not the case, then modifications +may be needed to the code under \c{src/gui/egl} and +\c{src/plugins/graphicssystems/openvg} to accomodate the EGL +implementation. + +The ShivaVG graphics system under \c{src/plugins/graphicssystems/shivavg} +is an example of how to integrate a non-EGL implementation of OpenVG into +Qt. It is currently only supported with Qt/X11 and being an example only, +the resulting screen output may not be as good as with other OpenVG +engines. + +\section1 Using the OpenVG graphics system + +Once the graphics system plugin has been built and installed, applications +can be run as follows to use the plugin: + + \code + app -graphicssystem OpenVG + \endcode + +If ShivaVG is being used, then substitute \c ShivaVG instead of \c OpenVG +in the line above. + +If the plugin fails to load, try setting the \c QT_DEBUG_PLUGINS +environment variable to 1 and try again. Usually the plugin cannot be +loaded because Qt cannot locate it in the directory +\c{plugins/graphicssystems} within the Qt installation, or the dynamic +library path does not include the directory containing the system's \c +libOpenVG.so library. + +\section2 Supported features + +\table + \header + \o Feature + \o Description + + \row + \o Context modes + \o The default configuration is "single-context" mode, where a single +EGLContext object is used for all drawing, regardless of the surface. +Multiple EGLSurfaces are created, one for each window surface or pixmap. +eglMakeCurrent() is called with the same EGLContext every time, but a +different EGLSurface. + +Single-context mode is necessary for QPixmapData to be implemented in terms +of a VGImage. If single-context mode is not enabled, then QPixmapData will +use the fallback QRasterPixmapData implementation, which is less efficient +performance-wise. + +Single-context mode can be disabled with the QVG_NO_SINGLE_CONTEXT +define if the OpenVG engine does not support one context with multiple +surfaces. + + \row + \o Transformation matrices + \o All affine and projective transformation matrices are supported. + +QVGPaintEngine will use the engine to accelerate affine transformation +matrices only. When a projective transformation matrix is used, +QVGPaintEngine will transform the coordinates before passing them to the +engine. This will probably incur a performance penalty. + +Pixmaps and images are always transformed by the engine, because OpenVG +specifies that projective transformations must work for images. + +It is recommended that client applications should avoid using projective +transformations for non-image elements in performance critical code. + + \row + \o Composition modes + \o The following composition modes are supported: + +\list +\o QPainter::CompositionMode_SourceOver +\o QPainter::CompositionMode_DestinationOver +\o QPainter::CompositionMode_Source +\o QPainter::CompositionMode_SourceIn +\o QPainter::CompositionMode_DestinationIn +\o QPainter::CompositionMode_Plus +\o QPainter::CompositionMode_Multiply +\o QPainter::CompositionMode_Screen +\o QPainter::CompositionMode_Darken +\o QPainter::CompositionMode_Lighten +\endlist + +The other members of QPainter::CompositionMode are not supported +because OpenVG 1.1 does not have an equivalent in its \c VGBlendMode +enumeration. Any attempt to set an unsupported mode will result in +the actual mode being set to QPainter::CompositionMode_SourceOver. +Client applications should avoid using unsupported modes. + + \row + \o Pens and brushes + \o All pen styles are supported, including cosmetic pens. + +All brush styles are supported except for conical gradients, which are not +supported by OpenVG 1.1. Conical gradients will be converted into a solid +color brush corresponding to the first color in the gradient's color ramp. + +Affine matrices are supported for brush transforms, but not projective +matrices. + + + \row + \o Rectangles, lines, and points + \o Rectangles, lines, and rounded rectangles use cached VGPath +objects to try to accelerate drawing operations. vgModifyPathCoords() is +used to modify the co-ordinates in the cached VGPath object each time +fillRect(), drawRects(), drawLines(), or drawRoundedRect() is called. + +If the engine does not implement vgModifyPathCoords() properly, then the +QVG_NO_MODIFY_PATH define can be set to disable path caching. This will +incur a performance penalty. + +Points are implemented as lines from the point to itself. The cached line +drawing VGPath object is used when drawing points. + + \row + \o Polygons and Ellipses + \o Polygon and ellipse drawing creates a new VGPath object every +time drawPolygon() or drawEllipse() is called. If the client application +is making heavy use of these functions, the constant creation and +destruction of VGPath objects could have an impact on performance. + +If a projective transformation is active, ellipses are converted into cubic +curves prior to transformation, which may further impact performance. + +Client applications should avoid polygon and ellipse drawing in performance +critical code if possible. + + \row + \o Other Objects + \o Most other objects (arcs, pies, etc) use drawPath(), which takes +a QPainterPath argument. The default implementation in QPainterEngineEx +converts the QPainterPath into a QVectorPath and then calls draw(), which +in turn converts the QVectorPath into a VGPath for drawing. + +To reduce the overhead, we have overridden drawPath() in QVGPaintEngine to +convert QPainterPath's directly into VGPath's. This should help improve +performance compared to the default implementation. + +Client applications should try to avoid these types of objects in +performance critical code because of the QPainterPath to VGPath conversion +cost. + + \row + \o Clipping + \o Clipping with QRect, QRectF, and QRegion objects is supported on +all OpenVG engines with vgMask() if the transformation matrix is the +identity or a simple origin translation. + +Clipping with an arbitrary QPainterPath, or setting the clip region when +the transformation matrix is simple, is supported only if the OpenVG engine +has the vgRenderToMask() function (OpenVG 1.1 and higher). + +The QVG_NO_RENDER_TO_MASK define will disable the use of vgRenderToMask(). + +The QVG_SCISSOR_CLIP define will disable clipping with vgMask() or +vgRenderToMask() and instead use the scissor rectangle list to perform +clipping. Clipping with an arbitrary QPainterPath will not be supported. + +The QVG_SCISSOR_CLIP define should only be used if the OpenVG engine does +not support vgMask() or vgRenderToMask(). + + \row + \o Opacity + \o Opacity is supported for all drawing operations. Solid color +pens, solid color brushes, gradient brushes, and image drawing with +drawPixmap() and drawImage() will probably have the best performance +compared to other kinds of pens and brushes. + + \row + \o Text Drawing + \o If OpenVG 1.1 is used, the paint engine will use VG fonts to +cache glyphs while drawing. If the engine does not support VG fonts +correctly, QVG_NO_DRAW_GLYPHS can be defined to disable this mode. Text +drawing performance will suffer if VG fonts are not used. + +By default, image-based glyphs are used. If QVG_NO_IMAGE_GLYPHS is defined, +then path-based glyphs will be used instead. QVG_NO_IMAGE_GLYPHS is ignored +if QVG_NO_DRAW_GLYPHS is defined. + +If path-based glyphs are used, then the OpenVG engine will need to support +hinting to render text with good results. Image-based glyphs avoids the +need for hinting and will usually give better results than path-based +glyphs. + + \row + \o Pixmaps + \o In single-context mode, pixmaps will be implemented using +VGImage unless QVG_NO_PIXMAP_DATA is defined. + +QVGPixmapData will convert QImage's into VGImage's when the application +calls drawPixmap(), and the pixmap will be kept in VGImage form for the +lifetime of the QVGPixmapData object. When the application tries to paint +into a QPixmap with QPainter, the data will be converted back into a QImage +and the raster paint engine will be used to render into the QImage. + +This arrangement optimizes for the case of drawing the same static pixmap +over and over (e.g. for icons), but does not optimize the case of drawing +into pixmaps. + +Bitmaps must use QRasterPixmapData. They are not accelerated with VGImage +at present. + + \row + \o Pixmap filters + \o Convolution, colorize, drop shadow, and blur filters are +accelerated using OpenVG operations. + +\endtable + +\section2 Known issues + +Performance of copying the contents of an OpenVG-rendered window to the +screen needs platform-specific work in the QVGWindowSurface class. + +Clipping with arbitrary non-rectangular paths only works on engines that +support vgRenderToMask(). Simple rectangular paths are supported on all +engines that correctly implement vgMask(). + +The paint engine is not yet thread-safe, so it is not recommended for use +in threaded Qt applications that draw from multiple threads. Drawing should +be limited to the main GUI thread. + +Performance of projective matrices for non-image drawing is not as good +as for affine matrices. + +QPixmap's are implemented as VGImage objects so that they can be quickly +rendered with drawPixmap(). Rendering into a QPixmap using QPainter will +use the default Qt raster paint engine on a QImage copy of the QPixmap, and +will not be accelerated. This issue may be addressed in a future version +of the engine. + +ShivaVG support is highly experimental and limited to Qt/X11. It is +provided as an example of how to integrate a non-EGL engine. + diff --git a/doc/src/platforms/qt-embedded-linux.qdoc b/doc/src/platforms/qt-embedded-linux.qdoc index 21cbf3b..a6524d7 100644 --- a/doc/src/platforms/qt-embedded-linux.qdoc +++ b/doc/src/platforms/qt-embedded-linux.qdoc @@ -96,7 +96,7 @@ \o \l {Qt for Embedded Linux Pointer Handling}{Pointer Handling} \o \l {Qt for Embedded Linux Character Input}{Character Input} \o \l {Qt for Embedded Linux Display Management}{Display Management} - \o \l {Qt for Embedded Linux and OpenGL}{OpenGL} + \o \l {Qt for Embedded Linux Hardware Accelerated Graphics}{Hardware Accelerated Graphics} \o \l {Qt for Embedded Linux Fonts}{Fonts} \endlist diff --git a/doc/src/platforms/wince-introduction.qdoc b/doc/src/platforms/wince-introduction.qdoc index 46ecbf6..886b084 100644 --- a/doc/src/platforms/wince-introduction.qdoc +++ b/doc/src/platforms/wince-introduction.qdoc @@ -65,7 +65,7 @@ \endlist \o \list - \o \l {Windows CE OpenGL ES}{OpenGL ES} + \o \l {Qt for Windows CE Hardware Accelerated Graphics}{Hardware Accelerated Graphics} \o \l {Qt Performance Tuning} \o \l {Fine-Tuning Features in Qt} \endlist diff --git a/doc/src/platforms/wince-opengl.qdoc b/doc/src/platforms/wince-opengl.qdoc index 4fc4d7b..0ea2ec6 100644 --- a/doc/src/platforms/wince-opengl.qdoc +++ b/doc/src/platforms/wince-opengl.qdoc @@ -41,58 +41,48 @@ /*! \page windowsce-opengl.html - \title Windows CE OpenGL ES + \title Qt for Windows CE and OpenGL ES \ingroup qtce \brief Information about support for OpenGL ES with Qt for Windows CE. - \section1 Introduction + \input platforms/emb-opengl.qdocinc - \l {http://www.opengl.org}{OpenGL} is an industry standard API for 2D/3D - graphics. It provides a powerful, low-level interface between software - and acceleration hardware, and it is operating system and window system - independent. +\section1 Using OpenGL with Qt for Windows CE +Qt for Windows CE uses EGL 1.1 to embed OpenGL ES windows within the +Windows CE window manager. - \l {http://www.khronos.org/opengles}{OpenGL ES} is a subset of the - \l {http://www.opengl.org}{OpenGL} standard. It is meant for use in - embedded systems. Hence, it has a smaller, more constrained API. +\section2 Configure - Qt for Windows CE uses EGL 1.1 to embed OpenGL ES windows within the - Windows CE window manager. +To configure Qt for Windows Mobile 5.0 and OpenGL ES Common Lite support +you can run \c{configure} like this: - To use OpenGL ES enabled widgets in a Qt for Windows CE application, you - only need to subclass QGLWidget and draw on instances of the subclass with - OpenGL ES functions. - - OpenGL ES includes profiles for floating-point and fixed-point arithmetic. - The floating point profile is called OpenGL ES CM (Common) and the - fixed-point profile is called OpenGL ES CL (Common Lite). - - You can run \c{configure} with the \c{-opengl-es-cm} option for the Common - profile or \c{-opengl-es-cl} for the Common Lite profile. In both cases, - ensure that the \c{lib} and \c{includes} paths include the OpenGL ES - headers and libararies from your SDK. The OpenGL ES lib should be called - either \c{libGLES_CM.lib} for the Common profile or \c{libGLES_CL.lib} - for the Common Lite profile. + \snippet doc/src/snippets/code/doc_src_wince-opengl.qdoc 0 - To configure Qt for Windows Mobile 5.0 and OpenGL ES Common Lite support - you can run \c{configure} like this: +OpenGL ES includes profiles for floating-point and fixed-point arithmetic. +The floating point profile is called OpenGL ES CM (Common) and the +fixed-point profile is called OpenGL ES CL (Common Lite). - \snippet doc/src/snippets/code/doc_src_wince-opengl.qdoc 0 +You can run \c{configure} with the \c{-opengl-es-cm} option for the Common +profile or \c{-opengl-es-cl} for the Common Lite profile. In both cases, +ensure that the \c{lib} and \c{includes} paths include the OpenGL ES +headers and libararies from your SDK. The OpenGL ES lib should be called +either \c{libGLES_CM.lib} for the Common profile or \c{libGLES_CL.lib} for +the Common Lite profile. - The distinction between the Common and Common Lite profiles is important, - because the Common Lite profile has less functionality and only supports a - fixed-point vertex format. +The distinction between the Common and Common Lite profiles is important, +because the Common Lite profile has less functionality and only supports a +fixed-point vertex format. - To start programming with Qt and OpenGL ES on Windows CE, you can start - with the \l{Hello GL ES Example}. This example shows how to use QGLWidget - and QGLPainter with OpenGL ES. It also provides some hints on how to port - OpenGL code to OpenGL ES. +To start programming with Qt and OpenGL ES on Windows CE, you can start +with the \l{Hello GL ES Example}. This example shows how to use QGLWidget +and QGLPainter with OpenGL ES. It also provides some hints on how to port +OpenGL code to OpenGL ES. - \section2 Using OpenGL to Accelerate Normal 2D Painting +\section2 Using OpenGL to Accelerate Normal 2D Painting - Qt provides QOpenGLPaintEngine, a subclass of QPaintEngine that translates - QPainter operations into OpenGL calls. This is especially convenient for - drawing text or QImage objects in an OpenGL ES context. For further - details, refer to the \l{Hello GL ES Example}. +Qt provides QOpenGLPaintEngine, a subclass of QPaintEngine that translates +QPainter operations into OpenGL calls. This is especially convenient for +drawing text or QImage objects in an OpenGL ES context. For further +details, refer to the \l{Hello GL ES Example}. */ diff --git a/doc/src/platforms/wince-openvg.qdoc b/doc/src/platforms/wince-openvg.qdoc new file mode 100644 index 0000000..047c655 --- /dev/null +++ b/doc/src/platforms/wince-openvg.qdoc @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/*! + \page windowsce-openvg.html + \title Qt for Windows CE and OpenVG + \ingroup qtce + \brief Information about support for OpenVG with Qt for Windows CE. + + \input platforms/emb-openvg.qdocinc + +\section1 Using OpenVG with Qt for Windows CE +Qt for Windows CE uses EGL 1.1 to embed OpenVG windows within the Windows +CE window manager. + +\note Make sure that your Windows CE SDK have a working EGL implementation. +If not, OpenVG will not work. + +\note There is currently no support for Blitting and Alpha blending in Qt +for Windows CE. + +\note To configure Qt for Windows Mobile 5.0 and OpenVG support you can run +\c{configure} like this: + + \snippet doc/src/snippets/code/doc_src_wince-opengl.qdoc 0 + +*/ diff --git a/examples/gestures/imagegestures/imagegestures.pro b/examples/gestures/imagegestures/imagegestures.pro index 7780ad9..8c947e4 100644 --- a/examples/gestures/imagegestures/imagegestures.pro +++ b/examples/gestures/imagegestures/imagegestures.pro @@ -5,12 +5,12 @@ SOURCES = imagewidget.cpp \ mainwidget.cpp # install -target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer +target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures sources.files = $$SOURCES \ $$HEADERS \ $$RESOURCES \ $$FORMS \ - imageviewer.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer + imagegestures.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures INSTALLS += target \ sources diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index 28de6da..f615129 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -102,17 +102,13 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *) //! [gesture event handler] bool ImageWidget::gestureEvent(QGestureEvent *event) { - if (QGesture *pan = event->gesture(Qt::PanGesture)) { - panTriggered(static_cast<QPanGesture*>(pan)); - return true; - } else if (QGesture *pinch = event->gesture(Qt::PinchGesture)) { - pinchTriggered(static_cast<QPinchGesture*>(pinch)); - return true; - } else if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) { - swipeTriggered(static_cast<QSwipeGesture*>(swipe)); - return true; - } - return false; + if (QGesture *pan = event->gesture(Qt::PanGesture)) + panTriggered(static_cast<QPanGesture *>(pan)); + if (QGesture *pinch = event->gesture(Qt::PinchGesture)) + pinchTriggered(static_cast<QPinchGesture *>(pinch)); + if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) + swipeTriggered(static_cast<QSwipeGesture *>(swipe)); + return true; } //! [gesture event handler] @@ -128,21 +124,21 @@ void ImageWidget::panTriggered(QPanGesture *gesture) setCursor(Qt::ArrowCursor); } #endif - QPointF lastOffset = gesture->offset(); - horizontalOffset += lastOffset.x(); - verticalOffset += lastOffset.y(); + QPointF delta = gesture->delta(); + horizontalOffset += delta.x(); + verticalOffset += delta.y(); update(); } void ImageWidget::pinchTriggered(QPinchGesture *gesture) { - QPinchGesture::WhatChanged whatChanged = gesture->whatChanged(); - if (whatChanged & QPinchGesture::RotationAngleChanged) { + QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags(); + if (changeFlags & QPinchGesture::RotationAngleChanged) { qreal value = gesture->property("rotationAngle").toReal(); qreal lastValue = gesture->property("lastRotationAngle").toReal(); rotationAngle += value - lastValue; } - if (whatChanged & QPinchGesture::ScaleFactorChanged) { + if (changeFlags & QPinchGesture::ScaleFactorChanged) { qreal value = gesture->property("scaleFactor").toReal(); qreal lastValue = gesture->property("lastScaleFactor").toReal(); scaleFactor += value - lastValue; diff --git a/examples/opengl/hellogl_es/hellogl_es.pro b/examples/opengl/hellogl_es/hellogl_es.pro index 3168743..80ef7df 100644 --- a/examples/opengl/hellogl_es/hellogl_es.pro +++ b/examples/opengl/hellogl_es/hellogl_es.pro @@ -20,15 +20,6 @@ HEADERS += bubble.h RESOURCES += texture.qrc QT += opengl -wince*:{ - contains(QT_CONFIG,opengles1) { - QMAKE_LIBS += "libGLES_CM.lib" - } - contains(QT_CONFIG,opengles1cl) { - QMAKE_LIBS += "libGLES_CL.lib" - } -} - # install target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl_es.pro diff --git a/examples/opengl/hellogl_es2/hellogl_es2.pro b/examples/opengl/hellogl_es2/hellogl_es2.pro index d5ad4b8..92b4224 100644 --- a/examples/opengl/hellogl_es2/hellogl_es2.pro +++ b/examples/opengl/hellogl_es2/hellogl_es2.pro @@ -25,9 +25,3 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es2 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl_es2.pro sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es2 INSTALLS += target sources - - -wince*: { - QMAKE_LIBS += "libGLESv2.lib" - -}
\ No newline at end of file diff --git a/mkspecs/common/wince/qmake.conf b/mkspecs/common/wince/qmake.conf index d87be02..ff99f1b 100644 --- a/mkspecs/common/wince/qmake.conf +++ b/mkspecs/common/wince/qmake.conf @@ -64,6 +64,7 @@ QMAKE_LIBS_NETWORK = ws2.lib QMAKE_LIBS_OPENGL = QMAKE_LIBS_COMPAT = +QMAKE_LIBS_EGL = libEGL.lib QMAKE_LIBS_OPENGL_ES1 = libGLES_CM.lib QMAKE_LIBS_OPENGL_ES1CL = libGLES_CL.lib QMAKE_LIBS_OPENGL_ES2 = libGLESv2.lib diff --git a/mkspecs/features/egl.prf b/mkspecs/features/egl.prf index 22002c3..00f70d3 100644 --- a/mkspecs/features/egl.prf +++ b/mkspecs/features/egl.prf @@ -1,3 +1,29 @@ -!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL -!isEmpty(QMAKE_LIBDIR_EGL): LIBS += -L$$QMAKE_LIBDIR_EGL -!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL +# On UNIX, we can use config tests to figure out if egl.h is in +# EGL/egl.h or GLES/egl.h. Sadly, there are no config tests on WinCE +# so we have to assume that for GLES 1.1 (CL), the EGL header is in +# GLES/egl.h. We also assume there is no separate libEGL.lib library, +# so we use the GL library instead. + +wince*:contains(QT_CONFIG, opengles1) { + INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1 + LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1 + for(p, QMAKE_LIBDIR_OPENGL_ES1) { + exists($$p):LIBS_PRIVATE += -L$$p + } + DEFINES += QT_GLES_EGL +} else:wince*:contains(QT_CONFIG, opengles1cl) { + INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES1CL + LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1CL + LIBS += $$QMAKE_LFLAGS_EGL + for(p, QMAKE_LIBDIR_OPENGL_ES1CL) { + exists($$p):LIBS_PRIVATE += -L$$p + } + DEFINES += QT_GLES_EGL +} else { + INCLUDEPATH += $$QMAKE_INCDIR_EGL + LIBS_PRIVATE += $$QMAKE_LIBS_EGL + LIBS += $$QMAKE_LFLAGS_EGL + for(p, QMAKE_LIBDIR_EGL) { + exists($$p):LIBS_PRIVATE += -L$$p + } +} diff --git a/mkspecs/features/win32/opengl.prf b/mkspecs/features/win32/opengl.prf index 30af2a3..3414781 100644 --- a/mkspecs/features/win32/opengl.prf +++ b/mkspecs/features/win32/opengl.prf @@ -1,3 +1,11 @@ -QMAKE_LIBS += $$QMAKE_LIBS_OPENGL -QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL +# WinCE does not have a platform directory for .prf files, and the +# win32 directory is searched for .prfs by qmake on WinCE. Ideally +# there should be a features/wince/opengl.prf which contains the wince +# block below. +wince* { + include(../unix/opengl.prf) +} else { + QMAKE_LIBS += $$QMAKE_LIBS_OPENGL + QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL +} diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c index 0609232..4d85c19 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c @@ -1009,7 +1009,7 @@ static HB_Bool arabicSyriacOpenTypeShape(HB_ShaperItem *item, HB_Bool *ot_ok) ++l; ++properties; } - if (f + l < item->stringLength) { + if (f + l + item->item.pos < item->stringLength) { ++l; } getArabicProperties(uc+f, l, props); diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c index c932ec2..356dc01 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c @@ -2059,15 +2059,17 @@ static void Free_BaseArray( HB_BaseArray* ba, HB_BaseRecord *br; HB_Anchor *bans; - HB_UNUSED(num_classes); - if ( ba->BaseRecord ) { br = ba->BaseRecord; if ( ba->BaseCount ) { + HB_UShort i, count; + count = num_classes * ba->BaseCount; bans = br[0].BaseAnchor; + for (i = 0; i < count; i++) + Free_Anchor (&bans[i]); FREE( bans ); } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c index 533a063..2bda386 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c @@ -56,6 +56,8 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) assert(shaper_item->item.script == HB_Script_Hebrew); + HB_HeuristicSetGlyphAttributes(shaper_item); + #ifndef NO_OPENTYPE if (HB_SelectScript(shaper_item, hebrew_features)) { @@ -64,7 +66,6 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) return FALSE; - HB_HeuristicSetGlyphAttributes(shaper_item); HB_OpenTypeShape(shaper_item, /*properties*/0); return HB_OpenTypePosition(shaper_item, availableGlyphs, /*doLogClusters*/TRUE); } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp index 7104d2a..48f4f90 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp @@ -419,7 +419,7 @@ static const unsigned char indicForms[0xe00-0x900] = { Matra, Halant, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, - Invalid, Invalid, Invalid, LengthMark, + Invalid, Invalid, Invalid, Matra, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, Invalid, @@ -1050,62 +1050,59 @@ static const IndicOrdering * const indic_order[] = { // vowel matras that have to be split into two parts. static const unsigned short split_matras[] = { - // matra, split1, split2 + // matra, split1, split2, split3 // bengalis - 0x9cb, 0x9c7, 0x9be, - 0x9cc, 0x9c7, 0x9d7, + 0x9cb, 0x9c7, 0x9be, 0x0, + 0x9cc, 0x9c7, 0x9d7, 0x0, // oriya - 0xb48, 0xb47, 0xb56, - 0xb4b, 0xb47, 0xb3e, - 0xb4c, 0xb47, 0xb57, + 0xb48, 0xb47, 0xb56, 0x0, + 0xb4b, 0xb47, 0xb3e, 0x0, + 0xb4c, 0xb47, 0xb57, 0x0, // tamil - 0xbca, 0xbc6, 0xbbe, - 0xbcb, 0xbc7, 0xbbe, - 0xbcc, 0xbc6, 0xbd7, + 0xbca, 0xbc6, 0xbbe, 0x0, + 0xbcb, 0xbc7, 0xbbe, 0x0, + 0xbcc, 0xbc6, 0xbd7, 0x0, // telugu - 0xc48, 0xc46, 0xc56, + 0xc48, 0xc46, 0xc56, 0x0, // kannada - 0xcc0, 0xcbf, 0xcd5, - 0xcc7, 0xcc6, 0xcd5, - 0xcc8, 0xcc6, 0xcd6, - 0xcca, 0xcc6, 0xcc2, - 0xccb, 0xcca, 0xcd5, + 0xcc0, 0xcbf, 0xcd5, 0x0, + 0xcc7, 0xcc6, 0xcd5, 0x0, + 0xcc8, 0xcc6, 0xcd6, 0x0, + 0xcca, 0xcc6, 0xcc2, 0x0, + 0xccb, 0xcc6, 0xcc2, 0xcd5, // malayalam - 0xd4a, 0xd46, 0xd3e, - 0xd4b, 0xd47, 0xd3e, - 0xd4c, 0xd46, 0xd57, + 0xd4a, 0xd46, 0xd3e, 0x0, + 0xd4b, 0xd47, 0xd3e, 0x0, + 0xd4c, 0xd46, 0xd57, 0x0, // sinhala - 0xdda, 0xdd9, 0xdca, - 0xddc, 0xdd9, 0xdcf, - 0xddd, 0xddc, 0xdca, - 0xdde, 0xdd9, 0xddf, + 0xdda, 0xdd9, 0xdca, 0x0, + 0xddc, 0xdd9, 0xdcf, 0x0, + 0xddd, 0xdd9, 0xdcf, 0xdca, + 0xdde, 0xdd9, 0xddf, 0x0, 0xffff }; -static inline void splitMatra(unsigned short *reordered, int matra, int &len, int &base) +static inline void splitMatra(unsigned short *reordered, int matra, int &len) { unsigned short matra_uc = reordered[matra]; //qDebug("matra=%d, reordered[matra]=%x", matra, reordered[matra]); const unsigned short *split = split_matras; while (split[0] < matra_uc) - split += 3; + split += 4; assert(*split == matra_uc); ++split; - if (indic_position(*split) == Pre) { - reordered[matra] = split[1]; - memmove(reordered + 1, reordered, len*sizeof(unsigned short)); - reordered[0] = split[0]; - base++; - } else { - memmove(reordered + matra + 1, reordered + matra, (len-matra)*sizeof(unsigned short)); - reordered[matra] = split[0]; - reordered[matra+1] = split[1]; - } - len++; + int added_chars = split[2] == 0x0 ? 1 : 2; + + memmove(reordered + matra + added_chars, reordered + matra, (len-matra)*sizeof(unsigned short)); + reordered[matra] = split[0]; + reordered[matra+1] = split[1]; + if(added_chars == 2) + reordered[matra+2] = split[2]; + len += added_chars; } #ifndef NO_OPENTYPE @@ -1130,12 +1127,23 @@ static const HB_OpenTypeFeature indic_features[] = { // #define INDIC_DEBUG #ifdef INDIC_DEBUG -#define IDEBUG qDebug +#define IDEBUG hb_debug +#include <stdarg.h> + +static void hb_debug(const char *msg, ...) +{ + va_list ap; + va_start(ap, msg); // use variable arg list + vfprintf(stderr, msg, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + #else #define IDEBUG if(0) printf #endif -#ifdef INDIC_DEBUG +#if 0 //def INDIC_DEBUG static QString propertiesToString(int properties) { QString res; @@ -1386,12 +1394,12 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // to be at the beginning of the syllable, so we just move // them there now. if (matra_position == Split) { - splitMatra(uc, matra, len, base); + splitMatra(uc, matra, len); // Handle three-part matras (0xccb in Kannada) matra_position = indic_position(uc[matra]); - if (matra_position == Split) - splitMatra(uc, matra, len, base); - } else if (matra_position == Pre) { + } + + if (matra_position == Pre) { unsigned short m = uc[matra]; while (matra--) uc[matra+1] = uc[matra]; @@ -1609,11 +1617,11 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv // halant always applies #ifdef INDIC_DEBUG - { - IDEBUG("OT properties:"); - for (int i = 0; i < len; ++i) - qDebug(" i: %s", ::propertiesToString(properties[i]).toLatin1().data()); - } +// { +// IDEBUG("OT properties:"); +// for (int i = 0; i < len; ++i) +// qDebug(" i: %s", ::propertiesToString(properties[i]).toLatin1().data()); +// } #endif // initialize @@ -1731,6 +1739,11 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int if (script == HB_Script_Bengali && pos == 1 && (uc[0] == 0x0985 || uc[0] == 0x098f)) break; + // Sinhala uses the Halant as a component of certain matras. Allow these, but keep the state on Matra. + if (script == HB_Script_Sinhala && state == Matra) { + ++pos; + continue; + } goto finish; case Nukta: if (state == Consonant) @@ -1741,12 +1754,16 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int break; // fall through case VowelMark: - if (state == Matra || state == IndependentVowel) + if (state == Matra || state == LengthMark || state == IndependentVowel) break; // fall through case Matra: if (state == Consonant || state == Nukta) break; + if (state == Matra) { + // ### needs proper testing for correct two/three part matras + break; + } // ### not sure if this is correct. If it is, does it apply only to Bengali or should // it work for all Indic languages? // the combination Independent_A + Vowel Sign AA is allowed. @@ -1762,6 +1779,10 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int goto finish; case LengthMark: + if (state == Matra) { + // ### needs proper testing for correct two/three part matras + break; + } case IndependentVowel: case Invalid: case Other: diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.c b/src/3rdparty/harfbuzz/src/harfbuzz-open.c index cde5465..0fe1e4d 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.c @@ -1114,6 +1114,8 @@ _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd ) if ( ALLOC_ARRAY( cd->cd.cd1.ClassValueArray, 1, HB_UShort ) ) return error; + cd->loaded = TRUE; + return HB_Err_Ok; } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shape.h b/src/3rdparty/harfbuzz/src/harfbuzz-shape.h index 4f714a3..e4b5f9a 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shape.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shape.h @@ -161,7 +161,7 @@ typedef enum { /* * Buffer for output */ -typedef struct _HB_GlyphBufer HB_GlyphBuffer; +typedef struct _HB_GlyphBuffer HB_GlyphBuffer; struct _HB_GlyphBuffer { int glyph_item_size; int total_glyphs; diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h index e8f5513..d2357f43 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h @@ -242,27 +242,30 @@ typedef struct HB_Font_ { void *userData; } HB_FontRec; -typedef struct { - const HB_UChar16 *string; - hb_uint32 stringLength; - HB_ScriptItem item; - HB_Font font; - HB_Face face; - int shaperFlags; /* HB_ShaperFlags */ - - HB_Bool glyphIndicesPresent; /* set to true if the glyph indicies are already setup in the glyphs array */ - hb_uint32 initialGlyphCount; - - hb_uint32 num_glyphs; /* in: available glyphs out: glyphs used/needed */ - HB_Glyph *glyphs; /* out parameter */ - HB_GlyphAttributes *attributes; /* out */ - HB_Fixed *advances; /* out */ - HB_FixedPoint *offsets; /* out */ - unsigned short *log_clusters; /* out */ +typedef struct HB_ShaperItem_ HB_ShaperItem; + +struct HB_ShaperItem_ { + const HB_UChar16 *string; /* input: the Unicode UTF16 text to be shaped */ + hb_uint32 stringLength; /* input: the length of the input in 16-bit words */ + HB_ScriptItem item; /* input: the current run to be shaped: a run of text all in the same script that is a substring of <string> */ + HB_Font font; /* input: the font: scale, units and function pointers supplying glyph indices and metrics */ + HB_Face face; /* input: the shaper state; current script, access to the OpenType tables , etc. */ + int shaperFlags; /* input (unused) should be set to 0; intended to support flags defined in HB_ShaperFlag */ + HB_Bool glyphIndicesPresent; /* input: true if the <glyphs> array contains glyph indices ready to be shaped */ + hb_uint32 initialGlyphCount; /* input: if glyphIndicesPresent is true, the number of glyph indices in the <glyphs> array */ + + hb_uint32 num_glyphs; /* input: capacity of output arrays <glyphs>, <attributes>, <advances>, <offsets>, and <log_clusters>; */ + /* output: required capacity (may be larger than actual capacity) */ + + HB_Glyph *glyphs; /* output: <num_glyphs> indices of shaped glyphs */ + HB_GlyphAttributes *attributes; /* output: <num_glyphs> glyph attributes */ + HB_Fixed *advances; /* output: <num_glyphs> advances */ + HB_FixedPoint *offsets; /* output: <num_glyphs> offsets */ + unsigned short *log_clusters; /* output: for each output glyph, the index in the input of the start of its logical cluster */ /* internal */ - HB_Bool kerning_applied; /* out: kerning applied by shaper */ -} HB_ShaperItem; + HB_Bool kerning_applied; /* output: true if kerning was applied by the shaper */ +}; HB_Bool HB_ShapeItem(HB_ShaperItem *item); diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index 1a3ef4f..a7ea417 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -178,7 +178,7 @@ private slots: void telugu(); void kannada(); void malayalam(); - // sinhala missing + void sinhala(); void khmer(); void linearB(); @@ -510,6 +510,11 @@ void tst_QScriptEngine::bengali() { 0x151, 0x276, 0x172, 0x143, 0x0 } }, { { 0x9b0, 0x9cd, 0x995, 0x9be, 0x983, 0x0 }, { 0x151, 0x276, 0x172, 0x144, 0x0 } }, + // test decomposed two parts matras + { { 0x995, 0x9c7, 0x9be, 0x0 }, + { 0x179, 0x151, 0x172, 0x0 } }, + { { 0x995, 0x9c7, 0x9d7, 0x0 }, + { 0x179, 0x151, 0x17e, 0x0 } }, { {0}, {0} } }; @@ -638,15 +643,15 @@ void tst_QScriptEngine::bengali() if (face) { const ShapeTable shape_table [] = { { { 0x09a8, 0x09cd, 0x09af, 0x0 }, - { 0x0192, 0x0 } }, + { 0x01ca, 0x0 } }, { { 0x09b8, 0x09cd, 0x09af, 0x0 }, - { 0x01d6, 0x0 } }, + { 0x020e, 0x0 } }, { { 0x09b6, 0x09cd, 0x09af, 0x0 }, - { 0x01bc, 0x0 } }, + { 0x01f4, 0x0 } }, { { 0x09b7, 0x09cd, 0x09af, 0x0 }, - { 0x01c6, 0x0 } }, + { 0x01fe, 0x0 } }, { { 0x09b0, 0x09cd, 0x09a8, 0x09cd, 0x200d, 0x0 }, - { 0xd3, 0x12f, 0x0 } }, + { 0x10b, 0x167, 0x0 } }, { {0}, {0} } }; @@ -823,8 +828,9 @@ void tst_QScriptEngine::telugu() { 0xe6, 0xb3, 0x83, 0x0 } }, { { 0xc15, 0xc4d, 0xc30, 0xc48, 0x0 }, { 0xe6, 0xb3, 0x9f, 0x0 } }, - { {0}, {0} } - + { { 0xc15, 0xc46, 0xc56, 0x0 }, + { 0xe6, 0xb3, 0x0 } }, + { {0}, {0} } }; const ShapeTable *s = shape_table; @@ -867,7 +873,6 @@ void tst_QScriptEngine::kannada() { 0x0036, 0x00c1, 0x0 } }, { { 0x0cb0, 0x0ccd, 0x200d, 0x0c95, 0x0 }, { 0x0050, 0x00a7, 0x0 } }, - { {0}, {0} } }; @@ -891,6 +896,17 @@ void tst_QScriptEngine::kannada() { 0x00b0, 0x006c, 0x0 } }, { { 0x0cb7, 0x0ccd, 0x0 }, { 0x0163, 0x0 } }, + { { 0xc95, 0xcbf, 0xcd5, 0x0 }, + { 0x114, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd6, 0x0 }, + { 0x90, 0x6c, 0x74, 0x0 } }, + { { 0xc95, 0xcc6, 0xcc2, 0x0 }, + { 0x90, 0x6c, 0x69, 0x0 } }, + { { 0xc95, 0xcca, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x69, 0x73, 0x0 } }, + { {0}, {0} } }; @@ -943,7 +959,14 @@ void tst_QScriptEngine::malayalam() { 0x009e, 0x0 } }, { { 0x0d30, 0x0d4d, 0x200d, 0x0 }, { 0x009e, 0x0 } }, - + { { 0xd15, 0xd46, 0xd3e, 0x0 }, + { 0x5e, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd47, 0xd3e, 0x0 }, + { 0x5f, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd46, 0xd57, 0x0 }, + { 0x5e, 0x34, 0x65, 0x0 } }, + { { 0xd15, 0xd57, 0x0 }, + { 0x34, 0x65, 0x0 } }, { {0}, {0} } }; @@ -962,6 +985,39 @@ void tst_QScriptEngine::malayalam() } } +void tst_QScriptEngine::sinhala() +{ + { + FT_Face face = loadFace("FM-MalithiUW46.ttf"); + if (face) { + const ShapeTable shape_table [] = { + { { 0xd9a, 0xdd9, 0xdcf, 0x0 }, + { 0x4a, 0x61, 0x42, 0x0 } }, + { { 0xd9a, 0xdd9, 0xddf, 0x0 }, + { 0x4a, 0x61, 0x50, 0x0 } }, + { { 0xd9a, 0xdd9, 0xdca, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddc, 0xdca, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { { 0xd9a, 0xdda, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddd, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { {0}, {0} } + }; + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(face, s, HB_Script_Sinhala) ); + ++s; + } + + FT_Done_Face(face); + } else { + QSKIP("couln't find FM-MalithiUW46.ttf", SkipAll); + } + } +} void tst_QScriptEngine::khmer() diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 98f007c..810781f 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,8 +4,8 @@ This is a snapshot of the Qt port of WebKit from The commit imported was from the - qtwebkit-4.6-snapshot-20091003 branch/tag + qtwebkit/qtwebkit-4.6 branch/tag and has the sha1 checksum - 8f810287200d21aded375664cc0a6ac0476dbdea + 16aab1b39e14195abdc2100265da2e45b96b739f diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 2b36014..1dfc2f9 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,111 @@ +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Unreviewed build fix for WebInspector with Qt build. + + Simply re-generate the Qt resource file by running + WebKitTools/Scripts/generate-qt-inspector-resource + + * inspector/front-end/WebKit.qrc: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Make QWebPluginDatabase private API for now. + + https://bugs.webkit.org/show_bug.cgi?id=30775 + + * WebCore.pro: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Extended the conversion of the WebCore ResourceRequest to the + QNetworkRequest with a mandatory originating object argument, + which is meant to be the QWebFrame the request belongs to. + + https://bugs.webkit.org/show_bug.cgi?id=29975 + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::QNetworkReplyHandler): + (WebCore::QNetworkReplyHandler::sendResponseIfNeeded): + (WebCore::QNetworkReplyHandler::start): + * platform/network/qt/ResourceRequest.h: + * platform/network/qt/ResourceRequestQt.cpp: + (WebCore::ResourceRequest::toNetworkRequest): + +2009-11-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Adam Barth. + + QWebView crash fix. + + The QWebView should not crash if the stop() method is called from + a function triggered by the loadProgress signal. + + A null pointer protection was added in the ProgressTracker::incrementProgress. + + New autotest was created. + + https://bugs.webkit.org/show_bug.cgi?id=29425 + + * loader/ProgressTracker.cpp: + (WebCore::ProgressTracker::incrementProgress): + +2009-11-02 Kai Koehne <kai.koehne@nokia.com> + + Reviewed by Holger Freyther. + + Remove implementation of ImageDecocerQt::clearFrameBufferCache. + The implementation was buggy, and will visually break repeating + animations anyway. + + https://bugs.webkit.org/show_bug.cgi?id=31009 + + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::clearFrameBufferCache): + +2009-11-01 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Darin Adler. + + Don't add '/' to the URL path if the it does not include '/' after the protocol component + https://bugs.webkit.org/show_bug.cgi?id=30971 + + Match IE8 behaviour, that does not add '/' if there is none after the protocol component. + + * platform/KURL.cpp: + (WebCore::KURL::parse): + +2009-10-30 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Holger Hans Peter Freyther. + + If the owner widget of the page has a palette set, we + should use that one. This was only working when the + owner was a QWebView. This patch fixes that. + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::applyTheme): + +2009-10-29 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Implement DELETE HTTP method for XmlHttpRequest + https://bugs.webkit.org/show_bug.cgi?id=30894 + + No new tests as this functionality is already tested by the + xmlhttprequest LayoutTests. As this patch depends on an unreleased + version of the dependent QtNetwork library and the tests will be + enabled later once the dependent library is released (and the + buildbot is updated). + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::QNetworkReplyHandler): + (WebCore::QNetworkReplyHandler::start): + 2009-11-02 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> Rubber-stamped by Antti Koivisto. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 1379fdd..4e84a80 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -2327,6 +2327,7 @@ HEADERS += \ xml/XSLTExtensions.h \ xml/XSLTProcessor.h \ xml/XSLTUnicodeSort.h \ + $$PWD/../WebKit/qt/Api/qwebplugindatabase_p.h \ $$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \ $$PWD/platform/network/qt/DnsPrefetchHelper.h diff --git a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp index 04124bd..83cf5d0 100755 --- a/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp +++ b/src/3rdparty/webkit/WebCore/accessibility/AccessibilityAllInOne.cpp @@ -1,44 +1,44 @@ -/*
- * Copyright (C) 2009 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build.
-
-#include <AccessibilityARIAGrid.cpp>
-#include <AccessibilityARIAGridCell.cpp>
-#include <AccessibilityARIAGridRow.cpp>
-#include <AccessibilityImageMapLink.cpp>
-#include <AccessibilityList.cpp>
-#include <AccessibilityListBox.cpp>
-#include <AccessibilityListBoxOption.cpp>
-#include <AccessibilityMediaControls.cpp>
-#include <AccessibilityObject.cpp>
-#include <AccessibilityRenderObject.cpp>
-#include <AccessibilitySlider.cpp>
-#include <AccessibilityTable.cpp>
-#include <AccessibilityTableCell.cpp>
-#include <AccessibilityTableColumn.cpp>
-#include <AccessibilityTableHeaderContainer.cpp>
-#include <AccessibilityTableRow.cpp>
-#include <AXObjectCache.cpp>
+/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build. + +#include <AccessibilityARIAGrid.cpp> +#include <AccessibilityARIAGridCell.cpp> +#include <AccessibilityARIAGridRow.cpp> +#include <AccessibilityImageMapLink.cpp> +#include <AccessibilityList.cpp> +#include <AccessibilityListBox.cpp> +#include <AccessibilityListBoxOption.cpp> +#include <AccessibilityMediaControls.cpp> +#include <AccessibilityObject.cpp> +#include <AccessibilityRenderObject.cpp> +#include <AccessibilitySlider.cpp> +#include <AccessibilityTable.cpp> +#include <AccessibilityTableCell.cpp> +#include <AccessibilityTableColumn.cpp> +#include <AccessibilityTableHeaderContainer.cpp> +#include <AccessibilityTableRow.cpp> +#include <AXObjectCache.cpp> diff --git a/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc b/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc index a1d671e..0347952 100644 --- a/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc +++ b/src/3rdparty/webkit/WebCore/inspector/front-end/WebKit.qrc @@ -28,6 +28,7 @@ <file>InjectedScript.js</file> <file>InjectedScriptAccess.js</file> <file>inspector.js</file> + <file>InspectorControllerStub.js</file> <file>KeyboardShortcut.js</file> <file>MetricsSidebarPane.js</file> <file>Object.js</file> @@ -161,6 +162,15 @@ <file>Images/statusbarResizerVertical.png</file> <file>Images/storageIcon.png</file> <file>Images/successGreenDot.png</file> + <file>Images/timelineBarBlue.png</file> + <file>Images/timelineBarGray.png</file> + <file>Images/timelineBarGreen.png</file> + <file>Images/timelineBarOrange.png</file> + <file>Images/timelineBarPurple.png</file> + <file>Images/timelineBarRed.png</file> + <file>Images/timelineBarYellow.png</file> + <file>Images/timelineCheckmarks.png</file> + <file>Images/timelineDots.png</file> <file>Images/timelineHollowPillBlue.png</file> <file>Images/timelineHollowPillGray.png</file> <file>Images/timelineHollowPillGreen.png</file> @@ -168,6 +178,7 @@ <file>Images/timelineHollowPillPurple.png</file> <file>Images/timelineHollowPillRed.png</file> <file>Images/timelineHollowPillYellow.png</file> + <file>Images/timelineIcon.png</file> <file>Images/timelinePillBlue.png</file> <file>Images/timelinePillGray.png</file> <file>Images/timelinePillGreen.png</file> diff --git a/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp b/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp index e682b9b..6b6ce1b 100644 --- a/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp +++ b/src/3rdparty/webkit/WebCore/loader/ProgressTracker.cpp @@ -176,8 +176,10 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i // FIXME: Can this ever happen? if (!item) return; + + RefPtr<Frame> frame = m_originatingProgressFrame; - m_originatingProgressFrame->loader()->client()->willChangeEstimatedProgress(); + frame->loader()->client()->willChangeEstimatedProgress(); unsigned bytesReceived = length; double increment, percentOfRemainingBytes; @@ -189,7 +191,7 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i item->estimatedLength = item->bytesReceived * 2; } - int numPendingOrLoadingRequests = m_originatingProgressFrame->loader()->numPendingOrLoadingRequests(true); + int numPendingOrLoadingRequests = frame->loader()->numPendingOrLoadingRequests(true); estimatedBytesForPendingRequests = progressItemDefaultEstimatedLength * numPendingOrLoadingRequests; remainingBytes = ((m_totalPageAndResourceBytesToLoad + estimatedBytesForPendingRequests) - m_totalBytesReceived); if (remainingBytes > 0) // Prevent divide by 0. @@ -199,8 +201,8 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i // For documents that use WebCore's layout system, treat first layout as the half-way point. // FIXME: The hasHTMLView function is a sort of roundabout way of asking "do you use WebCore's layout system". - bool useClampedMaxProgress = m_originatingProgressFrame->loader()->client()->hasHTMLView() - && !m_originatingProgressFrame->loader()->firstLayoutDone(); + bool useClampedMaxProgress = frame->loader()->client()->hasHTMLView() + && !frame->loader()->firstLayoutDone(); double maxProgressValue = useClampedMaxProgress ? 0.5 : finalProgressValue; increment = (maxProgressValue - m_progressValue) * percentOfRemainingBytes; m_progressValue += increment; @@ -221,14 +223,14 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i if (m_progressValue == 1) m_finalProgressChangedSent = true; - m_originatingProgressFrame->loader()->client()->postProgressEstimateChangedNotification(); + frame->loader()->client()->postProgressEstimateChangedNotification(); m_lastNotifiedProgressValue = m_progressValue; m_lastNotifiedProgressTime = now; } } - m_originatingProgressFrame->loader()->client()->didChangeEstimatedProgress(); + frame->loader()->client()->didChangeEstimatedProgress(); } void ProgressTracker::completeProgress(unsigned long identifier) diff --git a/src/3rdparty/webkit/WebCore/platform/KURL.cpp b/src/3rdparty/webkit/WebCore/platform/KURL.cpp index ffacc19..c5829d2 100644 --- a/src/3rdparty/webkit/WebCore/platform/KURL.cpp +++ b/src/3rdparty/webkit/WebCore/platform/KURL.cpp @@ -1269,8 +1269,8 @@ void KURL::parse(const char* url, const String* originalString) m_userStart = m_userEnd = m_passwordEnd = m_hostEnd = m_portEnd = p - buffer.data(); // For canonicalization, ensure we have a '/' for no path. - // Only do this for http and https. - if (m_protocolInHTTPFamily && pathEnd - pathStart == 0) + // Do this only for hierarchical URL with protocol http or https. + if (m_protocolInHTTPFamily && hierarchical && pathEnd == pathStart) *p++ = '/'; // add path, escaping bad characters diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index f8403b7..b6823dd 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -145,16 +145,8 @@ RGBA32Buffer* ImageDecoderQt::frameBufferAtIndex(size_t index) return &frame; } -void ImageDecoderQt::clearFrameBufferCache(size_t index) +void ImageDecoderQt::clearFrameBufferCache(size_t /*index*/) { - // Currently QImageReader will be asked to read everything. This - // might change when we read gif images on demand. For now we - // can have a rather simple implementation. - if (index > m_frameBufferCache.size()) - return; - - for (size_t i = 0; i < index; ++index) - m_frameBufferCache[index].clear(); } void ImageDecoderQt::internalDecodeSize() diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index ed5e024..bbf5525 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -140,10 +140,14 @@ QNetworkReplyHandler::QNetworkReplyHandler(ResourceHandle* handle, LoadMode load m_method = QNetworkAccessManager::PostOperation; else if (r.httpMethod() == "PUT") m_method = QNetworkAccessManager::PutOperation; +#if QT_VERSION >= 0x040600 + else if (r.httpMethod() == "DELETE") + m_method = QNetworkAccessManager::DeleteOperation; +#endif else m_method = QNetworkAccessManager::UnknownOperation; - m_request = r.toNetworkRequest(); + m_request = r.toNetworkRequest(m_resourceHandle->getInternal()->m_frame); if (m_loadMode == LoadNormal) start(); @@ -323,10 +327,7 @@ void QNetworkReplyHandler::sendResponseIfNeeded() client->willSendRequest(m_resourceHandle, newRequest, response); m_redirected = true; - m_request = newRequest.toNetworkRequest(); - - ResourceHandleInternal* d = m_resourceHandle->getInternal(); - emit d->m_frame->page()->networkRequestStarted(d->m_frame, &m_request); + m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_frame); return; } @@ -368,8 +369,6 @@ void QNetworkReplyHandler::start() QNetworkAccessManager* manager = d->m_frame->page()->networkAccessManager(); - emit d->m_frame->page()->networkRequestStarted(d->m_frame, &m_request); - const QUrl url = m_request.url(); const QString scheme = url.scheme(); // Post requests on files and data don't really make sense, but for @@ -398,6 +397,12 @@ void QNetworkReplyHandler::start() putDevice->setParent(m_reply); break; } +#if QT_VERSION >= 0x040600 + case QNetworkAccessManager::DeleteOperation: { + m_reply = manager->deleteResource(m_request); + break; + } +#endif case QNetworkAccessManager::UnknownOperation: { m_reply = 0; ResourceHandleClient* client = m_resourceHandle->client(); diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h index 93dacf3..60d32dd 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequest.h @@ -31,6 +31,7 @@ QT_BEGIN_NAMESPACE class QNetworkRequest; +class QObject; QT_END_NAMESPACE namespace WebCore { @@ -59,7 +60,7 @@ namespace WebCore { } #if QT_VERSION >= 0x040400 - QNetworkRequest toNetworkRequest() const; + QNetworkRequest toNetworkRequest(QObject* originatingObject) const; #endif private: diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp index c8f6ad5..c866a54 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/ResourceRequestQt.cpp @@ -28,10 +28,13 @@ namespace WebCore { -QNetworkRequest ResourceRequest::toNetworkRequest() const +QNetworkRequest ResourceRequest::toNetworkRequest(QObject* originatingFrame) const { QNetworkRequest request; request.setUrl(url()); +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + request.setOriginatingObject(originatingFrame); +#endif const HTTPHeaderMap &headers = httpHeaderFields(); for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp index b61d356..501a28b 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp @@ -45,6 +45,7 @@ #include "RenderBox.h" #include "RenderTheme.h" #include "UserAgentStyleSheets.h" +#include "QWebPageClient.h" #include "qwebpage.h" #include <QApplication> @@ -757,12 +758,13 @@ ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) con if (result == RadioPart || result == CheckboxPart) option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off); - // If the webview has a custom palette, use it + // If the owner widget has a custom palette, use it Page* page = o->document()->page(); if (page) { - QWidget* view = static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage->view(); - if (view) - option.palette = view->palette(); + ChromeClient* client = page->chrome()->client(); + QWebPageClient* pageClient = client->platformPageClient(); + if (pageClient) + option.palette = pageClient->palette(); } return result; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri index 5a95c67..1a42597 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri +++ b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri @@ -8,7 +8,6 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \ $$PWD/qwebdatabase.h \ $$PWD/qwebsecurityorigin.h \ $$PWD/qwebelement.h \ - $$PWD/qwebplugindatabase.h \ $$PWD/qwebpluginfactory.h \ $$PWD/qwebhistory.h \ $$PWD/qwebinspector.h \ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index 606dae4..17a0118 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -734,6 +734,11 @@ void QWebFrame::load(const QNetworkRequest &req, case QNetworkAccessManager::PostOperation: request.setHTTPMethod("POST"); break; +#if QT_VERSION >= 0x040600 + case QNetworkAccessManager::DeleteOperation: + request.setHTTPMethod("DELETE"); + break; +#endif case QNetworkAccessManager::UnknownOperation: // eh? break; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp index 4578dc9..409e1a0 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp @@ -188,9 +188,3 @@ void QWebInspectorPrivate::adjustFrontendSize(const QSize& size) frontend->resize(size); } -/*! - \fn void QWebInspector::windowTitleChanged(const QString& newTitle); - - This is emitted to signal that this widget's title changed to \a newTitle. -*/ - diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h index bb5bd64..a5c1ed5 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.h @@ -39,9 +39,6 @@ public: QSize sizeHint() const; bool event(QEvent*); -Q_SIGNALS: - void windowTitleChanged(const QString& newTitle); - protected: void resizeEvent(QResizeEvent* event); void showEvent(QShowEvent* event); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index 6f1347c..a1e131a 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -78,6 +78,7 @@ #include "Cache.h" #include "runtime/InitializeThreading.h" #include "PageGroup.h" +#include "QWebPageClient.h" #include <QApplication> #include <QBasicTimer> @@ -107,6 +108,9 @@ #else #include "qwebnetworkinterface.h" #endif +#if defined(Q_WS_X11) +#include <QX11Info> +#endif using namespace WebCore; @@ -138,6 +142,95 @@ QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page) return page->handle()->page->groupName(); } +class QWebPageWidgetClient : public QWebPageClient { +public: + QWebPageWidgetClient(QWidget* view) + : view(view) + { + Q_ASSERT(view); + } + + virtual void scroll(int dx, int dy, const QRect&); + virtual void update(const QRect& dirtyRect); + virtual void setInputMethodEnabled(bool enable); +#if QT_VERSION >= 0x040600 + virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); +#endif + +#ifndef QT_NO_CURSOR + virtual QCursor cursor() const; + virtual void updateCursor(const QCursor& cursor); +#endif + + virtual QPalette palette() const; + virtual int screenNumber() const; + virtual QWidget* ownerWidget() const; + + virtual QObject* pluginParent() const; + + QWidget* view; +}; + +void QWebPageWidgetClient::scroll(int dx, int dy, const QRect& rectToScroll) +{ + view->scroll(qreal(dx), qreal(dy), rectToScroll); +} + +void QWebPageWidgetClient::update(const QRect & dirtyRect) +{ + view->update(dirtyRect); +} + +void QWebPageWidgetClient::setInputMethodEnabled(bool enable) +{ + view->setAttribute(Qt::WA_InputMethodEnabled, enable); +} +#if QT_VERSION >= 0x040600 +void QWebPageWidgetClient::setInputMethodHint(Qt::InputMethodHint hint, bool enable) +{ + if (enable) + view->setInputMethodHints(view->inputMethodHints() | hint); + else + view->setInputMethodHints(view->inputMethodHints() & ~hint); +} +#endif +#ifndef QT_NO_CURSOR +QCursor QWebPageWidgetClient::cursor() const +{ + return view->cursor(); +} + +void QWebPageWidgetClient::updateCursor(const QCursor& cursor) +{ + view->setCursor(cursor); +} +#endif + +QPalette QWebPageWidgetClient::palette() const +{ + return view->palette(); +} + +int QWebPageWidgetClient::screenNumber() const +{ +#if defined(Q_WS_X11) + if (view) + return view->x11Info().screen(); +#endif + + return 0; +} + +QWidget* QWebPageWidgetClient::ownerWidget() const +{ + return view; +} + +QObject* QWebPageWidgetClient::pluginParent() const +{ + return view; +} + // Lookup table mapping QWebPage::WebActions to the associated Editor commands static const char* editorCommandWebActions[] = { @@ -1672,6 +1765,15 @@ void QWebPage::setView(QWidget *view) { if (this->view() != view) { d->view = view; + if (!view) { + delete d->client; + d->client = 0; + } else { + if (!d->client) + d->client = new QWebPageWidgetClient(view); + else + static_cast<QWebPageWidgetClient*>(d->client)->view = view; + } setViewportSize(view ? view->size() : QSize(0, 0)); } } @@ -3406,16 +3508,6 @@ quint64 QWebPage::bytesReceived() const */ /*! - \since 4.6 - \fn void QWebPage::networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); - \preliminary - - This signal is emitted when a \a frame of the current page requests a web resource. The application - may want to associate the \a request with the \a frame that initiated it by storing the \a frame - as an attribute of the \a request. -*/ - -/*! \fn QWebPagePrivate* QWebPage::handle() const \internal */ diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h index f2bbde0..f39209c 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h @@ -347,8 +347,6 @@ Q_SIGNALS: void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item); void restoreFrameStateRequested(QWebFrame* frame); - void networkRequestStarted(QWebFrame* frame, QNetworkRequest* request); - protected: virtual QWebPage *createWindow(WebWindowType type); virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp index 623895f..758e257 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.cpp @@ -18,7 +18,7 @@ */ #include "config.h" -#include "qwebplugindatabase.h" +#include "qwebplugindatabase_p.h" #include "PluginDatabase.h" #include "PluginPackage.h" @@ -26,6 +26,7 @@ using namespace WebCore; /*! + \internal \typedef QWebPluginInfo::MimeType \since 4.6 \brief Represents a single MIME type supported by a plugin. @@ -33,6 +34,7 @@ using namespace WebCore; /*! \class QWebPluginInfo + \internal \since 4.6 \brief The QWebPluginInfo class represents a single Netscape plugin. @@ -232,6 +234,7 @@ QWebPluginInfo &QWebPluginInfo::operator=(const QWebPluginInfo& other) /*! \class QWebPluginDatabase + \internal \since 4.6 \brief The QWebPluginDatabase class provides an interface for managing Netscape plugins used by WebKit in QWebPages. diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase_p.h index b22c3de..b22c3de 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebplugindatabase_p.h diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp index ffa21e4..3052056 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp @@ -22,7 +22,7 @@ #include "qwebpage.h" #include "qwebpage_p.h" -#include "qwebplugindatabase.h" +#include "qwebplugindatabase_p.h" #include "Cache.h" #include "CrossOriginPreflightResultCache.h" @@ -627,7 +627,7 @@ QIcon QWebSettings::iconForUrl(const QUrl& url) /*! Returns the plugin database object. -*/ + QWebPluginDatabase *QWebSettings::pluginDatabase() { static QWebPluginDatabase* database = 0; @@ -635,6 +635,7 @@ QWebPluginDatabase *QWebSettings::pluginDatabase() database = new QWebPluginDatabase(); return database; } +*/ /*! Sets \a graphic to be drawn when QtWebKit needs to draw an image of the diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h index e68ea53..c958ae7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h @@ -114,7 +114,7 @@ public: static void clearIconDatabase(); static QIcon iconForUrl(const QUrl &url); - static QWebPluginDatabase *pluginDatabase(); + //static QWebPluginDatabase *pluginDatabase(); static void setWebGraphic(WebGraphic type, const QPixmap &graphic); static QPixmap webGraphic(WebGraphic type); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index b9c2f74..55ce1f7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -32,11 +32,8 @@ #include "qprinter.h" #include "qdir.h" #include "qfile.h" -#if defined(Q_WS_X11) -#include <QX11Info> -#endif -class QWebViewPrivate : public QWebPageClient { +class QWebViewPrivate { public: QWebViewPrivate(QWebView *view) : view(view) @@ -46,24 +43,6 @@ public: Q_ASSERT(view); } - virtual void scroll(int dx, int dy, const QRect&); - virtual void update(const QRect& dirtyRect); - virtual void setInputMethodEnabled(bool enable); -#if QT_VERSION >= 0x040600 - virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable); -#endif - -#ifndef QT_NO_CURSOR - virtual QCursor cursor() const; - virtual void updateCursor(const QCursor& cursor); -#endif - - virtual QPalette palette() const; - virtual int screenNumber() const; - virtual QWidget* ownerWidget() const; - - virtual QObject* pluginParent() const; - void _q_pageDestroyed(); QWebView *view; @@ -72,66 +51,6 @@ public: QPainter::RenderHints renderHints; }; -void QWebViewPrivate::scroll(int dx, int dy, const QRect& rectToScroll) -{ - view->scroll(qreal(dx), qreal(dy), rectToScroll); -} - -void QWebViewPrivate::update(const QRect & dirtyRect) -{ - view->update(dirtyRect); -} - -void QWebViewPrivate::setInputMethodEnabled(bool enable) -{ - view->setAttribute(Qt::WA_InputMethodEnabled, enable); -} -#if QT_VERSION >= 0x040600 -void QWebViewPrivate::setInputMethodHint(Qt::InputMethodHint hint, bool enable) -{ - if (enable) - view->setInputMethodHints(view->inputMethodHints() | hint); - else - view->setInputMethodHints(view->inputMethodHints() & ~hint); -} -#endif -#ifndef QT_NO_CURSOR -QCursor QWebViewPrivate::cursor() const -{ - return view->cursor(); -} - -void QWebViewPrivate::updateCursor(const QCursor& cursor) -{ - view->setCursor(cursor); -} -#endif - -QPalette QWebViewPrivate::palette() const -{ - return view->palette(); -} - -int QWebViewPrivate::screenNumber() const -{ -#if defined(Q_WS_X11) - if (view) - return view->x11Info().screen(); -#endif - - return 0; -} - -QWidget* QWebViewPrivate::ownerWidget() const -{ - return view; -} - -QObject* QWebViewPrivate::pluginParent() const -{ - return view; -} - void QWebViewPrivate::_q_pageDestroyed() { page = 0; @@ -251,6 +170,7 @@ QWebView::~QWebView() #else d->page->d->view = 0; #endif + delete d->page->d->client; d->page->d->client = 0; } @@ -296,7 +216,6 @@ void QWebView::setPage(QWebPage* page) d->page = page; if (d->page) { d->page->setView(this); - d->page->d->client = d; // set the page client d->page->setPalette(palette()); // #### connect signals QWebFrame *mainFrame = d->page->mainFrame(); @@ -728,7 +647,7 @@ bool QWebView::event(QEvent *e) // WebCore. // FIXME: Add a QEvent::CursorUnset or similar to Qt. if (cursor().shape() == Qt::ArrowCursor) - d->resetCursor(); + d->page->d->client->resetCursor(); #endif #endif } else if (e->type() == QEvent::Leave) diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index b19a1d0..84c5d43 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,132 @@ +2009-11-04 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] REGRESSION: Allow applications to use their own QWidget bypassing QWebView. + https://bugs.webkit.org/show_bug.cgi?id=30979 + + Decouple QWebViewPrivate from QWebPageClient, and automatically create + QWebPageWidgetClient whenever the view is QWidget based. + + * Api/qwebpage.cpp: + (QWebPageWidgetClient::QWebPageWidgetClient): + (QWebPageWidgetClient::scroll): + (QWebPageWidgetClient::update): + (QWebPageWidgetClient::setInputMethodEnabled): + (QWebPageWidgetClient::setInputMethodHint): + (QWebPageWidgetClient::cursor): + (QWebPageWidgetClient::updateCursor): + (QWebPageWidgetClient::palette): + (QWebPageWidgetClient::screenNumber): + (QWebPageWidgetClient::ownerWidget): + (QWebPageWidgetClient::pluginParent): + (QWebPage::setView): + * Api/qwebview.cpp: + (QWebView::~QWebView): + (QWebView::setPage): + (QWebView::event): + +2009-11-03 Andras Becsi <becsi.andras@stud.u-szeged.hu> + + Reviewed by Simon Hausmann. + + [Qt] Fix build of unit-test after r50454. + + * tests/qwebpage/tst_qwebpage.cpp: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Make QWebPluginDatabase private API for now. + + https://bugs.webkit.org/show_bug.cgi?id=30775 + + * Api/headers.pri: + * Api/qwebplugindatabase.cpp: + * Api/qwebplugindatabase_p.h: Renamed from WebKit/qt/Api/qwebplugindatabase.h. + * Api/qwebsettings.cpp: + * Api/qwebsettings.h: + * QtLauncher/main.cpp: + (MainWindow::setupUI): + * tests/tests.pro: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Rubber-stamped by Tor Arne Vestbø. + + Oops, also remove the API docs of the removed networkRequestStarted() signal. + + * Api/qwebpage.cpp: + +2009-11-03 Simon Hausmann <hausmann@webkit.org> + + Reviewed by Tor Arne Vestbø. + + Replace the QWebPage::networkRequestStarted() signal with the originatingObject + property set to the QWebFrame that belongs to the request. + + https://bugs.webkit.org/show_bug.cgi?id=29975 + + * Api/qwebpage.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction): + (WebCore::FrameLoaderClientQt::startDownload): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::loadFinished): + (TestNetworkManager::createRequest): + (tst_QWebPage::originatingObjectInNetworkRequests): + +2009-11-02 Jedrzej Nowacki <jedrzej.nowacki@nokia.com> + + Reviewed by Adam Barth. + + QWebView crash fix. + + The QWebView should not crash if the stop() method is called from + a function triggered by the loadProgress signal. + + A null pointer protection was added in the ProgressTracker::incrementProgress. + + New autotest was created. + + https://bugs.webkit.org/show_bug.cgi?id=29425 + + * tests/qwebview/tst_qwebview.cpp: + (WebViewCrashTest::WebViewCrashTest): + (WebViewCrashTest::loading): + (tst_QWebView::crashTests): + +2009-10-30 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Remove the QWebInspector::windowTitleChanged signal, + QEvent::WindowTitleChange can be used to achieve the same. + https://bugs.webkit.org/show_bug.cgi?id=30927 + + * Api/qwebinspector.cpp: + * Api/qwebinspector.h: + * WebCoreSupport/InspectorClientQt.cpp: + (WebCore::InspectorClientQt::updateWindowTitle): + +2009-10-29 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Implement DELETE HTTP method for XmlHttpRequest + https://bugs.webkit.org/show_bug.cgi?id=30894 + + No new tests as this functionality is already tested by the + xmlhttprequest LayoutTests. As this patch depends on an unreleased + version of the dependent QtNetwork library and the tests will be + enabled later once the dependent library is released (and the + buildbot is updated). + + * Api/qwebframe.cpp: + (QWebFrame::load): + 2009-10-29 Kenneth Rohde Christiansen <kenneth@webkit.org> Reviewed by Tor Arne Vestbø. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 1ed9b21..f706d77 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -708,7 +708,7 @@ void FrameLoaderClientQt::committedLoad(WebCore::DocumentLoader* loader, const c WebCore::ResourceError FrameLoaderClientQt::cancelledError(const WebCore::ResourceRequest& request) { ResourceError error = ResourceError("QtNetwork", QNetworkReply::OperationCanceledError, request.url().prettyURL(), - QCoreApplication::translate("QWebFrame", "Request canceled", 0, QCoreApplication::UnicodeUTF8)); + QCoreApplication::translate("QWebFrame", "Request cancelled", 0, QCoreApplication::UnicodeUTF8)); error.setIsCancellation(true); return error; } @@ -746,7 +746,7 @@ WebCore::ResourceError FrameLoaderClientQt::interruptForPolicyChangeError(const WebCore::ResourceError FrameLoaderClientQt::cannotShowMIMETypeError(const WebCore::ResourceResponse& response) { return ResourceError("WebKit", WebKitErrorCannotShowMIMEType, response.url().string(), - QCoreApplication::translate("QWebFrame", "Cannot show MIME type", 0, QCoreApplication::UnicodeUTF8)); + QCoreApplication::translate("QWebFrame", "Cannot show mimetype", 0, QCoreApplication::UnicodeUTF8)); } WebCore::ResourceError FrameLoaderClientQt::fileDoesNotExistError(const WebCore::ResourceResponse& response) @@ -946,7 +946,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc #if QT_VERSION < 0x040400 QWebNetworkRequest r(request); #else - QNetworkRequest r(request.toNetworkRequest()); + QNetworkRequest r(request.toNetworkRequest(m_webFrame)); #endif QWebPage* page = m_webFrame->page(); @@ -971,7 +971,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun #if QT_VERSION < 0x040400 QWebNetworkRequest r(request); #else - QNetworkRequest r(request.toNetworkRequest()); + QNetworkRequest r(request.toNetworkRequest(m_webFrame)); #endif QWebPage*page = m_webFrame->page(); @@ -1001,7 +1001,7 @@ void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request) if (!m_webFrame) return; - emit m_webFrame->page()->downloadRequested(request.toNetworkRequest()); + emit m_webFrame->page()->downloadRequested(request.toNetworkRequest(m_webFrame)); #endif } diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp index 12f405c..7a1bfd5 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp @@ -166,7 +166,6 @@ void InspectorClientQt::updateWindowTitle() if (m_inspectedWebPage->d->inspector) { QString caption = QCoreApplication::translate("QWebPage", "Web Inspector - %2").arg(m_inspectedURL); m_inspectedWebPage->d->inspector->setWindowTitle(caption); - emit m_inspectedWebPage->d->inspector->windowTitleChanged(caption); } } diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index 408478c..09dfae5 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -31,7 +31,7 @@ the module under the appropriate version of the GNU LGPL; version 2.1 for applications and libraries licensed under the GNU GPL version 2, or version 3 for applications and libraries licensed under the GNU - GPL version 3. + GPL version 2. \legalese WebKit is licensed under the GNU Library General Public License. diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro index 0e540e5..b8734cd 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.pro @@ -5,7 +5,7 @@ SOURCES += tst_qwebframe.cpp RESOURCES += qwebframe.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -DEFINES += SRCDIR=\\\"$$PWD/resources\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/resources\\\" symbian { TARGET.UID3 = 0xA000E53D diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index 5445ce8..6f07e90 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -38,6 +38,10 @@ #endif #include "../util.h" +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + //TESTED_CLASS= //TESTED_FILES= @@ -586,6 +590,7 @@ private slots: void javaScriptWindowObjectClearedOnEvaluate(); void setHtml(); void setHtmlWithResource(); + void setHtmlWithBaseURL(); void ipv6HostEncoding(); void metaData(); void popupFocus(); @@ -2371,6 +2376,28 @@ void tst_QWebFrame::setHtmlWithResource() QCOMPARE(p.styleProperty("color", QWebElement::CascadedStyle), QLatin1String("red")); } +void tst_QWebFrame::setHtmlWithBaseURL() +{ + QString html("<html><body><p>hello world</p><img src='resources/image2.png'/></body></html>"); + + QWebPage page; + QWebFrame* frame = page.mainFrame(); + + // in few seconds, the image should be completey loaded + QSignalSpy spy(&page, SIGNAL(loadFinished(bool))); + + frame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath())); + QTest::qWait(200); + QCOMPARE(spy.count(), 1); + + QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1); + QCOMPARE(frame->evaluateJavaScript("document.images[0].width").toInt(), 128); + QCOMPARE(frame->evaluateJavaScript("document.images[0].height").toInt(), 128); + + // no history item has to be added. + QCOMPARE(m_view->page()->history()->count(), 0); +} + class TestNetworkManager : public QNetworkAccessManager { public: diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro index 6b28efd..7853b28 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro @@ -5,7 +5,7 @@ SOURCES += tst_qwebpage.cpp RESOURCES += tst_qwebpage.qrc QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR -DEFINES += SRCDIR=\\\"$$PWD/\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" symbian { TARGET.UID3 = 0xA000E53E diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 0cf85ee..3eead92 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -37,6 +37,10 @@ #include <QPushButton> #include <QDir> +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + // Will try to wait for the condition while allowing event processing #define QTRY_COMPARE(__expr, __expected) \ do { \ @@ -129,6 +133,8 @@ private slots: void screenshot_data(); void screenshot(); + void originatingObjectInNetworkRequests(); + private: QWebView* m_view; QWebPage* m_page; @@ -234,7 +240,6 @@ void tst_QWebPage::loadFinished() { qRegisterMetaType<QWebFrame*>("QWebFrame*"); qRegisterMetaType<QNetworkRequest*>("QNetworkRequest*"); - QSignalSpy spyNetworkRequestStarted(m_page, SIGNAL(networkRequestStarted(QWebFrame*, QNetworkRequest*))); QSignalSpy spyLoadStarted(m_view, SIGNAL(loadStarted())); QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); @@ -245,7 +250,6 @@ void tst_QWebPage::loadFinished() QTest::qWait(3000); - QVERIFY(spyNetworkRequestStarted.count() > 1); QVERIFY(spyLoadStarted.count() > 1); QVERIFY(spyLoadFinished.count() > 1); @@ -346,9 +350,11 @@ public: TestNetworkManager(QObject* parent) : QNetworkAccessManager(parent) {} QList<QUrl> requestedUrls; + QList<QNetworkRequest> requests; protected: virtual QNetworkReply* createRequest(Operation op, const QNetworkRequest &request, QIODevice* outgoingData) { + requests.append(request); requestedUrls.append(request.url()); return QNetworkAccessManager::createRequest(op, request, outgoingData); } @@ -1609,5 +1615,27 @@ void tst_QWebPage::screenshot() QDir::setCurrent(QApplication::applicationDirPath()); } +void tst_QWebPage::originatingObjectInNetworkRequests() +{ + TestNetworkManager* networkManager = new TestNetworkManager(m_page); + m_page->setNetworkAccessManager(networkManager); + networkManager->requests.clear(); + + m_view->setHtml(QString("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html," + "<head><meta http-equiv='refresh' content='1'></head>foo \">" + "<frame src=\"data:text/html,bar\"></frameset>"), QUrl()); + QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool)))); + + QCOMPARE(networkManager->requests.count(), 2); + + QList<QWebFrame*> childFrames = m_page->mainFrame()->childFrames(); + QCOMPARE(childFrames.count(), 2); + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + for (int i = 0; i < 2; ++i) + QVERIFY(qobject_cast<QWebFrame*>(networkManager->requests.at(i).originatingObject()) == childFrames.at(i)); +#endif +} + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html new file mode 100644 index 0000000..9ff68f1 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/frame_a.html @@ -0,0 +1,2 @@ +<a href="http://google.com" target="frame_b"><img src="" width=100 height=100 alt="Google"></a> +<a href="http://yahoo.com" target="frame_b"><img src="" width=100 height=100 alt="Yahoo"></a> diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html new file mode 100644 index 0000000..c53ad09 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/data/index.html @@ -0,0 +1,4 @@ +<frameset cols="25%,75%"> + <frame src="frame_a.html" name="frame_a"> + <frame src="frame_b.html" name="frame_b"> +</frameset> diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro index e67bb7a..735537b 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro @@ -4,6 +4,7 @@ include(../../../../WebKit.pri) SOURCES += tst_qwebview.cpp QT += testlib network QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR +RESOURCES += tst_qwebview.qrc DEFINES += SRCDIR=\\\"$$PWD/\\\" symbian { diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp index fda979e..27daf38 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -20,6 +20,7 @@ */ #include <qtest.h> +#include "../util.h" #include <qpainter.h> #include <qwebview.h> @@ -45,6 +46,8 @@ private slots: void reusePage_data(); void reusePage(); + + void crashTests(); }; // This will be called before the first test function is executed. @@ -148,6 +151,46 @@ void tst_QWebView::reusePage() QDir::setCurrent(QApplication::applicationDirPath()); } +// Class used in crashTests +class WebViewCrashTest : public QObject { + Q_OBJECT + QWebView* m_view; +public: + bool m_executed; + + + WebViewCrashTest(QWebView* view) + : m_view(view) + , m_executed(false) + { + view->connect(view, SIGNAL(loadProgress(int)), this, SLOT(loading(int))); + } + +private slots: + void loading(int progress) + { + if (progress >= 20 && progress < 90) { + QVERIFY(!m_executed); + m_view->stop(); + m_executed = true; + } + } +}; + + +// Should not crash. +void tst_QWebView::crashTests() +{ + // Test if loading can be stopped in loadProgress handler without crash. + // Test page should have frames. + QWebView view; + WebViewCrashTest tester(&view); + QUrl url("qrc:///data/index.html"); + view.load(url); + QTRY_VERIFY(tester.m_executed); // If fail it means that the test wasn't executed. +} + + QTEST_MAIN(tst_QWebView) #include "tst_qwebview.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc new file mode 100644 index 0000000..ede34a9 --- /dev/null +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.qrc @@ -0,0 +1,7 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>data/index.html</file> + <file>data/frame_a.html</file> +</qresource> +</RCC> + diff --git a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro index 81cc8f3..939cd22 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro +++ b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebplugindatabase qwebview qwebhistory +SUBDIRS = qwebframe qwebpage qwebelement qgraphicswebview qwebhistoryinterface qwebview qwebhistory greaterThan(QT_MINOR_VERSION, 4): SUBDIRS += benchmarks/painting/tst_painting.pro benchmarks/loading/tst_loading.pro diff --git a/src/corelib/arch/qatomic_symbian.h b/src/corelib/arch/qatomic_symbian.h index 5880120..3721aca 100644 --- a/src/corelib/arch/qatomic_symbian.h +++ b/src/corelib/arch/qatomic_symbian.h @@ -42,8 +42,6 @@ #ifndef QATOMIC_SYMBIAN_H #define QATOMIC_SYMBIAN_H -QT_BEGIN_HEADER - #if defined(Q_CC_RVCT) # define QT_NO_ARM_EABI # include <QtCore/qatomic_arm.h> @@ -51,6 +49,16 @@ QT_BEGIN_HEADER # include <QtCore/qatomic_generic.h> #endif +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +// Empty, but needed to avoid warnings + +QT_END_NAMESPACE + QT_END_HEADER #endif // QATOMIC_SYMBIAN_H diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index 9b3e817..77785e8 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -632,6 +632,11 @@ #define QT_NO_COLORDIALOG #endif +// QGraphicsEffect +#if !defined(QT_NO_GRAPHICSEFFECT) && (defined(QT_NO_GRAPHICSVIEW)) +#define QT_NO_GRAPHICSEFFECT +#endif + // The Model/View Framework #if !defined(QT_NO_ITEMVIEWS) && (defined(QT_NO_RUBBERBAND) || defined(QT_NO_SCROLLAREA)) #define QT_NO_ITEMVIEWS diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index ff34006..ec4945f 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -491,6 +491,13 @@ Requires: SCROLLAREA Name: QGraphicsView SeeAlso: ??? +Feature: GRAPHICSEFFECT +Description: Supports the graphicseffect classes. +Section: Widgets +Requires: GRAPHICSVIEW +Name: QGraphicsEffect +SeeAlso: ??? + Feature: SPINWIDGET Description: Supports spinbox control widgets. Section: Widgets diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 33c6a34..5578091 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -960,7 +960,7 @@ QT_BEGIN_NAMESPACE \relates <QtGlobal> Turns the major, minor and patch numbers of a version into an - integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can + integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can be compared with another similarly processed version id. \sa QT_VERSION @@ -1795,7 +1795,7 @@ QSysInfo::S60Version QSysInfo::s60Version() TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents); if (err == KErrNone) { err = contents->Sort(EDescending|ESortByName); - if (err == KErrNone) { + if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 12) { TInt major = (*contents)[0].iName[9] - '0'; TInt minor = (*contents)[0].iName[11] - '0'; if (major == 3) { @@ -1808,6 +1808,12 @@ QSysInfo::S60Version QSysInfo::s60Version() if (minor == 0) { return cachedS60Version = SV_S60_5_0; } + else if (minor == 1) { + return cachedS60Version = SV_S60_5_1; + } + else if (minor == 2) { + return cachedS60Version = SV_S60_5_2; + } } } delete contents; @@ -1822,12 +1828,10 @@ QSysInfo::S60Version QSysInfo::s60Version() return cachedS60Version = SV_S60_3_2; # elif defined(__S60_50__) return cachedS60Version = SV_S60_5_0; -# else - return cachedS60Version = SV_S60_Unknown; # endif -# else - return cachedS60Version = SV_S60_Unknown; # endif + //If reaching here, it was not possible to determine the version + return cachedS60Version = SV_S60_Unknown; } QSysInfo::SymbianVersion QSysInfo::symbianVersion() { @@ -1838,6 +1842,10 @@ QSysInfo::SymbianVersion QSysInfo::symbianVersion() return SV_9_3; case SV_S60_5_0: return SV_9_4; + case SV_S60_5_1: + return SV_9_4; + case SV_S60_5_2: + return SV_9_4; default: return SV_Unknown; } @@ -2572,7 +2580,7 @@ void qsrand() seed = GetTickCount(); srand(seed); -#else +#else // Symbian? #endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1dbdc6d..d113e02 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1486,17 +1486,26 @@ public: #ifdef Q_OS_SYMBIAN enum SymbianVersion { SV_Unknown = 0x0000, + //These are the Symbian Ltd versions 9.2-9.4 SV_9_2 = 10, SV_9_3 = 20, - SV_9_4 = 30 + SV_9_4 = 30, + //Following values are the symbian foundation versions, i.e. Symbian^1 == SV_SF_1 + SV_SF_1 = SV_9_4, + SV_SF_2 = 40, + SV_SF_3 = 50, + SV_SF_4 = 60 }; static SymbianVersion symbianVersion(); enum S60Version { SV_S60_None = 0, SV_S60_Unknown = 1, - SV_S60_3_1 = 10, - SV_S60_3_2 = 20, - SV_S60_5_0 = 30 + SV_S60_3_1 = SV_9_2, + SV_S60_3_2 = SV_9_3, + SV_S60_5_0 = SV_9_4, + //versions beyond 5.0 are to be confirmed - it is better to use symbian version + SV_S60_5_1 = SV_SF_2, + SV_S60_5_2 = SV_SF_3 }; static S60Version s60Version(); #endif diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index b198276..0ee9cd2 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1715,14 +1715,12 @@ public: LastGestureType = ~0u }; - enum GestureContext + enum GestureFlag { - WidgetGesture = 0, - WidgetWithChildrenGesture = 3, - - ItemGesture = WidgetGesture, - ItemWithChildrenGesture = WidgetWithChildrenGesture + DontStartGestureOnChildren = 0x01, + ReceivePartialGestures = 0x02 }; + Q_DECLARE_FLAGS(GestureFlags, GestureFlag) enum NavigationMode { @@ -1752,6 +1750,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MatchFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TextInteractionFlags) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::InputMethodHints) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::TouchPointStates) +Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::GestureFlags) typedef bool (*qInternalCallback)(void **); diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index c6f32d2..5ac3675 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2910,34 +2910,36 @@ \value PanGesture A Pan gesture. \value PinchGesture A Pinch gesture. \value SwipeGesture A Swipe gesture. - \value CustomGesture User-defined gesture ID. - \value LastGestureType Last user gesture ID. + \value CustomGesture A flag that can be used to test if the gesture is a + user-defined gesture ID. + \omitvalue LastGestureType User-defined gestures are registered with the - QApplication::registerGestureRecognizer() function which generates a custom gesture ID - in the range of values from CustomGesture to LastGestureType. + QGestureRecognizer::registerRecognizer() function which generates a custom + gesture ID with the Qt::CustomGesture flag set. - \sa QGesture, QWidget::grabGesture() + \sa QGesture, QWidget::grabGesture(), QGraphicsObject::grabGesture() */ /*! - \enum Qt::GestureContext + \enum Qt::GestureFlag \since 4.6 - This enum type describes the context of a gesture. + This enum type describes additional flags that can be used when subscribing + to a gesture. - For a QGesture to trigger, the gesture recognizer should filter events for - a widget tree. This enum describes for which widget the gesture recognizer - should filter events: + \value DontStartGestureOnChildren By default gestures can start on the + widget or over any of its children. Use this flag to disable this and allow + a gesture to start on the widget only. - \value WidgetGesture Gestures can only start over the widget itself. - \value WidgetWithChildrenGesture Gestures can start on the widget or over - any of its children. - \value ItemGesture Gestures can only start over the item itself. - \value ItemWithChildrenGesture Gestures can start on the item or over - any of its children. + \value ReceivePartialGestures Allows any ignored gesture events to be + propagated to parent widgets which have specified this hint. By default + only gestures that are in the Qt::GestureStarted state are propagated and + the widget always gets the full gesture sequence starting with a gesture in + the Qt::GestureStarted state and ending with a gesture in the + Qt::GestureFinished or Qt::GestureCanceled states. - \sa QWidget::grabGesture() + \sa QWidget::grabGesture(), QGraphicsObject::grabGesture() */ /*! diff --git a/src/dbus/qdbusservicewatcher.cpp b/src/dbus/qdbusservicewatcher.cpp index 4872732..115fe3e 100644 --- a/src/dbus/qdbusservicewatcher.cpp +++ b/src/dbus/qdbusservicewatcher.cpp @@ -150,14 +150,14 @@ void QDBusServiceWatcherPrivate::removeService(const QString &service) modes: \list - \o watching for service registration only - \o watching for service unregistration only - \o watching for any kind of service ownership change (the default mode) + \o Watching for service registration only. + \o Watching for service unregistration only. + \o Watching for any kind of service ownership change (the default mode). \endlist Besides being created or deleted, services may change owners without a - unregister/register operation happening. So the \ref serviceRegistered() - and \ref serviceUnregistered() signals may not be emitted if that + unregister/register operation happening. So the serviceRegistered() + and serviceUnregistered() signals may not be emitted if that happens. This class is more efficient than using the diff --git a/src/gui/accessible/qaccessible_mac.mm b/src/gui/accessible/qaccessible_mac.mm index 9575ad8..030c1a9 100644 --- a/src/gui/accessible/qaccessible_mac.mm +++ b/src/gui/accessible/qaccessible_mac.mm @@ -504,11 +504,6 @@ QAElement::QAElement(const QAElement &element) } QAElement::QAElement(HIObjectRef object, int child) - :elementRef( -#ifndef QT_MAC_USE_COCOA - AXUIElementCreateWithHIObjectAndIdentifier(object, child) -#endif -) { #ifndef QT_MAC_USE_COCOA if (object == 0) { diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index c6b4a77..6bc6b76 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -3187,7 +3187,17 @@ void QFileDialogTreeView::keyPressEvent(QKeyEvent *e) if (!d_ptr->itemViewKeyboardEvent(e)) { QTreeView::keyPressEvent(e); } +#ifdef QT_KEYPAD_NAVIGATION + else if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder + || QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) + && !hasEditFocus()) { + e->ignore(); + } else { + e->accept(); + } +#else e->accept(); +#endif } QSize QFileDialogTreeView::sizeHint() const diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index d9bec27..b0e6575 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -399,9 +399,13 @@ QT_USE_NAMESPACE - (void)panelSelectionDidChange:(id)sender { Q_UNUSED(sender); - *mCurrentSelection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename])); - if (mPriv) - mPriv->QNSOpenSavePanelDelegate_selectionChanged(*mCurrentSelection); + if (mPriv) { + QString selection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString([mSavePanel filename])); + if (selection != mCurrentSelection) { + *mCurrentSelection = selection; + mPriv->QNSOpenSavePanelDelegate_selectionChanged(selection); + } + } } - (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo @@ -826,8 +830,8 @@ void QFileDialogPrivate::qt_mac_filedialog_event_proc(const NavEventCallbackMess || mode == QFileDialog::ExistingFiles){ // When changing directory, the current selection is cleared if // we are supposed to be selecting files only: - fileDialogPrivate->mCurrentSelectionList.clear(); if (!fileDialogPrivate->mCurrentSelection.isEmpty()){ + fileDialogPrivate->mCurrentSelectionList.clear(); fileDialogPrivate->mCurrentSelection.clear(); emit fileDialogPrivate->q_func()->currentChanged(fileDialogPrivate->mCurrentSelection); } diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 83f4f79..d7e838e 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -108,6 +108,7 @@ #include <QtCore/qdebug.h> #include <private/qdrawhelper_p.h> +#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_NAMESPACE /*! @@ -1128,3 +1129,4 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour QT_END_NAMESPACE +#endif //QT_NO_GRAPHICSEFFECT diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index 7335a25..5c73f4b 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -48,6 +48,7 @@ #include <QtGui/qcolor.h> #include <QtGui/qbrush.h> +#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -302,6 +303,7 @@ private: QT_END_NAMESPACE QT_END_HEADER +#endif //QT_NO_GRAPHICSEFFECT #endif // QGRAPHICSEFFECT_H diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index 0ff5794..9a46a24 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -60,6 +60,7 @@ #include <private/qobject_p.h> #include <private/qpixmapfilter_p.h> +#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_NAMESPACE class QGraphicsEffectSourcePrivate : public QObjectPrivate @@ -179,5 +180,6 @@ public: QT_END_NAMESPACE +#endif //QT_NO_GRAPHICSEFFECT #endif // QGRAPHICSEFFECT_P_H diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri index 627d511..669d311 100644 --- a/src/gui/egl/egl.pri +++ b/src/gui/egl/egl.pri @@ -1,3 +1,5 @@ +CONFIG += egl + HEADERS += \ egl/qegl_p.h \ egl/qeglproperties_p.h @@ -19,11 +21,3 @@ unix { } } } - -for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS_PRIVATE += -L$$p -} - -!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL -!isEmpty(QMAKE_LIBS_EGL): LIBS_PRIVATE += $$QMAKE_LIBS_EGL -!isEmpty(QMAKE_LFLAGS_EGL): LIBS += $$QMAKE_LFLAGS_EGL diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index e014763..949f555 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7408,19 +7408,32 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent } /*! - Subscribes the graphics object to the given \a gesture for the specified \a context. + Subscribes the graphics object to the given \a gesture with specific \a flags. - \sa QGestureEvent + \sa ungrabGesture(), QGestureEvent */ - -void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) +void QGraphicsObject::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags) { QGraphicsItemPrivate * const d = QGraphicsItem::d_func(); - d->gestureContext.insert(gesture, context); + d->gestureContext.insert(gesture, flags); (void)QGestureManager::instance(); // create a gesture manager } /*! + Unsubscribes the graphics object from the given \a gesture. + + \sa grabGesture(), QGestureEvent +*/ +void QGraphicsObject::ungrabGesture(Qt::GestureType gesture) +{ + QGraphicsItemPrivate * const d = QGraphicsItem::d_func(); + if (d->gestureContext.remove(gesture)) { + QGestureManager *manager = QGestureManager::instance(); + manager->cleanupCachedGestures(this, gesture); + } +} + +/*! \property QGraphicsObject::parent \brief the parent of the item diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 6e1c632..221513b 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -557,7 +557,8 @@ public: using QObject::children; #endif - void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::ItemWithChildrenGesture); + void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); + void ungrabGesture(Qt::GestureType type); Q_SIGNALS: void parentChanged(); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 977fa96..e3482e4 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -456,7 +456,7 @@ public: QGraphicsItem *focusScopeItem; Qt::InputMethodHints imHints; QGraphicsItem::PanelModality panelModality; - QMap<Qt::GestureType, Qt::GestureContext> gestureContext; + QMap<Qt::GestureType, Qt::GestureFlags> gestureContext; // Packed 32 bits quint32 acceptedMouseButtons : 5; diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index 5684f0e..cb68741 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -542,6 +542,9 @@ void QGraphicsLinearLayout::invalidate() QGraphicsLayout::invalidate(); } +/*! + \internal +*/ void QGraphicsLinearLayout::dump(int indent) const { #ifdef QT_DEBUG diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 33f5f28..80cd2bc 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1117,9 +1117,8 @@ bool QGraphicsScenePrivate::filterEvent(QGraphicsItem *item, QEvent *event) bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event) { if (QGraphicsObject *object = item->toGraphicsObject()) { - QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - if (qAppPriv->gestureManager) { - if (qAppPriv->gestureManager->filterEvent(object, event)) + if (qt_gestureManager) { + if (qt_gestureManager->filterEvent(object, event)) return true; } } @@ -5822,7 +5821,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) QWidget *viewport = event->widget(); if (!viewport) return; - QList<QGesture *> allGestures = event->allGestures(); + QList<QGesture *> allGestures = event->gestures(); DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" << "Delivering gestures:" << allGestures; @@ -5961,7 +5960,12 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) QGraphicsItemPrivate *gid = item->QGraphicsItem::d_func(); foreach(QGesture *g, alreadyIgnoredGestures) { - if (gid->gestureContext.contains(g->gestureType())) + QMap<Qt::GestureType, Qt::GestureFlags>::iterator contextit = + gid->gestureContext.find(g->gestureType()); + bool deliver = contextit != gid->gestureContext.end() && + (g->state() == Qt::GestureStarted || + (contextit.value() & Qt::ReceivePartialGestures)); + if (deliver) gestures += g; } if (gestures.isEmpty()) @@ -5974,8 +5978,12 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) sendEvent(item, &ev); QSet<QGesture *> ignoredGestures; foreach (QGesture *g, gestures) { - if (!ev.isAccepted() && !ev.isAccepted(g)) + if (!ev.isAccepted() && !ev.isAccepted(g)) { ignoredGestures.insert(g); + } else { + if (g->state() == Qt::GestureStarted) + gestureTargets[g] = item; + } } if (!ignoredGestures.isEmpty()) { // get a list of items under the (current) hotspot of each ignored @@ -6002,6 +6010,13 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) continue; } } + foreach (QGesture *g, startedGestures) { + 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, event->widget()); + } + } // forget about targets for gestures that have ended foreach (QGesture *g, allGestures) { @@ -6016,6 +6031,88 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) } } +void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidget *viewport) +{ + Q_ASSERT(original); + QGraphicsItem *originalItem = gestureTargets.value(original); + Q_ASSERT(originalItem); + + // iterate over all active gestures and for each find the owner + // if the owner is part of our sub-hierarchy, cancel it. + + QSet<QGesture *> canceledGestures; + QHash<QGesture *, QGraphicsObject *>::Iterator iter = gestureTargets.begin(); + while (iter != gestureTargets.end()) { + QGraphicsObject *item = iter.value(); + // note that we don't touch the gestures for our originalItem + if (item != originalItem && originalItem->isAncestorOf(item)) { + DEBUG() << " found a gesture to cancel" << iter.key(); + iter.key()->d_func()->state = Qt::GestureCanceled; + canceledGestures << iter.key(); + } + ++iter; + } + + // sort them per target item by cherry picking from almostCanceledGestures and delivering + QSet<QGesture *> almostCanceledGestures = canceledGestures; + QSet<QGesture *>::Iterator setIter; + while (!almostCanceledGestures.isEmpty()) { + QGraphicsObject *target = 0; + QSet<QGesture*> gestures; + setIter = almostCanceledGestures.begin(); + // sort per target item + while (setIter != almostCanceledGestures.end()) { + QGraphicsObject *item = gestureTargets.value(*setIter); + if (target == 0) + target = item; + if (target == item) { + gestures << *setIter; + setIter = almostCanceledGestures.erase(setIter); + } else { + ++setIter; + } + } + Q_ASSERT(target); + + QList<QGesture *> list = gestures.toList(); + QGestureEvent ev(list); + sendEvent(target, &ev); + + foreach (QGesture *g, list) { + if (ev.isAccepted() || ev.isAccepted(g)) + gestures.remove(g); + } + + foreach (QGesture *g, gestures) { + if (!g->hasHotSpot()) + continue; + + QPoint screenPos = g->hotSpot().toPoint(); + QList<QGraphicsItem *> items = itemsAtPosition(screenPos, QPointF(), viewport); + for (int j = 0; j < items.size(); ++j) { + QGraphicsObject *item = items.at(j)->toGraphicsObject(); + if (!item) + continue; + QGraphicsItemPrivate *d = item->QGraphicsItem::d_func(); + if (d->gestureContext.contains(g->gestureType())) { + QList<QGesture *> list; + list << g; + QGestureEvent ev(list); + sendEvent(item, &ev); + if (ev.isAccepted() || ev.isAccepted(g)) + break; // successfully delivered + } + } + } + } + + Q_ASSERT(qt_gestureManager); // it would be very odd if we got called without a manager. + for (setIter = canceledGestures.begin(); setIter != canceledGestures.end(); ++setIter) { + qt_gestureManager->recycle(*setIter); + gestureTargets.remove(*setIter); + } +} + QT_END_NAMESPACE #include "moc_qgraphicsscene.cpp" diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 6d46db5..c675c56 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -295,6 +295,7 @@ public: QMap<Qt::GestureType, QGesture *> *conflictedGestures, QList<QList<QGraphicsObject *> > *conflictedItems, QHash<QGesture *, QGraphicsObject *> *normalGestures); + void cancelGesturesForChildren(QGesture *original, QWidget *viewport); void updateInputMethodSensitivityInViews(); diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index e081735..4b8d4b8 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE object. Just like the QPixmap class, QBitmap is optimized by the use of - implicit data sharing. For more information, see the {Implicit + implicit data sharing. For more information, see the \l {Implicit Data Sharing} documentation. \sa QPixmap, QImage, QImageReader, QImageWriter diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 571ef9d..21ca1e3 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4083,7 +4083,8 @@ QImage QImage::createAlphaMask(Qt::ImageConversionFlags flags) const } QImage mask(d->width, d->height, Format_MonoLSB); - dither_to_Mono(mask.d, d, flags, true); + if (!mask.isNull()) + dither_to_Mono(mask.d, d, flags, true); return mask; } diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 7f0a504..cd8a4d4 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -73,27 +73,27 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, used to lock the global bitmap heap. Only used in S60 v3.1 and S60 v3.2. */ +_LIT(KFBSERVLargeBitmapAccessName,"FbsLargeBitmapAccess"); class QSymbianFbsClient { public: - QSymbianFbsClient() : heapLock(0), heapLocked(false) + QSymbianFbsClient() : heapLocked(false) { - QT_TRAP_THROWING(heapLock = new(ELeave) CFbsBitmap); - heapLock->Create(TSize(0,0), S60->screenDevice()->DisplayMode()); + heapLock.OpenGlobal(KFBSERVLargeBitmapAccessName); } ~QSymbianFbsClient() { - delete heapLock; + heapLock.Close(); } bool lockHeap() { bool wasLocked = heapLocked; - if (heapLock && !heapLocked) { - heapLock->LockHeap(ETrue); + if (heapLock.Handle() && !heapLocked) { + heapLock.Wait(); heapLocked = true; } @@ -104,8 +104,8 @@ public: { bool wasLocked = heapLocked; - if (heapLock && heapLocked) { - heapLock->UnlockHeap(ETrue); + if (heapLock.Handle() && heapLocked) { + heapLock.Signal(); heapLocked = false; } @@ -115,7 +115,7 @@ public: private: - CFbsBitmap *heapLock; + RMutex heapLock; bool heapLocked; }; @@ -169,7 +169,7 @@ public: inline void beginDataAccess(CFbsBitmap *bitmap) { - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) + if (symbianVersion == QSysInfo::SV_9_2) heapWasLocked = qt_symbianFbsClient()->lockHeap(); else bitmap->LockHeap(ETrue); @@ -177,7 +177,7 @@ public: inline void endDataAccess(CFbsBitmap *bitmap) { - if (symbianVersion == QSysInfo::SV_9_2 || symbianVersion == QSysInfo::SV_9_3) { + if (symbianVersion == QSysInfo::SV_9_2) { if (!heapWasLocked) qt_symbianFbsClient()->unlockHeap(); } else { @@ -753,7 +753,7 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage) return QPixmap(); QScopedPointer<QS60PixmapData> data(new QS60PixmapData(QPixmapData::PixmapType)); - data->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::SgImage); + data->fromNativeType(reinterpret_cast<void*>(sgImage), QPixmapData::SgImage); QPixmap pixmap(data.take()); return pixmap; } diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 8a0120a..c735031 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -1916,8 +1916,8 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform, free(dptr); return bm; } else { // color pixmap - QPixmap pm; - QX11PixmapData *x11Data = static_cast<QX11PixmapData*>(pm.data.data()); + QX11PixmapData *x11Data = new QX11PixmapData(QPixmapData::PixmapType); + QPixmap pm(x11Data); x11Data->flags &= ~QX11PixmapData::Uninitialized; x11Data->xinfo = xinfo; x11Data->d = d; diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index e50cc8b..d83ef2c 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -53,6 +53,7 @@ #include "private/qpaintengineex_p.h" #include "private/qpaintengine_raster_p.h" +#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_NAMESPACE class QPixmapFilterPrivate : public QObjectPrivate @@ -1107,3 +1108,5 @@ void QPixmapDropShadowFilter::draw(QPainter *p, } QT_END_NAMESPACE + +#endif //QT_NO_GRAPHICSEFFECT diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h index 6a96676..2573fc7 100644 --- a/src/gui/image/qpixmapfilter_p.h +++ b/src/gui/image/qpixmapfilter_p.h @@ -57,6 +57,7 @@ #include <QtGui/qpixmap.h> #include <QtGui/qgraphicseffect.h> +#ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -191,4 +192,5 @@ QT_END_NAMESPACE QT_END_HEADER +#endif //QT_NO_GRAPHICSEFFECT #endif // QPIXMAPFILTER_H diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h index 7a0509b..ea5d259 100644 --- a/src/gui/itemviews/qabstractitemview.h +++ b/src/gui/itemviews/qabstractitemview.h @@ -363,6 +363,7 @@ private: friend class QTreeViewPrivate; // needed to compile with MSVC friend class QAccessibleItemRow; friend class QListModeViewBase; + friend class QListViewPrivate; // needed to compile for Symbian emulator }; Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractItemView::EditTriggers) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 1694434..987aa26 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -154,14 +154,6 @@ bool QApplicationPrivate::autoSipEnabled = false; bool QApplicationPrivate::autoSipEnabled = true; #endif -QGestureManager* QGestureManager::instance() -{ - QApplicationPrivate *d = qApp->d_func(); - if (!d->gestureManager) - d->gestureManager = new QGestureManager(qApp); - return d->gestureManager; -} - QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type) : QCoreApplicationPrivate(argc, argv) { @@ -185,7 +177,7 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T directPainters = 0; #endif - gestureManager = 0; + gestureWidget = 0; if (!self) self = this; @@ -3634,12 +3626,12 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } // walk through parents and check for gestures - if (d->gestureManager) { + if (qt_gestureManager) { if (receiver->isWidgetType()) { - if (d->gestureManager->filterEvent(static_cast<QWidget *>(receiver), e)) + if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e)) return true; } else if (QGesture *gesture = qobject_cast<QGesture *>(receiver)) { - if (d->gestureManager->filterEvent(gesture, e)) + if (qt_gestureManager->filterEvent(gesture, e)) return true; } } @@ -4152,7 +4144,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) if (receiver->isWidgetType()) { QWidget *w = static_cast<QWidget *>(receiver); QGestureEvent *gestureEvent = static_cast<QGestureEvent *>(e); - QList<QGesture *> allGestures = gestureEvent->allGestures(); + QList<QGesture *> allGestures = gestureEvent->gestures(); bool eventAccepted = gestureEvent->isAccepted(); bool wasAccepted = eventAccepted; @@ -4163,7 +4155,12 @@ bool QApplication::notify(QObject *receiver, QEvent *e) for (int i = 0; i < allGestures.size();) { QGesture *g = allGestures.at(i); Qt::GestureType type = g->gestureType(); - if (wd->gestureContext.contains(type)) { + 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 { @@ -5613,39 +5610,6 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints); } -/*! - \since 4.6 - - 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 gesture ID between Qt::CustomGesture and - Qt::LastGestureType, inclusive. - - \sa unregisterGestureRecognizer(), QGestureRecognizer::createGesture(), QGesture -*/ -Qt::GestureType QApplication::registerGestureRecognizer(QGestureRecognizer *recognizer) -{ - return QGestureManager::instance()->registerGestureRecognizer(recognizer); -} - -/*! - \since 4.6 - - Unregisters all gesture recognizers of the specified \a type. - - \sa registerGestureRecognizer() -*/ -void QApplication::unregisterGestureRecognizer(Qt::GestureType type) -{ - QApplicationPrivate *d = qApp->d_func(); - if (d->gestureManager) - d->gestureManager->unregisterGestureRecognizer(type); -} - QT_END_NAMESPACE #include "moc_qapplication.cpp" diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 5877ba4..e8c1281 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -86,7 +86,6 @@ class QSymbianEvent; class QApplication; class QApplicationPrivate; -class QGestureRecognizer; #if defined(qApp) #undef qApp #endif @@ -288,9 +287,6 @@ public: static Qt::NavigationMode navigationMode(); #endif - static Qt::GestureType registerGestureRecognizer(QGestureRecognizer *recognizer); - static void unregisterGestureRecognizer(Qt::GestureType type); - Q_SIGNALS: void lastWindowClosed(); void focusChanged(QWidget *old, QWidget *now); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 0fa7269..8df4d08 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -84,7 +84,6 @@ class QInputContext; class QObject; class QWidget; class QSocketNotifier; -class QGestureManager; extern bool qt_is_gui_used; #ifndef QT_NO_CLIPBOARD @@ -510,7 +509,7 @@ public: void sendSyntheticEnterLeave(QWidget *widget); #endif - QGestureManager *gestureManager; + QWidget *gestureWidget; QMap<int, QWidget *> widgetForTouchPointId; QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints; diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 30bf99a..1b0659a 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -836,7 +836,7 @@ void QSymbianControl::Draw(const TRect& controlRect) const if (qwidget->d_func()->isOpaque) gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect); - } + } } else { surface->flush(qwidget, QRegion(qt_TRect2QRect(backingStoreRect)), QPoint()); } @@ -910,9 +910,9 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) CEikStatusPane* statusPane = S60->statusPane(); CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; - if (statusPane && (statusPane->IsVisible() == isFullscreen)) + if (statusPane && (bool)statusPane->IsVisible() == isFullscreen) statusPane->MakeVisible(!isFullscreen); - if (buttonGroup && (buttonGroup->IsVisible() == isFullscreen)) + if (buttonGroup && (bool)buttonGroup->IsVisible() == isFullscreen) buttonGroup->MakeVisible(!isFullscreen); #endif } else if (QApplication::activeWindow() == qwidget->window()) { @@ -925,6 +925,12 @@ 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()); + } qwidget->d_func()->setWindowIcon_sys(true); break; case KUidValueCoeFontChangeEvent: @@ -1046,8 +1052,17 @@ void qt_init(QApplicationPrivate * /* priv */, int) // After this construction, CEikonEnv will be available from CEikonEnv::Static(). // (much like our qApp). CEikonEnv* coe = new CEikonEnv; - QT_TRAP_THROWING(coe->ConstructAppFromCommandLineL(factory,*commandLine)); + //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); @@ -1080,9 +1095,9 @@ void qt_init(QApplicationPrivate * /* priv */, int) // 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(); + 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) + //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. @@ -1560,7 +1575,7 @@ int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event) } #endif break; - default: + default: break; } diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index d98ecbb..387c29b 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -2499,24 +2499,24 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam 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; + 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; diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 95c89e5..803a1b1 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -346,5 +346,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 a06c516..3728002 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac_p.h +++ b/src/gui/kernel/qcocoawindowdelegate_mac_p.h @@ -76,6 +76,8 @@ 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; @end @protocol NSDrawerDelegate <NSObject> diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 55a329c..ad68aea 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4202,7 +4202,7 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T \brief The QGestureEvent class provides the description of triggered gestures. The QGestureEvent class contains a list of gestures, which can be obtained using the - allGestures() function. + 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 @@ -4211,10 +4211,11 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T 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 - 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. + 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() @@ -4240,7 +4241,7 @@ QGestureEvent::~QGestureEvent() /*! Returns all gestures that are delivered in the event. */ -QList<QGesture *> QGestureEvent::allGestures() const +QList<QGesture *> QGestureEvent::gestures() const { return d_func()->gestures; } @@ -4344,8 +4345,9 @@ bool QGestureEvent::isAccepted(QGesture *gesture) const 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 the \a gesture. - Unwanted gestures may be propagated to the parent widget. + 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. @@ -4417,11 +4419,16 @@ QWidget *QGestureEvent::widget() const #ifndef QT_NO_GRAPHICSVIEW /*! - Returns the scene-local coordinates if the \a gesturePoint is inside a graphics view. + 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::mapToScene(const QPointF &gesturePoint) const +QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const { QWidget *w = widget(); if (w) // we get the viewport as widget, not the graphics view diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 141ccad..b9512fa 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -827,7 +827,7 @@ public: QGestureEvent(const QList<QGesture *> &gestures); ~QGestureEvent(); - QList<QGesture *> allGestures() const; + QList<QGesture *> gestures() const; QGesture *gesture(Qt::GestureType type) const; QList<QGesture *> activeGestures() const; @@ -860,7 +860,7 @@ public: QWidget *widget() const; #ifndef QT_NO_GRAPHICSVIEW - QPointF mapToScene(const QPointF &gesturePoint) const; + QPointF mapToGraphicsScene(const QPointF &gesturePoint) const; #endif private: diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 850f22c..4edf8a9 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE Gesture objects are not constructed directly by developers. They are created by the QGestureRecognizer object that is registered with the application; see - QApplication::registerGestureRecognizer(). + QGestureRecognizer::registerRecognizer(). \section1 Gesture Properties @@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE 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::}{filterEvent()} function, updating the + object via its \l{QGestureRecognizer::}{recognize()} function, updating the properties of the gesture object as required. The gesture object may be delivered to the target object in a QGestureEvent if @@ -90,7 +90,7 @@ QT_BEGIN_NAMESPACE Constructs a new gesture object with the given \a parent. QGesture objects are created by gesture recognizers in the - QGestureRecognizer::createGesture() function. + QGestureRecognizer::create() function. */ QGesture::QGesture(QObject *parent) : QObject(*new QGesturePrivate, parent) @@ -129,7 +129,7 @@ QGesture::~QGesture() \brief The point that is used to find the receiver for the gesture event. The hot-spot is a point in the global coordinate system, use - QWidget::mapFromGlobal() or QGestureEvent::mapToScene() to get a + QWidget::mapFromGlobal() or QGestureEvent::mapToGraphicsScene() to get a local hot-spot. The hot-spot should be set by the gesture recognizer to allow gesture event @@ -174,14 +174,26 @@ void QGesture::unsetHotSpot() } /*! + \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. +*/ + +/*! \enum QGesture::GestureCancelPolicy This enum describes how accepting a gesture can cancel other gestures automatically. \value CancelNone On accepting this gesture no other gestures will be affected. - \value CancelAllInContext On accepting this gesture all gestures that are active - in the context (Qt::GestureContext) will be cancelled. + + \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. */ void QGesture::setGestureCancelPolicy(GestureCancelPolicy policy) @@ -217,16 +229,6 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const */ /*! - \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. -*/ - -/*! \property QPanGesture::lastOffset \brief the last offset recorded for this gesture @@ -241,11 +243,19 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const /*! \property QPanGesture::offset - \brief the offset from the previous input position to the current input + \brief the total offset from the first input position to the current input position - The offset measures the change in position of the user's input on the - input device. + The offset measures the total change in position of the user's input + covered by the gesture on the input device. +*/ + +/*! + \property QPanGesture::delta + \brief the offset from the previous input position to the current input + + This is essentially the same as the difference between offset() and + lastOffset(). */ /*! @@ -261,10 +271,6 @@ QPanGesture::QPanGesture(QObject *parent) d_func()->gestureType = Qt::PanGesture; } -QPointF QPanGesture::totalOffset() const -{ - return d_func()->totalOffset; -} QPointF QPanGesture::lastOffset() const { @@ -276,15 +282,15 @@ QPointF QPanGesture::offset() const return d_func()->offset; } -qreal QPanGesture::acceleration() const +QPointF QPanGesture::delta() const { - return d_func()->acceleration; + Q_D(const QPanGesture); + return d->offset - d->lastOffset; } - -void QPanGesture::setTotalOffset(const QPointF &value) +qreal QPanGesture::acceleration() const { - d_func()->totalOffset = value; + return d_func()->acceleration; } void QPanGesture::setLastOffset(const QPointF &value) @@ -326,7 +332,7 @@ void QPanGesture::setAcceleration(qreal value) */ /*! - \enum QPinchGesture::WhatChange + \enum QPinchGesture::ChangeFlag This enum describes the changes that can occur to the properties of the gesture object. @@ -335,19 +341,30 @@ void QPanGesture::setAcceleration(qreal value) \value RotationAngleChanged The rotation angle held by rotationAngle changed. \value CenterPointChanged The center point held by centerPoint changed. - \sa whatChanged + \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::whatChanged - \brief the property of the gesture that has changed + \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 scaleFactor, rotationAngle, centerPoint + \sa totalChangeFlags, scaleFactor, rotationAngle, centerPoint */ /*! @@ -441,16 +458,25 @@ QPinchGesture::QPinchGesture(QObject *parent) d_func()->gestureType = Qt::PinchGesture; } -QPinchGesture::WhatChanged QPinchGesture::whatChanged() const +QPinchGesture::ChangeFlags QPinchGesture::totalChangeFlags() const { - return d_func()->whatChanged; + return d_func()->totalChangeFlags; } -void QPinchGesture::setWhatChanged(QPinchGesture::WhatChanged value) +void QPinchGesture::setTotalChangeFlags(QPinchGesture::ChangeFlags value) { - d_func()->whatChanged = 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 { diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 524d26e..dd322ad 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -97,6 +97,7 @@ private: friend class QGestureEvent; friend class QGestureRecognizer; friend class QGestureManager; + friend class QGraphicsScenePrivate; }; class QPanGesturePrivate; @@ -105,20 +106,19 @@ class Q_GUI_EXPORT QPanGesture : public QGesture Q_OBJECT Q_DECLARE_PRIVATE(QPanGesture) - Q_PROPERTY(QPointF totalOffset READ totalOffset WRITE setTotalOffset) 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 totalOffset() const; QPointF lastOffset() const; QPointF offset() const; + QPointF delta() const; qreal acceleration() const; - void setTotalOffset(const QPointF &value); void setLastOffset(const QPointF &value); void setOffset(const QPointF &value); void setAcceleration(qreal value); @@ -134,14 +134,15 @@ class Q_GUI_EXPORT QPinchGesture : public QGesture Q_DECLARE_PRIVATE(QPinchGesture) public: - enum WhatChange { + enum ChangeFlag { ScaleFactorChanged = 0x1, RotationAngleChanged = 0x2, CenterPointChanged = 0x4 }; - Q_DECLARE_FLAGS(WhatChanged, WhatChange) + Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag) - Q_PROPERTY(WhatChanged whatChanged READ whatChanged WRITE setWhatChanged) + 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) @@ -158,8 +159,11 @@ public: public: QPinchGesture(QObject *parent = 0); - WhatChanged whatChanged() const; - void setWhatChanged(WhatChanged value); + ChangeFlags totalChangeFlags() const; + void setTotalChangeFlags(ChangeFlags value); + + ChangeFlags changeFlags() const; + void setChangeFlags(ChangeFlags value); QPointF startCenterPoint() const; QPointF lastCenterPoint() const; @@ -187,7 +191,7 @@ public: QT_END_NAMESPACE -Q_DECLARE_METATYPE(QPinchGesture::WhatChanged) +Q_DECLARE_METATYPE(QPinchGesture::ChangeFlags) QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 34fbb26..ae2e287 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -90,10 +90,9 @@ public: { } - QPointF totalOffset; QPointF lastOffset; QPointF offset; - QPoint lastPosition; + QPoint startPosition; qreal acceleration; }; @@ -103,12 +102,15 @@ class QPinchGesturePrivate : public QGesturePrivate public: QPinchGesturePrivate() - : whatChanged(0), totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0), - totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0) + : totalChangeFlags(0), changeFlags(0), + totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0), + totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0), + isNewSequence(true) { } - QPinchGesture::WhatChanged whatChanged; + QPinchGesture::ChangeFlags totalChangeFlags; + QPinchGesture::ChangeFlags changeFlags; QPointF startCenterPoint; QPointF lastCenterPoint; @@ -121,6 +123,9 @@ public: qreal totalRotationAngle; qreal lastRotationAngle; qreal rotationAngle; + + bool isNewSequence; + QPointF startPosition[2]; }; class QSwipeGesturePrivate : public QGesturePrivate diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 0a88a24..628892d 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -52,6 +52,9 @@ #ifdef Q_WS_MAC #include "qmacgesturerecognizer_mac_p.h" #endif +#if defined(Q_OS_WIN) +#include "qwinnativepangesturerecognizer_win_p.h" +#endif #include "qdebug.h" @@ -64,6 +67,15 @@ 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) { @@ -77,6 +89,10 @@ QGestureManager::QGestureManager(QObject *parent) #endif #else registerGestureRecognizer(new QPanGestureRecognizer); + registerGestureRecognizer(new QPinchGestureRecognizer); +#if defined(Q_OS_WIN) + registerGestureRecognizer(new QWinNativePanGestureRecognizer); +#endif #endif } @@ -92,7 +108,7 @@ QGestureManager::~QGestureManager() Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *recognizer) { - QGesture *dummy = recognizer->createGesture(0); + QGesture *dummy = recognizer->create(0); if (!dummy) { qWarning("QGestureManager::registerGestureRecognizer: " "the recognizer fails to create a gesture object, skipping registration."); @@ -172,7 +188,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni } Q_ASSERT(recognizer); - QGesture *state = recognizer->createGesture(object); + QGesture *state = recognizer->create(object); if (!state) return 0; state->setParent(this); @@ -219,18 +235,19 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *, QGesture *state = getState(target, recognizer, gestureType); if (!state) continue; - QGestureRecognizer::Result result = recognizer->filterEvent(state, target, event); + QGestureRecognizer::Result result = recognizer->recognize(state, target, event); QGestureRecognizer::Result type = result & QGestureRecognizer::ResultState_Mask; - if (type == QGestureRecognizer::GestureTriggered) { + result &= QGestureRecognizer::ResultHint_Mask; + if (type == QGestureRecognizer::TriggerGesture) { DEBUG() << "QGestureManager:Recognizer: gesture triggered: " << state; triggeredGestures << state; - } else if (type == QGestureRecognizer::GestureFinished) { + } else if (type == QGestureRecognizer::FinishGesture) { DEBUG() << "QGestureManager:Recognizer: gesture finished: " << state; finishedGestures << state; - } else if (type == QGestureRecognizer::MaybeGesture) { + } else if (type == QGestureRecognizer::MayBeGesture) { DEBUG() << "QGestureManager:Recognizer: maybe gesture: " << state; newMaybeGestures << state; - } else if (type == QGestureRecognizer::NotGesture) { + } else if (type == QGestureRecognizer::CancelGesture) { DEBUG() << "QGestureManager:Recognizer: not gesture: " << state; notGestures << state; } else if (type == QGestureRecognizer::Ignore) { @@ -346,12 +363,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *, QSet<QGesture *> endedGestures = finishedGestures + canceledGestures + undeliveredGestures; foreach (QGesture *gesture, endedGestures) { - if (QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0)) { - gesture->setGestureCancelPolicy(QGesture::CancelNone); - recognizer->reset(gesture); - } else { - cleanupGesturesForRemovedRecognizer(gesture); - } + recycle(gesture); m_gestureTargets.remove(gesture); } return ret; @@ -409,15 +421,8 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original) deliverEvents(gestures, &undeliveredGestures); } - for (iter = cancelledGestures.begin(); iter != cancelledGestures.end(); ++iter) { - QGestureRecognizer *recognizer = m_gestureToRecognizer.value(*iter, 0); - if (recognizer) { - (*iter)->setGestureCancelPolicy(QGesture::CancelNone); - recognizer->reset(*iter); - } else { - cleanupGesturesForRemovedRecognizer(*iter); - } - } + for (iter = cancelledGestures.begin(); iter != cancelledGestures.end(); ++iter) + recycle(*iter); } void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture) @@ -439,7 +444,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) QSet<Qt::GestureType> types; QMultiHash<QObject *, Qt::GestureType> contexts; QWidget *w = receiver; - typedef QMap<Qt::GestureType, Qt::GestureContext>::const_iterator ContextIterator; + 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) { @@ -453,7 +458,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) { for (ContextIterator it = w->d_func()->gestureContext.begin(), e = w->d_func()->gestureContext.end(); it != e; ++it) { - if (it.value() == Qt::WidgetWithChildrenGesture) { + if (!(it.value() & Qt::DontStartGestureOnChildren)) { if (!types.contains(it.key())) { types.insert(it.key()); contexts.insertMulti(w, it.key()); @@ -474,7 +479,7 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) QMultiHash<QObject *, Qt::GestureType> contexts; QGraphicsObject *item = receiver; if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) { - typedef QMap<Qt::GestureType, Qt::GestureContext>::const_iterator ContextIterator; + 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()); @@ -485,10 +490,10 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) item = item->parentObject(); while (item) { - typedef QMap<Qt::GestureType, Qt::GestureContext>::const_iterator ContextIterator; + 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::ItemWithChildrenGesture) { + if (!(it.value() & Qt::DontStartGestureOnChildren)) { if (!types.contains(it.key())) { types.insert(it.key()); contexts.insertMulti(item, it.key()); @@ -528,12 +533,12 @@ void QGestureManager::getGestureTargets(const QSet<QGesture*> &gestures, foreach (QWidget *widget, gestures.keys()) { QWidget *w = widget->parentWidget(); while (w) { - QMap<Qt::GestureType, Qt::GestureContext>::const_iterator it + 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::GestureContext context = it.value(); - if (context == Qt::WidgetWithChildrenGesture && w != widget) { + Qt::GestureFlags flags = it.value(); + if (!(it.value() & Qt::DontStartGestureOnChildren) && w != widget) { // conflicting gesture! (*conflicts)[widget].append(gestures[widget]); break; @@ -627,7 +632,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, QApplication::sendEvent(receiver, &event); bool eventAccepted = event.isAccepted(); - foreach(QGesture *gesture, event.allGestures()) { + foreach(QGesture *gesture, event.gestures()) { if (eventAccepted || event.isAccepted(gesture)) { QWidget *w = event.d_func()->targetWidgets.value(gesture->gestureType(), 0); Q_ASSERT(w); @@ -652,6 +657,16 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures, << "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; + } + } } } } @@ -669,19 +684,24 @@ void QGestureManager::timerEvent(QTimerEvent *event) it = m_maybeGestures.erase(it); DEBUG() << "QGestureManager::timerEvent: gesture stopped due to timeout:" << gesture; - QGestureRecognizer *recognizer = m_gestureToRecognizer.value(gesture, 0); - if (recognizer) { - gesture->setGestureCancelPolicy(QGesture::CancelNone); - recognizer->reset(gesture); - } else { - cleanupGesturesForRemovedRecognizer(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 index 1e0734b..4efa10b 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -78,11 +78,12 @@ public: bool filterEvent(QGraphicsObject *receiver, QEvent *event); #endif //QT_NO_GRAPHICSVIEW - // declared in qapplication.cpp 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, @@ -141,6 +142,8 @@ private: 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 index 2673be3..ed0bdcc 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -42,6 +42,7 @@ #include "qgesturerecognizer.h" #include "private/qgesture_p.h" +#include "private/qgesturemanager_p.h" QT_BEGIN_NAMESPACE @@ -65,12 +66,12 @@ QT_BEGIN_NAMESPACE objects, and modifying the associated QGesture objects to include relevant information about the user's input. - Gestures are created when the framework calls createGesture() to handle user 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 filterEvent() handler function. + 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. @@ -79,20 +80,22 @@ QT_BEGIN_NAMESPACE 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 QApplication::registerGestureRecognizer(). You can also + 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 filterEvent() 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 filterEvent() function must return a value of Qt::GestureState 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. + 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 createGesture() function to construct instances of your gesture class. + 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. @@ -105,37 +108,37 @@ QT_BEGIN_NAMESPACE 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, NotGesture, - MaybeGesture, GestureTriggered, GestureFinished) and an optional hint + 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 NotGesture 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 MaybeGesture The event changed the internal 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 + filter more events to decide. Gesture recognizers in the MayBeGesture state may be reset automatically if they take too long to recognize gestures. - \value GestureTriggered The gesture has been triggered and the appropriate + \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 GestureFinished The gesture has been finished successfully and the + \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 ConsumeEventHint This hint specifies that the gesture framework should - consume the filtered event and not deliver it to the receiver. + \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::filterEvent() + \sa QGestureRecognizer::recognize() */ /*! @@ -159,7 +162,7 @@ QGestureRecognizer::~QGestureRecognizer() Reimplement this function to create a custom QGesture-derived gesture object if necessary. */ -QGesture *QGestureRecognizer::createGesture(QObject *target) +QGesture *QGestureRecognizer::create(QObject *target) { Q_UNUSED(target); return new QGesture; @@ -183,7 +186,7 @@ void QGestureRecognizer::reset(QGesture *gesture) } /*! - \fn QGestureRecognizer::filterEvent(QGesture *gesture, QObject *watched, QEvent *event) + \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. @@ -194,7 +197,34 @@ void QGestureRecognizer::reset(QGesture *gesture) 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 Qt::GestureState + \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 index a3c990d..4eebf7c 100644 --- a/src/gui/kernel/qgesturerecognizer.h +++ b/src/gui/kernel/qgesturerecognizer.h @@ -43,6 +43,7 @@ #define QGESTURERECOGNIZER_H #include <QtCore/qglobal.h> +#include <QtCore/qnamespace.h> QT_BEGIN_HEADER @@ -58,30 +59,34 @@ class Q_GUI_EXPORT QGestureRecognizer public: enum ResultFlag { - Ignore = 0x0001, - NotGesture = 0x0002, - MaybeGesture = 0x0004, - GestureTriggered = 0x0008, // Gesture started or updated - GestureFinished = 0x0010, + Ignore = 0x0001, - ResultState_Mask = 0x00ff, + MayBeGesture = 0x0002, + TriggerGesture = 0x0004, + FinishGesture = 0x0008, + CancelGesture = 0x0010, + + ResultState_Mask = 0x00ff, ConsumeEventHint = 0x0100, // StoreEventHint = 0x0200, // ReplayStoredEventsHint = 0x0400, // DiscardStoredEventsHint = 0x0800, - ResultHint_Mask = 0xff00 + ResultHint_Mask = 0xff00 }; Q_DECLARE_FLAGS(Result, ResultFlag) QGestureRecognizer(); virtual ~QGestureRecognizer(); - virtual QGesture *createGesture(QObject *target); - virtual QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event) = 0; - + 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) diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm index 7019580..d842322 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac.mm +++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm @@ -53,13 +53,13 @@ QMacSwipeGestureRecognizer::QMacSwipeGestureRecognizer() { } -QGesture *QMacSwipeGestureRecognizer::createGesture(QObject * /*target*/) +QGesture *QMacSwipeGestureRecognizer::create(QObject * /*target*/) { return new QSwipeGesture; } QGestureRecognizer::Result -QMacSwipeGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent *event) +QMacSwipeGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event) { if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) { QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event); @@ -67,7 +67,7 @@ QMacSwipeGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent case QNativeGestureEvent::Swipe: { QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture); g->setSwipeAngle(ev->angle); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; break; } default: break; @@ -90,13 +90,13 @@ QMacPinchGestureRecognizer::QMacPinchGestureRecognizer() { } -QGesture *QMacPinchGestureRecognizer::createGesture(QObject * /*target*/) +QGesture *QMacPinchGestureRecognizer::create(QObject * /*target*/) { return new QPinchGesture; } QGestureRecognizer::Result -QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent *event) +QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event) { if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) { QPinchGesture *g = static_cast<QPinchGesture *>(gesture); @@ -106,26 +106,26 @@ QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent reset(gesture); g->setStartCenterPoint(static_cast<QWidget*>(obj)->mapFromGlobal(ev->position)); g->setCenterPoint(g->startCenterPoint()); - g->setWhatChanged(QPinchGesture::CenterPointChanged); - return QGestureRecognizer::MaybeGesture | QGestureRecognizer::ConsumeEventHint; + 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->setWhatChanged(QPinchGesture::RotationAngleChanged); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; - break; + 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() + ev->percentage); - g->setWhatChanged(QPinchGesture::ScaleFactorChanged); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; - break; + g->setChangeFlags(QPinchGesture::ScaleFactorChanged); + g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags()); + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; case QNativeGestureEvent::GestureEnd: - return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; - break; + return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint; default: break; } @@ -137,7 +137,8 @@ QMacPinchGestureRecognizer::filterEvent(QGesture *gesture, QObject *obj, QEvent void QMacPinchGestureRecognizer::reset(QGesture *gesture) { QPinchGesture *g = static_cast<QPinchGesture *>(gesture); - g->setWhatChanged(0); + g->setChangeFlags(0); + g->setTotalChangeFlags(0); g->setScaleFactor(1.0f); g->setTotalScaleFactor(1.0f); g->setLastScaleFactor(1.0f); @@ -158,7 +159,7 @@ QMacPanGestureRecognizer::QMacPanGestureRecognizer() : _panCanceled(true) { } -QGesture *QMacPanGestureRecognizer::createGesture(QObject *target) +QGesture *QMacPanGestureRecognizer::create(QObject *target) { if (!target) return new QPanGesture; @@ -172,7 +173,7 @@ QGesture *QMacPanGestureRecognizer::createGesture(QObject *target) } QGestureRecognizer::Result -QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent *event) +QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *event) { const int panBeginDelay = 300; const int panBeginRadius = 3; @@ -185,10 +186,9 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent if (ev->touchPoints().size() == 1) { reset(gesture); _startPos = QCursor::pos(); - _lastPos = _startPos; _panTimer.start(panBeginDelay, target); _panCanceled = false; - return QGestureRecognizer::MaybeGesture; + return QGestureRecognizer::MayBeGesture; } break;} case QEvent::TouchEnd: { @@ -197,7 +197,7 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent const QTouchEvent *ev = static_cast<const QTouchEvent*>(event); if (ev->touchPoints().size() == 1) - return QGestureRecognizer::GestureFinished; + return QGestureRecognizer::FinishGesture; break;} case QEvent::TouchUpdate: { if (_panCanceled) @@ -212,23 +212,21 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent if ((p - _startPos).manhattanLength() > panBeginRadius) { _panCanceled = true; _panTimer.stop(); - return QGestureRecognizer::NotGesture; + return QGestureRecognizer::CancelGesture; } } else { const QPointF p = QCursor::pos(); - const QPointF posOffset = p - _lastPos; + const QPointF posOffset = p - _startPos; g->setLastOffset(g->offset()); g->setOffset(QPointF(posOffset.x(), posOffset.y())); - g->setTotalOffset(g->lastOffset() + g->offset()); - _lastPos = p; - return QGestureRecognizer::GestureTriggered; + 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::NotGesture; + return QGestureRecognizer::CancelGesture; } break;} case QEvent::Timer: { @@ -239,8 +237,7 @@ QMacPanGestureRecognizer::filterEvent(QGesture *gesture, QObject *target, QEvent break; // Begin new pan session! _startPos = QCursor::pos(); - _lastPos = _startPos; - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } break; } default: @@ -254,11 +251,9 @@ void QMacPanGestureRecognizer::reset(QGesture *gesture) { QPanGesture *g = static_cast<QPanGesture *>(gesture); _startPos = QPointF(); - _lastPos = QPointF(); _panCanceled = true; g->setOffset(QPointF(0, 0)); g->setLastOffset(QPointF(0, 0)); - g->setTotalOffset(QPointF(0, 0)); g->setAcceleration(qreal(1)); QGestureRecognizer::reset(gesture); } diff --git a/src/gui/kernel/qmacgesturerecognizer_mac_p.h b/src/gui/kernel/qmacgesturerecognizer_mac_p.h index bdc2e08..2dac56a 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac_p.h +++ b/src/gui/kernel/qmacgesturerecognizer_mac_p.h @@ -64,8 +64,8 @@ class QMacSwipeGestureRecognizer : public QGestureRecognizer public: QMacSwipeGestureRecognizer(); - QGesture *createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event); void reset(QGesture *gesture); }; @@ -74,8 +74,8 @@ class QMacPinchGestureRecognizer : public QGestureRecognizer public: QMacPinchGestureRecognizer(); - QGesture *createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event); void reset(QGesture *gesture); }; @@ -86,12 +86,11 @@ class QMacPanGestureRecognizer : public QObject, public QGestureRecognizer public: QMacPanGestureRecognizer(); - QGesture *createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event); void reset(QGesture *gesture); private: QPointF _startPos; - QPointF _lastPos; QBasicTimer _panTimer; bool _panCanceled; }; diff --git a/src/gui/kernel/qsound_s60.cpp b/src/gui/kernel/qsound_s60.cpp index 352580e..e4b7cec 100644 --- a/src/gui/kernel/qsound_s60.cpp +++ b/src/gui/kernel/qsound_s60.cpp @@ -60,13 +60,13 @@ class QAuServerS60; class QAuBucketS60 : public QAuBucket, public MMdaAudioPlayerCallback { public: - QAuBucketS60( QAuServerS60 *server, QSound *sound); + QAuBucketS60(QAuServerS60 *server, QSound *sound); ~QAuBucketS60(); void play(); void stop(); - inline QSound* sound() const { return m_sound; } + inline QSound *sound() const { return m_sound; } public: // from MMdaAudioPlayerCallback void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); @@ -77,88 +77,106 @@ private: QAuServerS60 *m_server; bool m_prepared; bool m_playCalled; - CMdaAudioPlayerUtility* m_playUtility; + CMdaAudioPlayerUtility *m_playUtility; }; class QAuServerS60 : public QAuServer { public: - QAuServerS60( QObject* parent ); + QAuServerS60(QObject *parent); - void init( QSound* s ) + void init(QSound *s) { - QAuBucketS60 *bucket = new QAuBucketS60( this, s ); - setBucket( s, bucket ); + QAuBucketS60 *bucket = new QAuBucketS60(this, s); + setBucket(s, bucket); } - void play( QSound* s ) + void play(QSound *s) { - bucket( s )->play(); + bucket(s)->play(); } - void stop( QSound* s ) + void stop(QSound *s) { - bucket( s )->stop(); + bucket(s)->stop(); } bool okay() { return true; } + void play(const QString& filename); + protected: - void 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 { - // We don't have a way to inform about errors -> just decrement loops - // in order that QSound::isFinished will return true; - while(decLoop(sound)) {} - } - } + void playCompleted(QAuBucketS60 *bucket, int error); protected: - QAuBucketS60* bucket( QSound *s ) + QAuBucketS60 *bucket(QSound *s) { - return (QAuBucketS60*)QAuServer::bucket( 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) : +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() +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) +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(); + 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){ + if (err) { m_server->playCompleted(this, err); } } void QAuBucketS60::play() { - if(m_prepared) { + if (m_prepared) { // OpenFileL call is completed we can start playing immediately m_playUtility->Play(); } else { @@ -180,11 +198,11 @@ void QAuBucketS60::MapcPlayComplete(TInt aError) void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/) { - if(aError) { + if (aError) { m_server->playCompleted(this, aError); } else { m_prepared = true; - if(m_playCalled){ + if (m_playCalled){ play(); } } @@ -192,7 +210,7 @@ void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds QAuBucketS60::~QAuBucketS60() { - if(m_playUtility){ + if (m_playUtility){ m_playUtility->Stop(); m_playUtility->Close(); } diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index dec2311..dfd49eb 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -44,6 +44,7 @@ #include "qgesture_p.h" #include "qevent.h" #include "qwidget.h" +#include "qabstractscrollarea.h" QT_BEGIN_NAMESPACE @@ -51,29 +52,34 @@ QPanGestureRecognizer::QPanGestureRecognizer() { } -QGesture *QPanGestureRecognizer::createGesture(QObject *target) +QGesture *QPanGestureRecognizer::create(QObject *target) { if (target && target->isWidgetType()) { +#if defined(Q_OS_WIN) + // 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; } -QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { - QPanGesture *q = static_cast<QPanGesture*>(state); + QPanGesture *q = static_cast<QPanGesture *>(state); QPanGesturePrivate *d = q->d_func(); - const QTouchEvent *ev = static_cast<const QTouchEvent*>(event); + const QTouchEvent *ev = static_cast<const QTouchEvent *>(event); QGestureRecognizer::Result result; switch (event->type()) { case QEvent::TouchBegin: { - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; QTouchEvent::TouchPoint p = ev->touchPoints().at(0); - d->lastPosition = p.pos().toPoint(); - d->lastOffset = d->totalOffset = d->offset = QPointF(); + d->lastOffset = d->offset = QPointF(); break; } case QEvent::TouchEnd: { @@ -83,13 +89,12 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); d->lastOffset = d->offset; d->offset = - QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(), - p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2; - d->totalOffset += 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::GestureFinished; + result = QGestureRecognizer::FinishGesture; } else { - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; } break; } @@ -99,14 +104,13 @@ QGestureRecognizer::Result QPanGestureRecognizer::filterEvent(QGesture *state, Q QTouchEvent::TouchPoint p2 = ev->touchPoints().at(1); d->lastOffset = d->offset; d->offset = - QPointF(p1.pos().x() - p1.lastPos().x() + p2.pos().x() - p2.lastPos().x(), - p1.pos().y() - p1.lastPos().y() + p2.pos().y() - p2.lastPos().y()) / 2; - d->totalOffset += d->offset; - if (d->totalOffset.x() > 10 || d->totalOffset.y() > 10 || - d->totalOffset.x() < -10 || d->totalOffset.y() < -10) { - result = QGestureRecognizer::GestureTriggered; + 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; + result = QGestureRecognizer::MayBeGesture; } } break; @@ -128,108 +132,128 @@ void QPanGestureRecognizer::reset(QGesture *state) QPanGesture *pan = static_cast<QPanGesture*>(state); QPanGesturePrivate *d = pan->d_func(); - d->totalOffset = d->lastOffset = d->offset = QPointF(); - d->lastPosition = QPoint(); + d->lastOffset = d->offset = QPointF(); d->acceleration = 0; -//#if defined(QT_MAC_USE_COCOA) -// d->singleTouchPanTimer.stop(); -// d->prevMousePos = QPointF(0, 0); -//#endif - QGestureRecognizer::reset(state); } -/* -bool QPanGestureRecognizer::event(QEvent *event) + +// +// QPinchGestureRecognizer +// + +QPinchGestureRecognizer::QPinchGestureRecognizer() { -#if defined(QT_MAC_USE_COCOA) - Q_D(QPanGesture); - if (event->type() == QEvent::Timer) { - const QTimerEvent *te = static_cast<QTimerEvent *>(event); - if (te->timerId() == d->singleTouchPanTimer.timerId()) { - d->singleTouchPanTimer.stop(); - updateState(Qt::GestureStarted); - } +} + +QGesture *QPinchGestureRecognizer::create(QObject *target) +{ + if (target && target->isWidgetType()) { + static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents); } -#endif + return new QPinchGesture; +} - bool consume = false; +QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) +{ + QPinchGesture *q = static_cast<QPinchGesture *>(state); + QPinchGesturePrivate *d = q->d_func(); + + const QTouchEvent *ev = static_cast<const QTouchEvent *>(event); -#if defined(Q_WS_WIN) -#elif defined(QT_MAC_USE_COCOA) - // The following implements single touch - // panning on Mac: - const int panBeginDelay = 300; - const int panBeginRadius = 3; - const QTouchEvent *ev = static_cast<const QTouchEvent*>(event); + QGestureRecognizer::Result result; switch (event->type()) { case QEvent::TouchBegin: { - if (ev->touchPoints().size() == 1) { - d->delayManager->setEnabled(true); - consume = d->delayManager->append(d->gestureTarget, *event); - d->lastPosition = QCursor::pos(); - d->singleTouchPanTimer.start(panBeginDelay, this); - } - break;} + result = QGestureRecognizer::MayBeGesture; + break; + } case QEvent::TouchEnd: { - d->delayManager->setEnabled(false); - if (state() != Qt::NoGesture) { - updateState(Qt::GestureFinished); - consume = true; - d->delayManager->clear(); + if (q->state() != Qt::NoGesture) { + result = QGestureRecognizer::FinishGesture; } else { - d->delayManager->replay(); + result = QGestureRecognizer::CancelGesture; } - reset(); - break;} + break; + } case QEvent::TouchUpdate: { - consume = d->delayManager->append(d->gestureTarget, *event); - if (ev->touchPoints().size() == 1) { - if (state() == Qt::NoGesture) { - // INVARIANT: The singleTouchTimer has still not fired. - // Lets check if the user moved his finger so much from - // the starting point that it makes sense to cancel: - const QPointF startPos = ev->touchPoints().at(0).startPos().toPoint(); - const QPointF p = ev->touchPoints().at(0).pos().toPoint(); - if ((startPos - p).manhattanLength() > panBeginRadius) { - d->delayManager->replay(); - consume = false; - reset(); - } else { - d->lastPosition = QCursor::pos(); - } + 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.pos(), p2.pos()).length() + / QLineF(d->startPosition[0], d->startPosition[1]).length(); + if (d->isNewSequence) { + d->lastScaleFactor = scaleFactor; } else { - d->delayManager->clear(); - QPointF mousePos = QCursor::pos(); - QPointF dist = mousePos - d->lastPosition; - d->lastPosition = mousePos; - d->lastOffset = d->offset; - d->offset = QSizeF(dist.x(), dist.y()); - d->totalOffset += d->offset; - updateState(Qt::GestureUpdated); + d->lastScaleFactor = d->scaleFactor; } - } else if (state() == Qt::NoGesture) { - d->delayManager->replay(); - consume = false; - reset(); + d->scaleFactor = scaleFactor; + d->totalScaleFactor += d->scaleFactor - d->lastScaleFactor; + d->changeFlags |= QPinchGesture::ScaleFactorChanged; + + const qreal rotationAngle = -line.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->isNewSequence = true; + result = QGestureRecognizer::MayBeGesture; } - break;} + break; + } case QEvent::MouseButtonPress: case QEvent::MouseMove: case QEvent::MouseButtonRelease: - if (d->delayManager->isEnabled()) - consume = d->delayManager->append(d->gestureTarget, *event); + result = QGestureRecognizer::Ignore; break; default: - return false; + result = QGestureRecognizer::Ignore; + break; } -#else - Q_UNUSED(event); -#endif - return QGestureRecognizer::Ignore; + return result; +} + +void QPinchGestureRecognizer::reset(QGesture *state) +{ + QPinchGesture *pinch = static_cast<QPinchGesture *>(state); + QPinchGesturePrivate *d = pinch->d_func(); + + d->totalChangeFlags = d->changeFlags = 0; + + d->startCenterPoint = d->lastCenterPoint = d->centerPoint = QPointF(); + d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 0; + d->totalRotationAngle = d->lastRotationAngle = d->rotationAngle = 0; + + d->isNewSequence = true; + + QGestureRecognizer::reset(state); } - */ QT_END_NAMESPACE diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h index fec5c2f..e6f346c 100644 --- a/src/gui/kernel/qstandardgestures_p.h +++ b/src/gui/kernel/qstandardgestures_p.h @@ -63,9 +63,19 @@ class QPanGestureRecognizer : public QGestureRecognizer public: QPanGestureRecognizer(); - QGesture *createGesture(QObject *target); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); + void reset(QGesture *state); +}; + +class QPinchGestureRecognizer : public QGestureRecognizer +{ +public: + QPinchGestureRecognizer(); + + QGesture *create(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 9165515..386bf71 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -197,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) @@ -229,7 +230,9 @@ QWidgetPrivate::~QWidgetPrivate() if (extra) deleteExtra(); +#ifndef QT_NO_GRAPHICSEFFECT delete graphicsEffect; +#endif //QT_NO_GRAPHICSEFFECT } QWindowSurface *QWidgetPrivate::createDefaultWindowSurface() @@ -1792,6 +1795,7 @@ QRegion QWidgetPrivate::clipRegion() const return r; } +#ifndef QT_NO_GRAPHICSEFFECT void QWidgetPrivate::invalidateGraphicsEffectsRecursively() { Q_Q(QWidget); @@ -1806,6 +1810,7 @@ void QWidgetPrivate::invalidateGraphicsEffectsRecursively() w = w->parentWidget(); } while (w); } +#endif //QT_NO_GRAPHICSEFFECT void QWidgetPrivate::setDirtyOpaqueRegion() { @@ -1813,7 +1818,9 @@ void QWidgetPrivate::setDirtyOpaqueRegion() dirtyOpaqueChildren = true; +#ifndef QT_NO_GRAPHICSEFFECT invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT if (q->isWindow()) return; @@ -1962,10 +1969,12 @@ void QWidgetPrivate::clipToEffectiveMask(QRegion ®ion) 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(); @@ -2000,11 +2009,13 @@ 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 @@ -5012,11 +5023,13 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, \sa setGraphicsEffect() */ +#ifndef QT_NO_GRAPHICSEFFECT QGraphicsEffect *QWidget::graphicsEffect() const { Q_D(const QWidget); return d->graphicsEffect; } +#endif //QT_NO_GRAPHICSEFFECT /*! @@ -5035,6 +5048,7 @@ QGraphicsEffect *QWidget::graphicsEffect() const \sa graphicsEffect() */ +#ifndef QT_NO_GRAPHICSEFFECT void QWidget::setGraphicsEffect(QGraphicsEffect *effect) { Q_D(QWidget); @@ -5064,6 +5078,7 @@ void QWidget::setGraphicsEffect(QGraphicsEffect *effect) d->updateIsOpaque(); update(); } +#endif //QT_NO_GRAPHICSEFFECT bool QWidgetPrivate::isAboutToShow() const { @@ -5210,6 +5225,7 @@ 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 *> @@ -5240,6 +5256,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP return; } } +#endif //QT_NO_GRAFFICSEFFECT const bool asRoot = flags & DrawAsRoot; const bool alsoOnScreen = flags & DrawPaintOnScreen; @@ -5394,7 +5411,6 @@ 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 && !wd->graphicsEffect; - if (index > 0) { QRegion wr(rgn); if (wd->isOpaque) @@ -5420,6 +5436,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis } } +#ifndef QT_NO_GRAPHICSEFFECT QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const { if (system != Qt::DeviceCoordinates) @@ -5520,6 +5537,7 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint * m_widget->render(&pixmap, pixmapOffset); return pixmap; } +#endif //QT_NO_GRAPHICSEFFECT #ifndef QT_NO_GRAPHICSVIEW /*! @@ -11736,22 +11754,22 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const */ /*! - Subscribes the widget to a given \a gesture with a \a context. + Subscribes the widget to a given \a gesture with specific \a flags. - \sa QGestureEvent + \sa ungrabGesture(), QGestureEvent \since 4.6 */ -void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) +void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags) { Q_D(QWidget); - d->gestureContext.insert(gesture, context); + d->gestureContext.insert(gesture, flags); (void)QGestureManager::instance(); // create a gesture manager } /*! - Unsubscribes the widget to a given \a gesture type + Unsubscribes the widget from a given \a gesture type - \sa QGestureEvent + \sa grabGesture(), QGestureEvent \since 4.6 */ void QWidget::ungrabGesture(Qt::GestureType gesture) diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index fce3f09..b7c55f9 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -351,10 +351,12 @@ 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::GestureContext context = Qt::WidgetWithChildrenGesture); + void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); void ungrabGesture(Qt::GestureType type); public Q_SLOTS: diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 58252ca..278bd80 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3017,10 +3017,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]; } @@ -3780,7 +3787,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) { @@ -3797,8 +3804,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) || diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 73a7d68..151b90a 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -384,7 +384,9 @@ public: void setOpaque(bool opaque); void updateIsTranslucent(); bool paintOnScreen() const; +#ifndef QT_NO_GRAPHICSEFFECT void invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT const QRegion &getOpaqueChildren() const; void setDirtyOpaqueRegion(); @@ -530,8 +532,10 @@ public: 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; } @@ -630,7 +634,7 @@ public: #ifndef QT_NO_ACTION QList<QAction*> actions; #endif - QMap<Qt::GestureType, Qt::GestureContext> gestureContext; + QMap<Qt::GestureType, Qt::GestureFlags> gestureContext; // Bit fields. uint high_attributes[3]; // the low ones are in QWidget::widget_attributes @@ -774,6 +778,7 @@ struct QWidgetPaintContext QPainter *painter; }; +#ifndef QT_NO_GRAPHICSEFFECT class QWidgetEffectSourcePrivate : public QGraphicsEffectSourcePrivate { public: @@ -826,6 +831,7 @@ public: QTransform lastEffectTransform; bool updateDueToGraphicsEffect; }; +#endif //QT_NO_GRAPHICSEFFECT inline QWExtra *QWidgetPrivate::extraData() const { diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 5bf7649..22a94b9 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -2036,7 +2036,7 @@ void QWidgetPrivate::winSetupGestures() if (!q || !q->isVisible()) return; QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); - WId winid = q->effectiveWinId(); + WId winid = q->internalWinId(); bool needh = false; bool needv = false; @@ -2052,6 +2052,8 @@ void QWidgetPrivate::winSetupGestures() needv = (vbarpolicy == Qt::ScrollBarAlwaysOn || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled; + if (!winid) + winid = q->winId(); // enforces the native winid on the viewport } if (winid && qAppPriv->SetGestureConfig) { GESTURECONFIG gc[1]; @@ -2071,17 +2073,6 @@ 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; - qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0])); } } diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp index 12d3058..5fceb13 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp @@ -56,16 +56,16 @@ QWinNativePanGestureRecognizer::QWinNativePanGestureRecognizer() { } -QGesture* QWinNativePanGestureRecognizer::createGesture(QObject *target) const +QGesture *QWinNativePanGestureRecognizer::create(QObject *target) { if (!target) return new QPanGesture; // a special case - if (qobject_cast<QGraphicsObject*>(target)) - return 0; if (!target->isWidgetType()) return 0; + if (qobject_cast<QGraphicsObject *>(target)) + return 0; - QWidget *q = static_cast<QWidget*>(target); + QWidget *q = static_cast<QWidget *>(target); QWidgetPrivate *d = q->d_func(); d->nativeGesturePanEnabled = true; d->winSetupGestures(); @@ -73,7 +73,9 @@ QGesture* QWinNativePanGestureRecognizer::createGesture(QObject *target) const return new QPanGesture; } -QGestureRecognizer::Result QWinNativePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result QWinNativePanGestureRecognizer::recognize(QGesture *state, + QObject *, + QEvent *event) { QPanGesture *q = static_cast<QPanGesture*>(state); QPanGesturePrivate *d = q->d_func(); @@ -85,26 +87,25 @@ QGestureRecognizer::Result QWinNativePanGestureRecognizer::filterEvent(QGesture case QNativeGestureEvent::GestureBegin: break; case QNativeGestureEvent::Pan: - result = QGestureRecognizer::GestureTriggered; + result = QGestureRecognizer::TriggerGesture; event->accept(); break; case QNativeGestureEvent::GestureEnd: if (q->state() == Qt::NoGesture) return QGestureRecognizer::Ignore; // some other gesture has ended - result = QGestureRecognizer::GestureFinished; + result = QGestureRecognizer::FinishGesture; break; default: return QGestureRecognizer::Ignore; } if (q->state() == Qt::NoGesture) { - d->lastOffset = d->totalOffset = d->offset = QPointF(); + d->lastOffset = d->offset = QPointF(); + d->startPosition = ev->position; } else { d->lastOffset = d->offset; - d->offset = QPointF(ev->position.x() - d->lastPosition.x(), - ev->position.y() - d->lastPosition.y()); - d->totalOffset += d->offset; + d->offset = QPointF(ev->position.x() - d->startPosition.x(), + ev->position.y() - d->startPosition.y()); } - d->lastPosition = ev->position; } return result; } @@ -114,8 +115,8 @@ void QWinNativePanGestureRecognizer::reset(QGesture *state) QPanGesture *pan = static_cast<QPanGesture*>(state); QPanGesturePrivate *d = pan->d_func(); - d->totalOffset = d->lastOffset = d->offset = QPointF(); - d->lastPosition = QPoint(); + d->lastOffset = d->offset = QPointF(); + d->startPosition = QPoint(); d->acceleration = 0; QGestureRecognizer::reset(state); diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h index a1e8511..8fb0d50 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h @@ -62,9 +62,8 @@ class QWinNativePanGestureRecognizer : public QGestureRecognizer public: QWinNativePanGestureRecognizer(); - QGesture* createGesture(QObject *target) const; - - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index f36470a..8226797 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -529,7 +529,9 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up Q_ASSERT(widget->window() == tlw); Q_ASSERT(!rgn.isEmpty()); +#ifndef QT_NO_GRAPHICSEFFECT widget->d_func()->invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT if (widget->d_func()->paintOnScreen()) { if (widget->d_func()->dirty.isEmpty()) { @@ -559,9 +561,11 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up if (invalidateBuffer) { const bool eventAlreadyPosted = !dirty.isEmpty(); +#ifndef QT_NO_GRAPHICSEFFECT if (widget->d_func()->graphicsEffect) dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset); else +#endif //QT_NO_GRAPHICSEFFECT dirty += rgn.translated(offset); if (!eventAlreadyPosted || updateImmediately) sendUpdateRequest(tlw, updateImmediately); @@ -576,9 +580,11 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up if (widget->d_func()->inDirtyList) { if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) { +#ifndef QT_NO_GRAPHICSEFFECT if (widget->d_func()->graphicsEffect) widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()); else +#endif //QT_NO_GRAPHICSEFFECT widget->d_func()->dirty += rgn; } } else { @@ -606,7 +612,9 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool upd Q_ASSERT(widget->window() == tlw); Q_ASSERT(!rect.isEmpty()); +#ifndef QT_NO_GRAPHICSEFFECT widget->d_func()->invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT if (widget->d_func()->paintOnScreen()) { if (widget->d_func()->dirty.isEmpty()) { diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h index 3288dae..fbef980 100644 --- a/src/gui/painting/qbackingstore_p.h +++ b/src/gui/painting/qbackingstore_p.h @@ -146,9 +146,11 @@ private: { if (widget && !widget->d_func()->inDirtyList && !widget->data->in_destructor) { QWidgetPrivate *widgetPrivate = widget->d_func(); +#ifndef QT_NO_GRAPHICSEFFECT if (widgetPrivate->graphicsEffect) widgetPrivate->dirty = widgetPrivate->effectiveRectFor(rgn.boundingRect()); else +#endif //QT_NO_GRAPHICSEFFECT widgetPrivate->dirty = rgn; dirtyWidgets.append(widget); widgetPrivate->inDirtyList = true; diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 4c4c994..3b439a8 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -161,6 +161,8 @@ void QS60MainAppUi::HandleResourceChangeL(TInt type) } /*! + * \fn void QS60MainAppUi::HandleWsEventL(const TWsEvent &event, CCoeControl *destination) + * * \brief Handles raw window server events. * * The event type and information is passed in \a wsEvent, while the receiving control is passed in diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index fea74fe..5884b68 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -1,3 +1,14 @@ +# This block serves the minimalistic resource file for S60 3.1 platforms. +# Note there is no way to ifdef S60 version in mmp file, that is why the resource +# file is always compiled for WINSCW +minimalAppResource31 = \ + "SOURCEPATH s60framework" \ + "START RESOURCE s60main.rss" \ + "HEADER" \ + "TARGETPATH resource\apps" \ + "END" +MMP_RULES += minimalAppResource31 + SOURCES += s60framework/qs60mainapplication.cpp \ s60framework/qs60mainappui.cpp \ s60framework/qs60maindocument.cpp diff --git a/src/s60main/s60main.rss b/src/gui/s60framework/s60main.rss index 07dc6a1..07dc6a1 100644 --- a/src/s60main/s60main.rss +++ b/src/gui/s60framework/s60main.rss diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index bf2f68e..4c9541b 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5656,102 +5656,103 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons default: break; } - + } // if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) if (!icon.isNull()) return icon; #if defined(Q_WS_MAC) - OSType iconType = 0; - switch (standardIcon) { - case QStyle::SP_MessageBoxQuestion: - case QStyle::SP_MessageBoxInformation: - case QStyle::SP_MessageBoxWarning: - case QStyle::SP_MessageBoxCritical: - iconType = kGenericApplicationIcon; - break; - case SP_DesktopIcon: - iconType = kDesktopIcon; - break; - case SP_TrashIcon: - iconType = kTrashIcon; - break; - case SP_ComputerIcon: - iconType = kComputerIcon; - break; - case SP_DriveFDIcon: - iconType = kGenericFloppyIcon; - break; - case SP_DriveHDIcon: - iconType = kGenericHardDiskIcon; - break; - case SP_DriveCDIcon: - case SP_DriveDVDIcon: - iconType = kGenericCDROMIcon; - break; - case SP_DriveNetIcon: - iconType = kGenericNetworkIcon; - break; - case SP_DirOpenIcon: - iconType = kOpenFolderIcon; - break; - case SP_DirClosedIcon: - case SP_DirLinkIcon: - iconType = kGenericFolderIcon; - break; - case SP_FileLinkIcon: - case SP_FileIcon: - iconType = kGenericDocumentIcon; - break; - case SP_DirIcon: { - // A rather special case - QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, option, widget); - QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, option, widget); - closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On); - closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On); - closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On); - closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On); - return closeIcon; - } - case SP_TitleBarNormalButton: - case SP_TitleBarCloseButton: { - QIcon titleBarIcon; - if (standardIcon == SP_TitleBarCloseButton) { - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png")); - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); - } else { - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png")); - titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); + if (QApplication::desktopSettingsAware()) { + OSType iconType = 0; + switch (standardIcon) { + case QStyle::SP_MessageBoxQuestion: + case QStyle::SP_MessageBoxInformation: + case QStyle::SP_MessageBoxWarning: + case QStyle::SP_MessageBoxCritical: + iconType = kGenericApplicationIcon; + break; + case SP_DesktopIcon: + iconType = kDesktopIcon; + break; + case SP_TrashIcon: + iconType = kTrashIcon; + break; + case SP_ComputerIcon: + iconType = kComputerIcon; + break; + case SP_DriveFDIcon: + iconType = kGenericFloppyIcon; + break; + case SP_DriveHDIcon: + iconType = kGenericHardDiskIcon; + break; + case SP_DriveCDIcon: + case SP_DriveDVDIcon: + iconType = kGenericCDROMIcon; + break; + case SP_DriveNetIcon: + iconType = kGenericNetworkIcon; + break; + case SP_DirOpenIcon: + iconType = kOpenFolderIcon; + break; + case SP_DirClosedIcon: + case SP_DirLinkIcon: + iconType = kGenericFolderIcon; + break; + case SP_FileLinkIcon: + case SP_FileIcon: + iconType = kGenericDocumentIcon; + break; + case SP_DirIcon: { + // A rather special case + QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, option, widget); + QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, option, widget); + closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On); + closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On); + closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On); + closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On); + return closeIcon; + } + case SP_TitleBarNormalButton: + case SP_TitleBarCloseButton: { + QIcon titleBarIcon; + if (standardIcon == SP_TitleBarCloseButton) { + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png")); + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); + } else { + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png")); + titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); + } + return titleBarIcon; } - return titleBarIcon; - } - default: - break; - } - if (iconType != 0) { - QIcon retIcon; - IconRef icon; - IconRef overlayIcon = 0; - if (iconType != kGenericApplicationIcon) { - GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon); - } else { - FSRef fsRef; - ProcessSerialNumber psn = { 0, kCurrentProcess }; - GetProcessBundleLocation(&psn, &fsRef); - GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0); - if (standardIcon == SP_MessageBoxCritical) { - overlayIcon = icon; - GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon); - } - } - if (icon) { - qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon); - ReleaseIconRef(icon); - } - if (overlayIcon) - ReleaseIconRef(overlayIcon); - return retIcon; - } + default: + break; + } + if (iconType != 0) { + QIcon retIcon; + IconRef icon; + IconRef overlayIcon = 0; + if (iconType != kGenericApplicationIcon) { + GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon); + } else { + FSRef fsRef; + ProcessSerialNumber psn = { 0, kCurrentProcess }; + GetProcessBundleLocation(&psn, &fsRef); + GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0); + if (standardIcon == SP_MessageBoxCritical) { + overlayIcon = icon; + GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon); + } + } + if (icon) { + qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon); + ReleaseIconRef(icon); + } + if (overlayIcon) + ReleaseIconRef(overlayIcon); + return retIcon; + } + } // if (QApplication::desktopSettingsAware()) #endif // Q_WS_MAC - } switch (standardIcon) { #ifndef QT_NO_IMAGEFORMAT_PNG diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b87f3a8..350a8e6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -499,7 +499,7 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const Q_UNUSED(app) QPalette applicationPalette = QApplication::palette(); applicationPalette.setBrush(QPalette::Window, backgroundTexture()); - QApplication::setPalette(applicationPalette); + setThemePalette(app); } void QS60StylePrivate::deleteBackground() @@ -743,7 +743,7 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const const QColor mainAreaTextColor = s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0); - widgetPalette.setColor(QPalette::All, QPalette::WindowText, + widgetPalette.setColor(QPalette::WindowText, s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0)); QApplication::setPalette(widgetPalette, "QSlider"); // return to original palette after each widget @@ -767,34 +767,34 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const QApplication::setPalette(widgetPalette, "QHeaderView"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::ButtonText, + widgetPalette.setColor(QPalette::ButtonText, s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0)); QApplication::setPalette(widgetPalette, "QMenuBar"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::Active, QPalette::WindowText, + widgetPalette.setColor(QPalette::WindowText, s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); QApplication::setPalette(widgetPalette, "QTabBar"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::Text, + widgetPalette.setColor(QPalette::Text, s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); QApplication::setPalette(widgetPalette, "QTableView"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + widgetPalette.setColor(QPalette::HighlightedText, s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QLineEdit"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::Text, + widgetPalette.setColor(QPalette::Text, s60Color(QS60StyleEnums::CL_QsnTextColors, 34, 0)); - widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + widgetPalette.setColor(QPalette::HighlightedText, s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QTextEdit"); widgetPalette = *palette; - widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, + widgetPalette.setColor(QPalette::HighlightedText, s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QComboBox"); widgetPalette = *palette; @@ -994,6 +994,10 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { const State bflags = toolBtn->state; const QRect button(subControlRect(control, toolBtn, SC_ToolButton, widget)); + QRect menuRect = QRect(); + if (toolBtn->subControls & SC_ToolButtonMenu) + menuRect = subControlRect(control, toolBtn, SC_ToolButtonMenu, widget); + QStyleOptionToolButton toolButton = *toolBtn; if (sub&SC_ToolButton) { @@ -1006,7 +1010,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom toolBar = qobject_cast<QToolBar *>(widget->parentWidget()); if (bflags & (State_Sunken | State_On | State_Raised)) { - tool.rect = button; + tool.rect = button.unite(menuRect); tool.state = bflags; // todo: I'd like to move extension button next to where last button is @@ -1061,6 +1065,12 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } else { drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); } + + if (toolButton.subControls & SC_ToolButtonMenu) { + tool.rect = menuRect; + tool.state = bflags; + drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget); + } } } @@ -1752,7 +1762,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, #endif //QT_NO_MENUBAR case CE_HeaderSection: - if ( const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { + if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { painter->save(); QPen linePen = QPen(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 1, header)); const int penWidth = (header->orientation == Qt::Horizontal) ? @@ -1770,6 +1780,25 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } } painter->restore(); + + //Draw corner button as normal pushButton. + if (qobject_cast<const QAbstractButton *>(widget)) { + //Make cornerButton slightly smaller so that it is not on top of table border graphic. + QStyleOptionHeader subopt = *header; + const int borderTweak = + QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth)>>1; + if (subopt.direction == Qt::LeftToRight) + subopt.rect.adjust(borderTweak, borderTweak, 0, -borderTweak); + else + subopt.rect.adjust(0, borderTweak, -borderTweak, -borderTweak); + drawPrimitive(PE_PanelButtonBevel, &subopt, painter, widget); + } else if ((header->palette.brush(QPalette::Button) != Qt::transparent)) { + //Draw non-themed background. Background for theme is drawn in CE_ShapedFrame + //to get continuous theme graphic across all the header cells. + qDrawShadePanel(painter, header->rect, header->palette, + header->state & (State_Sunken | State_On), penWidth, + &header->palette.brush(QPalette::Button)); + } } break; case CE_HeaderEmptyArea: // no need to draw this @@ -1840,15 +1869,24 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } else if (qobject_cast<const QTableView *>(widget)) { QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableItem, painter, option->rect, flags); } else if (const QHeaderView *header = qobject_cast<const QHeaderView *>(widget)) { - if (header->orientation() == Qt::Horizontal) { - QRect headerRect = option->rect; - const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); - headerRect.adjust(0,frameWidth,-2*frameWidth,0); - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, headerRect, flags); - } else { + //QS60style draws header background here instead of in each headersection, to get + //continuous graphic from section to section. + QS60StylePrivate::SkinElementFlags adjustableFlags = flags; + QRect headerRect = option->rect; + if (header->orientation() != Qt::Horizontal) { //todo: update to horizontal table graphic - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, option->rect, flags | QS60StylePrivate::SF_PointWest); + adjustableFlags = (adjustableFlags | QS60StylePrivate::SF_PointWest); + } else { + const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); + if (option->direction == Qt::LeftToRight) + headerRect.adjust(-2*frameWidth, 0, 0, 0); + else + headerRect.adjust(0, 0, 2*frameWidth, 0); } + if (option->palette.brush(QPalette::Button).color() == Qt::transparent) + QS60StylePrivate::drawSkinElement( + QS60StylePrivate::SE_TableHeaderItem, painter, headerRect, adjustableFlags); + } else if (qobject_cast<const QFrame *>(widget)) { QCommonStyle::drawControl(element, option, painter, widget); } @@ -2204,7 +2242,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases case PE_FrameLineEdit: - case PE_IndicatorButtonDropDown: case PE_IndicatorDockWidgetResizeHandle: case PE_PanelTipLabel: case PE_PanelScrollAreaCorner: @@ -2266,10 +2303,19 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz += QSize(2*f->lineWidth, 4*f->lineWidth); break; case CT_TabBarTab: - QSize naviPaneSize = QS60StylePrivate::naviPaneSize(); + { + const QSize naviPaneSize = QS60StylePrivate::naviPaneSize(); + sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); + if (naviPaneSize.height() > sz.height()) + sz.setHeight(naviPaneSize.height()); + } + break; + case CT_ItemViewItem: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); - if (naviPaneSize.height() > sz.height()) - sz.setHeight(naviPaneSize.height()); + if (QS60StylePrivate::isTouchSupported()) + //Make itemview easier to use in touch devices + //QCommonStyle does not adjust height with horizontal margin, it only adjusts width + sz.setHeight(sz.height() + 2*pixelMetric(QStyle::PM_FocusFrameVMargin)); break; default: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); @@ -2524,6 +2570,29 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple } } break; + case CC_ToolButton: + if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { + const int indicatorRect = pixelMetric(PM_MenuButtonIndicator, toolButton, widget) + + 2*pixelMetric(PM_ButtonMargin, toolButton, widget); + ret = toolButton->rect; + const bool popup = (toolButton->features & + (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay)) + == QStyleOptionToolButton::MenuButtonPopup; + switch (scontrol) { + case SC_ToolButton: + if (popup) + ret.adjust(0, 0, -indicatorRect, 0); + break; + case SC_ToolButtonMenu: + if (popup) + ret.adjust(ret.width() - indicatorRect, ret.height() - indicatorRect, 0, 0); + break; + default: + break; + } + ret = visualRect(toolButton->direction, toolButton->rect, ret); + } + break; default: ret = QCommonStyle::subControlRect(control, option, scontrol, widget); } diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 678844c..0cd87bd 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1382,13 +1382,13 @@ QSize QS60StylePrivate::naviPaneSize() QSize QS60StyleModeSpecifics::naviPaneSize() { CAknNavigationControlContainer* naviContainer; - if (S60->statusPane()) - naviContainer = static_cast<CAknNavigationControlContainer*> - (S60->statusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); - if (naviContainer) - return QSize(naviContainer->Size().iWidth, naviContainer->Size().iHeight); - else - return QSize(0,0); + if (S60->statusPane()) { + TRAPD(err, naviContainer = static_cast<CAknNavigationControlContainer*> + (S60->statusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi)))); + if (err==KErrNone) + return QSize(naviContainer->Size().iWidth, naviContainer->Size().iHeight); + } + return QSize(0,0); } #endif // Q_WS_S60 diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 14f0424..706b4e9 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -322,7 +322,7 @@ QPixmap QS60StylePrivate::backgroundTexture() { if (!m_background) { const QSize size = QApplication::desktop()->screen()->size(); - QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size); + QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size, 0); m_background = new QPixmap(background); } return *m_background; diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp index f5a2b94..d73a563 100644 --- a/src/gui/styles/qstyleoption.cpp +++ b/src/gui/styles/qstyleoption.cpp @@ -4736,8 +4736,9 @@ QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTab QStyleOptionFrame types. If the \a{other} style option's version is 1, this style option's - \l FrameFeature value is set to \l QStyleOptionFrameV2::None. If - its version is 2, its \l FrameFeature value is simply copied to + QStyleOptionFrameV2::FrameFeature value is set to + QStyleOptionFrameV2::None. If its version is 2, its + \l{QStyleOptionFrameV2::}{FrameFeature} value is simply copied to this style option. */ QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QStyleOptionTabWidgetFrame &other) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index b727c19..175b6b1 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1835,7 +1835,8 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) e->ignore(); return; } - bool isGettingInput = !e->commitString().isEmpty() || !e->preeditString().isEmpty() + bool isGettingInput = !e->commitString().isEmpty() + || e->preeditString() != cursor.block().layout()->preeditAreaText() || e->replacementLength() > 0; if (isGettingInput) { diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 1690d87..85b539f 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -294,15 +294,6 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme) Rest of the standard locations point to folder on same drive with executable, except that if executable is in ROM the folder from C drive is returned. - \note On Mac OS X, DataLocation does not include QCoreApplication::organizationName. - Use code like this to add it: - - \code - QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation); - #ifdef Q_WS_MAC - location.insert(location.count() - QCoreApplication::applicationName().count(), - QCoreApplication::organizationName() + "/"); - #endif \endcode */ diff --git a/src/gui/util/qdesktopservices_mac.cpp b/src/gui/util/qdesktopservices_mac.cpp index 0626e0a..23f9e60 100644 --- a/src/gui/util/qdesktopservices_mac.cpp +++ b/src/gui/util/qdesktopservices_mac.cpp @@ -153,9 +153,12 @@ QString QDesktopServices::storageLocation(StandardLocation type) QString path = getFullPath(ref); - QString appName = QCoreApplication::applicationName(); - if (!appName.isEmpty() && (type == DataLocation || type == CacheLocation)) - path += QLatin1Char('/') + appName; + if (type == DataLocation || type == CacheLocation) { + if (QCoreApplication::organizationName().isEmpty() == false) + path += QLatin1Char('/') + QCoreApplication::organizationName(); + if (QCoreApplication::applicationName().isEmpty() == false) + path += QLatin1Char('/') + QCoreApplication::applicationName(); + } return path; } diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 0896256..7d81d5a 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -293,13 +293,16 @@ void QAbstractScrollAreaPrivate::init() q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); layoutChildren(); + viewport->grabGesture(Qt::PanGesture); } #ifdef Q_WS_WIN void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled(bool on) { singleFingerPanEnabled = on; - winSetupGestures(); + QWidgetPrivate *dd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(viewport)); + if (dd) + dd->winSetupGestures(); } #endif // Q_WS_WIN @@ -539,6 +542,7 @@ void QAbstractScrollArea::setViewport(QWidget *widget) d->viewport->setParent(this); d->viewport->setFocusProxy(this); d->viewport->installEventFilter(d->viewportFilter.data()); + d->viewport->grabGesture(Qt::PanGesture); d->layoutChildren(); if (isVisible()) d->viewport->show(); @@ -935,6 +939,26 @@ bool QAbstractScrollArea::event(QEvent *e) case QEvent::TouchUpdate: case QEvent::TouchEnd: return false; + case QEvent::Gesture: + { + QGestureEvent *ge = static_cast<QGestureEvent *>(e); + QPanGesture *g = static_cast<QPanGesture *>(ge->gesture(Qt::PanGesture)); + if (g) { + QScrollBar *hBar = horizontalScrollBar(); + QScrollBar *vBar = verticalScrollBar(); + QPointF delta = g->lastOffset(); + if (!delta.isNull()) { + if (QApplication::isRightToLeft()) + delta.rx() *= -1; + int newX = hBar->value() - delta.x(); + int newY = vBar->value() - delta.y(); + hBar->setValue(newX); + vBar->setValue(newY); + } + return true; + } + return false; + } case QEvent::StyleChange: case QEvent::LayoutDirectionChange: case QEvent::ApplicationLayoutDirectionChange: @@ -990,6 +1014,8 @@ bool QAbstractScrollArea::viewportEvent(QEvent *e) #endif return QFrame::event(e); case QEvent::LayoutRequest: + case QEvent::Gesture: + case QEvent::GestureOverride: return event(e); default: break; @@ -1266,11 +1292,13 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y) void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars() { layoutChildren(); -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN // Need to re-subscribe to gestures as the content changes to make sure we // enable/disable panning when needed. - winSetupGestures(); -#endif // Q_OS_WIN + QWidgetPrivate *dd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(viewport)); + if (dd) + dd->winSetupGestures(); +#endif // Q_WS_WIN } QPoint QAbstractScrollAreaPrivate::contentsOffset() const @@ -1335,25 +1363,6 @@ void QAbstractScrollArea::setupViewport(QWidget *viewport) Q_UNUSED(viewport); } -//void QAbstractScrollAreaPrivate::_q_gestureTriggered() -//{ -// Q_Q(QAbstractScrollArea); -// QPanGesture *g = qobject_cast<QPanGesture*>(q->sender()); -// if (!g) -// return; -// QScrollBar *hBar = q->horizontalScrollBar(); -// QScrollBar *vBar = q->verticalScrollBar(); -// QSizeF delta = g->lastOffset(); -// if (!delta.isNull()) { -// if (QApplication::isRightToLeft()) -// delta.rwidth() *= -1; -// int newX = hBar->value() - delta.width(); -// int newY = vBar->value() - delta.height(); -// hbar->setValue(newX); -// vbar->setValue(newY); -// } -//} - QT_END_NAMESPACE #include "moc_qabstractscrollarea.cpp" diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 2c9cdd9..2914164 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -401,7 +401,8 @@ void QLineControl::moveCursor(int pos, bool mark) void QLineControl::processInputMethodEvent(QInputMethodEvent *event) { int priorState = 0; - bool isGettingInput = !event->commitString().isEmpty() || !event->preeditString().isEmpty() + bool isGettingInput = !event->commitString().isEmpty() + || event->preeditString() != preeditAreaText() || event->replacementLength() > 0; bool cursorPositionChanged = false; diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index bb93546..0de7421 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -730,9 +730,6 @@ QPlainTextEditPrivate::QPlainTextEditPrivate() backgroundVisible = false; centerOnScroll = false; inDrag = false; -#ifdef Q_WS_WIN - singleFingerPanEnabled = true; -#endif } @@ -789,6 +786,9 @@ void QPlainTextEditPrivate::init(const QString &txt) viewport->setCursor(Qt::IBeamCursor); #endif originalOffsetY = 0; +#ifdef Q_WS_WIN + setSingleFingerPanEnabled(true); +#endif } void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) @@ -1450,6 +1450,29 @@ bool QPlainTextEdit::event(QEvent *e) d->sendControlEvent(e); } #endif + else if (e->type() == QEvent::Gesture) { + QGestureEvent *ge = static_cast<QGestureEvent *>(e); + QPanGesture *g = static_cast<QPanGesture *>(ge->gesture(Qt::PanGesture)); + if (g) { + QScrollBar *hBar = horizontalScrollBar(); + QScrollBar *vBar = verticalScrollBar(); + if (g->state() == Qt::GestureStarted) + d->originalOffsetY = vBar->value(); + QPointF offset = g->offset(); + if (!offset.isNull()) { + if (QApplication::isRightToLeft()) + offset.rx() *= -1; + // QPlainTextEdit scrolls by lines only in vertical direction + QFontMetrics fm(document()->defaultFont()); + int lineHeight = fm.height(); + int newX = hBar->value() - g->lastOffset().x(); + int newY = d->originalOffsetY - offset.y()/lineHeight; + hBar->setValue(newX); + vBar->setValue(newY); + } + } + return true; + } return QAbstractScrollArea::event(e); } @@ -2929,30 +2952,6 @@ QAbstractTextDocumentLayout::PaintContext QPlainTextEdit::getPaintContext() cons (\a available is true) or unavailable (\a available is false). */ -//void QPlainTextEditPrivate::_q_gestureTriggered() -//{ -// Q_Q(QPlainTextEdit); -// QPanGesture *g = qobject_cast<QPanGesture*>(q->sender()); -// if (!g) -// return; -// QScrollBar *hBar = q->horizontalScrollBar(); -// QScrollBar *vBar = q->verticalScrollBar(); -// if (g->state() == Qt::GestureStarted) -// originalOffsetY = vBar->value(); -// QSizeF totalOffset = g->totalOffset(); -// if (!totalOffset.isNull()) { -// if (QApplication::isRightToLeft()) -// totalOffset.rwidth() *= -1; -// // QPlainTextEdit scrolls by lines only in vertical direction -// QFontMetrics fm(q->document()->defaultFont()); -// int lineHeight = fm.height(); -// int newX = hBar->value() - g->lastOffset().width(); -// int newY = originalOffsetY - totalOffset.height()/lineHeight; -// hbar->setValue(newX); -// vbar->setValue(newY); -// } -//} - QT_END_NAMESPACE #include "moc_qplaintextedit.cpp" diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index d995e0f..88502e3 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -116,9 +116,6 @@ QTextEditPrivate::QTextEditPrivate() preferRichText = false; showCursorOnInitialShow = true; inDrag = false; -#ifdef Q_WS_WIN - setSingleFingerPanEnabled(true); -#endif } void QTextEditPrivate::createAutoBulletList() @@ -186,6 +183,9 @@ void QTextEditPrivate::init(const QString &html) #ifndef QT_NO_CURSOR viewport->setCursor(Qt::IBeamCursor); #endif +#ifdef Q_WS_WIN + setSingleFingerPanEnabled(true); +#endif } void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp index 4f7f15c..fecbe83 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend.cpp +++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp @@ -229,7 +229,7 @@ void QNetworkAccessDebugPipeBackend::possiblyFinish() void QNetworkAccessDebugPipeBackend::closeDownstreamChannel() { - qWarning("QNetworkAccessDebugPipeBackend::closeDownstreamChannel()",operation());; + qWarning("QNetworkAccessDebugPipeBackend::closeDownstreamChannel() %d",operation());; //if (operation() == QNetworkAccessManager::GetOperation) // socket.disconnectFromHost(); } @@ -237,7 +237,7 @@ void QNetworkAccessDebugPipeBackend::closeDownstreamChannel() void QNetworkAccessDebugPipeBackend::socketError() { - qWarning("QNetworkAccessDebugPipeBackend::socketError()", socket.error()); + qWarning("QNetworkAccessDebugPipeBackend::socketError() %d",socket.error()); QNetworkReply::NetworkError code; switch (socket.error()) { case QAbstractSocket::RemoteHostClosedError: diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 89a6e91..8b4f364 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1589,10 +1589,10 @@ bool QAbstractSocket::setSocketDescriptor(int socketDescriptor, SocketState sock } /*! - Sets the option \a option to the value described by \a value. + \since 4.6 + Sets the given \a option to the value described by \a value. \sa socketOption() - \since 4.6 */ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) { @@ -1618,10 +1618,10 @@ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, cons } /*! + \since 4.6 Returns the value of the \a option option. \sa setSocketOption() - \since 4.6 */ QVariant QAbstractSocket::socketOption(QAbstractSocket::SocketOption option) { diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index cfa99c8..e53d8a4 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -468,7 +468,10 @@ bool QSslSocket::setSocketDescriptor(int socketDescriptor, SocketState state, Op } /*! - \reimp + \since 4.6 + Sets the given \a option to the value described by \a value. + + \sa socketOption() */ void QSslSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) { @@ -478,7 +481,10 @@ void QSslSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVa } /*! - \reimp + \since 4.6 + Returns the value of the \a option option. + + \sa setSocketOption() */ QVariant QSslSocket::socketOption(QAbstractSocket::SocketOption option) { diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 7d6052b..b2474ed 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -15,14 +15,7 @@ contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengles1):CONFIG += opengles1 contains(QT_CONFIG, opengles1cl):CONFIG += opengles1cl contains(QT_CONFIG, opengles2):CONFIG += opengles2 - -contains(QT_CONFIG, opengles.*) { - for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS_PRIVATE += -L$$p - } - !isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL - !isEmpty(QMAKE_LIBS_EGL): LIBS_PRIVATE += $$QMAKE_LIBS_EGL -} +contains(QT_CONFIG, egl):CONFIG += egl HEADERS += qgl.h \ qgl_p.h \ @@ -61,7 +54,7 @@ SOURCES += qgl.cpp \ gl2paintengineex/qpaintengineex_opengl2_p.h \ gl2paintengineex/qglengineshadersource_p.h \ gl2paintengineex/qglcustomshaderstage_p.h \ - gl2paintengineex/qtriangulatingstroker_p.h + gl2paintengineex/qtriangulatingstroker_p.h SOURCES += qglshaderprogram.cpp \ qglpixmapfilter.cpp \ @@ -149,17 +142,3 @@ embedded { } INCLUDEPATH += ../3rdparty/harfbuzz/src - -contains(QT_CONFIG,opengles1) { - LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1 - LIBS += $$QMAKE_LFLAGS_OPENGL_ES1 -} else:contains(QT_CONFIG,opengles1cl) { - LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES1CL - LIBS += $$QMAKE_LFLAGS_OPENGL_ES1CL -} else:contains(QT_CONFIG,opengles2) { - LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL_ES2 - LIBS += $$QMAKE_LFLAGS_OPENGL_ES2 -} else { - LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL - LIBS += $$QMAKE_LFLAGS_OPENGL -} diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 8768fbc..0eaab28 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -518,7 +518,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const m_singlePass = false; QGLFramebufferObjectFormat format; - format.setInternalTextureFormat(GL_RGBA); + format.setInternalTextureFormat(GLenum(GL_RGBA)); QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size() / 2, format, true); if (!fbo) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 080c3b2..e28c382 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -2827,4 +2827,54 @@ void QGLShaderProgram::shaderDestroyed() #endif +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS +/*! \internal */ +void QGLShaderProgram::setUniformValue(int location, QMacCompatGLint value) +{ + setUniformValue(location, GLint(value)); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValue(int location, QMacCompatGLuint value) +{ + setUniformValue(location, GLuint(value)); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValue(const char *name, QMacCompatGLint value) +{ + setUniformValue(name, GLint(value)); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValue(const char *name, QMacCompatGLuint value) +{ + setUniformValue(name, GLuint(value)); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValueArray(int location, const QMacCompatGLint *values, int count) +{ + setUniformValueArray(location, (const GLint *)values, count); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValueArray(int location, const QMacCompatGLuint *values, int count) +{ + setUniformValueArray(location, (const GLuint *)values, count); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValueArray(const char *name, const QMacCompatGLint *values, int count) +{ + setUniformValueArray(name, (const GLint *)values, count); +} + +/*! \internal */ +void QGLShaderProgram::setUniformValueArray(const char *name, const QMacCompatGLuint *values, int count) +{ + setUniformValueArray(name, (const GLuint *)values, count); +} +#endif + QT_END_NAMESPACE diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index b7bd2d7..49c3364 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -181,6 +181,17 @@ public: int uniformLocation(const QByteArray& name) const; int uniformLocation(const QString& name) const; +#ifdef Q_MAC_COMPAT_GL_FUNCTIONS + void setUniformValue(int location, QMacCompatGLint value); + void setUniformValue(int location, QMacCompatGLuint value); + void setUniformValue(const char *name, QMacCompatGLint value); + void setUniformValue(const char *name, QMacCompatGLuint value); + void setUniformValueArray(int location, const QMacCompatGLint *values, int count); + void setUniformValueArray(int location, const QMacCompatGLuint *values, int count); + void setUniformValueArray(const char *name, const QMacCompatGLint *values, int count); + void setUniformValueArray(const char *name, const QMacCompatGLuint *values, int count); +#endif + void setUniformValue(int location, GLfloat value); void setUniformValue(int location, GLint value); void setUniformValue(int location, GLuint value); diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp index 1dec9ea..c1410a6 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp @@ -271,6 +271,67 @@ int PvrEglScreen::transformation() const #endif +#ifndef QT_NO_QWS_TRANSFORMED + +static const QScreen *parentScreen + (const QScreen *current, const QScreen *lookingFor) +{ + if (!current) + return 0; + switch (current->classId()) { + case QScreen::ProxyClass: + case QScreen::TransformedClass: { + const QScreen *child = + static_cast<const QProxyScreen *>(current)->screen(); + if (child == lookingFor) + return current; + else + return parentScreen(child, lookingFor); + } + // Not reached. + + case QScreen::MultiClass: { + QList<QScreen *> screens = current->subScreens(); + foreach (QScreen *screen, screens) { + if (screen == lookingFor) + return current; + const QScreen *parent = parentScreen(screen, lookingFor); + if (parent) + return parent; + } + } + break; + + default: break; + } + return 0; +} + +int PvrEglScreen::transformation() const +{ + // We need to search for our parent screen, which is assumed to be + // "Transformed". If it isn't, then there is no transformation. + // There is no direct method to get the parent screen so we need + // to search every screen until we find ourselves. + if (!parent && qt_screen != this) + parent = parentScreen(qt_screen, this); + if (!parent) + return 0; + if (parent->classId() != QScreen::TransformedClass) + return 0; + return 90 * static_cast<const QTransformedScreen *>(parent) + ->transformation(); +} + +#else + +int PvrEglScreen::transformation() const +{ + return 0; +} + +#endif + void PvrEglScreen::sync() { // Put code here to synchronize 2D and 3D operations if necessary. diff --git a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro index 4734144..158633d 100644 --- a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro +++ b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro @@ -1,5 +1,7 @@ # Use subdirs template to suppress generation of unnecessary files TEMPLATE = subdirs -# We just want to extract the zip file containing sqlite binaries for Symbian -BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip" +# We just want to export the sqlite3 binaries for Symbian for platforms that do not have them. +!exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) { + BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip" +} diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 022a072..90c9f27 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -12,7 +12,7 @@ symbian: { VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION} qtresources.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/s60main.rsc - qtresources.path = $$APP_RESOURCE_DIR + qtresources.path = c:$$APP_RESOURCE_DIR qtlibraries.sources = \ QtCore.dll \ @@ -24,24 +24,24 @@ symbian: { qts60plugindeployment = \ "IF package(0x1028315F)" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"!:\\sys\\bin\\qts60plugin_5_0.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0.dll\"" \ "ELSEIF package(0x102752AE)" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_2.dll\" - \"!:\\sys\\bin\\qts60plugin_3_2.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_2.dll\" - \"c:\\sys\\bin\\qts60plugin_3_2.dll\"" \ "ELSEIF package(0x102032BE)" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_1.dll\" - \"!:\\sys\\bin\\qts60plugin_3_1.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_3_1.dll\" - \"c:\\sys\\bin\\qts60plugin_3_1.dll\"" \ "ELSE" \ - " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"!:\\sys\\bin\\qts60plugin_5_0.dll\"" \ + " \"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/qts60plugin_5_0.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0.dll\"" \ "ENDIF" qtlibraries.pkg_postrules += qts60plugindeployment sqlitedeployment = \ "; Deploy sqlite onto phone that does not have it (this should be replaced with embedded sis file when available)" \ "IF NOT package(0x2002533b) " \ - "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/sqlite3.dll\" - \"!:\\sys\\bin\\sqlite3.dll\"" \ + "\"$${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)/sqlite3.dll\" - \"c:\\sys\\bin\\sqlite3.dll\"" \ "ENDIF" qtlibraries.pkg_postrules += sqlitedeployment - qtlibraries.path = /sys/bin + qtlibraries.path = c:/sys/bin vendorinfo = \ "; Localised Vendor name" \ @@ -67,15 +67,15 @@ symbian: { !contains(QT_CONFIG, no-mng): imageformats_plugins.sources += qmng.dll !contains(QT_CONFIG, no-tiff): imageformats_plugins.sources += qtiff.dll !contains(QT_CONFIG, no-ico): imageformats_plugins.sources += qico.dll - imageformats_plugins.path = $$QT_PLUGINS_BASE_DIR/imageformats + imageformats_plugins.path = c:$$QT_PLUGINS_BASE_DIR/imageformats codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll - codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs + codecs_plugins.path = c:$$QT_PLUGINS_BASE_DIR/codecs contains(QT_CONFIG, phonon-backend) { phonon_backend_plugins.sources += phonon_mmf.dll - phonon_backend_plugins.path = $$QT_PLUGINS_BASE_DIR/phonon_backend + phonon_backend_plugins.path = c:$$QT_PLUGINS_BASE_DIR/phonon_backend DEPLOYMENT += phonon_backend_plugins } @@ -85,7 +85,7 @@ symbian: { qtlibraries.sources += QtSvg.dll imageformats_plugins.sources += qsvg.dll iconengines_plugins.sources = qsvgicon.dll - iconengines_plugins.path = $$QT_PLUGINS_BASE_DIR/iconengines + iconengines_plugins.path = c:$$QT_PLUGINS_BASE_DIR/iconengines DEPLOYMENT += iconengines_plugins } @@ -105,9 +105,9 @@ symbian: { qtlibraries.sources += QtWebKit.dll } - graphicssystems_plugins.path = $$QT_PLUGINS_BASE_DIR/graphicssystems + graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems contains(QT_CONFIG, openvg) { - qtlibraries.sources = QtOpenVG.dll + qtlibraries.sources += QtOpenVG.dll graphicssystems_plugins.sources += qvggraphicssystem.dll } diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp index d30e07a..edc2fb8 100644 --- a/src/s60main/qts60main_mcrt0.cpp +++ b/src/s60main/qts60main_mcrt0.cpp @@ -83,12 +83,10 @@ GLDEF_C TInt QtMainWrapper() char **envp = 0; // get args & environment __crt0(argc, argv, envp); - CleanupArrayDelete<char*>::PushL(argv); - CleanupArrayDelete<char*>::PushL(envp); //Call user(application)'s main - int ret = 0; - QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);); - CleanupStack::PopAndDestroy(2, argv); + TRAPD(ret, QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);)); + delete[] argv; + delete[] envp; return ret; } diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro index cc3c547..47cf020 100644 --- a/src/s60main/s60main.pro +++ b/src/s60main/s60main.pro @@ -16,16 +16,6 @@ symbian { SOURCES = qts60main.cpp \ qts60main_mcrt0.cpp - # This block serves the minimalistic resource file for S60 3.1 platforms. - # Note there is no way to ifdef S60 version in mmp file, that is why the resource - # file is always compiled for WINSCW - minimalAppResource31 = \ - "START RESOURCE s60main.rss" \ - "HEADER" \ - "TARGETPATH resource\apps" \ - "END" - MMP_RULES += minimalAppResource31 - # s60main needs to be built in ARM mode for GCCE to work. MMP_RULES+="ALWAYS_BUILD_AS_ARM" @@ -36,14 +26,4 @@ symbian { error("$$_FILE_ is intended only for Symbian!") } -symbian-abld: { - # abld build commands generated resources after the static library is built, and - # we have dependency to resource from static lib -> resources need to be generated - # explicitly before library - rsgFix2.commands = "-$(DEL_FILE) $(EPOCROOT)Epoc32\Data\z\resource\apps\s60main.rsc >NUL 2>&1" - rsgFix.commands = "-$(ABLD) resource $(PLATFORM) $(CFG) 2>NUL" - QMAKE_EXTRA_TARGETS += rsgFix rsgFix2 - PRE_TARGETDEPS += rsgFix rsgFix2 -} - include(../qbase.pri) diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 1e41571..981b750 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -1150,7 +1150,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const case QVariant::Time: #ifndef QT_NO_DATESTRING if (field.value().toTime().isValid()) { - r = QLatin1Char('\'') + field.value().toTime().toString(Qt::ISODate) + QLatin1Char('\''); + r = QLatin1Char('\'') + field.value().toTime().toString(QLatin1String("hh:mm:ss.zzz")) + QLatin1Char('\''); } else #endif { diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index df94080..e5c6550 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -406,7 +406,7 @@ bool QSqlTableModel::select() QSqlQuery qu(query, d->db); setQuery(qu); - if (!qu.isActive()) { + if (!qu.isActive() || lastError().isValid()) { // something went wrong - revert to non-select state d->initRecordAndPrimaryIndex(); return false; diff --git a/src/xmlpatterns/acceltree/qacceltree_p.h b/src/xmlpatterns/acceltree/qacceltree_p.h index 8da61c9..ee7d6f6 100644 --- a/src/xmlpatterns/acceltree/qacceltree_p.h +++ b/src/xmlpatterns/acceltree/qacceltree_p.h @@ -89,7 +89,7 @@ namespace QPatternist * @see <a href"http://www.inf.uni-konstanz.de/dbis/publications/download/accelerating-locsteps.pdf">Accelerating * XPath Evaluation in Any RDBMS, Torsten Grust</a> */ - class AccelTree : public QAbstractXmlNodeModel + class Q_AUTOTEST_EXPORT AccelTree : public QAbstractXmlNodeModel { friend class AccelTreePrivate; public: diff --git a/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h b/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h index bb547bd..27e3c22 100644 --- a/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h +++ b/src/xmlpatterns/acceltree/qcompressedwhitespace_p.h @@ -84,7 +84,7 @@ namespace QPatternist * * @author Frans Englich <frans.englich@nokia.com> */ - class CompressedWhitespace + class Q_AUTOTEST_EXPORT CompressedWhitespace { public: /** diff --git a/tests/auto/checkxmlfiles/checkxmlfiles.pro b/tests/auto/checkxmlfiles/checkxmlfiles.pro index c368c02..d53c11c 100644 --- a/tests/auto/checkxmlfiles/checkxmlfiles.pro +++ b/tests/auto/checkxmlfiles/checkxmlfiles.pro @@ -12,7 +12,7 @@ addFiles.sources = \ $$QT_SOURCE_TREE/examples/sql/masterdetail/albumdetails.xml \ $$QT_SOURCE_TREE/examples/xmlpatterns/xquery/globalVariables/globals.gccxml \ $$QT_SOURCE_TREE/doc/src/diagrams/stylesheet/treeview.svg \ - $$QT_SOURCE_TREE/doc/src/diagrams/designer-mainwindow-actions.ui \ + $$QT_SOURCE_TREE/doc/src/diagrams/designer-manual/designer-mainwindow-actions.ui \ $$QT_SOURCE_TREE/demos/undo/undo.qrc addFiles.path = xmlfiles DEPLOYMENT += addFiles diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 02c8232..20b53f2 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -111,12 +111,12 @@ public: CustomEvent::EventType = QEvent::registerEventType(); } - QGesture* createGesture(QObject *) + QGesture* create(QObject *) { return new CustomGesture; } - QGestureRecognizer::Result filterEvent(QGesture *state, QObject*, QEvent *event) + QGestureRecognizer::Result recognize(QGesture *state, QObject*, QEvent *event) { if (event->type() == CustomEvent::EventType) { QGestureRecognizer::Result result = 0; @@ -128,13 +128,13 @@ public: if (e->hasHotSpot) g->setHotSpot(e->hotSpot); if (g->serial >= CustomGesture::SerialFinishedThreshold) - result |= QGestureRecognizer::GestureFinished; + result |= QGestureRecognizer::FinishGesture; else if (g->serial >= CustomGesture::SerialStartedThreshold) - result |= QGestureRecognizer::GestureTriggered; + result |= QGestureRecognizer::TriggerGesture; else if (g->serial >= CustomGesture::SerialMaybeThreshold) - result |= QGestureRecognizer::MaybeGesture; + result |= QGestureRecognizer::MayBeGesture; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; return result; } return QGestureRecognizer::Ignore; @@ -142,7 +142,7 @@ public: void reset(QGesture *state) { - CustomGesture *g = static_cast<CustomGesture*>(state); + CustomGesture *g = static_cast<CustomGesture *>(state); g->serial = 0; QGestureRecognizer::reset(state); } @@ -159,26 +159,26 @@ public: CustomEvent::EventType = QEvent::registerEventType(); } - QGesture* createGesture(QObject *) + QGesture* create(QObject *) { return new CustomGesture; } - QGestureRecognizer::Result filterEvent(QGesture *state, QObject*, QEvent *event) + QGestureRecognizer::Result recognize(QGesture *state, QObject*, QEvent *event) { if (event->type() == CustomEvent::EventType) { QGestureRecognizer::Result result = QGestureRecognizer::ConsumeEventHint; - CustomGesture *g = static_cast<CustomGesture*>(state); - CustomEvent *e = static_cast<CustomEvent*>(event); + CustomGesture *g = static_cast<CustomGesture *>(state); + CustomEvent *e = static_cast<CustomEvent *>(event); g->serial = e->serial; if (e->hasHotSpot) g->setHotSpot(e->hotSpot); if (g->serial >= CustomGesture::SerialFinishedThreshold) - result |= QGestureRecognizer::GestureFinished; + result |= QGestureRecognizer::FinishGesture; else if (g->serial >= CustomGesture::SerialMaybeThreshold) - result |= QGestureRecognizer::GestureTriggered; + result |= QGestureRecognizer::TriggerGesture; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; return result; } return QGestureRecognizer::Ignore; @@ -186,7 +186,7 @@ public: void reset(QGesture *state) { - CustomGesture *g = static_cast<CustomGesture*>(state); + CustomGesture *g = static_cast<CustomGesture *>(state); g->serial = 0; QGestureRecognizer::reset(state); } @@ -256,7 +256,7 @@ protected: } if (eventsPtr) { QGestureEvent *e = static_cast<QGestureEvent*>(event); - QList<QGesture*> gestures = e->allGestures(); + QList<QGesture*> gestures = e->gestures(); foreach(QGesture *g, gestures) { eventsPtr->all << g->gestureType(); switch(g->state()) { @@ -332,6 +332,7 @@ private slots: void consumeEventHint(); void unregisterRecognizer(); void autoCancelGestures(); + void autoCancelGestures2(); }; tst_Gestures::tst_Gestures() @@ -344,14 +345,14 @@ tst_Gestures::~tst_Gestures() void tst_Gestures::initTestCase() { - CustomGesture::GestureType = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + CustomGesture::GestureType = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); QVERIFY(CustomGesture::GestureType != Qt::GestureType(0)); QVERIFY(CustomGesture::GestureType != Qt::CustomGesture); } void tst_Gestures::cleanupTestCase() { - QApplication::unregisterGestureRecognizer(CustomGesture::GestureType); + QGestureRecognizer::unregisterRecognizer(CustomGesture::GestureType); } void tst_Gestures::init() @@ -365,7 +366,7 @@ void tst_Gestures::cleanup() void tst_Gestures::customGesture() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); CustomEvent event; sendCustomGesture(&event, &widget); @@ -386,7 +387,7 @@ void tst_Gestures::customGesture() void tst_Gestures::consumeEventHint() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); CustomGestureRecognizer::ConsumeEvents = true; CustomEvent event; @@ -399,7 +400,7 @@ void tst_Gestures::consumeEventHint() void tst_Gestures::autoCancelingGestures() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); // send partial gesture. The gesture will be in the "maybe" state, but will // never get enough events to fire, so Qt will have to kill it. CustomEvent ev; @@ -423,7 +424,7 @@ void tst_Gestures::gestureOverChild() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); CustomEvent event; sendCustomGesture(&event, child); @@ -439,7 +440,7 @@ void tst_Gestures::gestureOverChild() QCOMPARE(widget.gestureOverrideEventsReceived, 0); // enable gestures over the children - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + widget.grabGesture(CustomGesture::GestureType); widget.reset(); child->reset(); @@ -468,8 +469,8 @@ void tst_Gestures::multipleWidgetOnlyGestureInTree() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - child->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + parent.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + child->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; @@ -506,8 +507,8 @@ void tst_Gestures::conflictingGestures() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); - child->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + parent.grabGesture(CustomGesture::GestureType); + child->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -542,7 +543,9 @@ void tst_Gestures::conflictingGestures() parent.reset(); child->reset(); - // nobody accepts the override, we will send normal events to the closest context (to the child) + // nobody accepts the override, we will send normal events to the closest + // context (i.e. to the child widget) and it will be propagated and + // accepted by the parent widget parent.acceptGestureOverride = false; child->acceptGestureOverride = false; child->ignoredGestures << CustomGesture::GestureType; @@ -551,6 +554,41 @@ void tst_Gestures::conflictingGestures() sendCustomGesture(&event, child); QCOMPARE(child->gestureOverrideEventsReceived, 1); + QCOMPARE(child->gestureEventsReceived, 1); + QCOMPARE(parent.gestureOverrideEventsReceived, 1); + QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); + + parent.reset(); + child->reset(); + + // nobody accepts the override, and nobody accepts the gesture event + parent.acceptGestureOverride = false; + child->acceptGestureOverride = false; + parent.ignoredGestures << CustomGesture::GestureType; + child->ignoredGestures << CustomGesture::GestureType; + + // sending events to the child and making sure there is no conflict + sendCustomGesture(&event, child); + + QCOMPARE(child->gestureOverrideEventsReceived, 1); + QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(parent.gestureOverrideEventsReceived, 1); + QCOMPARE(parent.gestureEventsReceived, 1); + + parent.reset(); + child->reset(); + + // we set an attribute to make sure all gesture events are propagated + parent.grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures); + parent.acceptGestureOverride = false; + child->acceptGestureOverride = false; + parent.ignoredGestures << CustomGesture::GestureType; + child->ignoredGestures << CustomGesture::GestureType; + + // sending events to the child and making sure there is no conflict + sendCustomGesture(&event, child); + + QCOMPARE(child->gestureOverrideEventsReceived, 1); QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount); QCOMPARE(parent.gestureOverrideEventsReceived, 1); QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount); @@ -558,7 +596,7 @@ void tst_Gestures::conflictingGestures() parent.reset(); child->reset(); - Qt::GestureType ContinuousGesture = QApplication::registerGestureRecognizer(new CustomContinuousGestureRecognizer); + Qt::GestureType ContinuousGesture = QGestureRecognizer::registerRecognizer(new CustomContinuousGestureRecognizer); static const int ContinuousGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; child->grabGesture(ContinuousGesture); // child accepts override. And it also receives another custom gesture. @@ -572,13 +610,13 @@ void tst_Gestures::conflictingGestures() QCOMPARE(parent.gestureOverrideEventsReceived, 0); QCOMPARE(parent.gestureEventsReceived, 0); - QApplication::unregisterGestureRecognizer(ContinuousGesture); + QGestureRecognizer::unregisterRecognizer(ContinuousGesture); } void tst_Gestures::finishedWithoutStarted() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); // the gesture will claim it finished, but it was never started. CustomEvent ev; @@ -598,9 +636,9 @@ void tst_Gestures::finishedWithoutStarted() void tst_Gestures::unknownGesture() { GestureWidget widget; - widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - widget.grabGesture(Qt::CustomGesture, Qt::WidgetGesture); - widget.grabGesture(Qt::GestureType(Qt::PanGesture+512), Qt::WidgetGesture); + widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + widget.grabGesture(Qt::CustomGesture, Qt::DontStartGestureOnChildren); + widget.grabGesture(Qt::GestureType(Qt::PanGesture+512), Qt::DontStartGestureOnChildren); CustomEvent event; sendCustomGesture(&event, &widget); @@ -702,7 +740,7 @@ protected: } if (eventsPtr) { QGestureEvent *e = static_cast<QGestureEvent*>(event); - QList<QGesture*> gestures = e->allGestures(); + QList<QGesture*> gestures = e->gestures(); foreach(QGesture *g, gestures) { eventsPtr->all << g->gestureType(); switch(g->state()) { @@ -746,7 +784,7 @@ void tst_Gestures::graphicsItemGesture() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -820,7 +858,7 @@ void tst_Gestures::graphicsItemTreeGesture() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item1->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -850,7 +888,7 @@ void tst_Gestures::graphicsItemTreeGesture() QCOMPARE(item1_child2->gestureEventsReceived, 0); QCOMPARE(item1_child2->gestureOverrideEventsReceived, 0); QCOMPARE(item1->gestureOverrideEventsReceived, 1); - QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1->gestureEventsReceived, 1); } void tst_Gestures::explicitGraphicsObjectTarget() @@ -878,10 +916,10 @@ void tst_Gestures::explicitGraphicsObjectTarget() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - item1->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); - item2->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); - item2_child1->grabGesture(CustomGesture::GestureType, Qt::ItemGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + item1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + item2->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + item2_child1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -938,7 +976,7 @@ void tst_Gestures::gestureOverChildGraphicsItem() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item1->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -965,7 +1003,39 @@ void tst_Gestures::gestureOverChildGraphicsItem() event.hasHotSpot = true; sendCustomGesture(&event, item0, &scene); - QCOMPARE(item0->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item2_child1->gestureEventsReceived, 0); + QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item2->gestureEventsReceived, 1); + QCOMPARE(item2->gestureOverrideEventsReceived, 1); + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + + item0->reset(); item1->reset(); item2->reset(); item2_child1->reset(); + item2->grabGesture(CustomGesture::GestureType); + item2->ignoredGestures << CustomGesture::GestureType; + item1->ignoredGestures << CustomGesture::GestureType; + + event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + + QCOMPARE(item2_child1->gestureEventsReceived, 0); + QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); + QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item2->gestureOverrideEventsReceived, 1); + QCOMPARE(item1->gestureEventsReceived, 1); + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + + item0->reset(); item1->reset(); item2->reset(); item2_child1->reset(); + item2->grabGesture(CustomGesture::GestureType); + item2->ignoredGestures << CustomGesture::GestureType; + item1->ignoredGestures << CustomGesture::GestureType; + item1->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures); + + event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item0, &scene); + QCOMPARE(item2_child1->gestureEventsReceived, 0); QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0); QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount); @@ -981,10 +1051,10 @@ void tst_Gestures::twoGesturesOnDifferentLevel() GestureWidget *child = new GestureWidget("child"); l->addWidget(child); - Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); + Qt::GestureType SecondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); - parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); - child->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); + parent.grabGesture(CustomGesture::GestureType); + child->grabGesture(SecondGesture); CustomEvent event; // sending events that form a gesture to one widget, but they will be @@ -1009,7 +1079,7 @@ void tst_Gestures::twoGesturesOnDifferentLevel() for(int i = 0; i < child->events.all.size(); ++i) QCOMPARE(parent.events.all.at(i), CustomGesture::GestureType); - QApplication::unregisterGestureRecognizer(SecondGesture); + QGestureRecognizer::unregisterRecognizer(SecondGesture); } void tst_Gestures::multipleGesturesInTree() @@ -1021,18 +1091,19 @@ void tst_Gestures::multipleGesturesInTree() GestureWidget *D = new GestureWidget("D", C); Qt::GestureType FirstGesture = CustomGesture::GestureType; - Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType ThirdGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - - A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1 3] - A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | - B->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // B [ 2 3] - B->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | - C->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // C [1 2 3] - C->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // | - C->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // D [1 3] - D->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); + Qt::GestureType SecondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType ThirdGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + + Qt::GestureFlags flags = Qt::ReceivePartialGestures; + A->grabGesture(FirstGesture, flags); // A [1 3] + A->grabGesture(ThirdGesture, flags); // | + B->grabGesture(SecondGesture, flags); // B [ 2 3] + B->grabGesture(ThirdGesture, flags); // | + C->grabGesture(FirstGesture, flags); // C [1 2 3] + C->grabGesture(SecondGesture, flags); // | + C->grabGesture(ThirdGesture, flags); // D [1 3] + D->grabGesture(FirstGesture, flags); + D->grabGesture(ThirdGesture, flags); // make sure all widgets ignore events, so they get propagated. A->ignoredGestures << FirstGesture << ThirdGesture; @@ -1079,8 +1150,8 @@ void tst_Gestures::multipleGesturesInTree() QCOMPARE(A->events.all.count(SecondGesture), 0); QCOMPARE(A->events.all.count(ThirdGesture), TotalGestureEventsCount); - QApplication::unregisterGestureRecognizer(SecondGesture); - QApplication::unregisterGestureRecognizer(ThirdGesture); + QGestureRecognizer::unregisterRecognizer(SecondGesture); + QGestureRecognizer::unregisterRecognizer(ThirdGesture); } void tst_Gestures::multipleGesturesInComplexTree() @@ -1092,26 +1163,27 @@ void tst_Gestures::multipleGesturesInComplexTree() GestureWidget *D = new GestureWidget("D", C); Qt::GestureType FirstGesture = CustomGesture::GestureType; - Qt::GestureType SecondGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType ThirdGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType FourthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType FifthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType SixthGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - Qt::GestureType SeventhGesture = QApplication::registerGestureRecognizer(new CustomGestureRecognizer); - - A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1,3,4] - A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // | - A->grabGesture(FourthGesture, Qt::WidgetWithChildrenGesture); // B [2,3,5] - B->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // | - B->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // C [1,2,3,6] - B->grabGesture(FifthGesture, Qt::WidgetWithChildrenGesture); // | - C->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // D [1,3,7] - C->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); - C->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); - C->grabGesture(SixthGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); - D->grabGesture(SeventhGesture, Qt::WidgetWithChildrenGesture); + Qt::GestureType SecondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType ThirdGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType FourthGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType FifthGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType SixthGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + Qt::GestureType SeventhGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + + Qt::GestureFlags flags = Qt::ReceivePartialGestures; + A->grabGesture(FirstGesture, flags); // A [1,3,4] + A->grabGesture(ThirdGesture, flags); // | + A->grabGesture(FourthGesture, flags); // B [2,3,5] + B->grabGesture(SecondGesture, flags); // | + B->grabGesture(ThirdGesture, flags); // C [1,2,3,6] + B->grabGesture(FifthGesture, flags); // | + C->grabGesture(FirstGesture, flags); // D [1,3,7] + C->grabGesture(SecondGesture, flags); + C->grabGesture(ThirdGesture, flags); + C->grabGesture(SixthGesture, flags); + D->grabGesture(FirstGesture, flags); + D->grabGesture(ThirdGesture, flags); + D->grabGesture(SeventhGesture, flags); // make sure all widgets ignore events, so they get propagated. QSet<Qt::GestureType> allGestureTypes; @@ -1175,12 +1247,12 @@ void tst_Gestures::multipleGesturesInComplexTree() QCOMPARE(A->events.all.count(SixthGesture), 0); QCOMPARE(A->events.all.count(SeventhGesture), 0); - QApplication::unregisterGestureRecognizer(SecondGesture); - QApplication::unregisterGestureRecognizer(ThirdGesture); - QApplication::unregisterGestureRecognizer(FourthGesture); - QApplication::unregisterGestureRecognizer(FifthGesture); - QApplication::unregisterGestureRecognizer(SixthGesture); - QApplication::unregisterGestureRecognizer(SeventhGesture); + QGestureRecognizer::unregisterRecognizer(SecondGesture); + QGestureRecognizer::unregisterRecognizer(ThirdGesture); + QGestureRecognizer::unregisterRecognizer(FourthGesture); + QGestureRecognizer::unregisterRecognizer(FifthGesture); + QGestureRecognizer::unregisterRecognizer(SixthGesture); + QGestureRecognizer::unregisterRecognizer(SeventhGesture); } void tst_Gestures::testMapToScene() @@ -1189,7 +1261,7 @@ void tst_Gestures::testMapToScene() QList<QGesture*> list; list << &gesture; QGestureEvent event(list); - QCOMPARE(event.mapToScene(gesture.hotSpot()), QPointF()); // not set, can't do much + QCOMPARE(event.mapToGraphicsScene(gesture.hotSpot()), QPointF()); // not set, can't do much QGraphicsScene scene; QGraphicsView view(&scene); @@ -1206,7 +1278,7 @@ void tst_Gestures::testMapToScene() QPoint origin = view.mapToGlobal(QPoint()); event.setWidget(view.viewport()); - QCOMPARE(event.mapToScene(origin + QPoint(100, 200)), view.mapToScene(QPoint(100, 200))); + QCOMPARE(event.mapToGraphicsScene(origin + QPoint(100, 200)), view.mapToScene(QPoint(100, 200))); } void tst_Gestures::ungrabGesture() // a method on QWidget @@ -1224,7 +1296,7 @@ void tst_Gestures::ungrabGesture() // a method on QWidget if (event->type() == QEvent::Gesture) { QGestureEvent *gestureEvent = static_cast<QGestureEvent*>(event); if (gestureEvent) - foreach (QGesture *g, gestureEvent->allGestures()) + foreach (QGesture *g, gestureEvent->gestures()) gestures.insert(g); } return GestureWidget::event(event); @@ -1235,8 +1307,8 @@ void tst_Gestures::ungrabGesture() // a method on QWidget MockGestureWidget *a = &parent; MockGestureWidget *b = new MockGestureWidget("B", a); - a->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); - b->grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture); + a->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + b->grabGesture(CustomGesture::GestureType); b->ignoredGestures << CustomGesture::GestureType; CustomEvent event; @@ -1295,20 +1367,6 @@ void tst_Gestures::unregisterRecognizer() // a method on QApplication void tst_Gestures::autoCancelGestures() { - class MockRecognizer : public QGestureRecognizer { - public: - QGestureRecognizer::Result filterEvent(QGesture *gesture, QObject *watched, QEvent *event) - { - Q_UNUSED(gesture); - Q_UNUSED(watched); - if (event->type() == QEvent::MouseButtonPress) - return QGestureRecognizer::GestureTriggered; - if (event->type() == QEvent::MouseButtonRelease) - return QGestureRecognizer::GestureFinished; - return QGestureRecognizer::Ignore; - } - }; - class MockWidget : public GestureWidget { public: MockWidget(const char *name) : GestureWidget(name) { } @@ -1317,21 +1375,25 @@ void tst_Gestures::autoCancelGestures() { if (event->type() == QEvent::Gesture) { QGestureEvent *ge = static_cast<QGestureEvent*>(event); - Q_ASSERT(ge->allGestures().count() == 1); // can't use QCOMPARE here... - ge->allGestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); + Q_ASSERT(ge->gestures().count() == 1); // can't use QCOMPARE here... + ge->gestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); } return GestureWidget::event(event); } }; + const Qt::GestureType secondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer); + MockWidget parent("parent"); // this one sets the cancel policy to CancelAllInContext parent.resize(300, 100); + parent.setWindowFlags(Qt::X11BypassWindowManagerHint); GestureWidget *child = new GestureWidget("child", &parent); child->setGeometry(10, 10, 100, 80); - Qt::GestureType type = QApplication::registerGestureRecognizer(new MockRecognizer()); - parent.grabGesture(type, Qt::WidgetWithChildrenGesture); - child->grabGesture(type, Qt::WidgetWithChildrenGesture); + parent.grabGesture(CustomGesture::GestureType); + child->grabGesture(secondGesture); + parent.show(); + QTest::qWaitForWindowShown(&parent); /* An event is send to both the child and the parent, when the child gets it a gesture is triggered @@ -1340,18 +1402,73 @@ void tst_Gestures::autoCancelGestures() parent gets it he accepts it and that causes the cancel policy to activate. The cause of that is the gesture for the child is cancelled and send to the child as such. */ - QMouseEvent event(QEvent::MouseButtonPress, QPoint(20,20), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + CustomEvent event; + event.serial = CustomGesture::SerialStartedThreshold; QApplication::sendEvent(child, &event); + QCOMPARE(child->events.all.count(), 2); QCOMPARE(child->events.started.count(), 1); - QCOMPARE(child->events.all.count(), 1); - QCOMPARE(parent.events.all.count(), 0); - child->reset(); - QApplication::sendEvent(&parent, &event); + QCOMPARE(child->events.canceled.count(), 1); QCOMPARE(parent.events.all.count(), 1); - QCOMPARE(parent.events.started.count(), 1); - QCOMPARE(child->events.started.count(), 0); - QCOMPARE(child->events.all.count(), 1); + + // clean up, make the parent gesture finish + event.serial = CustomGesture::SerialFinishedThreshold; + QApplication::sendEvent(child, &event); + QCOMPARE(parent.events.all.count(), 2); +} + +void tst_Gestures::autoCancelGestures2() +{ + class MockItem : public GestureItem { + public: + MockItem(const char *name) : GestureItem(name) { } + + bool event(QEvent *event) { + if (event->type() == QEvent::Gesture) { + QGestureEvent *ge = static_cast<QGestureEvent*>(event); + Q_ASSERT(ge->gestures().count() == 1); // can't use QCOMPARE here... + ge->gestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext); + } + return GestureItem::event(event); + } + }; + + const Qt::GestureType secondGesture = QGestureRecognizer ::registerRecognizer(new CustomGestureRecognizer); + + QGraphicsScene scene; + QGraphicsView view(&scene); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + MockItem *parent = new MockItem("parent"); + GestureItem *child = new GestureItem("child"); + child->setParentItem(parent); + parent->setPos(0, 0); + child->setPos(10, 10); + scene.addItem(parent); + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + view.viewport()->grabGesture(secondGesture, Qt::DontStartGestureOnChildren); + parent->grabGesture(CustomGesture::GestureType); + child->grabGesture(secondGesture); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + CustomEvent event; + event.serial = CustomGesture::SerialStartedThreshold; + event.hasHotSpot = true; + event.hotSpot = mapToGlobal(QPointF(5, 5), child, &view); + // qDebug() << event.hotSpot; + scene.sendEvent(child, &event); + //QEventLoop().exec(); + QCOMPARE(parent->events.all.count(), 1); + QCOMPARE(child->events.started.count(), 1); QCOMPARE(child->events.canceled.count(), 1); + QCOMPARE(child->events.all.count(), 2); + + // clean up, make the parent gesture finish + event.serial = CustomGesture::SerialFinishedThreshold; + scene.sendEvent(child, &event); + QCOMPARE(parent->events.all.count(), 2); } QTEST_MAIN(tst_Gestures) diff --git a/tests/auto/q3filedialog/tst_q3filedialog.cpp b/tests/auto/q3filedialog/tst_q3filedialog.cpp index 2585f60..e2686eb 100644 --- a/tests/auto/q3filedialog/tst_q3filedialog.cpp +++ b/tests/auto/q3filedialog/tst_q3filedialog.cpp @@ -59,7 +59,9 @@ public: virtual ~tst_Q3FileDialog(); private slots: +#ifndef QT_MAC_USE_COCOA void getSetCheck(); +#endif }; tst_Q3FileDialog::tst_Q3FileDialog() @@ -70,6 +72,7 @@ tst_Q3FileDialog::~tst_Q3FileDialog() { } +#ifndef QT_MAC_USE_COCOA class Preview : public QLabel, public Q3FilePreview { public: @@ -125,6 +128,7 @@ void tst_Q3FileDialog::getSetCheck() obj1.setPreviewMode(Q3FileDialog::PreviewMode(Q3FileDialog::Info)); QCOMPARE(obj1.previewMode(), Q3FileDialog::PreviewMode(Q3FileDialog::Info)); } +#endif QTEST_MAIN(tst_Q3FileDialog) #include "tst_q3filedialog.moc" diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/qclipboard/test/test.pro index 508eba1..62a38af 100644 --- a/tests/auto/qclipboard/test/test.pro +++ b/tests/auto/qclipboard/test/test.pro @@ -13,7 +13,18 @@ win32 { wince*|symbian*: { copier.sources = ../copier/copier.exe copier.path = copier - paster.sources = ../paster/paster.exe + paster.sources = ../paster/paster.exe paster.path = paster - DEPLOYMENT = copier paster + + symbian*: { + load(data_caging_paths) + rsc.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/copier.rsc + rsc.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/paster.rsc + rsc.path = $$APP_RESOURCE_DIR + reg_resource.sources = $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/copier_reg.rsc + reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/paster_reg.rsc + reg_resource.path = $$REG_RESOURCE_IMPORT_DIR + } + + DEPLOYMENT = copier paster rsc reg_resource }
\ No newline at end of file diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index c53780e..1140402 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -450,11 +450,12 @@ void tst_QDateTime::toString_enumformat() qDebug() << str3; QVERIFY(!str3.isEmpty()); //check for date/time components in any order - QVERIFY(str3.contains("1995")); + //year may be 2 or 4 digits + QVERIFY(str3.contains("95")); //day and month may be in numeric or word form QVERIFY(str3.contains("12")); QVERIFY(str3.contains("34")); - QVERIFY(str3.contains("56")); + //seconds may be absent } void tst_QDateTime::addDays() diff --git a/tests/auto/qsound/tst_qsound.cpp b/tests/auto/qsound/tst_qsound.cpp index 56a330b..73eca98 100644 --- a/tests/auto/qsound/tst_qsound.cpp +++ b/tests/auto/qsound/tst_qsound.cpp @@ -55,20 +55,32 @@ public: tst_QSound( QObject* parent=0) : QObject(parent) {} private slots: - void checkFinished(); + void checkFinished(); + + // Manual tests + void staticPlay(); }; void tst_QSound::checkFinished() { - QSound sound(SRCDIR"4.wav"); - sound.setLoops(3); - sound.play(); - QTest::qWait(5000); + QSound sound(SRCDIR"4.wav"); + sound.setLoops(3); + sound.play(); + QTest::qWait(5000); #if defined(Q_WS_QWS) - QEXPECT_FAIL("", "QSound buggy on embedded (task QTBUG-157)", Abort); + QEXPECT_FAIL("", "QSound buggy on embedded (task QTBUG-157)", Abort); #endif - QVERIFY(sound.isFinished() ); + QVERIFY(sound.isFinished() ); +} + +void tst_QSound::staticPlay() +{ + QSKIP("Test disabled -- only for manual purposes", SkipAll); + + // Check that you hear sound with static play also. + QSound::play(SRCDIR"4.wav"); + QTest::qWait(2000); } QTEST_MAIN(tst_QSound); diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 4d9e50f..4264a70 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -193,9 +193,13 @@ private slots: void sqlServerReturn0_data() { generic_data(); } void sqlServerReturn0(); + void QTBUG_551_data() { generic_data("QOCI"); } void QTBUG_551(); + void QTBUG_5251_data() { generic_data("QPSQL"); } + void QTBUG_5251(); + private: // returns all database connections void generic_data(const QString &engine=QString()); @@ -2901,5 +2905,35 @@ void tst_QSqlQuery::QTBUG_551() QCOMPARE(res_outLst[2].toString(), QLatin1String("3. Value is 2")); } +void tst_QSqlQuery::QTBUG_5251() +{ + QFETCH( QString, dbName ); + QSqlDatabase db = QSqlDatabase::database( dbName ); + CHECK_DATABASE( db ); + + if (!db.driverName().startsWith( "QPSQL" )) return; + + QSqlQuery q(db); + q.exec("DROP TABLE " + qTableName("timetest")); + QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("timetest") + " (t TIME)")); + QVERIFY_SQL(q, exec("INSERT INTO " + qTableName("timetest") + " VALUES ('1:2:3.666')")); + + QSqlTableModel timetestModel(0,db); + timetestModel.setEditStrategy(QSqlTableModel::OnManualSubmit); + timetestModel.setTable(qTableName("timetest")); + QVERIFY_SQL(timetestModel, select()); + + QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("01:02:03.666")); + QVERIFY_SQL(timetestModel,setData(timetestModel.index(0, 0), QTime(0,12,34,500))); + QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:12:34.500")); + QVERIFY_SQL(timetestModel, submitAll()); + QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:12:34.500")); + + QVERIFY_SQL(q, exec("UPDATE " + qTableName("timetest") + " SET t = '0:11:22.33'")); + QVERIFY_SQL(timetestModel, select()); + QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:11:22.330")); + +} + QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index cb24a9f..8c840cd 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -86,6 +86,7 @@ private slots: void escapedRelations(); void escapedTableName(); void whiteSpaceInIdentifiers(); + void psqlSchemaTest(); private: void dropTestTables( QSqlDatabase db ); @@ -150,10 +151,11 @@ void tst_QSqlRelationalTableModel::initTestCase() if (db.driverName().startsWith("QIBASE")) db.exec("SET DIALECT 3"); else if (tst_Databases::isSqlServer(db)) { - QSqlQuery q(db); - QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON")); - QVERIFY_SQL(q, exec("SET IMPLICIT_TRANSACTIONS OFF")); + db.exec("SET ANSI_DEFAULTS ON"); + db.exec("SET IMPLICIT_TRANSACTIONS OFF"); } + else if(tst_Databases::isPostgreSQL(db)) + db.exec("set client_min_messages='warning'"); recreateTestTables(db); } } @@ -181,6 +183,9 @@ void tst_QSqlRelationalTableModel::dropTestTables( QSqlDatabase db ) << qTableName("CASETEST1" ) << qTableName("casetest1" ); tst_Databases::safeDropTables( db, tableNames ); + + db.exec("DROP SCHEMA "+qTableName("QTBUG_5373")+" CASCADE"); + db.exec("DROP SCHEMA "+qTableName("QTBUG_5373_s2")+" CASCADE"); } void tst_QSqlRelationalTableModel::init() @@ -1118,8 +1123,8 @@ void tst_QSqlRelationalTableModel::escapedTableName() } } -void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers() { - +void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers() +{ QFETCH_GLOBAL(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); @@ -1193,5 +1198,26 @@ void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers() { QCOMPARE(model.data(model.index(0, 2)).toInt(), 6); } +void tst_QSqlRelationalTableModel::psqlSchemaTest() +{ + QFETCH_GLOBAL(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + if(!tst_Databases::isPostgreSQL(db)) { + QSKIP("Postgresql specific test", SkipSingle); + return; + } + QSqlRelationalTableModel model(0, db); + QSqlQuery q(db); + QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373"))); + QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373_s2"))); + QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373")+"."+qTableName("user")+"(userid int primary key, relatingid int)")); + QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373_s2")+"."+qTableName("user2")+"(userid2 int primary key, username2 char(40))")); + model.setTable(qTableName("QTBUG_5373")+"."+qTableName("user")); + model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2")+"."+qTableName("user2"), "userid2", "username2")); + QVERIFY_SQL(model, select()); +} + QTEST_MAIN(tst_QSqlRelationalTableModel) #include "tst_qsqlrelationaltablemodel.moc" diff --git a/tests/auto/qtextscriptengine/generate/generate.pro b/tests/auto/qtextscriptengine/generate/generate.pro index 355633d..354e0e5 100644 --- a/tests/auto/qtextscriptengine/generate/generate.pro +++ b/tests/auto/qtextscriptengine/generate/generate.pro @@ -5,6 +5,7 @@ TEMPLATE = app CONFIG -= moc INCLUDEPATH += . /usr/include/freetype2 +INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src # Input SOURCES += main.cpp diff --git a/tests/auto/qtextscriptengine/generate/main.cpp b/tests/auto/qtextscriptengine/generate/main.cpp index 853c726..15fbc47 100644 --- a/tests/auto/qtextscriptengine/generate/main.cpp +++ b/tests/auto/qtextscriptengine/generate/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtTest/QtTest> +#include <QApplication> #include <QTextEdit> #include <QLineEdit> #include <QVBoxLayout> @@ -85,7 +85,7 @@ void MyEdit::setText(const QString &str) result += "0x" + QString::number(str.at(i).unicode(), 16) + ", "; result += "0x0 },\n { "; for (int i = 0; i < e->layoutData->items[0].num_glyphs; ++i) - result += "0x" + QString::number(e->layoutData->glyphPtr[i].glyph, 16) + ", "; + result += "0x" + QString::number(e->layoutData->glyphLayout.glyphs[i], 16) + ", "; result += "0x0 } }"; setPlainText(result); diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index 226348a..78e0ce6 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -98,7 +98,7 @@ private slots: void telugu(); void kannada(); void malayalam(); - // sinhala missing + void sinhala(); void khmer(); void linearB(); @@ -379,7 +379,11 @@ void tst_QTextScriptEngine::bengali() { 0x151, 0x276, 0x172, 0x143, 0x0 } }, { { 0x9b0, 0x9cd, 0x995, 0x9be, 0x983, 0x0 }, { 0x151, 0x276, 0x172, 0x144, 0x0 } }, - + // test decomposed two parts matras + { { 0x995, 0x9c7, 0x9be, 0x0 }, + { 0x179, 0x151, 0x172, 0x0 } }, + { { 0x995, 0x9c7, 0x9d7, 0x0 }, + { 0x179, 0x151, 0x17e, 0x0 } }, { {0}, {0} } }; @@ -502,16 +506,16 @@ void tst_QTextScriptEngine::bengali() if (QFontDatabase().families(QFontDatabase::Bengali).contains("Likhan")) { QFont f("Likhan"); const ShapeTable shape_table [] = { - { { 0x09a8, 0x09cd, 0x09af, 0x0 }, - { 0x0192, 0x0 } }, + { { 0x9a8, 0x9cd, 0x9af, 0x0 }, + { 0x1ca, 0x0 } }, { { 0x09b8, 0x09cd, 0x09af, 0x0 }, - { 0x01d6, 0x0 } }, + { 0x020e, 0x0 } }, { { 0x09b6, 0x09cd, 0x09af, 0x0 }, - { 0x01bc, 0x0 } }, + { 0x01f4, 0x0 } }, { { 0x09b7, 0x09cd, 0x09af, 0x0 }, - { 0x01c6, 0x0 } }, + { 0x01fe, 0x0 } }, { { 0x09b0, 0x09cd, 0x09a8, 0x09cd, 0x200d, 0x0 }, - { 0xd3, 0x12f, 0x0 } }, + { 0x10b, 0x167, 0x0 } }, { {0}, {0} } }; @@ -647,6 +651,12 @@ void tst_QTextScriptEngine::tamil() { 0x0025, 0x0 } }, { { 0x0b83, 0x0b95, 0x0 }, { 0x0025, 0x0031, 0x0 } }, + { { 0xb95, 0xbc6, 0xbbe, 0x0 }, + { 0xa, 0x31, 0x7, 0x0 } }, + { { 0xb95, 0xbc7, 0xbbe, 0x0 }, + { 0xb, 0x31, 0x7, 0x0 } }, + { { 0xb95, 0xbc6, 0xbd7, 0x0 }, + { 0xa, 0x31, 0x40, 0x0 } }, { {0}, {0} } }; @@ -694,7 +704,9 @@ void tst_QTextScriptEngine::telugu() { 0xe6, 0xb3, 0x83, 0x0 } }, { { 0xc15, 0xc4d, 0xc30, 0xc48, 0x0 }, { 0xe6, 0xb3, 0x9f, 0x0 } }, - { {0}, {0} } + { { 0xc15, 0xc46, 0xc56, 0x0 }, + { 0xe6, 0xb3, 0x0 } }, + { {0}, {0} } }; @@ -762,7 +774,16 @@ void tst_QTextScriptEngine::kannada() { 0x00b0, 0x006c, 0x0 } }, { { 0x0cb7, 0x0ccd, 0x0 }, { 0x0163, 0x0 } }, - + { { 0xc95, 0xcbf, 0xcd5, 0x0 }, + { 0x114, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x73, 0x0 } }, + { { 0xc95, 0xcc6, 0xcd6, 0x0 }, + { 0x90, 0x6c, 0x74, 0x0 } }, + { { 0xc95, 0xcc6, 0xcc2, 0x0 }, + { 0x90, 0x6c, 0x69, 0x0 } }, + { { 0xc95, 0xcca, 0xcd5, 0x0 }, + { 0x90, 0x6c, 0x69, 0x73, 0x0 } }, { {0}, {0} } }; @@ -816,8 +837,14 @@ void tst_QTextScriptEngine::malayalam() { 0x009e, 0x0 } }, { { 0x0d30, 0x0d4d, 0x200d, 0x0 }, { 0x009e, 0x0 } }, - - + { { 0xd15, 0xd46, 0xd3e, 0x0 }, + { 0x5e, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd47, 0xd3e, 0x0 }, + { 0x5f, 0x34, 0x58, 0x0 } }, + { { 0xd15, 0xd46, 0xd57, 0x0 }, + { 0x5e, 0x34, 0x65, 0x0 } }, + { { 0xd15, 0xd57, 0x0 }, + { 0x34, 0x65, 0x0 } }, { {0}, {0} } }; @@ -836,6 +863,42 @@ void tst_QTextScriptEngine::malayalam() #endif } +void tst_QTextScriptEngine::sinhala() +{ +#if defined(Q_WS_X11) + { + if (QFontDatabase().families(QFontDatabase::Sinhala).contains("Malithi Web")) { + QFont f("Malithi Web"); + const ShapeTable shape_table [] = { + { { 0xd9a, 0xdd9, 0xdcf, 0x0 }, + { 0x4a, 0x61, 0x42, 0x0 } }, + { { 0xd9a, 0xdd9, 0xddf, 0x0 }, + { 0x4a, 0x61, 0x50, 0x0 } }, + { { 0xd9a, 0xdd9, 0xdca, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddc, 0xdca, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { { 0xd9a, 0xdda, 0x0 }, + { 0x4a, 0x62, 0x0 } }, + { { 0xd9a, 0xddd, 0x0 }, + { 0x4a, 0x61, 0x42, 0x41, 0x0 } }, + { {0}, {0} } + }; + + + const ShapeTable *s = shape_table; + while (s->unicode[0]) { + QVERIFY( shaping(f, s) ); + ++s; + } + } else { + QSKIP("couln't find Malithi Web", SkipAll); + } + } +#else + QSKIP("X11 specific test", SkipAll); +#endif +} void tst_QTextScriptEngine::khmer() diff --git a/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp b/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp index cb6bd4d..c19deb6 100644 --- a/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp +++ b/tests/auto/qxmlnodemodelindex/tst_qxmlnodemodelindex.cpp @@ -178,7 +178,7 @@ void tst_QXmlNodeModelIndex::model() const /* Check default value. */ { const QXmlNodeModelIndex index; - QCOMPARE(index.model(), static_cast<void *>(0)); + QCOMPARE(index.model(), static_cast<const QAbstractXmlNodeModel *>(0)); } } diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index 8a9d4ef..49f2b08 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -345,8 +345,8 @@ void tst_QXmlQuery::copyConstructor() const query1.setInitialTemplateName(name); const QXmlQuery query2(query1); - QCOMPARE(query2.messageHandler(), &silencer); - QCOMPARE(query2.uriResolver(), &resolver); + QCOMPARE(query2.messageHandler(), static_cast<QAbstractMessageHandler *>(&silencer)); + QCOMPARE(query2.uriResolver(), static_cast<const QAbstractUriResolver *>(&resolver)); QCOMPARE(query2.queryLanguage(), QXmlQuery::XSLT20); QCOMPARE(query2.initialTemplateName(), name); QCOMPARE(query2.networkAccessManager(), &networkManager); @@ -522,7 +522,7 @@ void tst_QXmlQuery::assignmentOperator() const QVERIFY(copy.isValid()); QCOMPARE(copy.uriResolver(), static_cast<const QAbstractUriResolver *>(&returnURI)); - QCOMPARE(copy.messageHandler(), &silencer); + QCOMPARE(copy.messageHandler(), static_cast<QAbstractMessageHandler *>(&silencer)); QCOMPARE(testName.localName(copy.namePool()), QString::fromLatin1("somethingToCheck")); QXmlResultItems result; @@ -559,7 +559,7 @@ void tst_QXmlQuery::assignmentOperator() const /* Check that the copy picked up the new things. */ QVERIFY(copy.isValid()); QCOMPARE(copy.uriResolver(), static_cast<const QAbstractUriResolver *>(&secondUriResolver)); - QCOMPARE(copy.messageHandler(), &secondSilencer); + QCOMPARE(copy.messageHandler(), static_cast<QAbstractMessageHandler *>(&secondSilencer)); QXmlResultItems resultCopy; copy.evaluateTo(&resultCopy); @@ -577,7 +577,7 @@ void tst_QXmlQuery::assignmentOperator() const /* Check that the original is unchanged. */ QVERIFY(original.isValid()); QCOMPARE(original.uriResolver(), static_cast<const QAbstractUriResolver *>(&returnURI)); - QCOMPARE(original.messageHandler(), &silencer); + QCOMPARE(original.messageHandler(), static_cast<QAbstractMessageHandler *>(&silencer)); QXmlResultItems resultOriginal; original.evaluateTo(&resultOriginal); @@ -931,7 +931,7 @@ void tst_QXmlQuery::setMessageHandler() const QXmlQuery query; MessageSilencer silencer; query.setMessageHandler(&silencer); - QCOMPARE(&silencer, query.messageHandler()); + QCOMPARE(static_cast<QAbstractMessageHandler *>(&silencer), query.messageHandler()); } void tst_QXmlQuery::evaluateToReceiver() @@ -1691,7 +1691,7 @@ void tst_QXmlQuery::setUriResolver() const TestURIResolver resolver; QXmlQuery query; query.setUriResolver(&resolver); - QCOMPARE(query.uriResolver(), &resolver); + QCOMPARE(query.uriResolver(), static_cast<const QAbstractUriResolver *>(&resolver)); } } diff --git a/tests/auto/qxmlschema/tst_qxmlschema.cpp b/tests/auto/qxmlschema/tst_qxmlschema.cpp index 79f5587..ec91f88 100644 --- a/tests/auto/qxmlschema/tst_qxmlschema.cpp +++ b/tests/auto/qxmlschema/tst_qxmlschema.cpp @@ -357,7 +357,7 @@ void tst_QXmlSchema::messageHandler() const QXmlSchema schema; schema.setMessageHandler(&handler); - QCOMPARE(schema.messageHandler(), &handler); + QCOMPARE(schema.messageHandler(), static_cast<QAbstractMessageHandler *>(&handler)); } } @@ -394,7 +394,7 @@ void tst_QXmlSchema::uriResolver() const QXmlSchema schema; schema.setUriResolver(&resolver); - QCOMPARE(schema.uriResolver(), &resolver); + QCOMPARE(schema.uriResolver(), static_cast<const QAbstractUriResolver *>(&resolver)); } } diff --git a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp index 519f864..9fc784b 100644 --- a/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp +++ b/tests/auto/qxmlschemavalidator/tst_qxmlschemavalidator.cpp @@ -149,8 +149,8 @@ void tst_QXmlSchemaValidator::propertyInitialization() const schema.setNetworkAccessManager(&manager); QXmlSchemaValidator validator(schema); - QCOMPARE(validator.messageHandler(), &handler); - QCOMPARE(validator.uriResolver(), &resolver); + QCOMPARE(validator.messageHandler(), static_cast<QAbstractMessageHandler *>(&handler)); + QCOMPARE(validator.uriResolver(), static_cast<const QAbstractUriResolver *>(&resolver)); QCOMPARE(validator.networkAccessManager(), &manager); } } @@ -384,7 +384,7 @@ void tst_QXmlSchemaValidator::messageHandler() const QXmlSchemaValidator validator(schema); validator.setMessageHandler(&handler); - QCOMPARE(validator.messageHandler(), &handler); + QCOMPARE(validator.messageHandler(), static_cast<QAbstractMessageHandler *>(&handler)); } /* Test that we return the message handler that was set, even if the schema changed in between. */ @@ -399,7 +399,7 @@ void tst_QXmlSchemaValidator::messageHandler() const const QXmlSchema schema2; validator.setSchema(schema2); - QCOMPARE(validator.messageHandler(), &handler); + QCOMPARE(validator.messageHandler(), static_cast<QAbstractMessageHandler *>(&handler)); } } @@ -452,7 +452,7 @@ void tst_QXmlSchemaValidator::uriResolver() const QXmlSchemaValidator validator(schema); validator.setUriResolver(&resolver); - QCOMPARE(validator.uriResolver(), &resolver); + QCOMPARE(validator.uriResolver(), static_cast<const QAbstractUriResolver *>(&resolver)); } /* Test that we return the uri resolver that was set, even if the schema changed in between. */ @@ -467,7 +467,7 @@ void tst_QXmlSchemaValidator::uriResolver() const const QXmlSchema schema2; validator.setSchema(schema2); - QCOMPARE(validator.uriResolver(), &resolver); + QCOMPARE(validator.uriResolver(), static_cast<const QAbstractUriResolver *>(&resolver)); } } diff --git a/tests/auto/qxmlserializer/tst_qxmlserializer.cpp b/tests/auto/qxmlserializer/tst_qxmlserializer.cpp index aeca140..51044ff 100644 --- a/tests/auto/qxmlserializer/tst_qxmlserializer.cpp +++ b/tests/auto/qxmlserializer/tst_qxmlserializer.cpp @@ -148,7 +148,7 @@ void tst_QXmlSerializer::outputDevice() const { const QXmlQuery query; const QXmlSerializer serializer(query, &file); - QCOMPARE(serializer.outputDevice(), &file); + QCOMPARE(serializer.outputDevice(), static_cast< QIODevice *>(&file)); } } @@ -158,7 +158,7 @@ void tst_QXmlSerializer::serializationError() const QXmlQuery query; MessageSilencer silencer; query.setMessageHandler(&silencer); - + query.setQuery(queryString); QByteArray output; diff --git a/tests/auto/xmlpatterns.pri b/tests/auto/xmlpatterns.pri index 7cdd67f..8c8ccad 100644 --- a/tests/auto/xmlpatterns.pri +++ b/tests/auto/xmlpatterns.pri @@ -15,8 +15,9 @@ QT -= gui XMLPATTERNS_SDK = QtXmlPatternsSDK if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { - win32:XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}d - else: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}_debug + symbian: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK} + else:win32: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}d + else: XMLPATTERNS_SDK = $${XMLPATTERNS_SDK}_debug } INCLUDEPATH += \ diff --git a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp index 0dcb070..22f6693 100644 --- a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp +++ b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp @@ -48,6 +48,10 @@ #include "../qxmlquery/TestFundament.h" #include "../network-settings.h" +#if defined(Q_OS_SYMBIAN) +#define SRCDIR "" +#endif + /*! \class tst_XmlPatterns \internal @@ -130,6 +134,8 @@ void tst_XmlPatterns::xquerySupport() #ifdef Q_OS_WINCE QSKIP("WinCE: This test uses unsupported WinCE functionality", SkipAll); +#elif defined(Q_OS_SYMBIAN) + QSKIP("Symbian: This test uses unsupported Symbian functionality (QProcess with std streams)", SkipAll); #endif QFETCH(int, expectedExitCode); @@ -218,7 +224,7 @@ void tst_XmlPatterns::xquerySupport() void tst_XmlPatterns::xquerySupport_data() const { -#ifdef Q_OS_WINCE +#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) return; #endif @@ -849,6 +855,8 @@ void tst_XmlPatterns::xsltSupport_data() const #ifdef Q_OS_WINCE QSKIP("WinCE: This test uses unsupported WinCE functionality", SkipAll); +#elif defined(Q_OS_SYMBIAN) + QSKIP("Symbian: This test uses unsupported Symbian functionality (QProcess with std streams)", SkipAll); #endif QTest::addColumn<int>("expectedExitCode"); diff --git a/tests/auto/xmlpatterns/xmlpatterns.pro b/tests/auto/xmlpatterns/xmlpatterns.pro index 01e3b2b..54dd9aa 100644 --- a/tests/auto/xmlpatterns/xmlpatterns.pro +++ b/tests/auto/xmlpatterns/xmlpatterns.pro @@ -2,10 +2,10 @@ load(qttest_p4) SOURCES += tst_xmlpatterns.cpp \ ../qxmlquery/TestFundament.cpp -!wince* { -DEFINES += SRCDIR=\\\"$$PWD/\\\" -} else { +wince* { DEFINES += SRCDIR=\\\"./\\\" +} else:!symbian { +DEFINES += SRCDIR=\\\"$$PWD/\\\" } include (../xmlpatterns.pri) diff --git a/tests/auto/xmlpatternsdiagnosticsts/test/test.pro b/tests/auto/xmlpatternsdiagnosticsts/test/test.pro index aeff896..acd71e4 100644 --- a/tests/auto/xmlpatternsdiagnosticsts/test/test.pro +++ b/tests/auto/xmlpatternsdiagnosticsts/test/test.pro @@ -25,8 +25,8 @@ INCLUDEPATH += $$(QTSRCDIR)/tests/auto/xmlpatternsxqts/lib/ \ ../../xmlpatternsxqts/test \ ../../xmlpatternsxqts/lib -wince*: { - catalog.sources = TestSuite Baseline.xml +wince*|symbian { + catalog.sources = ../TestSuite ../Baseline.xml catalog.path = . DEPLOYMENT += catalog } diff --git a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro index bcc988a..0f55078 100644 --- a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro +++ b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro @@ -11,8 +11,9 @@ SOURCES += ../xmlpatternsxqts/test/tst_suitetest.cpp PATTERNIST_SDK = QtXmlPatternsSDK if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { - win32:PATTERNIST_SDK = $${PATTERNIST_SDK}d - else: PATTERNIST_SDK = $${PATTERNIST_SDK}_debug + symbian: PATTERNIST_SDK = $${PATTERNIST_SDK} + else:win32: PATTERNIST_SDK = $${PATTERNIST_SDK}d + else: PATTERNIST_SDK = $${PATTERNIST_SDK}_debug } LIBS += -l$$PATTERNIST_SDK diff --git a/tests/auto/xmlpatternsxqts/lib/Global.h b/tests/auto/xmlpatternsxqts/lib/Global.h index eadb940..a620417 100644 --- a/tests/auto/xmlpatternsxqts/lib/Global.h +++ b/tests/auto/xmlpatternsxqts/lib/Global.h @@ -47,7 +47,7 @@ #include "private/qitem_p.h" #include "private/qnamepool_p.h" -#ifdef Q_WS_WIN +#if defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) # ifdef Q_PATTERNISTSDK_BUILDING #define Q_PATTERNISTSDK_EXPORT __declspec(dllexport) #else diff --git a/tests/auto/xmlpatternsxqts/lib/lib.pro b/tests/auto/xmlpatternsxqts/lib/lib.pro index cb9453a..f5b0a06 100644 --- a/tests/auto/xmlpatternsxqts/lib/lib.pro +++ b/tests/auto/xmlpatternsxqts/lib/lib.pro @@ -13,6 +13,12 @@ mac { INSTALLS += target } +symbian { + TARGET.EPOCALLOWDLLDATA=1 + TARGET.CAPABILITY = All -Tcb + MMP_RULES += EXPORTUNFROZEN +} + # We add gui, because xmlpatterns.pri pull it out. QT += xmlpatterns xml network testlib gui diff --git a/tests/manual/gestures/graphicsview/gestures.cpp b/tests/manual/gestures/graphicsview/gestures.cpp index 5416457..4c21712 100644 --- a/tests/manual/gestures/graphicsview/gestures.cpp +++ b/tests/manual/gestures/graphicsview/gestures.cpp @@ -45,41 +45,41 @@ Qt::GestureType ThreeFingerSlideGesture::Type = Qt::CustomGesture; -QGesture *ThreeFingerSlideGestureRecognizer::createGesture(QObject *) +QGesture *ThreeFingerSlideGestureRecognizer::create(QObject *) { return new ThreeFingerSlideGesture; } -QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { ThreeFingerSlideGesture *d = static_cast<ThreeFingerSlideGesture *>(state); QGestureRecognizer::Result result; switch (event->type()) { case QEvent::TouchBegin: - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; case QEvent::TouchEnd: if (d->gestureFired) - result = QGestureRecognizer::GestureFinished; + result = QGestureRecognizer::FinishGesture; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; case QEvent::TouchUpdate: if (d->state() != Qt::NoGesture) { QTouchEvent *ev = static_cast<QTouchEvent*>(event); if (ev->touchPoints().size() == 3) { d->gestureFired = true; - result = QGestureRecognizer::GestureTriggered; + result = QGestureRecognizer::TriggerGesture; } else { - result = QGestureRecognizer::MaybeGesture; + result = QGestureRecognizer::MayBeGesture; for (int i = 0; i < ev->touchPoints().size(); ++i) { const QTouchEvent::TouchPoint &pt = ev->touchPoints().at(i); const int distance = (pt.pos().toPoint() - pt.startPos().toPoint()).manhattanLength(); if (distance > 20) { - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; } } } } else { - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; } break; @@ -89,7 +89,7 @@ QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::filterEvent(QGestu if (d->state() != Qt::NoGesture) result = QGestureRecognizer::Ignore; else - result = QGestureRecognizer::NotGesture; + result = QGestureRecognizer::CancelGesture; break; default: result = QGestureRecognizer::Ignore; @@ -105,12 +105,12 @@ void ThreeFingerSlideGestureRecognizer::reset(QGesture *state) } -QGesture *RotateGestureRecognizer::createGesture(QObject *) +QGesture *RotateGestureRecognizer::create(QObject *) { return new QGesture; } -QGestureRecognizer::Result RotateGestureRecognizer::filterEvent(QGesture *, QObject *, QEvent *event) +QGestureRecognizer::Result RotateGestureRecognizer::recognize(QGesture *, QObject *, QEvent *event) { switch (event->type()) { case QEvent::TouchBegin: diff --git a/tests/manual/gestures/graphicsview/gestures.h b/tests/manual/gestures/graphicsview/gestures.h index 6140b12..8a31b71 100644 --- a/tests/manual/gestures/graphicsview/gestures.h +++ b/tests/manual/gestures/graphicsview/gestures.h @@ -59,8 +59,8 @@ public: class ThreeFingerSlideGestureRecognizer : public QGestureRecognizer { private: - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; @@ -70,8 +70,8 @@ public: RotateGestureRecognizer(); private: - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture *create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp index de92afe..f8433b5 100644 --- a/tests/manual/gestures/graphicsview/main.cpp +++ b/tests/manual/gestures/graphicsview/main.cpp @@ -66,11 +66,11 @@ protected: default: qDebug("view: Pan: <unknown state>"); break; } - const QPointF offset = pan->offset(); + const QPointF delta = pan->delta(); QScrollBar *vbar = verticalScrollBar(); QScrollBar *hbar = horizontalScrollBar(); - vbar->setValue(vbar->value() - offset.y()); - hbar->setValue(hbar->value() - offset.x()); + vbar->setValue(vbar->value() - delta.y()); + hbar->setValue(hbar->value() - delta.x()); ge->accept(pan); return true; } @@ -152,8 +152,8 @@ private: MainWindow::MainWindow() { - (void)QApplication::registerGestureRecognizer(new MousePanGestureRecognizer); - ThreeFingerSlideGesture::Type = QApplication::registerGestureRecognizer(new ThreeFingerSlideGestureRecognizer); + (void)QGestureRecognizer::registerRecognizer(new MousePanGestureRecognizer); + ThreeFingerSlideGesture::Type = QGestureRecognizer::registerRecognizer(new ThreeFingerSlideGestureRecognizer); tabWidget = new QTabWidget; diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp index 6cdbe12..82adfbd 100644 --- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp @@ -51,12 +51,12 @@ MousePanGestureRecognizer::MousePanGestureRecognizer() { } -QGesture* MousePanGestureRecognizer::createGesture(QObject *) +QGesture* MousePanGestureRecognizer::create(QObject *) { return new QPanGesture; } -QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result MousePanGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { QPanGesture *g = static_cast<QPanGesture *>(state); QPoint globalPos; @@ -78,23 +78,19 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick || event->type() == QEvent::GraphicsSceneMousePress || event->type() == QEvent::GraphicsSceneMouseDoubleClick) { g->setHotSpot(globalPos); - g->setProperty("lastPos", globalPos); + g->setProperty("startPos", globalPos); g->setProperty("pressed", QVariant::fromValue<bool>(true)); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } else if (event->type() == QEvent::MouseMove || event->type() == QEvent::GraphicsSceneMouseMove) { if (g->property("pressed").toBool()) { - QPoint pos = globalPos; - QPoint lastPos = g->property("lastPos").toPoint(); + QPoint offset = globalPos - g->property("startPos").toPoint(); g->setLastOffset(g->offset()); - lastPos = pos - lastPos; - g->setOffset(QPointF(lastPos.x(), lastPos.y())); - g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y())); - g->setProperty("lastPos", pos); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + g->setOffset(QPointF(offset.x(), offset.y())); + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } - return QGestureRecognizer::NotGesture; + return QGestureRecognizer::CancelGesture; } else if (event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::GraphicsSceneMouseRelease) { - return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint; } return QGestureRecognizer::Ignore; } @@ -102,11 +98,10 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat void MousePanGestureRecognizer::reset(QGesture *state) { QPanGesture *g = static_cast<QPanGesture *>(state); - g->setTotalOffset(QPointF()); g->setLastOffset(QPointF()); g->setOffset(QPointF()); g->setAcceleration(0); - g->setProperty("lastPos", QVariant()); + g->setProperty("startPos", QVariant()); g->setProperty("pressed", QVariant::fromValue<bool>(false)); QGestureRecognizer::reset(state); } diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h index b062fd0..6e04621 100644 --- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h +++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.h @@ -49,8 +49,8 @@ class MousePanGestureRecognizer : public QGestureRecognizer public: MousePanGestureRecognizer(); - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture* create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; diff --git a/tests/manual/gestures/scrollarea/main.cpp b/tests/manual/gestures/scrollarea/main.cpp index f90f6c6..4f33b28 100644 --- a/tests/manual/gestures/scrollarea/main.cpp +++ b/tests/manual/gestures/scrollarea/main.cpp @@ -50,7 +50,7 @@ public: ScrollArea(QWidget *parent = 0) : QScrollArea(parent), outside(false) { - viewport()->grabGesture(Qt::PanGesture); + viewport()->grabGesture(Qt::PanGesture, Qt::ReceivePartialGestures); } protected: @@ -73,11 +73,11 @@ protected: QPanGesture *pan = static_cast<QPanGesture *>(event->gesture(Qt::PanGesture)); if (pan) { switch(pan->state()) { - case Qt::GestureStarted: qDebug("area: Pan: started"); break; - case Qt::GestureFinished: qDebug("area: Pan: finished"); break; - case Qt::GestureCanceled: qDebug("area: Pan: canceled"); break; + case Qt::GestureStarted: qDebug() << this << "Pan: started"; break; + case Qt::GestureFinished: qDebug() << this << "Pan: finished"; break; + case Qt::GestureCanceled: qDebug() << this << "Pan: canceled"; break; case Qt::GestureUpdated: break; - default: qDebug("area: Pan: <unknown state>"); break; + default: qDebug() << this << "Pan: <unknown state>"; break; } if (pan->state() == Qt::GestureStarted) @@ -87,8 +87,8 @@ protected: if (outside) return; - const QPointF offset = pan->offset(); - const QPointF totalOffset = pan->totalOffset(); + const QPointF delta = pan->delta(); + const QPointF totalOffset = pan->offset(); QScrollBar *vbar = verticalScrollBar(); QScrollBar *hbar = horizontalScrollBar(); @@ -102,8 +102,8 @@ protected: outside = true; return; } - vbar->setValue(vbar->value() - offset.y()); - hbar->setValue(hbar->value() - offset.x()); + vbar->setValue(vbar->value() - delta.y()); + hbar->setValue(hbar->value() - delta.x()); event->accept(pan); } } @@ -134,11 +134,11 @@ protected: QPanGesture *pan = static_cast<QPanGesture *>(event->gesture(Qt::PanGesture)); if (pan) { switch (pan->state()) { - case Qt::GestureStarted: qDebug("slider: Pan: started"); break; - case Qt::GestureFinished: qDebug("slider: Pan: finished"); break; - case Qt::GestureCanceled: qDebug("slider: Pan: canceled"); break; + case Qt::GestureStarted: qDebug() << this << "Pan: started"; break; + case Qt::GestureFinished: qDebug() << this << "Pan: finished"; break; + case Qt::GestureCanceled: qDebug() << this << "Pan: canceled"; break; case Qt::GestureUpdated: break; - default: qDebug("slider: Pan: <unknown state>"); break; + default: qDebug() << this << "Pan: <unknown state>"; break; } if (pan->state() == Qt::GestureStarted) @@ -147,8 +147,8 @@ protected: event->ignore(pan); if (outside) return; - const QPointF offset = pan->offset(); - const QPointF totalOffset = pan->totalOffset(); + const QPointF delta = pan->delta(); + const QPointF totalOffset = pan->offset(); if (orientation() == Qt::Horizontal) { if ((value() == minimum() && totalOffset.x() < -10) || (value() == maximum() && totalOffset.x() > 10)) { @@ -156,7 +156,7 @@ protected: return; } if (totalOffset.y() < 40 && totalOffset.y() > -40) { - setValue(value() + offset.x()); + setValue(value() + delta.x()); event->accept(pan); } else { outside = true; @@ -168,7 +168,7 @@ protected: return; } if (totalOffset.x() < 40 && totalOffset.x() > -40) { - setValue(value() - offset.y()); + setValue(value() - delta.y()); event->accept(pan); } else { outside = true; @@ -186,6 +186,7 @@ public: MainWindow() { rootScrollArea = new ScrollArea; + rootScrollArea->setObjectName(QLatin1String("rootScrollArea")); setCentralWidget(rootScrollArea); QWidget *root = new QWidget; @@ -193,14 +194,17 @@ public: rootScrollArea->setWidget(root); Slider *verticalSlider = new Slider(Qt::Vertical, root); + verticalSlider->setObjectName(QLatin1String("verticalSlider")); verticalSlider ->move(650, 1100); Slider *horizontalSlider = new Slider(Qt::Horizontal, root); + horizontalSlider->setObjectName(QLatin1String("horizontalSlider")); horizontalSlider ->move(600, 1000); childScrollArea = new ScrollArea(root); + childScrollArea->setObjectName(QLatin1String("childScrollArea")); childScrollArea->move(500, 500); QWidget *w = new QWidget; - w->setMinimumWidth(400); + w->setMinimumWidth(700); QVBoxLayout *l = new QVBoxLayout(w); l->setMargin(20); for (int i = 0; i < 100; ++i) { @@ -211,6 +215,14 @@ public: l->addWidget(w); } childScrollArea->setWidget(w); +#if defined(Q_OS_WIN) + // Windows can force Qt to create a native window handle for an + // intermediate widget and that will block gesture to get touch events. + // So this hack to make sure gestures get all touch events they need. + foreach (QObject *w, children()) + if (w->isWidgetType()) + static_cast<QWidget *>(w)->setAttribute(Qt::WA_AcceptTouchEvents); +#endif } private: ScrollArea *rootScrollArea; @@ -220,7 +232,7 @@ private: int main(int argc, char **argv) { QApplication app(argc, argv); - app.registerGestureRecognizer(new MousePanGestureRecognizer); + QGestureRecognizer::registerRecognizer(new MousePanGestureRecognizer); MainWindow w; w.show(); return app.exec(); diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp index 63d3e76..66fcf18 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp @@ -49,34 +49,39 @@ MousePanGestureRecognizer::MousePanGestureRecognizer() { } -QGesture* MousePanGestureRecognizer::createGesture(QObject *) +QGesture *MousePanGestureRecognizer::create(QObject *) { return new QPanGesture; } -QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event) +QGestureRecognizer::Result MousePanGestureRecognizer::recognize(QGesture *state, QObject *, QEvent *event) { QPanGesture *g = static_cast<QPanGesture *>(state); + if (event->type() == QEvent::TouchBegin) { + // ignore the following mousepress event + g->setProperty("ignoreMousePress", QVariant::fromValue<bool>(true)); + } else if (event->type() == QEvent::TouchEnd) { + g->setProperty("ignoreMousePress", QVariant::fromValue<bool>(false)); + } QMouseEvent *me = static_cast<QMouseEvent *>(event); - if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick) { + if (event->type() == QEvent::MouseButtonPress) { + if (g->property("ignoreMousePress").toBool()) + return QGestureRecognizer::Ignore; g->setHotSpot(me->globalPos()); - g->setProperty("lastPos", me->globalPos()); + g->setProperty("startPos", me->globalPos()); g->setProperty("pressed", QVariant::fromValue<bool>(true)); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } else if (event->type() == QEvent::MouseMove) { if (g->property("pressed").toBool()) { - QPoint pos = me->globalPos(); - QPoint lastPos = g->property("lastPos").toPoint(); + QPoint offset = me->globalPos() - g->property("startPos").toPoint(); g->setLastOffset(g->offset()); - lastPos = pos - lastPos; - g->setOffset(QPointF(lastPos.x(), lastPos.y())); - g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y())); - g->setProperty("lastPos", pos); - return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint; + g->setOffset(QPointF(offset.x(), offset.y())); + return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint; } - return QGestureRecognizer::NotGesture; + return QGestureRecognizer::CancelGesture; } else if (event->type() == QEvent::MouseButtonRelease) { - return QGestureRecognizer::GestureFinished | QGestureRecognizer::ConsumeEventHint; + if (g->property("pressed").toBool()) + return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint; } return QGestureRecognizer::Ignore; } @@ -84,11 +89,11 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat void MousePanGestureRecognizer::reset(QGesture *state) { QPanGesture *g = static_cast<QPanGesture *>(state); - g->setTotalOffset(QPointF()); g->setLastOffset(QPointF()); g->setOffset(QPointF()); g->setAcceleration(0); - g->setProperty("lastPos", QVariant()); + g->setProperty("startPos", QVariant()); g->setProperty("pressed", QVariant::fromValue<bool>(false)); + g->setProperty("ignoreMousePress", QVariant::fromValue<bool>(false)); QGestureRecognizer::reset(state); } diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h index b062fd0..6e04621 100644 --- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h +++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.h @@ -49,8 +49,8 @@ class MousePanGestureRecognizer : public QGestureRecognizer public: MousePanGestureRecognizer(); - QGesture* createGesture(QObject *target); - QGestureRecognizer::Result filterEvent(QGesture *state, QObject *watched, QEvent *event); + QGesture* create(QObject *target); + QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event); void reset(QGesture *state); }; diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 2722b2f..62b4736 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -222,8 +222,8 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent) QVBoxLayout *vboxLayout = new QVBoxLayout(this); QString resourcePath = QLatin1String(":/trolltech/assistant/images/"); -#ifndef Q_OS_MAC vboxLayout->setMargin(0); +#ifndef Q_OS_MAC resourcePath.append(QLatin1String("win")); #else resourcePath.append(QLatin1String("mac")); diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index e2b7d58..95f271d 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3103,7 +3103,7 @@ void Configure::generateConfigfiles() if (tmpFile3.open()) { tmpStream.setDevice(&tmpFile3); tmpStream << "/* Evaluation license key */" << endl - << "static const char qt_eval_key_data [512 + 12] = \"" << licenseInfo["LICENSEKEYEXT"] << "\";" << endl; + << "static const char qt_eval_key_data [512 + 12] = \"qt_qevalkey=" << licenseInfo["LICENSEKEYEXT"] << "\";" << endl; tmpStream.flush(); tmpFile3.flush(); diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 7ceacb2..8c039eb 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -35,7 +35,7 @@ HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \ \ "<script type=\"text/javascript\" src=\"http://www.google.com/jsapi\"></script>" \ "<script type=\"text/javascript\">google.load(\"elements\", \"1\", {packages: \"transliteration\"});</script>" \ - "<script type=\"text/javascript\" src=\"http://www.google.com/coop/cse/t13n?form=cse-search-box&t13n_langs=en\"></script>" \ + "<script type=\"text/javascript\" src=\"http://www.google.com/coop/cse/t13n?form=cse-search-box&t13n_langs=en\"></script>" \ \ - "<script type=\"text/javascript\" src=\"http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en\"></script>"\ + "<script type=\"text/javascript\" src=\"http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en\"></script>"\ "</tr></table></div></address>" |