From a2a5a8c5e203fe9d55f9addba1533a30c6f2ba19 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 10 Jun 2010 18:54:11 +0200 Subject: Doc: Started organizing Symbian platform deployment information. Reviewed-by: Trust Me --- doc/src/deployment/deployment.qdoc | 27 ++++++++-- doc/src/external-resources.qdoc | 10 ++++ doc/src/platforms/symbian-introduction.qdoc | 76 +++++++++++++++++------------ 3 files changed, 78 insertions(+), 35 deletions(-) diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index 51974af..286c080 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -1472,8 +1472,10 @@ /*! \page deployment-symbian.html \contentspage Deploying Qt Applications + \ingroup qtsymbian + \title Deploying an Application on the Symbian Platform - \title Deploying an Application on the Symbian platform + \section1 Overview Applications are deployed to Symbian devices in signed \c .sis package files. The \c .sis file content is controlled with \c .pkg files. The \c .pkg file contains a set @@ -1483,10 +1485,17 @@ to end-users some changes are needed. This document describes what changes are typically needed and how to implement them. + \section1 Requirements + + Download the latest release of the Smart Installer from + \l{http://get.qt.nokia.com/nokiasmartinstaller/}, and install it on top + of the Qt package. + \section1 Static Linking - Qt for the Symbian platform does currently not support static linking of - Qt libraries. + Qt for the Symbian platform does not currently support static linking of + Qt libraries with application binaries. You will need to build shared + libraries as described below and link your application with them. \section1 Shared Libraries @@ -1532,7 +1541,7 @@ S60 3rd edition FP1, S60 3rd edition FP2 and S60 5th edition devices. Now we are ready to compile the application and create the application - deployment file. Run \c qmake to create Symbian specific makefiles, resources (\.rss) + deployment file. Run \c qmake to create Symbian specific makefiles, resources (\c .rss) and deployment packaging files (\c .pkg). And do build to create the application binaries and resources. @@ -1562,4 +1571,14 @@ For more information about creating a \c .sis file and installing it to device see also \l {The Symbian platform - Introduction to Qt#Installing your own applications}{here}. + \section1 Further Reading + + This document aims to cover the common case for developers who want to + deploy Qt applications on devices using the Smart Installer. It does not + aim to cover every possible way of installing applications, Qt and other + dependencies on a device. + + A wider selection of deployment methods is described in the + \l{Deploying a Qt Application article} on the Symbian Foundation + Developer Wiki. */ diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 249c10a1..6f22f00 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -427,3 +427,13 @@ \externalpage http://opensource.org/licenses/bsd-license.php \title New and Modified BSD Licenses */ + +/*! + \externalpage http://developer.symbian.org/wiki/index.php/Platform_Security_%28Fundamentals_of_Symbian_C%2B%2B%29#Self-Signed_Applications + \title Symbian Platform Security +*/ + +/*! + \externalpage http://developer.symbian.org/wiki/index.php/Deploying_a_Qt_Application + \title Deploying a Qt Application article +*/ diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 6ffc568..9563a8e 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -83,12 +83,12 @@ \tableofcontents - \section1 Required tools + \section1 Required Tools See \l{Qt for the Symbian platform Requirements} to see what tools are required to use Qt for the Symbian platform. - \section1 Installing Qt and running demos + \section1 Installing Qt and Running Demos Follow the instructions found in \l{Installing Qt on the Symbian platform from a Binary Package} to learn how to install Qt using a binary package and how to build and run Qt demos. @@ -96,7 +96,7 @@ Follow the instructions found in \l{Installing Qt on the Symbian platform} to learn how to install Qt using using source package and how to build and run the Qt demos. - \section1 Building your own applications + \section1 Building Your Own Applications If you are new to Qt development, have a look at \l{How to Learn Qt}. In general, the difference between developing a @@ -109,12 +109,19 @@ \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 0 For more information on how to use qmake have a look at the \l - {qmake Tutorial}. + {qmake Tutorial}. In particular, see the + \l{qmake Platform Notes#Symbian platform}{qmake Platform Notes} for + details of Symbian-specific build settings. Now you can build the Qt for the Symbian platform application with - standard build tools. By default, running \c make will produce binaries for - the emulator. However, the Symbian platform comes with several alternative - build targets, as shown in the table below: + standard build tools. + + \section2 Alternative Build Targets + + By default, running \c make will produce binaries for the emulator. + However, the Symbian platform comes with several alternative + build targets that can be used to create binaries for target hardware + and deploy them on devices, as shown in the table below: \table \row \o \c debug-winscw \o Build debug binaries for the emulator (default). @@ -144,19 +151,30 @@ To work on your project in Carbide, simply import the \c .pro file by right clicking on the project explorer and executing "Import...". - \section2 Smart Installer + \section1 Running Applications from the Command Line - The Smart Installer makes sure that deployed applications have all the Qt dependencies - they need to run on a device. + The application can be launched on the emulator using \c{make run} command. - Download the latest release of the Smart Installer from \l{http://get.qt.nokia.com/nokiasmartinstaller/}, - and install it on top of the Qt package. + The application can be launched on a device using \c{make runonphone} command. + When this command is invoked, a \c .sis file is first created as if \c{make sis} + command was invoked (see above for details). + \bold{Note:} Running the application on a device using this command requires + \c TRK application to be running on the device. - \section1 Installing your own applications + Additional environment variables that can be utilized with these commands are: + \table + \row \o \c QT_RUN_OPTIONS \o Any command line parameters you wish to pass + to your application. + \row \o \c QT_RUN_ON_PHONE_OPTIONS \o Options for runonphone application. + Execute \c runonphone from command line for + more information about available options. + \c{make runonphone} only. + \endtable + + \section1 Installing Your Own Applications To install your own applications on hardware, you need a signed \c .sis file. - (Refer to the \l{http://developer.symbian.org/wiki/index.php/Platform_Security_%28Fundamentals_of_Symbian_C%2B%2B%29#Self-Signed_Applications} - {Platform Security Article} for more informations about self-signing.) + (Refer to the \l{Symbian Platform Security} article for more informations about self-signing.) The signed \c .sis file can be created with \c make \c sis target. \c sis target is only supported for executables or projects with \c DEPLOYMENT statements. By default the \c sis target will create signed \c .sis file for last build @@ -214,23 +232,19 @@ \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 5 - \section1 Running applications from command line + \section1 Deployment and the Smart Installer - The application can be launched on the emulator using \c{make run} command. + Although some Symbian devices may already have a version of Qt installed + on them, there needs to be a way to ensure that an appropriate version + of Qt is available for your application to use. Rather than deploy the + required Qt libraries with your application, the preferred way to + package Qt applications for deployment is to download and use the Smart + Installer. - The application can be launched on a device using \c{make runonphone} command. - When this command is invoked, a \c .sis file is first created as if \c{make sis} - command was invoked (see above for details). - \bold{Note:} Running the application on a device using this command requires - \c TRK application to be running on the device. + The Smart Installer makes sure that deployed applications have all the + Qt dependencies they need to run on a device, performing the necessary + updates when the user installs the application. - Additional environment variables that can be utilized with these commands are: - \table - \row \o \c QT_RUN_OPTIONS \o Any command line parameters you wish to pass - to your application. - \row \o \c QT_RUN_ON_PHONE_OPTIONS \o Options for runonphone application. - Execute \c runonphone from command line for - more information about available options. - \c{make runonphone} only. - \endtable + More information about deployment can be found in the + \l{Deploying an Application on the Symbian Platform} document. */ -- cgit v0.12 From 4aab0b33e7c34677b530553bb0a5493aca6547a5 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 28 Jun 2010 18:42:41 +0200 Subject: Doc: Synchronize HTML templates for each language. Reviewed-by: Trust Me --- tools/qdoc3/test/qt-html-templates.qdocconf | 2 +- tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf | 14 +- tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf | 191 +++++++++++++++++++--- 3 files changed, 170 insertions(+), 37 deletions(-) diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 1fb000b..8708f1b 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -160,7 +160,7 @@ HTML.footer = " \n" \ "
\n" \ "
X
\n" \ "
\n" \ - "

\n" \ + "

\n" \ "

\n" \ "
\n" \ "
\n" \ diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf index 027548e..e2abd2a 100644 --- a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf @@ -160,19 +160,9 @@ HTML.footer = " \n" \ "
\n" \ "
X
\n" \ "
\n" \ - "

\n" \ + "

\n" \ "

\n" \ "
\n" \ "
\n" \ "
\n" \ - "
\n" \ - "\n" + " \n" diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf index 5fb68cf..e00bef9 100644 --- a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf @@ -1,25 +1,168 @@ -HTML.stylesheets = classic.css -HTML.postheader = "\n" \ - "\n" \ - "\n" \ - "" \ - "" \ - "
" \ - "" \ - "  " \ - "" \ - "主页 ·" \ - " " \ - "所有类 ·" \ - " " \ - "所有函数 ·" \ - " " \ - "简介" \ - "
" +HTML.stylesheets = style/style.css \ + style/OfflineStyle.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style_ie6.css -HTML.footer = "


\n" \ - "\n" \ - "\n" \ - "\n" \ - "\n" \ - "
版权所有 © 2010 诺基亚公司和/或其子公司商标
Qt \\version
" +HTML.postheader = "
\n" \ + "
\n" \ + "
\n" \ + " Home
\n" \ + " Qt Reference Documentation\n" \ + "
\n" \ + "
\n" \ + " \n" \ + "
\n" \ + "
\n" \ + "
\n" \ + " \n" \ + "
\n" \ + "
\n" \ + " \n" \ + "
\n" \ + " \n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "
\n" \ + " \n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "
\n" \ + " Search index:
\n" \ + "
\n" \ + "
\n" \ + "
\n" \ + " \n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "

\n" \ + " API Lookup

\n" \ + "
\n" \ + " \n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "

\n" \ + " Qt Topics

\n" \ + "
\n" \ + " \n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "

\n" \ + " Examples

\n" \ + "
\n" \ + " \n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "
    \n" \ + "
  • Home
  • \n" \ + " \n" + +HTML.postpostheader = "
\n" \ + "
\n" \ + "
\n" \ + " \n" \ + "
\n" \ + "
\n" \ + "
\n" + +HTML.footer = " \n" \ + "
\n" \ + " [+] Documentation Feedback
\n" \ + "
\n" \ + "
\n" \ + "
\n" \ + " \n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "

\n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

\n" \ + "

\n" \ + " All other trademarks are property of their respective owners. Privacy Policy

\n" \ + "
\n" \ + "
\n" \ + "
X
\n" \ + "
\n" \ + "

\n" \ + "

\n" \ + "
\n" \ + "
\n" \ + "
\n" \ + "
\n" -- cgit v0.12 From 08478207ee9a6563ae63ebcef833925db6426bd8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 30 Jun 2010 19:03:53 +0200 Subject: Doc: Made the Gestures Programming document more visible. Reviewed-by: Trust Me --- src/gui/kernel/qevent.cpp | 5 +++++ src/gui/kernel/qgesture.cpp | 28 +++++++++++++++++++++++----- src/gui/kernel/qgesturerecognizer.cpp | 3 +++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 92eed33..0c0eabb 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4281,6 +4281,11 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T QGestureEvent::accept() for each of them, or an event filter consumes the event. + \section1 Further Reading + + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + \sa QGesture, QGestureRecognizer, QWidget::grabGesture(), QGraphicsObject::grabGesture() */ diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index f5688f4..8264422 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -58,6 +58,9 @@ QT_BEGIN_NAMESPACE the QGestureRecognizer object that is registered with the application; see QGestureRecognizer::registerRecognizer(). + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + \section1 Gesture Properties The class has a list of properties that can be queried by the user to get @@ -218,7 +221,10 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const \image pangesture.png - \sa {Gestures Programming}, QPinchGesture, QSwipeGesture + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + + \sa QPinchGesture, QSwipeGesture */ /*! @@ -313,6 +319,9 @@ void QPanGesture::setAcceleration(qreal value) them closer together or further apart to change the scale factor, zoom, or level of detail of the user interface. + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + \image pinchgesture.png Instead of repeatedly applying the same pinching gesture, the user may @@ -321,7 +330,7 @@ void QPanGesture::setAcceleration(qreal value) will continue to be delivered to the target object, containing an instance of QPinchGesture in the Qt::GestureUpdated state. - \sa {Gestures Programming}, QPanGesture, QSwipeGesture + \sa QPanGesture, QSwipeGesture */ /*! @@ -571,7 +580,10 @@ void QPinchGesture::setRotationAngle(qreal value) \image swipegesture.png - \sa {Gestures Programming}, QPanGesture, QPinchGesture + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + + \sa QPanGesture, QPinchGesture */ /*! @@ -666,7 +678,10 @@ void QSwipeGesture::setSwipeAngle(qreal value) \brief The QTapGesture class describes a tap gesture made by the user. \ingroup gestures - \sa {Gestures Programming}, QPanGesture, QPinchGesture + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + + \sa QPanGesture, QPinchGesture */ /*! @@ -699,7 +714,10 @@ void QTapGesture::setPosition(const QPointF &value) gesture made by the user. \ingroup gestures - \sa {Gestures Programming}, QPanGesture, QPinchGesture + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + + \sa QPanGesture, QPinchGesture */ /*! diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp index 3e23bbf..e0e7784 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -62,6 +62,9 @@ QT_BEGIN_NAMESPACE need to use this class directly. Instances will be created behind the scenes by the framework. + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + \section1 Recognizing Gestures The process of recognizing gestures involves filtering input events sent to specific -- cgit v0.12 From bbc7aa139308ff304f2e4c2611ed57d855d00d80 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 16 Jul 2010 14:04:08 +0200 Subject: Doc: Fixed name clash. Reviewed-by: Trust Me --- doc/src/examples/qml-examples.qdoc | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index ce53677..db6e657 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -165,7 +165,6 @@ \image qml-layoutitem-example.png */ /*! - \title QGraphicsGridLayout \example declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout This example shows how to use QGraphicsGridLayout to lay out QML items. This is -- cgit v0.12 From 4ed51b7160471ae3a7db1fbb12a8f265ff7c3239 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 16 Jul 2010 14:06:50 +0200 Subject: Doc: Merged in some of Thomas Zander's suggestions. Reviewed-by: Trust Me --- doc/src/frameworks-technologies/gestures.qdoc | 49 +++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index 927df22..f7c8312 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -60,7 +60,8 @@ \section1 Using Standard Gestures with Widgets Gestures can be enabled for instances of QWidget and QGraphicsObject subclasses. - An object that accepts gesture input is referred to as a \e{target object}. + An object that accepts gesture input is referred to throughout the documentation + as a \e{target object}. To enable a gesture for a target object, call its QWidget::grabGesture() or QGraphicsObject::grabGesture() function with an argument describing the @@ -69,13 +70,57 @@ \snippet examples/gestures/imagegestures/imagewidget.cpp enable gestures - In the above code, the gesture is set up in the constructor of the target object + In the above code, the gestures are set up in the constructor of the target object itself. + \section1 Handling Events + When the user performs a gesture, QGestureEvent events will be delivered to the target object, and these can be handled by reimplementing the QWidget::event() handler function for widgets or QGraphicsItem::sceneEvent() for graphics objects. + As one target object can subscribe to more than one gesture type, the QGestureEvent + can contain more than one QGesture, indicating several possible gestures are active + at the same time. It is then up to the widget to determine how to handle those + multiple gestures and choose if some should be canceled in favor of others. + + Each QGesture contained within a QGestureEvent object can be accepted() or ignored() + individually, or all together. Additionally, you can query the individual QGesture + data objects (the state) using several getters. + + \section2 Standard Procedure for Event Handling + + A QGesture is by default accepted when it arrives at your widget. However, it is good + practice to always explicitly accept or reject a gesture. The general rule is that, if + you accept a gesture, you are using it. If you are ignoring it you are not interested + in it. Ignoring a gesture may mean it gets offered to another target object, or it will + get canceled. + + Each QGesture has several states it goes through; there is a well defined way to change + the state, typically the user input is the cause of state changes (by starting and + stopping interaction, for instance) but the widget can also cause state changes. + + The first time a particular QGesture is delivered to a widget or graphics item, it will + be in the Qt::GestureStarted state. The way you handle the gesture at this point + influences whether you can interact with it later. + + \list + \o Accepting the gesture means the widget acts on the gesture and there will follow + gestures with the Qt::GestureUpdatedstate. + \o Ignoring the gesture will mean the gesture will never be offered to you again. + It will be offered to a parent widget or item as well. + \o Calling setGestureCancelPolicy() on the gesture when it is in its starting state, + and is also accepted can cause other gestures to be canceled. + \endlist + + Using QGesture::CancelAllInContext to cancel a gesture will cause all gestures, in any + state, to be canceled unless they are explicitly accepted. This means that active + gestures on children will get canceled. It also means that gestures delivered in the + same QGestureEvent will get canceled if the widget ignores them. This can be a useful + way to filter out all gestures except the one you are interested in. + + \section2 Example Event Handling + For convenience, the \l{Image Gestures Example} reimplements the general \l{QWidget::}{event()} handler function and delegates gesture events to a specialized gestureEvent() function: -- cgit v0.12 From d59380458cce6fc52b6de91d8380b31d46c3f83f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 16 Jul 2010 14:09:11 +0200 Subject: Doc: Fixed QML documentation errors. Reviewed-by: Trust Me --- src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp | 2 +- src/declarative/graphicsitems/qdeclarativepathview.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp index 0342c9f..9dcba60 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -612,7 +612,7 @@ QAction* QDeclarativeWebView::stopAction() const #endif // QT_NO_ACTION /*! - \qmlproperty real WebView::title + \qmlproperty string WebView::title This property holds the title of the web page currently viewed By default, this property contains an empty string. diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index f4ebd13..1224c73 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -403,7 +403,7 @@ QDeclarativePathView::~QDeclarativePathView() The model provides a set of data that is used to create the items for the view. For large or dynamic datasets the model is usually provided by a C++ model object. - Models can also be created directly in XML, using the ListModel element. + Models can also be created directly in QML, using the ListModel element. \sa {qmlmodels}{Data Models} */ @@ -627,8 +627,8 @@ void QDeclarativePathViewPrivate::setOffset(qreal o) so as to stay with the current item. The below example demonstrates how to make a simple highlight. Note the use - of the PathView.onPath property to ensure that the highlight is hidden - when flicked off of the path. + of the \l{PathView::onPath}{PathView.onPath} attached property to ensure that + the highlight is hidden when flicked away from the path. \code Component { -- cgit v0.12 From e2fb9c4df301678719cb0cff78838b35435c3b38 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 16 Jul 2010 14:09:59 +0200 Subject: Doc: Fixed typo. Reviewed-by: Trust Me --- src/xmlpatterns/api/qabstractxmlnodemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp index 7f2ad9f..0f9760d 100644 --- a/src/xmlpatterns/api/qabstractxmlnodemodel.cpp +++ b/src/xmlpatterns/api/qabstractxmlnodemodel.cpp @@ -1355,7 +1355,7 @@ bool QXmlItem::isNull() const QAbstractXmlNodeModel for its existence, the only way you can create an instance of QXmlNodeModelIndex is by asking the node model to create one for you with QAbstractXmlNodeModel::createIndex(). Since - that function is protected, it is usually a good ide to write a + that function is protected, it is usually a good idea to write a public function that creates a QXmlNodeModelIndex from arguments that are appropriate for your particular node model. -- cgit v0.12 From 637d207e397c13c09a8dcbd718ee85bce2548e90 Mon Sep 17 00:00:00 2001 From: Frank Osterfeld Date: Thu, 5 Aug 2010 13:42:58 +0200 Subject: QDom: Do not crash on "text" "a:" is not a valid tagname. The function creating the element node notices that and returns 0, but the parser ignores it and continues, and then crashes later when processing the "text". This patch aborts the parsing immediately when creating the element node failed and fixes the crash. Merge-request: 2431 Reviewed-by: Olivier Goffart --- src/xml/dom/qdom.cpp | 6 ++++-- tests/auto/qdom/tst_qdom.cpp | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 1267e7e..662c796 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -7418,8 +7418,10 @@ bool QDomHandler::startElement(const QString& nsURI, const QString&, const QStri n = doc->createElement(qName); } - if (n) - n->setLocation(locator->lineNumber(), locator->columnNumber()); + if (!n) + return false; + + n->setLocation(locator->lineNumber(), locator->columnNumber()); node->appendChild(n); node = n; diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index 0f6cdaa..8bf7620 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -1776,6 +1776,7 @@ void tst_QDom::crashInSetContent() const QDomImplementation::setInvalidDataPolicy(QDomImplementation::ReturnNullNode); QDomDocument docImport; + QCOMPARE(docImport.setContent(QLatin1String("text"), true), false); QVERIFY(docImport.setContent(QLatin1String(""))); } -- cgit v0.12 From 15505360dc8e8b8f1343bba6fd3e5a9c95718d30 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Thu, 5 Aug 2010 13:43:19 +0200 Subject: Replace the SSE prologues by a macro Replace the code of the SSE prologue by a macro to avoid copying the prologue everywhere. Reviewed-by: Andreas Kling --- src/corelib/tools/qsimd_p.h | 4 +++- src/gui/painting/qdrawhelper_sse2.cpp | 14 ++++---------- src/gui/painting/qdrawingprimitive_sse2_p.h | 8 ++------ 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 5ff0f97..a3148fb 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -150,7 +150,9 @@ enum CPUFeatures { Q_CORE_EXPORT uint qDetectCPUFeatures(); -Q_CORE_EXPORT uint qDetectCPUFeatures(); + +#define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ + for (; i < static_cast(qMin(static_cast(length), ((4 - ((reinterpret_cast(ptr) >> 2) & 0x3)) & 0x3))); ++i) QT_END_NAMESPACE diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 7ab9eda..22c0384 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -112,9 +112,7 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, int x = 0; // First, align dest to 16 bytes: - const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast(dst) >> 2) & 0x3)) & 0x3; - const int prologLength = qMin(w, offsetToAlignOn16Bytes); - for (; x < prologLength; ++x) { + ALIGNMENT_PROLOGUE_16BYTES(dst, x, w) { quint32 s = src[x]; s = BYTE_MUL(s, const_alpha); dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha); @@ -182,12 +180,10 @@ inline int comp_func_Plus_one_pixel(uint d, const uint s) void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha) { int x = 0; - const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast(dst) >> 2) & 0x3)) & 0x3; - const int prologLength = qMin(length, offsetToAlignOn16Bytes); if (const_alpha == 255) { // 1) Prologue: align destination on 16 bytes - for (; x < prologLength; ++x) + ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]); // 2) composition with SSE2 @@ -208,7 +204,7 @@ void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uin const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha); // 1) Prologue: align destination on 16 bytes - for (; x < prologLength; ++x) + ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha); const __m128i half = _mm_set1_epi16(0x80); @@ -239,9 +235,7 @@ void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, u int x = 0; // 1) prologue, align on 16 bytes - const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast(dst) >> 2) & 0x3)) & 0x3; - const int prologLength = qMin(length, offsetToAlignOn16Bytes); - for (; x < prologLength; ++x) + ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha); // 2) interpolate pixels with SSE2 diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h index 18355c2..d8f6bf5 100644 --- a/src/gui/painting/qdrawingprimitive_sse2_p.h +++ b/src/gui/painting/qdrawingprimitive_sse2_p.h @@ -143,9 +143,7 @@ QT_BEGIN_NAMESPACE int x = 0; \ \ /* First, get dst aligned. */ \ - const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast(dst) >> 2) & 0x3)) & 0x3;\ - const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ - for (; x < prologLength; ++x) { \ + ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \ uint s = src[x]; \ if (s >= 0xff000000) \ dst[x] = s; \ @@ -202,9 +200,7 @@ QT_BEGIN_NAMESPACE { \ int x = 0; \ \ - const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast(dst) >> 2) & 0x3)) & 0x3;\ - const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ - for (; x < prologLength; ++x) { \ + ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \ quint32 s = src[x]; \ if (s != 0) { \ s = BYTE_MUL(s, const_alpha); \ -- cgit v0.12 From 05bb249c2ad3ee15eb205a806f8546c105683096 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Thu, 5 Aug 2010 11:21:03 +0200 Subject: Fix QTextEngine overflow caused by extremely long text Internally, QTextEngine use int to calculate most of the layout data required. If a string longer than 2^24 is passed into either QTextEngine or classes using it (QStackTextEngine, QPainter, QFontMetrics, etc.), overflow will happen because the memory size required to allocate for layout will become too large for int to handle. This patch will prevent these cases and add error handling mechanism for relevant code. Task-number: QT-3658 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextengine.cpp | 87 ++++++++++++++++++++++++++++++++------------ src/gui/text/qtextengine_p.h | 14 +++++-- src/gui/text/qtextlayout.cpp | 19 +++++++--- 3 files changed, 87 insertions(+), 33 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 439f2a4..5670e29 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -923,6 +923,13 @@ void QTextEngine::shapeText(int item) const si.width += glyphs.advances_x[i]; } +static inline bool hasCaseChange(const QScriptItem &si) +{ + return si.analysis.flags == QScriptAnalysis::SmallCaps || + si.analysis.flags == QScriptAnalysis::Uppercase || + si.analysis.flags == QScriptAnalysis::Lowercase; +} + #if defined(Q_WS_WINCE) //TODO // set the glyph attributes heuristically. Assumes a 1 to 1 relationship between chars and glyphs // and no reordering. @@ -1050,14 +1057,15 @@ void QTextEngine::shapeTextWithCE(int item) const if (option.useDesignMetrics()) flags |= DesignMetrics; - attributes(); // pre-initialize char attributes + // pre-initialize char attributes + if (! attributes()) + return; const int len = length(item); int num_glyphs = length(item); const QChar *str = layoutData->string.unicode() + si.position; ushort upperCased[256]; - if (si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase - || si.analysis.flags == QScriptAnalysis::Lowercase) { + if (hasCaseChange(si)) { ushort *uc = upperCased; if (len > 256) uc = new ushort[len]; @@ -1071,7 +1079,14 @@ void QTextEngine::shapeTextWithCE(int item) const } while (true) { - ensureSpace(num_glyphs); + if (! ensureSpace(num_glyphs)) { + // If str is converted to uppercase/lowercase form with a new buffer, + // we need to delete that buffer before return for error + const ushort *uc = reinterpret_cast(str); + if (hasCaseChange(si) && uc != upperCased) + delete [] uc; + return; + } num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; QGlyphLayout g = availableGlyphs(&si); @@ -1092,9 +1107,7 @@ void QTextEngine::shapeTextWithCE(int item) const layoutData->used += si.num_glyphs; const ushort *uc = reinterpret_cast(str); - if ((si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase - || si.analysis.flags == QScriptAnalysis::Lowercase) - && uc != upperCased) + if (hasCaseChange(si) && uc != upperCased) delete [] uc; } #endif @@ -1133,8 +1146,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const entire_shaper_item.item.bidiLevel = si.analysis.bidiLevel; HB_UChar16 upperCased[256]; // XXX what about making this 4096, so we don't have to extend it ever. - if (si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase - || si.analysis.flags == QScriptAnalysis::Lowercase) { + if (hasCaseChange(si)) { HB_UChar16 *uc = upperCased; if (entire_shaper_item.item.length > 256) uc = new HB_UChar16[entire_shaper_item.item.length]; @@ -1156,17 +1168,24 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const entire_shaper_item.shaperFlags |= HB_ShaperFlag_UseDesignMetrics; entire_shaper_item.num_glyphs = qMax(layoutData->glyphLayout.numGlyphs - layoutData->used, int(entire_shaper_item.item.length)); - ensureSpace(entire_shaper_item.num_glyphs); + if (! ensureSpace(entire_shaper_item.num_glyphs)) { + if (hasCaseChange(si)) + delete [] const_cast(entire_shaper_item.string); + return; + } QGlyphLayout initialGlyphs = availableGlyphs(&si).mid(0, entire_shaper_item.num_glyphs); if (!stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)) { - ensureSpace(entire_shaper_item.num_glyphs); + if (! ensureSpace(entire_shaper_item.num_glyphs)) { + if (hasCaseChange(si)) + delete [] const_cast(entire_shaper_item.string); + return; + } initialGlyphs = availableGlyphs(&si).mid(0, entire_shaper_item.num_glyphs); if (!stringToGlyphs(&entire_shaper_item, &initialGlyphs, font)) { // ############ if this happens there's a bug in the fontengine - if ((si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase - || si.analysis.flags == QScriptAnalysis::Lowercase) && entire_shaper_item.string != upperCased) + if (hasCaseChange(si) && entire_shaper_item.string != upperCased) delete [] const_cast(entire_shaper_item.string); return; } @@ -1231,7 +1250,11 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const remaining_glyphs -= shaper_item.initialGlyphCount; do { - ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs); + if (! ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs)) { + if (hasCaseChange(si)) + delete [] const_cast(entire_shaper_item.string); + return; + } const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos); moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); @@ -1271,8 +1294,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const layoutData->used += si.num_glyphs; - if ((si.analysis.flags == QScriptAnalysis::SmallCaps || si.analysis.flags == QScriptAnalysis::Uppercase) - && entire_shaper_item.string != upperCased) + if (hasCaseChange(si) && entire_shaper_item.string != upperCased) delete [] const_cast(entire_shaper_item.string); } @@ -1317,7 +1339,8 @@ const HB_CharAttributes *QTextEngine::attributes() const return (HB_CharAttributes *) layoutData->memory; itemize(); - ensureSpace(layoutData->string.length()); + if (! ensureSpace(layoutData->string.length())) + return NULL; QVarLengthArray hbScriptItems(layoutData->items.size()); @@ -1864,7 +1887,10 @@ void QTextEngine::justify(const QScriptLine &line) // don't include trailing white spaces when doing justification int line_length = line.length; - const HB_CharAttributes *a = attributes()+line.from; + const HB_CharAttributes *a = attributes(); + if (! a) + return; + a += line.from; while (line_length && a[line_length-1].whiteSpace) --line_length; // subtract one char more, as we can't justfy after the last character @@ -2045,7 +2071,7 @@ QTextEngine::LayoutData::LayoutData() memory_on_stack = false; used = 0; hasBidi = false; - inLayout = false; + layoutState = LayoutEmpty; haveCharAttributes = false; logClustersPtr = 0; available_glyphs = 0; @@ -2079,7 +2105,7 @@ QTextEngine::LayoutData::LayoutData(const QString &str, void **stack_memory, int } used = 0; hasBidi = false; - inLayout = false; + layoutState = LayoutEmpty; haveCharAttributes = false; } @@ -2090,12 +2116,12 @@ QTextEngine::LayoutData::~LayoutData() memory = 0; } -void QTextEngine::LayoutData::reallocate(int totalGlyphs) +bool QTextEngine::LayoutData::reallocate(int totalGlyphs) { Q_ASSERT(totalGlyphs >= glyphLayout.numGlyphs); if (memory_on_stack && available_glyphs >= totalGlyphs) { glyphLayout.grow(glyphLayout.data(), totalGlyphs); - return; + return true; } int space_charAttributes = sizeof(HB_CharAttributes)*string.length()/sizeof(void*) + 1; @@ -2103,7 +2129,14 @@ void QTextEngine::LayoutData::reallocate(int totalGlyphs) int space_glyphs = QGlyphLayout::spaceNeededForGlyphLayout(totalGlyphs)/sizeof(void*) + 2; int newAllocated = space_charAttributes + space_glyphs + space_logClusters; - Q_ASSERT(newAllocated >= allocated); + // These values can be negative if the length of string/glyphs causes overflow, + // we can't layout such a long string all at once, so return false here to + // indicate there is a failure + if (space_charAttributes < 0 || space_logClusters < 0 || space_glyphs < 0 || newAllocated < allocated) { + layoutState = LayoutFailed; + return false; + } + void **newMem = memory; newMem = (void **)::realloc(memory_on_stack ? 0 : memory, newAllocated*sizeof(void *)); Q_CHECK_PTR(newMem); @@ -2124,6 +2157,7 @@ void QTextEngine::LayoutData::reallocate(int totalGlyphs) glyphLayout.grow(reinterpret_cast(m), totalGlyphs); allocated = newAllocated; + return true; } // grow to the new size, copying the existing data to the new layout @@ -2155,7 +2189,7 @@ void QTextEngine::freeMemory() } else { layoutData->used = 0; layoutData->hasBidi = false; - layoutData->inLayout = false; + layoutData->layoutState = LayoutEmpty; layoutData->haveCharAttributes = false; } for (int i = 0; i < lines.size(); ++i) { @@ -2314,6 +2348,9 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int shape(i); HB_CharAttributes *attributes = const_cast(this->attributes()); + if (!attributes) + return QString(); + unsigned short *logClusters = this->logClusters(&si); QGlyphLayout glyphs = shapedGlyphs(&si); @@ -2385,6 +2422,8 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int return QString(); const HB_CharAttributes *attributes = this->attributes(); + if (!attributes) + return QString(); if (mode == Qt::ElideRight) { QFixed currentWidth; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index e623fa5..4cbe81f 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -416,6 +416,11 @@ class QTextFormatCollection; class Q_GUI_EXPORT QTextEngine { public: + enum LayoutState { + LayoutEmpty, + InLayout, + LayoutFailed, + }; struct LayoutData { LayoutData(const QString &str, void **stack_memory, int mem_size); LayoutData(); @@ -428,11 +433,11 @@ public: QGlyphLayout glyphLayout; mutable int used; uint hasBidi : 1; - uint inLayout : 1; + uint layoutState : 2; uint memory_on_stack : 1; bool haveCharAttributes; QString string; - void reallocate(int totalGlyphs); + bool reallocate(int totalGlyphs); }; QTextEngine(LayoutData *data); @@ -520,9 +525,10 @@ public: return layoutData->glyphLayout.mid(si->glyph_data_offset, si->num_glyphs); } - inline void ensureSpace(int nGlyphs) const { + inline bool ensureSpace(int nGlyphs) const { if (layoutData->glyphLayout.numGlyphs - layoutData->used < nGlyphs) - layoutData->reallocate((((layoutData->used + nGlyphs)*3/2 + 15) >> 4) << 4); + return layoutData->reallocate((((layoutData->used + nGlyphs)*3/2 + 15) >> 4) << 4); + return true; } void freeMemory(); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 674064e..5a11c87 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -74,6 +74,8 @@ static inline QFixed leadingSpaceWidth(QTextEngine *eng, const QScriptLine &line int pos = line.length; const HB_CharAttributes *attributes = eng->attributes(); + if (!attributes) + return QFixed(); while (pos > 0 && attributes[line.from + pos - 1].whiteSpace) --pos; return eng->width(line.from + pos, line.length - pos); @@ -601,7 +603,7 @@ bool QTextLayout::cacheEnabled() const void QTextLayout::beginLayout() { #ifndef QT_NO_DEBUG - if (d->layoutData && d->layoutData->inLayout) { + if (d->layoutData && d->layoutData->layoutState == QTextEngine::InLayout) { qWarning("QTextLayout::beginLayout: Called while already doing layout"); return; } @@ -609,7 +611,7 @@ void QTextLayout::beginLayout() d->invalidate(); d->clearLineData(); d->itemize(); - d->layoutData->inLayout = true; + d->layoutData->layoutState = QTextEngine::InLayout; } /*! @@ -618,7 +620,7 @@ void QTextLayout::beginLayout() void QTextLayout::endLayout() { #ifndef QT_NO_DEBUG - if (!d->layoutData || !d->layoutData->inLayout) { + if (!d->layoutData || d->layoutData->layoutState == QTextEngine::LayoutEmpty) { qWarning("QTextLayout::endLayout: Called without beginLayout()"); return; } @@ -627,7 +629,7 @@ void QTextLayout::endLayout() if (l && d->lines.at(l-1).length < 0) { QTextLine(l-1, d).setNumColumns(INT_MAX); } - d->layoutData->inLayout = false; + d->layoutData->layoutState = QTextEngine::LayoutEmpty; if (!d->cacheGlyphs) d->freeMemory(); } @@ -757,11 +759,14 @@ bool QTextLayout::isValidCursorPosition(int pos) const QTextLine QTextLayout::createLine() { #ifndef QT_NO_DEBUG - if (!d->layoutData || !d->layoutData->inLayout) { + if (!d->layoutData || d->layoutData->layoutState == QTextEngine::LayoutEmpty) { qWarning("QTextLayout::createLine: Called without layouting"); return QTextLine(); } #endif + if (d->layoutData->layoutState == QTextEngine::LayoutFailed) + return QTextLine(); + int l = d->lines.size(); if (l && d->lines.at(l-1).length < 0) { QTextLine(l-1, d).setNumColumns(INT_MAX); @@ -1801,6 +1806,8 @@ void QTextLine::layout_helper(int maxGlyphs) Qt::Alignment alignment = eng->option.alignment(); const HB_CharAttributes *attributes = eng->attributes(); + if (!attributes) + return; lbh.currentPosition = line.from; int end = 0; lbh.logClusters = eng->layoutData->logClustersPtr; @@ -1814,6 +1821,8 @@ void QTextLine::layout_helper(int maxGlyphs) if (!current.num_glyphs) { eng->shape(item); attributes = eng->attributes(); + if (!attributes) + return; lbh.logClusters = eng->layoutData->logClustersPtr; } lbh.currentPosition = qMax(line.from, current.position); -- cgit v0.12 From cb086eb5340c4c41efaf45373aa05c37e8aa974a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 5 Aug 2010 17:19:48 +0200 Subject: Doc: Fixed qdoc warnings. Reviewed-by: Trust Me --- doc/src/declarative/declarativeui.qdoc | 2 +- doc/src/declarative/qtdeclarative.qdoc | 2 +- doc/src/examples/qml-examples.qdoc | 2 +- doc/src/examples/simpletreemodel.qdoc | 4 +- doc/src/examples/spinboxdelegate.qdoc | 4 +- doc/src/external-resources.qdoc | 2 +- doc/src/index.qdoc | 10 ++--- doc/src/modules.qdoc | 1 - doc/src/overviews.qdoc | 3 +- doc/src/qt-webpages.qdoc | 5 +++ src/dbus/qdbusconnection.cpp | 4 ++ src/declarative/qml/qdeclarativeimageprovider.cpp | 8 ++-- src/declarative/util/qdeclarativeanimation.cpp | 2 +- src/declarative/util/qdeclarativetransition.cpp | 4 +- src/gui/graphicsview/qgraphicsitem.cpp | 18 +++++++++ src/gui/graphicsview/qgraphicstransform.cpp | 21 +++++++++++ src/gui/s60framework/qs60mainapplication.cpp | 6 +++ src/gui/s60framework/qs60mainappui.cpp | 45 +++++++++++++++++++++++ src/network/access/qnetworkrequest.cpp | 20 +++++----- tools/qdoc3/test/qt-html-templates.qdocconf | 7 +--- 20 files changed, 130 insertions(+), 40 deletions(-) diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 217e372..42189c0 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -27,7 +27,7 @@ /*! \title Qt Quick -\page declarativeui.html +\page qtquick.html \brief Qt Quick provides a declarative framework for building highly dynamic, custom user interfaces. diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 413eb59..b4f4c83 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -48,7 +48,7 @@ \endcode For more information on the Qt Declarative module, see the - \l{declarativeui.html}{Qt Quick} documentation. + \l{Qt Quick} documentation. */ diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 8d3aa25..0d191c9 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -562,7 +562,7 @@ \example declarative/ui-components/dialcontrol This example shows how to create a dial-type control. It combines - \l Image elements with \l Rotation transforms and \l SpringAnimatino behaviors + \l Image elements with \l Rotation transforms and \l SpringAnimation behaviors to produce an interactive speedometer-type dial. \image qml-dialcontrol-example.png diff --git a/doc/src/examples/simpletreemodel.qdoc b/doc/src/examples/simpletreemodel.qdoc index c34f4af..790d5fa 100644 --- a/doc/src/examples/simpletreemodel.qdoc +++ b/doc/src/examples/simpletreemodel.qdoc @@ -32,7 +32,7 @@ The Simple Tree Model example shows how to create a basic, read-only hierarchical model to use with Qt's standard view classes. For a description of simple non-hierarchical list and table models, see the - \l{model-view-programming.html}{Model/View Programming} overview. + \l{Model/View Programming} overview. \image simpletreemodel-example.png @@ -40,7 +40,7 @@ information in a data source, using an abstract model of the data to simplify and standardize the way it is accessed. Simple models represent data as a table of items, and allow views to access this data via an - \l{model-view-model.html}{index-based} system. More generally, models can + \l{Model/View Programming#Models}{index-based} system. More generally, models can be used to represent data in the form of a tree structure by allowing each item to act as a parent to a table of child items. diff --git a/doc/src/examples/spinboxdelegate.qdoc b/doc/src/examples/spinboxdelegate.qdoc index 49e3295..48e4bfa 100644 --- a/doc/src/examples/spinboxdelegate.qdoc +++ b/doc/src/examples/spinboxdelegate.qdoc @@ -42,8 +42,8 @@ \image spinboxdelegate-example.png This concepts behind this example are covered in the - \l{model-view-delegate.html}{Delegate Classes} chapter of the - \l{model-view-programming.html}{Model/View Programming} overview. + \l{Model/View Programming#Delegate Classes}{Delegate Classes} chapter of the + \l{Model/View Programming} overview. \section1 SpinBoxDelegate Class Definition diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 5c6108a..e901124c 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -416,7 +416,7 @@ /*! \externalpage http://opensource.org/licenses/bsd-license.php - \title BSD License + \title New and Modified BSD Licenses */ /*! diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 7efd1e6..499667c 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -65,7 +65,6 @@
@@ -94,12 +92,12 @@
diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index a81bfb2..c51fcad 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -116,7 +116,6 @@ /*! \module QtMultimedia - \page qtmultimedia-module.html \title QtMultimedia Module \contentspage All Modules \previouspage QtCore diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index a1773a3..c7b88cf 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -55,8 +55,7 @@ These pages are about Qt's traditional set of GUI components for building both native look ^ feel and custom UI's for the desktop - environment. Use \l {declarativeui.html} {Qt Quick} for building - UI's for mobile devices. + environment. Use \l{Qt Quick} for building UI's for mobile devices. \generatelist {related} */ diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc index 0c61285..5d9b41b 100644 --- a/doc/src/qt-webpages.qdoc +++ b/doc/src/qt-webpages.qdoc @@ -234,3 +234,8 @@ \externalpage http://qt.gitorious.org \title Public Qt Repository */ + +/*! + \externalpage http://get.qt.nokia.com/nokiasmartinstaller/ + \title Smart Installer +*/ diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 5cbb8ca..87ee3d1 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -227,6 +227,10 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP \value ExportChildObjects export this object's child objects + \value ExportScriptableInvokables export this object's scriptable methods + \value ExportNonScriptableInvokables export this object's non-scriptable methods + \value ExportAllInvokables export all of this object's methods + \sa registerObject(), QDBusAbstractAdaptor, {usingadaptors.html}{Using adaptors} */ diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp index 241df87..4743a1b 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.cpp +++ b/src/declarative/qml/qdeclarativeimageprovider.cpp @@ -59,13 +59,13 @@ public: \list \o Loaded using QPixmaps rather than actual image files - \o Loaded asynchronously in a separate thread, if imageType() is \l ImageType::Image + \o Loaded asynchronously in a separate thread, if imageType() is \l{QDeclarativeImageProvider::ImageType}{ImageType::Image} \endlist To specify that an image should be loaded by an image provider, use the \bold {"image:"} scheme for the URL source of the image, followed by the identifiers of the image provider and the requested image. For example: - + \qml Image { source: "image://myimageprovider/image.png" } \endqml @@ -83,7 +83,7 @@ public: and "red", respectively: \snippet examples/declarative/cppextensions/imageprovider/imageprovider-example.qml 0 - + When these images are loaded by QML, it looks for a matching image provider and calls its requestImage() or requestPixmap() method (depending on its imageType()) to load the image. The method is called with the \c id @@ -136,7 +136,7 @@ public: main thread. In this case, if \l {Image::}{asynchronous} is set to \c true, the value is ignored and the image is loaded synchronously. - + \sa QDeclarativeEngine::addImageProvider() */ diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 6a9cf95..cda7623 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1323,7 +1323,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) \snippet doc/src/snippets/declarative/rotationanimation.qml 0 - Notice the RotationAnimation did not need to set a \l {RotationAnimation::}{target} + Notice the RotationAnimation did not need to set a \l target value. As a convenience, when used in a transition, RotationAnimation will rotate all properties named "rotation" or "angle". You can override this by providing your own properties via \l {PropertyAnimation::properties}{properties} or diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index 582191b..8de6b23 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -60,10 +60,10 @@ QT_BEGIN_NAMESPACE For example, the following \l Rectangle has two states: the default state, and an added "moved" state. In the "moved state, the rectangle's position changes - to (50, 50). The added \l Transition specifies that when the rectangle + to (50, 50). The added Transition specifies that when the rectangle changes between the default and the "moved" state, any changes to the \c x and \c y properties should be animated, using an \c Easing.InOutQuad. - + \snippet doc/src/snippets/declarative/transition.qml 0 To define multiple transitions, specify \l Item::transitions as a list: diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 1626d83..2856699 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7965,6 +7965,24 @@ void QGraphicsItemPrivate::resetHeight() */ /*! + \property QGraphicsObject::children + \since 4.7 + \internal +*/ + +/*! + \property QGraphicsObject::width + \since 4.7 + \internal +*/ + +/*! + \property QGraphicsObject::height + \since 4.7 + \internal +*/ + +/*! \class QAbstractGraphicsShapeItem \brief The QAbstractGraphicsShapeItem class provides a common base for all path items. diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index 986bee6..27dceb8 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -565,6 +565,27 @@ void QGraphicsRotation::applyTo(QMatrix4x4 *matrix) const \sa QGraphicsRotation::axis */ +/*! + \fn QGraphicsScale::xScaleChanged() + \since 4.7 + + This signal is emitted whenever the \l xScale property changes. +*/ + +/*! + \fn QGraphicsScale::yScaleChanged() + \since 4.7 + + This signal is emitted whenever the \l yScale property changes. +*/ + +/*! + \fn QGraphicsScale::zScaleChanged() + \since 4.7 + + This signal is emitted whenever the \l zScale property changes. +*/ + #include "moc_qgraphicstransform.cpp" QT_END_NAMESPACE diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index 0f9367e..185c06f 100644 --- a/src/gui/s60framework/qs60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -141,11 +141,17 @@ void QS60MainApplication::PreDocConstructL() QS60MainApplicationBase::PreDocConstructL(); } +/*! + \internal +*/ CDictionaryStore *QS60MainApplication::OpenIniFileLC(RFs &aFs) const { return QS60MainApplicationBase::OpenIniFileLC(aFs); } +/*! + \internal +*/ void QS60MainApplication::NewAppServerL(CApaAppServer *&aAppServer) { QS60MainApplicationBase::NewAppServerL(aAppServer); diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp index 40c2d03..72cf577 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/gui/s60framework/qs60mainappui.cpp @@ -281,76 +281,121 @@ void QS60MainAppUi::RestoreMenuL(CCoeControl *menuWindow, TInt resourceId, TMenu } } +/*! + \internal +*/ void QS60MainAppUi::Exit() { QS60MainAppUiBase::Exit(); } +/*! + \internal +*/ void QS60MainAppUi::SetFadedL(TBool aFaded) { QS60MainAppUiBase::SetFadedL(aFaded); } +/*! + \internal +*/ TRect QS60MainAppUi::ApplicationRect() const { return QS60MainAppUiBase::ApplicationRect(); } +/*! + \internal +*/ void QS60MainAppUi::HandleScreenDeviceChangedL() { QS60MainAppUiBase::HandleScreenDeviceChangedL(); } +/*! + \internal +*/ void QS60MainAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent) { QS60MainAppUiBase::HandleApplicationSpecificEventL(aType, aEvent); } +/*! + \internal +*/ TTypeUid::Ptr QS60MainAppUi::MopSupplyObject(TTypeUid aId) { return QS60MainAppUiBase::MopSupplyObject(aId); } +/*! + \internal +*/ void QS60MainAppUi::ProcessCommandL(TInt aCommand) { QS60MainAppUiBase::ProcessCommandL(aCommand); } +/*! + \internal +*/ TErrorHandlerResponse QS60MainAppUi::HandleError (TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText) { return QS60MainAppUiBase::HandleError(aError, aExtErr, aErrorText, aContextText); } +/*! + \internal +*/ void QS60MainAppUi::HandleViewDeactivation(const TVwsViewId &aViewIdToBeDeactivated, const TVwsViewId &aNewlyActivatedViewId) { QS60MainAppUiBase::HandleViewDeactivation(aViewIdToBeDeactivated, aNewlyActivatedViewId); } +/*! + \internal +*/ void QS60MainAppUi::PrepareToExit() { QS60MainAppUiBase::PrepareToExit(); } +/*! + \internal +*/ void QS60MainAppUi::HandleTouchPaneSizeChange() { QS60MainAppUiBase::HandleTouchPaneSizeChange(); } +/*! + \internal +*/ void QS60MainAppUi::HandleSystemEventL(const TWsEvent &aEvent) { QS60MainAppUiBase::HandleSystemEventL(aEvent); } +/*! + \internal +*/ void QS60MainAppUi::Reserved_MtsmPosition() { QS60MainAppUiBase::Reserved_MtsmPosition(); } +/*! + \internal +*/ void QS60MainAppUi::Reserved_MtsmObject() { QS60MainAppUiBase::Reserved_MtsmObject(); } +/*! + \internal +*/ void QS60MainAppUi::HandleForegroundEventL(TBool aForeground) { QS60MainAppUiBase::HandleForegroundEventL(aForeground); diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index fa592c2..8710cb6 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -174,12 +174,12 @@ QT_BEGIN_NAMESPACE When using this flag with sequential upload data, the ContentLengthHeader header must be set. - \value HttpPipeliningAllowedAttribute + \value HttpPipeliningAllowedAttribute Requests only, type: QVariant::Bool (default: false) Indicates whether the QNetworkAccessManager code is allowed to use HTTP pipelining with this request. - \value HttpPipeliningWasUsedAttribute + \value HttpPipeliningWasUsedAttribute Replies only, type: QVariant::Bool Indicates whether the HTTP pipelining was used for receiving this reply. @@ -200,9 +200,9 @@ QT_BEGIN_NAMESPACE See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information. - \since 4.7 + (This value was introduced in 4.7.) - \value CookieSaveControlAttribute + \value CookieSaveControlAttribute Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic) Indicates whether to save 'Cookie' headers received from the server in reply to the request. @@ -213,9 +213,9 @@ QT_BEGIN_NAMESPACE See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information. - \since 4.7 + (This value was introduced in 4.7.) - \value AuthenticationReuseAttribute + \value AuthenticationReuseAttribute Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic) Indicates whether to use cached authorization credentials in the request, if available. If this is set to QNetworkRequest::Manual and the authentication @@ -228,15 +228,13 @@ QT_BEGIN_NAMESPACE See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information. - \since 4.7 + (This value was introduced in 4.7.) \omitvalue MaximumDownloadBufferSizeAttribute - \since 4.7 - \internal + (This value was introduced in 4.7.) \omitvalue DownloadBufferAttribute - \since 4.7 - \internal + (This value was introduced in 4.7.) \value User Special type. Additional information can be passed in diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index cf15628..089b11f 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -4,9 +4,6 @@ HTML.stylesheets = style/style.css \ style/style_ie8.css \ style/style_ie6.css -HTML.creatorpostheader = "**\n" -HTML.creatorpostpostheader = "***\n" - HTML.postheader = "
\n" \ "
\n" \ "
\n" \ @@ -48,7 +45,7 @@ HTML.postheader = "
\n" \ "
  • Qt Topics \n" \ "
      \n" \ "
    • Basic Qt architecture
    • \n" \ - "
    • Device UI's & Qt Quick
    • \n" \ + "
    • Device UI's & Qt Quick
    • \n" \ "
    • Desktop UI components
    • \n" \ "
    • Platform-specific info
    • \n" \ "
    • How-To's and Best Practices
    • \n" \ @@ -100,7 +97,7 @@ HTML.postheader = "
      \n" \ "
      \n" \ " \n" \ -- cgit v0.12 From a49f2700c6b5c0f5851f9cfab38b5554e9530577 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 5 Aug 2010 17:22:38 +0200 Subject: QStyleSheet documentation: QMenu's tear-off is styled with ::tearoff Task-number: QTBUG-12553 Reviewed-by: Carlos Duclos --- doc/src/widgets-and-layouts/stylesheet.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index 1390376..977f641 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -925,7 +925,7 @@ The scroller is styled using the \l{#scroller-sub}{::scroller}. - The tear-off is styled using the \l{#tear-off-sub}{::tear-off}. + The tear-off is styled using the \l{#tearoff-sub}{::tearoff}. See \l{Qt Style Sheets Examples#Customizing QMenu}{Customizing QMenu} for an example. @@ -3337,7 +3337,7 @@ \o The tear indicator of a QTabBar. \row - \o \c ::tear-off \target tear-off-sub + \o \c ::tearoff \target tearoff-sub \o The tear-off indicator of a QMenu. \row -- cgit v0.12 From eb6d70eeeaaafb748a5fca38f6f033136aadf148 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 6 Aug 2010 10:26:48 +0200 Subject: Test we do not have compiler warnings in our headers with more options I removed some statics because else the test could not be run several times Reviewed-by: Andreas Kling --- tests/auto/compilerwarnings/tst_compilerwarnings.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp index 82c327a..8d344d8 100644 --- a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp +++ b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp @@ -114,6 +114,9 @@ void tst_CompilerWarnings::warnings_data() QTest::addColumn("cflags"); QTest::newRow("standard") << QStringList(); + QTest::newRow("warn deprecated, fast plus, no debug") << (QStringList() << "-DQT_DEPRECATED_WARNINGS" + << "-DQT_USE_FAST_OPERATOR_PLUS" << "-DQT_NU_DEBUG" << "-DQT_NO_DEBUG_STREAM" << "-DQT_NO_WARNING_OUTPUT"); + QTest::newRow("no deprecated, no keywords") << (QStringList() << "-DQT_NO_DEPRECATED" << "-DQT_NO_KEYWORDS"); #if 0 #ifdef Q_WS_QWS @@ -136,14 +139,14 @@ void tst_CompilerWarnings::warnings() QSKIP("gcc 3.x outputs too many bogus warnings", SkipAll); #endif - static QString tmpFile; + /*static*/ QString tmpFile; if (tmpFile.isEmpty()) { QTemporaryFile tmpQFile; tmpQFile.open(); tmpFile = tmpQFile.fileName(); tmpQFile.close(); } - static QString tmpSourceFile; + /*static*/ QString tmpSourceFile; bool openResult = true; const QString tmpBaseName("XXXXXX-test.cpp"); QString templatePath = QDir::temp().absoluteFilePath(tmpBaseName); -- cgit v0.12 From 033b53a02fb02c5aec412e3d87ad9661110c6e6e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 6 Aug 2010 10:31:20 +0200 Subject: compilation with QT_NO_DEPRECATED Reviewed-by: Andreas Kling --- src/network/bearer/qnetworkconfiguration.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index d9d36fd..02f9cb6 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -120,7 +120,9 @@ public: Purpose purpose() const; // Required to maintain source compatibility with Qt Mobility. +#ifdef QT_DEPRECATED QT_DEPRECATED inline QString bearerName() const { return bearerTypeName(); } +#endif BearerType bearerType() const; QString bearerTypeName() const; -- cgit v0.12 From 1b0f790d27cda48137c7114fadc694432a104c90 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 6 Aug 2010 17:48:28 +0200 Subject: QSharedPointer documentation: specify that it is not safe to operate on the same object in different threads Task-number: QTBUG-12700 Reviewed-by: thiago --- src/corelib/tools/qsharedpointer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index f102598..5fac960 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -67,8 +67,8 @@ QSharedPointer and QWeakPointer are thread-safe and operate atomically on the pointer value. Different threads can also access - the same QSharedPointer or QWeakPointer object at the same time - without need for locking mechanisms. + the QSharedPointer or QWeakPointer pointing to the same object at + the same time without need for locking mechanisms. It should be noted that, while the pointer value can be accessed in this manner, QSharedPointer and QWeakPointer provide no -- cgit v0.12 From d81ab877bc4424d918c400af3f65509f80f22f67 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Thu, 5 Aug 2010 14:45:49 +0200 Subject: Move the build of Neon file from painting.pri to gui.pro Move the build operation of files using Neon from painting.pri to gui.pro. This will make easier to add Neon files in the future. Reviewed-by: Andreas Kling --- src/gui/gui.pro | 18 ++++++++++++++++++ src/gui/painting/painting.pri | 21 +++------------------ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 28440cc..89ae06f 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -77,6 +77,24 @@ symbian { DEPLOYMENT = partial_upgrade $$DEPLOYMENT } +neon: QMAKE_CXXFLAGS *= -mfpu=neon +neon:*-g++* { + HEADERS += $$NEON_HEADERS + SOURCES += $$NEON_SOURCES + + DRAWHELPER_NEON_ASM_FILES = $$NEON_ASM + + neon_compiler.commands = $$QMAKE_CXX -c + neon_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + neon_compiler.dependency_type = TYPE_C + neon_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + neon_compiler.input = DRAWHELPER_NEON_ASM_FILES + neon_compiler.variable_out = OBJECTS + neon_compiler.name = compiling[neon] ${QMAKE_FILE_IN} + silent:neon_compiler.commands = @echo compiling[neon] ${QMAKE_FILE_IN} && $$neon_compiler.commands + QMAKE_EXTRA_COMPILERS += neon_compiler +} + contains(QMAKE_MAC_XARCH, no) { DEFINES += QT_NO_MAC_XARCH } else { diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 4023f65..dfa4a48 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -246,23 +246,8 @@ symbian { QMAKE_CXXFLAGS.ARMCC *= -O3 } -neon:*-g++* { - DEFINES += QT_HAVE_NEON - HEADERS += painting/qdrawhelper_neon_p.h - SOURCES += painting/qdrawhelper_neon.cpp - QMAKE_CXXFLAGS *= -mfpu=neon - - DRAWHELPER_NEON_ASM_FILES = ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S - - neon_compiler.commands = $$QMAKE_CXX -c - neon_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} - neon_compiler.dependency_type = TYPE_C - neon_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} - neon_compiler.input = DRAWHELPER_NEON_ASM_FILES - neon_compiler.variable_out = OBJECTS - neon_compiler.name = compiling[neon] ${QMAKE_FILE_IN} - silent:neon_compiler.commands = @echo compiling[neon] ${QMAKE_FILE_IN} && $$neon_compiler.commands - QMAKE_EXTRA_COMPILERS += neon_compiler -} +NEON_SOURCES += painting/qdrawhelper_neon.cpp +NEON_HEADERS += painting/qdrawhelper_neon_p.h +NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S include($$PWD/../../3rdparty/zlib_dependency.pri) -- cgit v0.12 From a0f155cdaf641d92acc8b61be89b96319d16ccba Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Thu, 5 Aug 2010 14:47:54 +0200 Subject: Do the conversion from RGB888 to RGB32 using Neon Doing the conversion with Neon is 700% faster. Help by Thiago Macieira on vacation. Reviewed-by: Thiago Macieira --- src/gui/image/image.pri | 1 + src/gui/image/qimage.cpp | 8 +++ src/gui/image/qimage_neon.cpp | 114 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 src/gui/image/qimage_neon.cpp diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index b20a04f..f89706c 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -94,5 +94,6 @@ contains(QT_CONFIG, tiff):include($$PWD/qtiffhandler.pri) contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri) # SIMD +NEON_SOURCES += image/qimage_neon.cpp SSE2_SOURCES += image/qimage_sse2.cpp SSSE3_SOURCES += image/qimage_ssse3.cpp diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index cb834c0..ac148ee 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3769,6 +3769,14 @@ void qInitImageConversions() converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_ssse3; } #endif +#ifdef QT_HAVE_NEON + if (features & NEON) { + extern void convert_RGB888_to_RGB32_neon(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); + converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_neon; + converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_neon; + converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_neon; + } +#endif } /*! diff --git a/src/gui/image/qimage_neon.cpp b/src/gui/image/qimage_neon.cpp new file mode 100644 index 0000000..15bf472 --- /dev/null +++ b/src/gui/image/qimage_neon.cpp @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +#ifdef QT_HAVE_NEON + +QT_BEGIN_NAMESPACE + +Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, const uchar *src, int len) +{ + if (!len) + return; + + const quint32 *const end = dst + len; + + // align dst on 64 bits + const int offsetToAlignOn8Bytes = (reinterpret_cast(dst) >> 2) & 0x1; + for (int i = 0; i < offsetToAlignOn8Bytes; ++i) { + *dst++ = qRgb(src[0], src[1], src[2]); + src += 3; + } + + if ((len - offsetToAlignOn8Bytes) >= 8) { + const quint32 *const simdEnd = end - 7; + register uint8x8_t fullVector asm ("d3") = vdup_n_u8(0xff); + do { +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + asm volatile ( + "vld3.8 { d4, d5, d6 }, [%[SRC]] !\n\t" + "vst4.8 { d3, d4, d5, d6 }, [%[DST],:64] !\n\t" + : [DST]"+r" (dst), [SRC]"+r" (src) + : "w"(fullVector) + : "memory", "d4", "d5", "d6" + ); +#else + asm volatile ( + "vld3.8 { d0, d1, d2 }, [%[SRC]] !\n\t" + "vswp d0, d2\n\t" + "vst4.8 { d0, d1, d2, d3 }, [%[DST],:64] !\n\t" + : [DST]"+r" (dst), [SRC]"+r" (src) + : "w"(fullVector) + : "memory", "d0", "d1", "d2" + ); +#endif + } while (dst < simdEnd); + } + + while (dst != end) { + *dst++ = qRgb(src[0], src[1], src[2]); + src += 3; + } +} + +void convert_RGB888_to_RGB32_neon(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->format == QImage::Format_RGB888); + Q_ASSERT(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const uchar *src_data = (uchar *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + qt_convert_rgb888_to_rgb32_neon(dest_data, src_data, src->width); + src_data += src->bytes_per_line; + dest_data = (quint32 *)((uchar*)dest_data + dest->bytes_per_line); + } +} + +QT_END_NAMESPACE + +#endif // QT_HAVE_NEON -- cgit v0.12 From 296cf92e1047409a203294e81fb388cc6a0e5c85 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Fri, 6 Aug 2010 15:50:38 +0200 Subject: Use the fast Neon conversion for converting colors of jpeg images. Reviewed-by: Andreas Kling --- src/gui/image/qjpeghandler.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index d358a5e..eda5efb 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -803,9 +803,16 @@ bool QJpegHandlerPrivate::read(QImage *image) QJpegHandler::QJpegHandler() : d(new QJpegHandlerPrivate(this)) { -#if defined(QT_HAVE_SSSE3) const uint features = qDetectCPUFeatures(); - + Q_UNUSED(features); +#if defined(QT_HAVE_NEON) + // from qimage_neon.cpp + Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, const uchar *src, int len); + + if (features & NEON) + rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_neon; +#endif // QT_HAVE_NEON +#if defined(QT_HAVE_SSSE3) // from qimage_ssse3.cpp Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len); -- cgit v0.12 From c45516f1f3781dcb504158f730b98897c7f2f2a1 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Fri, 6 Aug 2010 15:52:37 +0200 Subject: Remove the definition of QT_HAVE_NEON from qt.prf Since we cannot use NEON and VFP concurrently, it is better not to force neon all over the place :) Reviewed-by: Andreas Kling Reviewed-by: Thiago Macieira --- mkspecs/features/qt.prf | 1 - src/corelib/corelib.pro | 5 ++++- src/gui/gui.pro | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index aa0f06e..84010a0 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -211,7 +211,6 @@ mac { } #SIMD defines: -neon: DEFINES += QT_HAVE_NEON mmx:DEFINES += QT_HAVE_MMX 3dnow:DEFINES += QT_HAVE_3DNOW sse:DEFINES += QT_HAVE_SSE QT_HAVE_MMXEXT diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index bc8ef9f..728bdf9 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -53,6 +53,9 @@ symbian: { DEPLOYMENT = partial_upgrade $$DEPLOYMENT } -neon: QMAKE_CXXFLAGS *= -mfpu=neon +neon { + DEFINES += QT_HAVE_NEON + QMAKE_CXXFLAGS *= -mfpu=neon +} diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 89ae06f..3943e26 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -77,8 +77,9 @@ symbian { DEPLOYMENT = partial_upgrade $$DEPLOYMENT } -neon: QMAKE_CXXFLAGS *= -mfpu=neon neon:*-g++* { + DEFINES += QT_HAVE_NEON + QMAKE_CXXFLAGS *= -mfpu=neon HEADERS += $$NEON_HEADERS SOURCES += $$NEON_SOURCES -- cgit v0.12 From c5fa9eb1cb02d979502e2c9918d752c6708fb406 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 9 Aug 2010 10:31:16 +0200 Subject: Fix scrollbar randomly popping up in QPlainTextEdit When a line break was detected, we would retain the value of the right bearing for the character after the break instead of resetting it to the right bearing of the previous value. This could in some cases cause the bounding rect of the text to be wrong, and could cause unnecessary horizontal scrollbars to pop up. It was especially visible when using WrapAnywhere. Visible e.g. in the compile output in Creator. Done-by: mae Reviewed-by: Eskil Reviewed-by: Lars --- src/gui/text/qtextlayout.cpp | 21 +++++++++++++++++---- tests/auto/qtextlayout/tst_qtextlayout.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 5a11c87..da43913 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1709,14 +1709,18 @@ namespace { return glyphs.glyphs[logClusters[currentPosition - 1]]; } + inline void adjustRightBearing(glyph_t glyph) + { + qreal rb; + fontEngine->getGlyphBearings(glyph, 0, &rb); + rightBearing = qMin(QFixed(), QFixed::fromReal(rb)); + } + inline void adjustRightBearing() { if (currentPosition <= 0) return; - - qreal rb; - fontEngine->getGlyphBearings(currentGlyph(), 0, &rb); - rightBearing = qMin(QFixed(), QFixed::fromReal(rb)); + adjustRightBearing(currentGlyph()); } inline void resetRightBearing() @@ -1901,6 +1905,9 @@ void QTextLine::layout_helper(int maxGlyphs) } else { lbh.whiteSpaceOrObject = false; bool sb_or_ws = false; + glyph_t previousGlyph = 0; + if (lbh.currentPosition > 0 && lbh.logClusters[lbh.currentPosition - 1] line.width) lbh.adjustRightBearing(); if (lbh.checkFullOtherwiseExtend(line)) { + // we are too wide, fix right bearing + if (rightBearing <= 0) + lbh.rightBearing = rightBearing; // take from cache + else if (previousGlyph > 0) + lbh.adjustRightBearing(previousGlyph); if (!breakany) { line.textWidth += lbh.softHyphenWidth; } diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index f798faf..659ba1a 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -122,6 +122,7 @@ private slots: void smallTextLengthWrapAtWordBoundaryOrAnywhere(); void testLineBreakingAllSpaces(); void lineWidthFromBOM(); + void textWidthVsWIdth(); private: @@ -1359,5 +1360,34 @@ void tst_QTextLayout::glyphLessItems() } } +void tst_QTextLayout::textWidthVsWIdth() +{ + QTextLayout layout; + QTextOption opt; + opt.setWrapMode(QTextOption::WrapAnywhere); + layout.setTextOption(opt); + layout.setText(QString::fromLatin1( + "g++ -c -m64 -pipe -g -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DCORE_LIBRARY -DIDE_LIBRARY_BASENAME=\"lib\" -DWITH_TESTS " + "-DQT_NO_CAST_TO_ASCII -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_FAST_CONCATENATION -DQT_PLUGIN -DQT_TESTLIB_LIB -DQT_SCRIPT_LIB -DQT_SVG_LIB -DQT_SQL_LIB -DQT_XM" + "L_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../../qt-qml/mkspecs/linux-g++-64 -I. -I../../../../qt-qml/include/QtCore -I../../../." + "./qt-qml/include/QtNetwork -I../../../../qt-qml/include/QtGui -I../../../../qt-qml/include/QtXml -I../../../../qt-qml/include/QtSql -I../../../../qt-qml/inc" + "lude/QtSvg -I../../../../qt-qml/include/QtScript -I../../../../qt-qml/include/QtTest -I../../../../qt-qml/include -I../../../../qt-qml/include/QtHelp -I../." + "./libs -I/home/ettrich/dev/creator/tools -I../../plugins -I../../shared/scriptwrapper -I../../libs/3rdparty/botan/build -Idialogs -Iactionmanager -Ieditorma" + "nager -Iprogressmanager -Iscriptmanager -I.moc/debug-shared -I.uic -o .obj/debug-shared/sidebar.o sidebar.cpp")); + + // textWidth includes right bearing, but it should never be LARGER than width if there is space for at least one character + for (int width = 100; width < 1000; ++width) { + layout.beginLayout(); + QTextLine line = layout.createLine(); + line.setLineWidth(width); + layout.endLayout(); + + qreal textWidthIsLargerBy = qMax(qreal(0), line.naturalTextWidth() - line.width()); + qreal thisMustBeZero = 0; + QCOMPARE(textWidthIsLargerBy, thisMustBeZero); + } +} + + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From 4f2f48caae2ae18336bff10bb1e1ab07f2dd4650 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 9 Aug 2010 11:49:43 +0200 Subject: doc: Clarify documentation of QStaticText There has been some confusion concerning what HTML tags can be used when using the rich text format with QStaticText. This patch attempts to make it clearer in the documentation that the tags have to be text related. Reviewed-by: Samuel --- src/gui/text/qstatictext.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 7396bcd..21c2e02 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -109,10 +109,18 @@ QT_BEGIN_NAMESPACE QPainter::drawStaticText() and can change from call to call with a minimal impact on performance. - QStaticText will attempt to guess the format of the input text using Qt::mightBeRichText(). - To force QStaticText to display its contents as either plain text or rich text, use the - function QStaticText::setTextFormat() and pass in, respectively, Qt::PlainText and - Qt::RichText. + For extra convenience, it is possible to apply formatting to the text using the HTML subset + supported by QTextDocument. QStaticText will attempt to guess the format of the input text using + Qt::mightBeRichText(), and interpret it as rich text if this function returns true. To force + QStaticText to display its contents as either plain text or rich text, use the function + QStaticText::setTextFormat() and pass in, respectively, Qt::PlainText and Qt::RichText. + + QStaticText can only represent text, so only HTML tags which alter the layout or appearance of + the text will be respected. Adding an image to the input HTML, for instance, will cause the + image to be included as part of the layout, affecting the positions of the text glyphs, but it + will not be displayed. The result will be an empty area the size of the image in the output. + Similarly, using tables will cause the text to be laid out in table format, but the borders + will not be drawn. If it's the first time the static text is drawn, or if the static text, or the painter's font has been altered since the last time it was drawn, the text's layout has to be -- cgit v0.12 From ddd2a54224e651ff45af834201eec1be2c56d583 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 9 Aug 2010 11:58:40 +0200 Subject: QtDeclarative: get rid of warnings in public header warning: use of old-style cast Reviewed-by: brad --- src/declarative/qml/qdeclarativelist.h | 8 ++++---- src/declarative/qml/qdeclarativeprivate.h | 4 ++-- tests/auto/compilerwarnings/test_cpp.txt | 3 +++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/declarative/qml/qdeclarativelist.h b/src/declarative/qml/qdeclarativelist.h index 399b2a1..c10bc11 100644 --- a/src/declarative/qml/qdeclarativelist.h +++ b/src/declarative/qml/qdeclarativelist.h @@ -98,16 +98,16 @@ public: private: static void qlist_append(QDeclarativeListProperty *p, T *v) { - ((QList *)p->data)->append(v); + reinterpret_cast *>(p->data)->append(v); } static int qlist_count(QDeclarativeListProperty *p) { - return ((QList *)p->data)->count(); + return reinterpret_cast *>(p->data)->count(); } static T *qlist_at(QDeclarativeListProperty *p, int idx) { - return ((QList *)p->data)->at(idx); + return reinterpret_cast *>(p->data)->at(idx); } static void qlist_clear(QDeclarativeListProperty *p) { - return ((QList *)p->data)->clear(); + return reinterpret_cast *>(p->data)->clear(); } }; #endif diff --git a/src/declarative/qml/qdeclarativeprivate.h b/src/declarative/qml/qdeclarativeprivate.h index cb916bf..d45ddbc 100644 --- a/src/declarative/qml/qdeclarativeprivate.h +++ b/src/declarative/qml/qdeclarativeprivate.h @@ -105,7 +105,7 @@ namespace QDeclarativePrivate template struct StaticCastSelectorClass { - static inline int cast() { return (int)((intptr_t)static_cast((From *)0x10000000)) - 0x10000000; } + static inline int cast() { return int(reinterpret_cast(static_cast(reinterpret_cast(0x10000000)))) - 0x10000000; } }; template @@ -119,7 +119,7 @@ namespace QDeclarativePrivate static inline int cast() { - return StaticCastSelectorClass::cast(); + return StaticCastSelectorClass(0)))>::cast(); } }; diff --git a/tests/auto/compilerwarnings/test_cpp.txt b/tests/auto/compilerwarnings/test_cpp.txt index 62b35eb..1d317b8 100644 --- a/tests/auto/compilerwarnings/test_cpp.txt +++ b/tests/auto/compilerwarnings/test_cpp.txt @@ -58,6 +58,9 @@ #include #endif +#include + + #ifndef Q_OS_MAC int main(int, char **) { -- cgit v0.12 From 720f4ca0ec3b42a101ac24b2cf74cdc87d29eac9 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 9 Aug 2010 14:11:46 +0200 Subject: Fix QString::arg: When specifying %L1, the group separator would be added even if the local specify QLocale::OmitGroupSeparator Task-number: QTBUG-9281 Reviewed-by: Denis --- src/corelib/tools/qstring.cpp | 13 ++++++++----- tests/auto/qstring/tst_qstring.cpp | 12 ++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index d6ab5da..2fd9a0b 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -6645,8 +6645,9 @@ QString QString::arg(qlonglong a, int fieldWidth, int base, const QChar &fillCha QString locale_arg; if (d.locale_occurrences > 0) { QLocale locale; - locale_arg = locale.d()->longLongToString(a, -1, base, fieldWidth, - flags | QLocalePrivate::ThousandsGroup); + if (!locale.numberOptions() & QLocale::OmitGroupSeparator) + flags |= QLocalePrivate::ThousandsGroup; + locale_arg = locale.d()->longLongToString(a, -1, base, fieldWidth, flags); } return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar); @@ -6688,8 +6689,9 @@ QString QString::arg(qulonglong a, int fieldWidth, int base, const QChar &fillCh QString locale_arg; if (d.locale_occurrences > 0) { QLocale locale; - locale_arg = locale.d()->unsLongLongToString(a, -1, base, fieldWidth, - flags | QLocalePrivate::ThousandsGroup); + if (!locale.numberOptions() & QLocale::OmitGroupSeparator) + flags |= QLocalePrivate::ThousandsGroup; + locale_arg = locale.d()->unsLongLongToString(a, -1, base, fieldWidth, flags); } return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar); @@ -6822,7 +6824,8 @@ QString QString::arg(double a, int fieldWidth, char fmt, int prec, const QChar & if (d.locale_occurrences > 0) { QLocale locale; - flags |= QLocalePrivate::ThousandsGroup; + if (!locale.numberOptions() & QLocale::OmitGroupSeparator) + flags |= QLocalePrivate::ThousandsGroup; locale_arg = locale.d()->doubleToString(a, prec, form, fieldWidth, flags); } diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index c887936..ef82769 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -208,6 +208,7 @@ private slots: void repeated_data() const; void task262677remove(); void QTBUG10404_compareRef(); + void QTBUG9281_arg_locale(); }; typedef QList IntList; @@ -4860,6 +4861,17 @@ void tst_QString::QTBUG10404_compareRef() QVERIFY(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 3), Qt::CaseInsensitive) < 0); } +void tst_QString::QTBUG9281_arg_locale() +{ + QLocale l(QLocale::English, QLocale::UnitedKingdom); + l.setNumberOptions(QLocale::OmitGroupSeparator); + QLocale::setDefault(l); + QString str("*%L1*%L2*"); + str = str.arg(123456).arg(1234.56); + QCOMPARE(str, QString::fromLatin1("*123456*1234.56*")); + QLocale::setDefault(QLocale::C); +} + QTEST_APPLESS_MAIN(tst_QString) -- cgit v0.12 From a1641e27d2e2f5e29362e3737be6b9d75714d138 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Mon, 9 Aug 2010 15:56:34 +0200 Subject: Add text decoration support to QStaticText The original code path of QStaticText does not include decoration drawing, this patch generalized the drawTextItemDecoration() function to draw decoration for drawText(), then use that to draw decoration for QStaticText. A helper function called drawDecorationForGlyphs() is made to allow easier extension for direct glyphs drawing support. Task-number: QTBUG-12121 Reviewed-by: Eskil --- src/gui/painting/qpainter.cpp | 84 +++++++++++++++++++---- tests/auto/qstatictext/tst_qstatictext.cpp | 106 +++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+), 13 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 9dadbd5..b694d9c 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -90,6 +90,15 @@ void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QTextOption *option, const QString& str, QRectF *brect, int tabstops, int* tabarray, int tabarraylen, QPainter *painter); +static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QFontEngine *fe, + QTextCharFormat::UnderlineStyle underlineStyle, + const QTextItem::RenderFlags flags, qreal width, + const QTextCharFormat &charFormat); +// Helper function to calculate left most position, width and flags for decoration drawing +static void drawDecorationForGlyphs(QPainter *painter, const glyph_t *glyphArray, + const QFixedPoint *positions, int glyphCount, + QFontEngine *fontEngine, const QFont &font, + const QTextCharFormat &charFormat); static inline QGradient::CoordinateMode coordinateMode(const QBrush &brush) { @@ -5923,6 +5932,10 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText currentColor = item->color; } d->extended->drawStaticTextItem(item); + + drawDecorationForGlyphs(this, item->glyphs, item->glyphPositions, + item->numGlyphs, item->fontEngine, staticText_d->font, + QTextCharFormat()); } if (currentColor != oldPen.color()) setPen(oldPen); @@ -6290,15 +6303,15 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen) return pixmap; } -static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QTextItemInt &ti) +static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QFontEngine *fe, + QTextCharFormat::UnderlineStyle underlineStyle, + const QTextItem::RenderFlags flags, qreal width, + const QTextCharFormat &charFormat) { - QTextCharFormat::UnderlineStyle underlineStyle = ti.underlineStyle; if (underlineStyle == QTextCharFormat::NoUnderline - && !(ti.flags & (QTextItem::StrikeOut | QTextItem::Overline))) + && !(flags & (QTextItem::StrikeOut | QTextItem::Overline))) return; - QFontEngine *fe = ti.fontEngine; - const QPen oldPen = painter->pen(); const QBrush oldBrush = painter->brush(); painter->setBrush(Qt::NoBrush); @@ -6307,7 +6320,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const pen.setWidthF(fe->lineThickness().toReal()); pen.setCapStyle(Qt::FlatCap); - QLineF line(pos.x(), pos.y(), pos.x() + ti.width.toReal(), pos.y()); + QLineF line(pos.x(), pos.y(), pos.x() + width, pos.y()); const qreal underlineOffset = fe->underlinePosition().toReal(); // deliberately ceil the offset to avoid the underline coming too close to @@ -6322,21 +6335,21 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const painter->save(); painter->translate(0, pos.y() + 1); - QColor uc = ti.charFormat.underlineColor(); + QColor uc = charFormat.underlineColor(); if (uc.isValid()) pen.setColor(uc); // Adapt wave to underlineOffset or pen width, whatever is larger, to make it work on all platforms const QPixmap wave = generateWavyPixmap(qMax(underlineOffset, pen.widthF()), pen); - const int descent = (int) ti.descent.toReal(); + const int descent = (int) fe->descent().toReal(); painter->setBrushOrigin(painter->brushOrigin().x(), 0); - painter->fillRect(pos.x(), 0, qCeil(ti.width.toReal()), qMin(wave.height(), descent), wave); + painter->fillRect(pos.x(), 0, qCeil(width), qMin(wave.height(), descent), wave); painter->restore(); } else if (underlineStyle != QTextCharFormat::NoUnderline) { QLineF underLine(line.x1(), underlinePos, line.x2(), underlinePos); - QColor uc = ti.charFormat.underlineColor(); + QColor uc = charFormat.underlineColor(); if (uc.isValid()) pen.setColor(uc); @@ -6348,14 +6361,14 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const pen.setStyle(Qt::SolidLine); pen.setColor(oldPen.color()); - if (ti.flags & QTextItem::StrikeOut) { + if (flags & QTextItem::StrikeOut) { QLineF strikeOutLine = line; strikeOutLine.translate(0., - fe->ascent().toReal() / 3.); painter->setPen(pen); painter->drawLine(strikeOutLine); } - if (ti.flags & QTextItem::Overline) { + if (flags & QTextItem::Overline) { QLineF overLine = line; overLine.translate(0., - fe->ascent().toReal()); painter->setPen(pen); @@ -6366,6 +6379,50 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const painter->setBrush(oldBrush); } +static void drawDecorationForGlyphs(QPainter *painter, const glyph_t *glyphArray, + const QFixedPoint *positions, int glyphCount, + QFontEngine *fontEngine, const QFont &font, + const QTextCharFormat &charFormat) +{ + if (!(font.underline() || font.strikeOut() || font.overline())) + return; + + QFixed leftMost; + QFixed rightMost; + QFixed baseLine; + for (int i=0; iboundingBox(glyphArray[i]); + if (i == 0 || leftMost > positions[i].x) + leftMost = positions[i].x; + + // We don't support glyphs that do not share a common baseline. If this turns out to + // be a relevant use case, then we need to find clusters of glyphs that share a baseline + // and do a drawTextItemDecorations call per cluster. + if (i == 0 || baseLine < positions[i].y) + baseLine = positions[i].y; + + // We use the advance rather than the actual bounds to match the algorithm in drawText() + if (i == 0 || rightMost < positions[i].x + gm.xoff) + rightMost = positions[i].x + gm.xoff; + } + + QFixed width = rightMost - leftMost; + QTextItem::RenderFlags flags = 0; + + if (font.underline()) + flags |= QTextItem::Underline; + if (font.overline()) + flags |= QTextItem::Overline; + if (font.strikeOut()) + flags |= QTextItem::StrikeOut; + + drawTextItemDecoration(painter, QPointF(leftMost.toReal(), baseLine.toReal()), + fontEngine, + font.underline() ? QTextCharFormat::SingleUnderline + : QTextCharFormat::NoUnderline, flags, + width.toReal(), charFormat); +} + void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti) { #ifdef QT_DEBUG_DRAW @@ -6496,7 +6553,8 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti) else d->engine->drawTextItem(p, ti); } - drawTextItemDecoration(this, p, ti); + drawTextItemDecoration(this, p, ti.fontEngine, ti.underlineStyle, ti.flags, ti.width.toReal(), + ti.charFormat); if (d->state->renderHints != oldRenderHints) { d->state->renderHints = oldRenderHints; diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 1d166f4..0ae5320 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -85,6 +85,10 @@ private slots: void setPenPlainText(); void setPenRichText(); void richTextOverridesPen(); + + void drawStruckOutText(); + void drawOverlinedText(); + void drawUnderlinedText(); }; void tst_QStaticText::init() @@ -620,5 +624,107 @@ void tst_QStaticText::richTextOverridesPen() } } +void tst_QStaticText::drawStruckOutText() +{ + QPixmap imageDrawText(1000, 1000); + QPixmap imageDrawStaticText(1000, 1000); + + imageDrawText.fill(Qt::white); + imageDrawStaticText.fill(Qt::white); + + QString s = QString::fromLatin1("Foobar"); + + QFont font; + font.setStrikeOut(true); + + { + QPainter p(&imageDrawText); + p.setFont(font); + p.drawText(QPointF(50, 50), s); + } + + { + QPainter p(&imageDrawStaticText); + QStaticText text = QStaticText(s); + p.setFont(font); + p.drawStaticText(QPointF(50, 50 - QFontMetricsF(p.font()).ascent()), text); + } + +#if defined(DEBUG_SAVE_IMAGE) + imageDrawText.save("drawStruckOutText_imageDrawText.png"); + imageDrawStaticText.save("drawStruckOutText_imageDrawStaticText.png"); +#endif + + QCOMPARE(imageDrawText, imageDrawStaticText); +} + +void tst_QStaticText::drawOverlinedText() +{ + QPixmap imageDrawText(1000, 1000); + QPixmap imageDrawStaticText(1000, 1000); + + imageDrawText.fill(Qt::white); + imageDrawStaticText.fill(Qt::white); + + QString s = QString::fromLatin1("Foobar"); + + QFont font; + font.setOverline(true); + + { + QPainter p(&imageDrawText); + p.setFont(font); + p.drawText(QPointF(50, 50), s); + } + + { + QPainter p(&imageDrawStaticText); + QStaticText text = QStaticText(s); + p.setFont(font); + p.drawStaticText(QPointF(50, 50 - QFontMetricsF(p.font()).ascent()), text); + } + +#if defined(DEBUG_SAVE_IMAGE) + imageDrawText.save("drawOverlinedText_imageDrawText.png"); + imageDrawStaticText.save("drawOverlinedText_imageDrawStaticText.png"); +#endif + + QCOMPARE(imageDrawText, imageDrawStaticText); +} + +void tst_QStaticText::drawUnderlinedText() +{ + QPixmap imageDrawText(1000, 1000); + QPixmap imageDrawStaticText(1000, 1000); + + imageDrawText.fill(Qt::white); + imageDrawStaticText.fill(Qt::white); + + QString s = QString::fromLatin1("Foobar"); + + QFont font; + font.setUnderline(true); + + { + QPainter p(&imageDrawText); + p.setFont(font); + p.drawText(QPointF(50, 50), s); + } + + { + QPainter p(&imageDrawStaticText); + QStaticText text = QStaticText(s); + p.setFont(font); + p.drawStaticText(QPointF(50, 50 - QFontMetricsF(p.font()).ascent()), text); + } + +#if defined(DEBUG_SAVE_IMAGE) + imageDrawText.save("drawUnderlinedText_imageDrawText.png"); + imageDrawStaticText.save("drawUnderlinedText_imageDrawStaticText.png"); +#endif + + QCOMPARE(imageDrawText, imageDrawStaticText); +} + QTEST_MAIN(tst_QStaticText) #include "tst_qstatictext.moc" -- cgit v0.12 From 2281a3a7a62a5a81de7fefaf0b84f130b16bd44f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 10 Aug 2010 10:54:26 +0200 Subject: QMetaObject::normalizeSignature avoid reading past the string in case of invalid signature given. If passed "a(b", qNormalizeType would return a pointer to the \0 at the end of the string. We would add \0 to the result (thinking it is ',' or ')' ) And continue to process the memory after the string. Reviewed-by: Kent Hansen Task-number: QT-1591 --- src/corelib/kernel/qmetaobject.cpp | 5 ++++- tests/auto/qmetaobject/tst_qmetaobject.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 79a38cd..9854e68 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1009,8 +1009,11 @@ QByteArray QMetaObject::normalizedSignature(const char *method) int argdepth = 0; int templdepth = 0; while (*d) { - if (argdepth == 1) + if (argdepth == 1) { d = qNormalizeType(d, templdepth, result); + if (!*d) //most likely an invalid signature. + break; + } if (*d == '(') ++argdepth; if (*d == ')') diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index 62416b1..bb96da1 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -714,6 +714,8 @@ void tst_QMetaObject::normalizedSignature_data() QTest::newRow("const12") << "void foo(Fooconst*const *const)" << "void foo(Foo*const*const)"; QTest::newRow("const13") << "void foo(const Foo&)" << "void foo(Foo)"; QTest::newRow("const14") << "void foo(Fooconst&)" << "void foo(Foo)"; + + QTest::newRow("invalid1") << "a( b" << "a(b"; } void tst_QMetaObject::normalizedSignature() @@ -721,7 +723,7 @@ void tst_QMetaObject::normalizedSignature() QFETCH(QString, signature); QFETCH(QString, result); - QCOMPARE(QString::fromLatin1(QMetaObject::normalizedSignature(signature.toLatin1())), result); + QCOMPARE(QMetaObject::normalizedSignature(signature.toLatin1()), result.toLatin1()); } void tst_QMetaObject::normalizedType_data() @@ -759,7 +761,7 @@ void tst_QMetaObject::normalizedType() QFETCH(QString, type); QFETCH(QString, result); - QCOMPARE(QString::fromLatin1(QMetaObject::normalizedType(type.toLatin1())), result); + QCOMPARE(QMetaObject::normalizedType(type.toLatin1()), result.toLatin1()); } void tst_QMetaObject::customPropertyType() -- cgit v0.12 From c21f95aab2228168452d1d7bb4e332a8c6164a02 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 10 Aug 2010 11:35:51 +0200 Subject: Added one test for QRegExp Task-number: QT-1289 --- tests/auto/qregexp/tst_qregexp.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/auto/qregexp/tst_qregexp.cpp b/tests/auto/qregexp/tst_qregexp.cpp index ea07323..d0d26ee 100644 --- a/tests/auto/qregexp/tst_qregexp.cpp +++ b/tests/auto/qregexp/tst_qregexp.cpp @@ -105,6 +105,7 @@ private slots: void QTBUG_7049_data(); void QTBUG_7049(); + void interval(); }; // Testing get/set functions @@ -1426,5 +1427,22 @@ void tst_QRegExp::QTBUG_7049() QCOMPARE( re.cap(2), cap2 ); } +void tst_QRegExp::interval() +{ + { + QRegExp exp("a{0,1}"); + QVERIFY(exp.isValid()); + } + { + QRegExp exp("a{1,1}"); + QVERIFY(exp.isValid()); + } + { + QRegExp exp("a{1,0}"); + QVERIFY(!exp.isValid()); + } +} + + QTEST_APPLESS_MAIN(tst_QRegExp) #include "tst_qregexp.moc" -- cgit v0.12