diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-06-22 07:11:59 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-06-22 07:11:59 (GMT) |
commit | 9adf2ec67251099b1807eb586367fda4cf60ff40 (patch) | |
tree | 28a10fddf909d02d34ede330adfd135fb62994eb | |
parent | ca17b86f02524338d1501652c22eb9fd2501317b (diff) | |
parent | b92a7337d47e8b1be2d65d5a726f7a6f291a65bb (diff) | |
download | Qt-9adf2ec67251099b1807eb586367fda4cf60ff40.zip Qt-9adf2ec67251099b1807eb586367fda4cf60ff40.tar.gz Qt-9adf2ec67251099b1807eb586367fda4cf60ff40.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
159 files changed, 1282 insertions, 673 deletions
diff --git a/demos/embedded/qmlcalculator/deployment.pri b/demos/embedded/qmlcalculator/deployment.pri index d5078f6..a0bfbb6 100644 --- a/demos/embedded/qmlcalculator/deployment.pri +++ b/demos/embedded/qmlcalculator/deployment.pri @@ -1,6 +1,6 @@ qmlcalculator_src = $$PWD/../../declarative/calculator symbian { - qmlcalculator_uid3 = EA8EBD98 + qmlcalculator_uid3 = A000E3FB qmlcalculator_files.path = ../$$qmlcalculator_uid3 } qmlcalculator_files.sources = $$qmlcalculator_src/calculator.qml $$qmlcalculator_src/Core diff --git a/demos/embedded/qmlclocks/deployment.pri b/demos/embedded/qmlclocks/deployment.pri index 84803ec..a30e403 100644 --- a/demos/embedded/qmlclocks/deployment.pri +++ b/demos/embedded/qmlclocks/deployment.pri @@ -1,6 +1,6 @@ qmlclocks_src = $$PWD/../../../examples/declarative/toys/clocks symbian { - qmlclocks_uid3 = E19225B9 + qmlclocks_uid3 = A000E3FC qmlclocks_files.path = ../$$qmlclocks_uid3 } qmlclocks_files.sources = $$qmlclocks_src/clocks.qml $$qmlclocks_src/content diff --git a/demos/embedded/qmldialcontrol/deployment.pri b/demos/embedded/qmldialcontrol/deployment.pri index 8eb39b2..c04ed05 100644 --- a/demos/embedded/qmldialcontrol/deployment.pri +++ b/demos/embedded/qmldialcontrol/deployment.pri @@ -1,6 +1,6 @@ qmldialcontrol_src = $$PWD/../../../examples/declarative/ui-components/dialcontrol symbian { - qmldialcontrol_uid3 = E59A9283 + qmldialcontrol_uid3 = A000E3FD qmldialcontrol_files.path = ../$$qmldialcontrol_uid3 } qmldialcontrol_files.sources = $$qmldialcontrol_src/dialcontrol.qml $$qmldialcontrol_src/content diff --git a/demos/embedded/qmleasing/deployment.pri b/demos/embedded/qmleasing/deployment.pri index ddab1ba..bc37348 100644 --- a/demos/embedded/qmleasing/deployment.pri +++ b/demos/embedded/qmleasing/deployment.pri @@ -1,6 +1,6 @@ qmleasing_src = $$PWD/../../../examples/declarative/animation/easing symbian { - qmleasing_uid3 = E8E8E725 + qmleasing_uid3 = A000E3FE qmleasing_files.path = ../$$qmleasing_uid3 } qmleasing_files.sources = $$qmleasing_src/easing.qml diff --git a/demos/embedded/qmlflickr/deployment.pri b/demos/embedded/qmlflickr/deployment.pri index aef3198..c1f82df 100644 --- a/demos/embedded/qmlflickr/deployment.pri +++ b/demos/embedded/qmlflickr/deployment.pri @@ -1,6 +1,6 @@ qmlflickr_src = $$PWD/../../declarative/flickr symbian { - qmlflickr_uid3 = E56D5A92 + qmlflickr_uid3 = A000E3FF qmlflickr_files.path = ../$$qmlflickr_uid3 } qmlflickr_files.sources = $$qmlflickr_src/flickr.qml $$qmlflickr_src/common $$qmlflickr_src/mobile diff --git a/demos/embedded/qmlphotoviewer/deployment.pri b/demos/embedded/qmlphotoviewer/deployment.pri index 99475cc..0a457de 100644 --- a/demos/embedded/qmlphotoviewer/deployment.pri +++ b/demos/embedded/qmlphotoviewer/deployment.pri @@ -1,6 +1,6 @@ qmlphotoviewer_src = $$PWD/../../declarative/photoviewer symbian { - qmlphotoviewer_uid3 = E8567E72 + qmlphotoviewer_uid3 = A000E400 qmlphotoviewer_files.path = ../$$qmlphotoviewer_uid3 } qmlphotoviewer_files.sources = $$qmlphotoviewer_src/photoviewer.qml $$qmlphotoviewer_src/PhotoViewerCore diff --git a/demos/embedded/qmltwitter/deployment.pri b/demos/embedded/qmltwitter/deployment.pri index e5bd884..34c8cd1 100644 --- a/demos/embedded/qmltwitter/deployment.pri +++ b/demos/embedded/qmltwitter/deployment.pri @@ -1,6 +1,6 @@ qmltwitter_src = $$PWD/../../declarative/twitter symbian { - qmltwitter_uid3 = EEF6D468 + qmltwitter_uid3 = A000E401 qmltwitter_files.path = ../$$qmltwitter_uid3 } qmltwitter_files.sources = $$qmltwitter_src/twitter.qml $$qmltwitter_src/TwitterCore diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index ad8c10c..f127ed1 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -45,34 +45,87 @@ \brief Building UI's with QML \ingroup all-examples -\section1 Running the examples -You can find many simple examples in the \c examples/declarative -sub-directory that show how to use various aspects of QML. In addition, the -\c demos/declarative sub-directory contains more sophisticated demos of large -applications. These demos are intended to show integrated functionality -rather than being instructive on specific elements. +Qt includes a set of examples and demos that show how to use various aspects +of QML. The examples are small demonstrations of particular QML components, +while the demos contain more complete and functional applications. To run the examples and demos, you can use Qt Creator or the included \l {Qt Declarative UI Runtime}{qmlviewer} -command-line application. It has some useful options, revealed by: +command-line application. For example, from your build directory, run: \code - bin/qmlviewer -help + bin/qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml \endcode -For example, from your build directory, run: -\code - bin/qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml -\endcode +\section1 Demos + +The QML demos integrate a variety of features to demonstrate how QML +can be used to produce sophisticated interfaces and applications: + + +\table +\row + +\o +\l{demos/declarative/calculator}{Calculator} +\image qml-calculator-example-small.png + +\o +\l{demos/declarative/flickr}{Flickr Mobile} +\image qml-flickr-demo-small.png + +\o +\l{demos/declarative/minehunt}{Minehunt} +\image qml-minehunt-demo-small.png + +\row + +\o +\l{demos/declarative/photoviewer}{Photo Viewer} +\image qml-photoviewer-demo-small.png + +\o +\l{demos/declarative/rssnews}{RSS News Reader} +\image qml-rssnews-demo-small.png + +\o +\l{demos/declarative/samegame}{Same Game} +\image qml-samegame-demo-small.png + +\row + +\o +\l{demos/declarative/snake}{Snake} +\image qml-snake-demo-small.png + +\o +\l{demos/declarative/twitter}{Twitter} +\image qml-twitter-demo-small.png + +\o +\l{demos/declarative/webbrowser}{Web Browser} +\image qml-webbrowser-demo-small.png + +\endtable + +The demos can be found in Qt's \c demos/declarative directory. + \section1 Examples +The QML examples are small, simple applications that show how to use a particular +QML component or feature. If you are new +to QML, you may also find the \l{QML Tutorial}{Hello World} and +\l {QML Advanced Tutorial}{Same Game} tutorials useful. + +The examples can be found in Qt's \c examples/declarative directory. + \section2 Animation \list \o \l{declarative/animation/basics}{Basics} \o \l{declarative/animation/behaviors}{Behaviors} -\o \l{declarative/animation/easing}{Easing types} +\o \l{declarative/animation/easing}{Easing} \o \l{declarative/animation/states}{States} \endlist @@ -82,6 +135,12 @@ For example, from your build directory, run: \o \l{declarative/imageelements/image}{Image} \endlist +\section2 Text +\list +\o \l{declarative/text/fonts}{Fonts} +\o \l{declarative/text/textselection}{Text Selection} +\endlist + \section2 Positioners \list \o \l{declarative/positioners}{Example} @@ -110,6 +169,15 @@ For example, from your build directory, run: \o \l{declarative/ui-components/tabwidget}{Tab widget} \endlist +\section2 Toys +\list +\o \l{declarative/toys/clocks}{Clocks} +\o \l{declarative/toys/corkboards}{Corkboards} +\o \l{declarative/toys/dynamicscene}{Dynamic Scene} +\o \l{declarative/toys/tic-tac-toe}{Tic Tac Toe} +\o \l{declarative/toys/tvtennis}{TV Tennis} +\endlist + \section2 Models and Views \list \o \l{declarative/modelviews/gridview}{GridView} @@ -153,27 +221,6 @@ For example, from your build directory, run: \o \l{declarative/cppextensions/networkaccessmanagerfactory}{Network access manager factory} \endlist -\section2 Toys -\list -\o \l{declarative/toys/clocks}{Clocks} -\o \l{declarative/toys/corkboards}{Corkboards} -\o \l{declarative/toys/dynamicscene}{Dynamic Scene} -\o \l{declarative/toys/tic-tac-toe}{Tic Tac Toe} -\o \l{declarative/toys/tvtennis}{TV Tennis} -\endlist - - -\section1 Demos - -\list -\o \l{demos/declarative/calculator}{Calculator} -\o \l{demos/declarative/flickr}{Flickr Mobile} -\o \l{demos/declarative/minehunt}{Minehunt} -\o \l{demos/declarative/photoviewer}{Photo Viewer} -\o \l{demos/declarative/rssnews}{RSS News Reader} -\o \l{demos/declarative/samegame}{Same Game} -\o \l{demos/declarative/snake}{Snake} -\endlist \section1 Labs diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index ee708a8..1c0680d 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -43,7 +43,21 @@ \title Animation: Basics \example declarative/animation/basics - This example shows how to create \l{QML Animation}{animations} in QML. + This example shows how to create and combine \l{QML Animation}{animations} in QML. + + \table + \row + \o \image qml-coloranim-example.png + \row + \o color-animation.qml + \endtable + + \table + \row + \o \image qml-propertyanim-example.png + \row + \o property-animation.qml + \endtable */ /*! @@ -51,34 +65,69 @@ \example declarative/animation/behaviors This example shows how to use QML behaviors. + + \image qml-behaviors-example.png */ /*! - \title Animation: Easing types + \title Animation: Easing \example declarative/animation/easing This example shows the different easing modes available for \l{QML Animation}{animations}. + + \image qml-easing-example.png */ /*! \title Animation: States \example declarative/animation/states - This example shows how to use \l{States}{states} and \l{Transitions}{transitions}. + These examples show how to use \l{States}{states} and \l{Transitions}{transitions}. + + The \c states.qml example shows how an item can change between states, and \c transitions.qml + shows how these state changes can be animated. + + \table + \row + \o \image qml-states-example.png + \row + \o states.qml + \endtable + + \table + \row + \o \image qml-transitions-example.png + \row + \o transitions.qml + \endtable */ /*! \title Image Elements: Border Image \example declarative/imageelements/borderimage - This example shows how to use the BorderImage element. + These examples show how to use the BorderImage element. + + \table + \row + \o \image qml-borderimage-example.png + \row + \o borderimage.qml + \endtable + + \table + \row + \o \image qml-borderimage-shadows-example.png + \row + \o shadows.qml + \endtable */ /*! \title Image Elements: Image \example declarative/imageelements/image - This example shows how to use the Image element and its \l{Image::fillMode}{fillModes}. + This example shows how to use the \l Image element and its \l{Image::fillMode}{fillModes}. \image qml-image-example.png */ @@ -116,6 +165,8 @@ \example declarative/cppextensions/plugins This example shows how to create a C++ plugin extension by subclassing QDeclarativeExtensionPlugin. + + \image qml-plugins-example.png */ /*! @@ -124,6 +175,8 @@ This example show how to use the LayoutItem element to integrate QML items into an existing \l{Graphics View Framework}{Graphics View}-based application. + + \image qml-layoutitem-example.png */ /*! \title QGraphicsGridLayout @@ -132,6 +185,8 @@ This example shows how to use QGraphicsGridLayout to lay out QML items. This is useful if you need to integrate Qt \l{Graphics View Framework}{Graphics View} layouts with QML. + + \image qml-qgraphicsgridlayout-example.png */ /*! \title QGraphicsLinearLayout @@ -140,6 +195,8 @@ This example shows how to use QGraphicsLinearLayout to lay out QML items. This is useful if you need to integrate Qt \l{Graphics View Framework}{Graphics View} layouts with QML. + + \image qml-qgraphicslinearlayout-example.png */ /*! \page declarative-cppextensions-qgraphicslayouts.html @@ -160,6 +217,8 @@ \example declarative/cppextensions/qwidgets This example shows how to embed QWidget-based objects into QML using QGraphicsProxyWidget. + + \image qml-qwidgets-example.png */ /*! @@ -171,7 +230,7 @@ */ /*! - \title C++ Extensions: Network access manager + \title C++ Extensions: Network access manager factory \example declarative/cppextensions/networkaccessmanagerfactory This example shows how to use QDeclarativeNetworkAccessManagerFactory to create a QNetworkAccessManager @@ -183,21 +242,25 @@ \example declarative/i18n This example shows how to enable text translation in QML. + + \image qml-i18n-example.png */ /*! \title Positioners \example declarative/positioners - This example shows how to use positioner elements such as Row, Column, - Grid and Flow. + This example shows how to use positioner elements such as \l Row, \l Column, + \l Grid and \l Flow. + + \image qml-positioners-example.png */ /*! \title Key Interaction: Focus \example declarative/keyinteraction/focus - This example shows how to handle keys and focus in QML. + This example shows how to handle keyboard input and focus in QML. \image qml-focus-example.png */ @@ -207,6 +270,8 @@ \example declarative/modelviews/gridview This example shows how to use the GridView element. + + \image qml-gridview-example.png */ /*! @@ -214,6 +279,41 @@ \example declarative/modelviews/listview These examples show how to use the ListView element. + + \table + \row + \o \image qml-listview-dynamiclist-example.png + \row + \o dynamiclist.qml + \endtable + + \table + \row + \o \image qml-listview-expandingdelegates-example.png + \row + \o expandingdelegates.qml + \endtable + + \table + \row + \o \image qml-listview-highlight-example.png + \row + \o highlight.qml + \endtable + + \table + \row + \o \image qml-listview-highlightranges-example.png + \row + \o highlightranges.qml + \endtable + + \table + \row + \o \image qml-listview-sections-example.png + \row + \o sections.qml + \endtable */ /*! @@ -222,13 +322,17 @@ This example shows how to create a C++ extension that exposes a QList<QObject*> as a model in QML. + + \image qml-objectlistmodel-example.png */ /*! \title Models and Views: Package \example declarative/modelviews/package - This example shows how to use the Package element. + This example shows how to use the \l Package element. + + \image qml-package-example.png */ /*! @@ -236,6 +340,8 @@ \example declarative/modelviews/parallax This example shows how to combine and switch between views. + + \image qml-parallax-example.png */ /*! @@ -244,6 +350,8 @@ This example shows how to create a C++ extension that exposes a QStringList as a model in QML. + + \image qml-stringlistmodel-example.png */ /*! @@ -251,13 +359,50 @@ \example declarative/modelviews/visualitemmodel This example shows how to use the VisualItemModel element. + + \image qml-visualitemmodel-example.png */ /*! \title Models and Views: WebView \example declarative/modelviews/webview - This example shows how to use the WebView element. + These examples shows how to use the WebView element. + + \table + \row + \o \image qml-webview-alert-example.png + \row + \o alert.qml + \endtable + + \table + \row + \o \image qml-webview-autosize-example.png + \row + \o autosize.qml + \endtable + + \table + \row + \o \image qml-webview-googlemaps-example.png + \row + \o googlemaps.qml + \endtable + + \table + \row + \o \image qml-webview-inlinehtml-example.png + \row + \o inlinehtml.qml + \endtable + + \table + \row + \o \image qml-webview-newwindows-example.png + \row + \o newwindows.qml + \endtable */ /*! @@ -271,8 +416,46 @@ \title Text: Fonts \example declarative/text/fonts - This example shows how to discover available fonts from QML and use - fonts in different ways. + These examples show how to discover available fonts from QML and manipulate + text in various ways. + + \table + \row + \o \image qml-fonts-availableFonts-example.png + \row + \o availableFonts.qml + \endtable + + \table + \row + \o \image qml-fonts-banner-example.png + \row + \o banner.qml + \endtable + + \table + \row + \o \image qml-fonts-fonts-example.png + \row + \o fonts.qml + \endtable + + \table + \row + \o \image qml-fonts-hello-example.png + \row + \o hello.qml + \endtable +*/ + +/*! + \title Text: Text Selection + \example declarative/text/textselection + + This example shows how text selection, copy and paste operations + can be implemented on top of the TextEdit element. + + \image qml-textselection-example.png */ /*! @@ -350,18 +533,22 @@ */ /*! - \title Touch Interaction: Mouse Area + \title Touch Interaction: MouseArea \example declarative/touchinteraction/mousearea - This example shows how to use the MouseArea element. + This example shows how to use the MouseArea element to access information + about mouse input. + + \image qml-mousearea-example.png */ /*! \title UI Components: Dial \example declarative/ui-components/dialcontrol - This example presents an interactive speedometer-type dial by combining - \l Image elements with \l Rotation transforms and \l SpringFollow animations. + This example shows how to create a dial-type control. It combines + \l Image elements with \l Rotation transforms and \l SpringFollow animations + to produce an interactive speedometer-type dial. \image qml-dialcontrol-example.png */ @@ -371,7 +558,7 @@ \title UI Components: Flipable \example declarative/ui-components/flipable - This example shows how to use the Flipable element. + This example shows how to use the \l Flipable element. \image qml-flipable-example.png */ @@ -389,7 +576,7 @@ \title UI Components: Scroll Bar \example declarative/ui-components/scrollbar - This example shows how to create scroll bars for a Flickable element + This example shows how to create scroll bars for a \l Flickable element using the \l {Flickable::visibleArea.xPosition}{Flickable::visibleArea} properties. @@ -400,7 +587,8 @@ \title UI Components: Search Box \example declarative/ui-components/searchbox - This example shows how to create a search box. + This example shows how to combine TextInput, FocusScope and BorderImage + elements to display multiple text input fields. \image qml-searchbox-example.png */ @@ -409,7 +597,7 @@ \title UI Components: Slide Switch \example declarative/ui-components/slideswitch - This example shows how to create a slide switch. + This example shows how to create a slide switch control. \image qml-slideswitch-example.png */ @@ -418,7 +606,7 @@ \title UI Components: Spinner \example declarative/ui-components/spinner - This example shows how to create a spinner-type component. + This example shows how to create a spinner-type component using the PathView element. \image qml-spinner-example.png */ @@ -436,5 +624,7 @@ \title XML: XMLHttpRequest \example declarative/xml/xmlhttprequest - This example shows how to use \l XmlHttpRequest in QML. + This example shows how to use the \l XmlHttpRequest API in QML. + + \image qml-xmlhttprequest-example.png */ diff --git a/doc/src/examples/qml-webbrowser.qdoc b/doc/src/examples/qml-webbrowser.qdoc new file mode 100644 index 0000000..da6f600 --- /dev/null +++ b/doc/src/examples/qml-webbrowser.qdoc @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** 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 documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title Web Browser + \example demos/declarative/webbrowser + + This demo shows how to write a simple web browser in QML by combining the + WebView element with other components including scroll bars, + \l Flickable views and TextInput fields. + + \image qml-webbrowser-demo.png +*/ + diff --git a/doc/src/images/declarative-folderlistmodel.png b/doc/src/images/declarative-folderlistmodel.png Binary files differindex a469f96..fbed4f8 100644 --- a/doc/src/images/declarative-folderlistmodel.png +++ b/doc/src/images/declarative-folderlistmodel.png diff --git a/doc/src/images/qml-behaviors-example.png b/doc/src/images/qml-behaviors-example.png Binary files differnew file mode 100644 index 0000000..aee5c2b --- /dev/null +++ b/doc/src/images/qml-behaviors-example.png diff --git a/doc/src/images/qml-borderimage-example.png b/doc/src/images/qml-borderimage-example.png Binary files differnew file mode 100644 index 0000000..7e488f2 --- /dev/null +++ b/doc/src/images/qml-borderimage-example.png diff --git a/doc/src/images/qml-borderimage-shadows-example.png b/doc/src/images/qml-borderimage-shadows-example.png Binary files differnew file mode 100644 index 0000000..4700868 --- /dev/null +++ b/doc/src/images/qml-borderimage-shadows-example.png diff --git a/doc/src/images/qml-calculator-example-small.png b/doc/src/images/qml-calculator-example-small.png Binary files differnew file mode 100644 index 0000000..9e0370f --- /dev/null +++ b/doc/src/images/qml-calculator-example-small.png diff --git a/doc/src/images/qml-calculator-example.png b/doc/src/images/qml-calculator-example.png Binary files differindex 19ce1b6..0f9ced8 100644 --- a/doc/src/images/qml-calculator-example.png +++ b/doc/src/images/qml-calculator-example.png diff --git a/doc/src/images/qml-coloranim-example.png b/doc/src/images/qml-coloranim-example.png Binary files differnew file mode 100644 index 0000000..12edc99 --- /dev/null +++ b/doc/src/images/qml-coloranim-example.png diff --git a/doc/src/images/qml-dynamicscene-example.png b/doc/src/images/qml-dynamicscene-example.png Binary files differindex 1f725d1..4179ebe 100644 --- a/doc/src/images/qml-dynamicscene-example.png +++ b/doc/src/images/qml-dynamicscene-example.png diff --git a/doc/src/images/qml-easing-example.png b/doc/src/images/qml-easing-example.png Binary files differnew file mode 100644 index 0000000..fef5b70 --- /dev/null +++ b/doc/src/images/qml-easing-example.png diff --git a/doc/src/images/qml-flickr-demo-small.png b/doc/src/images/qml-flickr-demo-small.png Binary files differnew file mode 100644 index 0000000..370ffcf --- /dev/null +++ b/doc/src/images/qml-flickr-demo-small.png diff --git a/doc/src/images/qml-focus-example.png b/doc/src/images/qml-focus-example.png Binary files differindex 5a114a0..0ec2bff 100644 --- a/doc/src/images/qml-focus-example.png +++ b/doc/src/images/qml-focus-example.png diff --git a/doc/src/images/qml-fonts-availableFonts-example.png b/doc/src/images/qml-fonts-availableFonts-example.png Binary files differnew file mode 100644 index 0000000..4d8440c --- /dev/null +++ b/doc/src/images/qml-fonts-availableFonts-example.png diff --git a/doc/src/images/qml-fonts-banner-example.png b/doc/src/images/qml-fonts-banner-example.png Binary files differnew file mode 100644 index 0000000..b415161 --- /dev/null +++ b/doc/src/images/qml-fonts-banner-example.png diff --git a/doc/src/images/qml-fonts-fonts-example.png b/doc/src/images/qml-fonts-fonts-example.png Binary files differnew file mode 100644 index 0000000..4481397 --- /dev/null +++ b/doc/src/images/qml-fonts-fonts-example.png diff --git a/doc/src/images/qml-fonts-hello-example.png b/doc/src/images/qml-fonts-hello-example.png Binary files differnew file mode 100644 index 0000000..18da867 --- /dev/null +++ b/doc/src/images/qml-fonts-hello-example.png diff --git a/doc/src/images/qml-gridview-example.png b/doc/src/images/qml-gridview-example.png Binary files differnew file mode 100644 index 0000000..8a092b5 --- /dev/null +++ b/doc/src/images/qml-gridview-example.png diff --git a/doc/src/images/qml-i18n-example.png b/doc/src/images/qml-i18n-example.png Binary files differnew file mode 100644 index 0000000..8e734ea --- /dev/null +++ b/doc/src/images/qml-i18n-example.png diff --git a/doc/src/images/qml-layoutitem-example.png b/doc/src/images/qml-layoutitem-example.png Binary files differnew file mode 100644 index 0000000..b3c778a --- /dev/null +++ b/doc/src/images/qml-layoutitem-example.png diff --git a/doc/src/images/qml-listview-dynamiclist-example.png b/doc/src/images/qml-listview-dynamiclist-example.png Binary files differnew file mode 100644 index 0000000..6acc3d9 --- /dev/null +++ b/doc/src/images/qml-listview-dynamiclist-example.png diff --git a/doc/src/images/qml-listview-expandingdelegates-example.png b/doc/src/images/qml-listview-expandingdelegates-example.png Binary files differnew file mode 100644 index 0000000..e7ffc33 --- /dev/null +++ b/doc/src/images/qml-listview-expandingdelegates-example.png diff --git a/doc/src/images/qml-listview-highlight-example.png b/doc/src/images/qml-listview-highlight-example.png Binary files differnew file mode 100644 index 0000000..4f95c13 --- /dev/null +++ b/doc/src/images/qml-listview-highlight-example.png diff --git a/doc/src/images/qml-listview-highlightranges-example.png b/doc/src/images/qml-listview-highlightranges-example.png Binary files differnew file mode 100644 index 0000000..f499caa --- /dev/null +++ b/doc/src/images/qml-listview-highlightranges-example.png diff --git a/doc/src/declarative/pics/ListViewSections.png b/doc/src/images/qml-listview-sections-example.png Binary files differindex 4e8f076..4e8f076 100644 --- a/doc/src/declarative/pics/ListViewSections.png +++ b/doc/src/images/qml-listview-sections-example.png diff --git a/doc/src/images/qml-minehunt-demo-small.png b/doc/src/images/qml-minehunt-demo-small.png Binary files differnew file mode 100644 index 0000000..e5badac --- /dev/null +++ b/doc/src/images/qml-minehunt-demo-small.png diff --git a/doc/src/images/qml-mousearea-example.png b/doc/src/images/qml-mousearea-example.png Binary files differnew file mode 100644 index 0000000..c6e52d6 --- /dev/null +++ b/doc/src/images/qml-mousearea-example.png diff --git a/doc/src/images/qml-objectlistmodel-example.png b/doc/src/images/qml-objectlistmodel-example.png Binary files differnew file mode 100644 index 0000000..c0fc490 --- /dev/null +++ b/doc/src/images/qml-objectlistmodel-example.png diff --git a/doc/src/images/qml-package-example.png b/doc/src/images/qml-package-example.png Binary files differnew file mode 100644 index 0000000..f7749aa --- /dev/null +++ b/doc/src/images/qml-package-example.png diff --git a/doc/src/images/qml-parallax-example.png b/doc/src/images/qml-parallax-example.png Binary files differnew file mode 100644 index 0000000..2df52ed --- /dev/null +++ b/doc/src/images/qml-parallax-example.png diff --git a/doc/src/images/qml-photoviewer-demo-small.png b/doc/src/images/qml-photoviewer-demo-small.png Binary files differnew file mode 100644 index 0000000..b16fb4e --- /dev/null +++ b/doc/src/images/qml-photoviewer-demo-small.png diff --git a/doc/src/images/qml-plugins-example.png b/doc/src/images/qml-plugins-example.png Binary files differnew file mode 100644 index 0000000..c2d4886 --- /dev/null +++ b/doc/src/images/qml-plugins-example.png diff --git a/doc/src/images/qml-positioners-example.png b/doc/src/images/qml-positioners-example.png Binary files differnew file mode 100644 index 0000000..721c1b3 --- /dev/null +++ b/doc/src/images/qml-positioners-example.png diff --git a/doc/src/images/qml-propertyanim-example.png b/doc/src/images/qml-propertyanim-example.png Binary files differnew file mode 100644 index 0000000..46efc64 --- /dev/null +++ b/doc/src/images/qml-propertyanim-example.png diff --git a/doc/src/images/qml-qgraphicsgridlayout-example.png b/doc/src/images/qml-qgraphicsgridlayout-example.png Binary files differnew file mode 100644 index 0000000..1a3bd47 --- /dev/null +++ b/doc/src/images/qml-qgraphicsgridlayout-example.png diff --git a/doc/src/images/qml-qgraphicslinearlayout-example.png b/doc/src/images/qml-qgraphicslinearlayout-example.png Binary files differnew file mode 100644 index 0000000..3964f5b --- /dev/null +++ b/doc/src/images/qml-qgraphicslinearlayout-example.png diff --git a/doc/src/images/qml-qwidgets-example.png b/doc/src/images/qml-qwidgets-example.png Binary files differnew file mode 100644 index 0000000..262b3df --- /dev/null +++ b/doc/src/images/qml-qwidgets-example.png diff --git a/doc/src/images/qml-rssnews-demo-small.png b/doc/src/images/qml-rssnews-demo-small.png Binary files differnew file mode 100644 index 0000000..451a420 --- /dev/null +++ b/doc/src/images/qml-rssnews-demo-small.png diff --git a/doc/src/images/qml-rssnews-demo.png b/doc/src/images/qml-rssnews-demo.png Binary files differindex 948ef4d..b4143b4 100644 --- a/doc/src/images/qml-rssnews-demo.png +++ b/doc/src/images/qml-rssnews-demo.png diff --git a/doc/src/images/qml-samegame-demo-small.png b/doc/src/images/qml-samegame-demo-small.png Binary files differnew file mode 100644 index 0000000..ec9ad76 --- /dev/null +++ b/doc/src/images/qml-samegame-demo-small.png diff --git a/doc/src/images/qml-samegame-demo.png b/doc/src/images/qml-samegame-demo.png Binary files differindex c17b4e0..945f2b9 100644 --- a/doc/src/images/qml-samegame-demo.png +++ b/doc/src/images/qml-samegame-demo.png diff --git a/doc/src/images/qml-scrollbar-example.png b/doc/src/images/qml-scrollbar-example.png Binary files differnew file mode 100644 index 0000000..4cf7c2c --- /dev/null +++ b/doc/src/images/qml-scrollbar-example.png diff --git a/doc/src/images/qml-snake-demo-small.png b/doc/src/images/qml-snake-demo-small.png Binary files differnew file mode 100644 index 0000000..23a7b3b --- /dev/null +++ b/doc/src/images/qml-snake-demo-small.png diff --git a/doc/src/images/qml-states-example.png b/doc/src/images/qml-states-example.png Binary files differnew file mode 100644 index 0000000..30514ec --- /dev/null +++ b/doc/src/images/qml-states-example.png diff --git a/doc/src/images/qml-stringlistmodel-example.png b/doc/src/images/qml-stringlistmodel-example.png Binary files differnew file mode 100644 index 0000000..c8c888b --- /dev/null +++ b/doc/src/images/qml-stringlistmodel-example.png diff --git a/doc/src/images/qml-tabwidget-example.png b/doc/src/images/qml-tabwidget-example.png Binary files differindex 05887f3..847052d 100644 --- a/doc/src/images/qml-tabwidget-example.png +++ b/doc/src/images/qml-tabwidget-example.png diff --git a/doc/src/images/qml-textselection-example.png b/doc/src/images/qml-textselection-example.png Binary files differnew file mode 100644 index 0000000..284ef53 --- /dev/null +++ b/doc/src/images/qml-textselection-example.png diff --git a/doc/src/images/qml-transitions-example.png b/doc/src/images/qml-transitions-example.png Binary files differnew file mode 100644 index 0000000..8656bfe --- /dev/null +++ b/doc/src/images/qml-transitions-example.png diff --git a/doc/src/images/qml-tvtennis-example.png b/doc/src/images/qml-tvtennis-example.png Binary files differindex ac2b527..1a38034 100644 --- a/doc/src/images/qml-tvtennis-example.png +++ b/doc/src/images/qml-tvtennis-example.png diff --git a/doc/src/images/qml-twitter-demo-small.png b/doc/src/images/qml-twitter-demo-small.png Binary files differnew file mode 100644 index 0000000..b55ceba --- /dev/null +++ b/doc/src/images/qml-twitter-demo-small.png diff --git a/doc/src/images/qml-visualitemmodel-example.png b/doc/src/images/qml-visualitemmodel-example.png Binary files differnew file mode 100644 index 0000000..c716a59 --- /dev/null +++ b/doc/src/images/qml-visualitemmodel-example.png diff --git a/doc/src/images/qml-webbrowser-demo-small.png b/doc/src/images/qml-webbrowser-demo-small.png Binary files differnew file mode 100644 index 0000000..6c5d57d --- /dev/null +++ b/doc/src/images/qml-webbrowser-demo-small.png diff --git a/doc/src/images/qml-webbrowser-demo.png b/doc/src/images/qml-webbrowser-demo.png Binary files differnew file mode 100644 index 0000000..9ff471e --- /dev/null +++ b/doc/src/images/qml-webbrowser-demo.png diff --git a/doc/src/images/qml-webview-alert-example.png b/doc/src/images/qml-webview-alert-example.png Binary files differnew file mode 100644 index 0000000..c1cddce --- /dev/null +++ b/doc/src/images/qml-webview-alert-example.png diff --git a/doc/src/images/qml-webview-autosize-example.png b/doc/src/images/qml-webview-autosize-example.png Binary files differnew file mode 100644 index 0000000..5cec614 --- /dev/null +++ b/doc/src/images/qml-webview-autosize-example.png diff --git a/doc/src/images/qml-webview-googlemaps-example.png b/doc/src/images/qml-webview-googlemaps-example.png Binary files differnew file mode 100644 index 0000000..d6c77a1 --- /dev/null +++ b/doc/src/images/qml-webview-googlemaps-example.png diff --git a/doc/src/images/qml-webview-inlinehtml-example.png b/doc/src/images/qml-webview-inlinehtml-example.png Binary files differnew file mode 100644 index 0000000..426cf8a --- /dev/null +++ b/doc/src/images/qml-webview-inlinehtml-example.png diff --git a/doc/src/images/qml-webview-newwindows-example.png b/doc/src/images/qml-webview-newwindows-example.png Binary files differnew file mode 100644 index 0000000..bd98b57 --- /dev/null +++ b/doc/src/images/qml-webview-newwindows-example.png diff --git a/doc/src/images/qml-xmlhttprequest-example.png b/doc/src/images/qml-xmlhttprequest-example.png Binary files differnew file mode 100644 index 0000000..68e7d27 --- /dev/null +++ b/doc/src/images/qml-xmlhttprequest-example.png diff --git a/examples/declarative/animation/basics/property-animation.qml b/examples/declarative/animation/basics/property-animation.qml index 0fb253a..69d166a 100644 --- a/examples/declarative/animation/basics/property-animation.qml +++ b/examples/declarative/animation/basics/property-animation.qml @@ -65,7 +65,8 @@ Item { // The shadow for the smiley face Image { anchors.horizontalCenter: parent.horizontalCenter - source: "images/shadow.png"; y: smiley.minHeight + 58 + y: smiley.minHeight + 58 + source: "images/shadow.png" // The scale property depends on the y position of the smiley face. scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) @@ -77,7 +78,8 @@ Item { property int minHeight: 2 * window.height / 3 anchors.horizontalCenter: parent.horizontalCenter - source: "images/face-smile.png"; y: minHeight + y: minHeight + source: "images/face-smile.png" // Animate the y property. Setting loops to Animation.Infinite makes the // animation repeat indefinitely, otherwise it would only run once. diff --git a/examples/declarative/animation/behaviors/behavior-example.qml b/examples/declarative/animation/behaviors/behavior-example.qml index 91845fc..d187fbf 100644 --- a/examples/declarative/animation/behaviors/behavior-example.qml +++ b/examples/declarative/animation/behaviors/behavior-example.qml @@ -87,12 +87,12 @@ Rectangle { border.width: 4; border.color: "white" color: "firebrick" - // Setting an 'elastic' behavior on the focusRect's x property. + // Set an 'elastic' behavior on the focusRect's x property. Behavior on x { NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 } } - // Setting an 'elastic' behavior on the focusRect's y property. + // Set an 'elastic' behavior on the focusRect's y property. Behavior on y { NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 } } @@ -104,12 +104,11 @@ Rectangle { color: "white" font.pixelSize: 16; font.bold: true - // Setting a behavior on the focusText's x property: + // Set a behavior on the focusText's x property: // Set the opacity to 0, set the new text value, then set the opacity back to 1. Behavior on text { SequentialAnimation { NumberAnimation { target: focusText; property: "opacity"; to: 0; duration: 150 } - PropertyAction { } NumberAnimation { target: focusText; property: "opacity"; to: 1; duration: 150 } } } diff --git a/examples/declarative/i18n/i18n.qml b/examples/declarative/i18n/i18n.qml index 7bbb19c..5c2702c 100644 --- a/examples/declarative/i18n/i18n.qml +++ b/examples/declarative/i18n/i18n.qml @@ -65,7 +65,7 @@ Rectangle { anchors.fill: parent; spacing: 20 Text { - text: "If a translation is available for the system language (eg. French) then the string below will translated (eg. 'Bonjour'). Otherwise is will show 'Hello'." + text: "If a translation is available for the system language (eg. French) then the string below will translated (eg. 'Bonjour'). Otherwise it will show 'Hello'." width: parent.width; wrapMode: Text.WordWrap } diff --git a/examples/declarative/keyinteraction/focus/Core/qmldir b/examples/declarative/keyinteraction/focus/Core/qmldir deleted file mode 100644 index e25d63c..0000000 --- a/examples/declarative/keyinteraction/focus/Core/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -ContextMenu ContextMenu.qml -GridMenu GridMenu.qml -ListViews ListViews.qml -ListViewDelegate ListViewDelegate.qml diff --git a/examples/declarative/modelviews/listview/PetsModel.qml b/examples/declarative/modelviews/listview/content/PetsModel.qml index b77557d..b77557d 100644 --- a/examples/declarative/modelviews/listview/PetsModel.qml +++ b/examples/declarative/modelviews/listview/content/PetsModel.qml diff --git a/examples/declarative/modelviews/listview/RecipesModel.qml b/examples/declarative/modelviews/listview/content/RecipesModel.qml index e6d829f..e6d829f 100644 --- a/examples/declarative/modelviews/listview/RecipesModel.qml +++ b/examples/declarative/modelviews/listview/content/RecipesModel.qml diff --git a/examples/declarative/modelviews/listview/content/pics/archive-insert.png b/examples/declarative/modelviews/listview/content/pics/archive-insert.png Binary files differdeleted file mode 100644 index b706248..0000000 --- a/examples/declarative/modelviews/listview/content/pics/archive-insert.png +++ /dev/null diff --git a/examples/declarative/modelviews/listview/content/pics/go-down.png b/examples/declarative/modelviews/listview/content/pics/arrow-down.png Binary files differindex 63331a5..63331a5 100644 --- a/examples/declarative/modelviews/listview/content/pics/go-down.png +++ b/examples/declarative/modelviews/listview/content/pics/arrow-down.png diff --git a/examples/declarative/modelviews/listview/content/pics/go-up.png b/examples/declarative/modelviews/listview/content/pics/arrow-up.png Binary files differindex 4459024..4459024 100644 --- a/examples/declarative/modelviews/listview/content/pics/go-up.png +++ b/examples/declarative/modelviews/listview/content/pics/arrow-up.png diff --git a/examples/declarative/modelviews/listview/content/pics/button-pressed.png b/examples/declarative/modelviews/listview/content/pics/button-pressed.png Binary files differdeleted file mode 100644 index e434d32..0000000 --- a/examples/declarative/modelviews/listview/content/pics/button-pressed.png +++ /dev/null diff --git a/examples/declarative/modelviews/listview/content/pics/button.png b/examples/declarative/modelviews/listview/content/pics/button.png Binary files differdeleted file mode 100644 index 56a63ce..0000000 --- a/examples/declarative/modelviews/listview/content/pics/button.png +++ /dev/null diff --git a/examples/declarative/modelviews/listview/content/pics/archive-remove.png b/examples/declarative/modelviews/listview/content/pics/list-delete.png Binary files differindex 9640f6b..9640f6b 100644 --- a/examples/declarative/modelviews/listview/content/pics/archive-remove.png +++ b/examples/declarative/modelviews/listview/content/pics/list-delete.png diff --git a/examples/declarative/modelviews/listview/content/pics/list-remove.png b/examples/declarative/modelviews/listview/content/pics/minus-sign.png Binary files differindex 2bb1a59..2bb1a59 100644 --- a/examples/declarative/modelviews/listview/content/pics/list-remove.png +++ b/examples/declarative/modelviews/listview/content/pics/minus-sign.png diff --git a/examples/declarative/modelviews/listview/content/pics/list-add.png b/examples/declarative/modelviews/listview/content/pics/plus-sign.png Binary files differindex e029787..e029787 100644 --- a/examples/declarative/modelviews/listview/content/pics/list-add.png +++ b/examples/declarative/modelviews/listview/content/pics/plus-sign.png diff --git a/examples/declarative/modelviews/listview/dynamiclist.qml b/examples/declarative/modelviews/listview/dynamiclist.qml index 12c331b..3c1af37 100644 --- a/examples/declarative/modelviews/listview/dynamiclist.qml +++ b/examples/declarative/modelviews/listview/dynamiclist.qml @@ -96,11 +96,11 @@ Rectangle { Column { Image { - source: "content/pics/go-up.png" - MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index,index-1,1) } + source: "content/pics/arrow-up.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index-1, 1) } } - Image { source: "content/pics/go-down.png" - MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index,index+1,1) } + Image { source: "content/pics/arrow-down.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index+1, 1) } } } @@ -129,7 +129,7 @@ Rectangle { PressAndHoldButton { anchors.verticalCenter: parent.verticalCenter - source: "content/pics/list-add.png" + source: "content/pics/plus-sign.png" onClicked: fruitModel.setProperty(index, "cost", cost + 0.25) } @@ -144,12 +144,12 @@ Rectangle { PressAndHoldButton { anchors.verticalCenter: parent.verticalCenter - source: "content/pics/list-remove.png" + source: "content/pics/minus-sign.png" onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25)) } Image { - source: "content/pics/archive-remove.png" + source: "content/pics/list-delete.png" MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) } } } diff --git a/examples/declarative/modelviews/listview/highlight.qml b/examples/declarative/modelviews/listview/highlight.qml index 9f43409..4c14f2a 100644 --- a/examples/declarative/modelviews/listview/highlight.qml +++ b/examples/declarative/modelviews/listview/highlight.qml @@ -43,6 +43,7 @@ // highlight bar is moved between items. import Qt 4.7 +import "content" Rectangle { width: 200; height: 300 diff --git a/examples/declarative/modelviews/listview/highlightranges.qml b/examples/declarative/modelviews/listview/highlightranges.qml index f0d7f75..30976f4 100644 --- a/examples/declarative/modelviews/listview/highlightranges.qml +++ b/examples/declarative/modelviews/listview/highlightranges.qml @@ -39,6 +39,7 @@ ****************************************************************************/ import Qt 4.7 +import "content" Rectangle { width: 600; height: 300 diff --git a/examples/declarative/modelviews/parallax/parallax.qml b/examples/declarative/modelviews/parallax/parallax.qml index 3b5c70a..19eadd0 100644 --- a/examples/declarative/modelviews/parallax/parallax.qml +++ b/examples/declarative/modelviews/parallax/parallax.qml @@ -39,12 +39,10 @@ ****************************************************************************/ import Qt 4.7 -import "../../toys/clocks/content" +import "../../toys/clocks/content" // for loading the Clock element import "qml" Rectangle { - id: root - width: 320; height: 480 ParallaxView { @@ -76,7 +74,5 @@ Rectangle { Component.onCompleted: item.inAnotherDemo = true; } } - - currentIndex: root.currentIndex } } diff --git a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml b/examples/declarative/modelviews/parallax/qml/ParallaxView.qml index adf0885..ac479f4 100644 --- a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml +++ b/examples/declarative/modelviews/parallax/qml/ParallaxView.qml @@ -44,8 +44,8 @@ Item { id: root property alias background: background.source - default property alias content: visualModel.children property int currentIndex: 0 + default property alias content: visualModel.children Image { id: background @@ -56,13 +56,13 @@ Item { ListView { id: list + anchors.fill: parent currentIndex: root.currentIndex onCurrentIndexChanged: root.currentIndex = currentIndex orientation: Qt.Horizontal boundsBehavior: Flickable.DragOverBounds - anchors.fill: parent model: VisualItemModel { id: visualModel } highlightRangeMode: ListView.StrictlyEnforceRange @@ -72,14 +72,6 @@ Item { ListView { id: selector - Rectangle { - color: "#60FFFFFF" - x: -10; y: -10; radius: 10; z: -1 - width: parent.width + 20; height: parent.height + 20 - } - currentIndex: root.currentIndex - onCurrentIndexChanged: root.currentIndex = currentIndex - height: 50 anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter @@ -87,6 +79,10 @@ Item { interactive: width == parent.width - 20 orientation: Qt.Horizontal + currentIndex: root.currentIndex + onCurrentIndexChanged: root.currentIndex = currentIndex + + model: visualModel.children delegate: Item { width: 50; height: 50 id: delegateRoot @@ -113,11 +109,15 @@ Item { } } transitions: Transition { - NumberAnimation { - properties: "scale,y" - } - } + NumberAnimation { properties: "scale,y" } + } + } + + Rectangle { + color: "#60FFFFFF" + x: -10; y: -10; z: -1 + width: parent.width + 20; height: parent.height + 20 + radius: 10 } - model: visualModel.children } } diff --git a/examples/declarative/modelviews/parallax/qml/Smiley.qml b/examples/declarative/modelviews/parallax/qml/Smiley.qml index 8399664..3ca672a 100644 --- a/examples/declarative/modelviews/parallax/qml/Smiley.qml +++ b/examples/declarative/modelviews/parallax/qml/Smiley.qml @@ -40,16 +40,18 @@ import Qt 4.7 +// This is taken from the declarative animation/basics/property-animation.qml +// example + Item { id: window width: 320; height: 480 - // The shadow for the smiley face Image { anchors.horizontalCenter: parent.horizontalCenter - source: "../pics/shadow.png"; y: smiley.minHeight + 58 + y: smiley.minHeight + 58 + source: "../pics/shadow.png" - // The scale property depends on the y position of the smiley face. scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) } @@ -59,26 +61,22 @@ Item { property int minHeight: 2 * window.height / 3 anchors.horizontalCenter: parent.horizontalCenter - source: "../pics/face-smile.png"; y: minHeight + y: minHeight + source: "../pics/face-smile.png" - // Animate the y property. Setting repeat to true makes the - // animation repeat indefinitely, otherwise it would only run once. - SequentialAnimation on y { + SequentialAnimation on y { loops: Animation.Infinite - // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function NumberAnimation { from: smiley.minHeight; to: smiley.maxHeight easing.type: Easing.OutExpo; duration: 300 } - // Then move back to minHeight in 1 second, using the OutBounce easing function NumberAnimation { from: smiley.maxHeight; to: smiley.minHeight easing.type: Easing.OutBounce; duration: 1000 } - // Then pause for 500ms PauseAnimation { duration: 500 } } } diff --git a/examples/declarative/modelviews/webview/alerts.qml b/examples/declarative/modelviews/webview/alerts.qml index 7303450..1537411 100644 --- a/examples/declarative/modelviews/webview/alerts.qml +++ b/examples/declarative/modelviews/webview/alerts.qml @@ -43,7 +43,7 @@ import org.webkit 1.0 WebView { id: webView - width: 120 + width: 200 height: 150 url: "alerts.html" @@ -58,13 +58,13 @@ WebView { y: parent.height // off "screen" anchors.horizontalCenter: parent.horizontalCenter - width: label.width+5 - height: label.height+5 + width: label.width + 5 + height: label.height + 5 opacity: 0 - function show(t) { - label.text = t + function show(text) { + label.text = text popup.state = "visible" timer.start() } @@ -82,17 +82,20 @@ WebView { Timer { id: timer interval: 1000 + onTriggered: popup.state = "" } Text { id: label anchors.centerIn: parent + width: webView.width *0.75 + color: "white" font.pixelSize: 20 - width: webView.width*0.75 wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter + smooth: true } } } diff --git a/examples/declarative/modelviews/webview/autosize.qml b/examples/declarative/modelviews/webview/autosize.qml index 556b429..64e3ff1 100644 --- a/examples/declarative/modelviews/webview/autosize.qml +++ b/examples/declarative/modelviews/webview/autosize.qml @@ -51,6 +51,7 @@ Rectangle { Column { id: layout spacing: 2 + WebView { html: "No width defined." Rectangle { @@ -58,6 +59,7 @@ Rectangle { anchors.fill: parent } } + WebView { width: rect.width html: "The width is full." @@ -66,6 +68,7 @@ Rectangle { anchors.fill: parent } } + WebView { width: rect.width/2 html: "The width is half." @@ -75,24 +78,25 @@ Rectangle { } } WebView { - preferredWidth: rect.width/2 - html: "The preferredWidth is half." + width: rect.width/2 + html: "The_width_is_half." // not wrapped Rectangle { color: "#10000000" anchors.fill: parent } } + WebView { preferredWidth: rect.width/2 - html: "The_preferredWidth_is_half." + html: "The preferredWidth is half." Rectangle { color: "#10000000" anchors.fill: parent } } WebView { - width: rect.width/2 - html: "The_width_is_half." + preferredWidth: rect.width/2 + html: "The_preferredWidth_is_half." // not wrapped Rectangle { color: "#10000000" anchors.fill: parent diff --git a/examples/declarative/modelviews/webview/content/FieldText.qml b/examples/declarative/modelviews/webview/content/FieldText.qml deleted file mode 100644 index 17fa4cd..0000000 --- a/examples/declarative/modelviews/webview/content/FieldText.qml +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************** -** -** 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 QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 - -Item { - id: fieldText - height: 30 - property string text: "" - property string label: "" - property bool mouseGrabbed: false - signal confirmed - signal cancelled - signal startEdit - - function edit() { - if (!mouseGrabbed) { - fieldText.startEdit(); - fieldText.state='editing'; - mouseGrabbed=true; - } - } - - function confirm() { - fieldText.state=''; - fieldText.text = textEdit.text; - mouseGrabbed=false; - fieldText.confirmed(); - } - - function reset() { - textEdit.text = fieldText.text; - fieldText.state=''; - mouseGrabbed=false; - fieldText.cancelled(); - } - - Image { - id: cancelIcon - width: 22 - height: 22 - anchors.right: parent.right - anchors.rightMargin: 4 - anchors.verticalCenter: parent.verticalCenter - source: "pics/cancel.png" - opacity: 0 - } - - Image { - id: confirmIcon - width: 22 - height: 22 - anchors.left: parent.left - anchors.leftMargin: 4 - anchors.verticalCenter: parent.verticalCenter - source: "pics/ok.png" - opacity: 0 - } - - TextInput { - id: textEdit - text: fieldText.text - focus: false - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.verticalCenter: parent.verticalCenter - color: "black" - font.bold: true - readOnly: true - onAccepted: confirm() - Keys.onEscapePressed: reset() - } - - Text { - id: textLabel - x: 5 - width: parent.width-10 - anchors.verticalCenter: parent.verticalCenter - horizontalAlignment: Text.AlignHCenter - color: fieldText.state == "editing" ? "#505050" : "#AAAAAA" - font.italic: true - font.bold: true - text: label - opacity: textEdit.text == '' ? 1 : 0 - Behavior on opacity { - NumberAnimation { - property: "opacity" - duration: 250 - } - } - } - - MouseArea { - anchors.fill: cancelIcon - onClicked: { reset() } - } - - MouseArea { - anchors.fill: confirmIcon - onClicked: { confirm() } - } - - MouseArea { - id: editRegion - anchors.fill: textEdit - onClicked: { edit() } - } - - states: [ - State { - name: "editing" - PropertyChanges { - target: confirmIcon - opacity: 1 - } - PropertyChanges { - target: cancelIcon - opacity: 1 - } - PropertyChanges { - target: textEdit - color: "black" - readOnly: false - focus: true - } - PropertyChanges { - target: editRegion - opacity: 0 - } - PropertyChanges { - target: textEdit.anchors - leftMargin: 34 - } - PropertyChanges { - target: textEdit.anchors - rightMargin: 34 - } - } - ] - - transitions: [ - Transition { - from: "" - to: "*" - reversible: true - NumberAnimation { - properties: "opacity,leftMargin,rightMargin" - duration: 200 - } - ColorAnimation { - property: "color" - duration: 150 - } - } - ] -} diff --git a/examples/declarative/modelviews/webview/content/Mapping/Map.qml b/examples/declarative/modelviews/webview/content/Mapping/Map.qml index be708ee..99f8479 100644 --- a/examples/declarative/modelviews/webview/content/Mapping/Map.qml +++ b/examples/declarative/modelviews/webview/content/Mapping/Map.qml @@ -43,14 +43,17 @@ import org.webkit 1.0 Item { id: page + property real latitude: -34.397 property real longitude: 150.644 property string address: "" property alias status: js.status + WebView { id: map anchors.fill: parent url: "map.html" + pressGrabTime: 0 javaScriptWindowObjects: QtObject { id: js WebView.windowObjectName: "qml" @@ -58,9 +61,13 @@ Item { property real lng: page.longitude property string address: page.address property string status: "Loading" - onAddressChanged: { if (map.url != "" && map.progress==1) map.evaluateJavaScript("goToAddress()") } + + onAddressChanged: { + if (map.url != "" && map.progress == 1) + map.evaluateJavaScript("goToAddress()") + } } - pressGrabTime: 0 + onLoadFinished: { evaluateJavaScript("goToAddress()"); } } } diff --git a/examples/declarative/modelviews/webview/content/SpinSquare.qml b/examples/declarative/modelviews/webview/content/SpinSquare.qml deleted file mode 100644 index ec83056..0000000 --- a/examples/declarative/modelviews/webview/content/SpinSquare.qml +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** 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 QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 - -Item { - property variant period : 250 - property variant color : "black" - id: root - - Item { - x: root.width/2 - y: root.height/2 - Rectangle { - color: root.color - x: -width/2 - y: -height/2 - width: root.width - height: width - } - NumberAnimation on rotation { - from: 0 - to: 360 - loops: Animation.Infinite - duration: root.period - } - } -} diff --git a/examples/declarative/modelviews/webview/googleMaps.qml b/examples/declarative/modelviews/webview/googlemaps.qml index 1c99940..1c99940 100644 --- a/examples/declarative/modelviews/webview/googleMaps.qml +++ b/examples/declarative/modelviews/webview/googlemaps.qml diff --git a/examples/declarative/modelviews/webview/inline-html.qml b/examples/declarative/modelviews/webview/inlinehtml.qml index 875c903..237bd8f 100644 --- a/examples/declarative/modelviews/webview/inline-html.qml +++ b/examples/declarative/modelviews/webview/inlinehtml.qml @@ -45,11 +45,11 @@ import org.webkit 1.0 // set on the html property. WebView { html:"\ - <body bgcolor=white>\ - <table border=1>\ - <tr><th><th>One<th>Two<th>Three\ - <tr><th>1<td>X<td>1<td>X\ - <tr><th>2<td>0<td>X<td>0\ - <tr><th>3<td>X<td>1<td>X\ + <body> + <table border=1> + <tr><th><th>One<th>Two<th>Three + <tr><th>1<td>X<td>1<td>X + <tr><th>2<td>0<td>X<td>0 + <tr><th>3<td>X<td>1<td>X </table>" } diff --git a/examples/declarative/modelviews/webview/transparent.qml b/examples/declarative/modelviews/webview/transparent.qml deleted file mode 100644 index 92c1578..0000000 --- a/examples/declarative/modelviews/webview/transparent.qml +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** 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 QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 -import org.webkit 1.0 - -// The WebView background is transparent -// if the HTML does not specify a background -Rectangle { - color: "green" - width: web.width - height: web.height - - WebView { - id: web - html: "Hello <b>World!</b>" - } -} diff --git a/examples/declarative/text/edit/pics/endHandle.png b/examples/declarative/text/textselection/pics/endHandle.png Binary files differindex 1a4bc5d..1a4bc5d 100644 --- a/examples/declarative/text/edit/pics/endHandle.png +++ b/examples/declarative/text/textselection/pics/endHandle.png diff --git a/examples/declarative/text/edit/pics/endHandle.sci b/examples/declarative/text/textselection/pics/endHandle.sci index 4f51f24..4f51f24 100644 --- a/examples/declarative/text/edit/pics/endHandle.sci +++ b/examples/declarative/text/textselection/pics/endHandle.sci diff --git a/examples/declarative/text/edit/pics/startHandle.png b/examples/declarative/text/textselection/pics/startHandle.png Binary files differindex deedcd5..deedcd5 100644 --- a/examples/declarative/text/edit/pics/startHandle.png +++ b/examples/declarative/text/textselection/pics/startHandle.png diff --git a/examples/declarative/text/edit/pics/startHandle.sci b/examples/declarative/text/textselection/pics/startHandle.sci index f9eae20..f9eae20 100644 --- a/examples/declarative/text/edit/pics/startHandle.sci +++ b/examples/declarative/text/textselection/pics/startHandle.sci diff --git a/examples/declarative/text/edit/edit.qml b/examples/declarative/text/textselection/textselection.qml index 4668ab2..1ba3e18 100644 --- a/examples/declarative/text/edit/edit.qml +++ b/examples/declarative/text/textselection/textselection.qml @@ -55,8 +55,8 @@ Rectangle { source: "pics/startHandle.sci" opacity: 0.0 width: 10 - x: edit.positionToRectangle(edit.selectionStart).x-flick.contentX-width - y: edit.positionToRectangle(edit.selectionStart).y-flick.contentY + x: edit.positionToRectangle(edit.selectionStart).x - flick.contentX-width + y: edit.positionToRectangle(edit.selectionStart).y - flick.contentY height: edit.positionToRectangle(edit.selectionStart).height } @@ -65,8 +65,8 @@ Rectangle { source: "pics/endHandle.sci" opacity: 0.0 width: 10 - x: edit.positionToRectangle(edit.selectionEnd).x-flick.contentX - y: edit.positionToRectangle(edit.selectionEnd).y-flick.contentY + x: edit.positionToRectangle(edit.selectionEnd).x - flick.contentX + y: edit.positionToRectangle(edit.selectionEnd).y - flick.contentY height: edit.positionToRectangle(edit.selectionEnd).height } @@ -79,8 +79,7 @@ Rectangle { interactive: true clip: true - function ensureVisible(r) - { + function ensureVisible(r) { if (contentX >= r.x) contentX = r.x; else if (contentX+width <= r.x+r.width) @@ -97,20 +96,25 @@ Rectangle { height: flick.height focus: true wrapMode: TextEdit.Wrap + onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) + text: "<h1>Text Selection</h1>" +"<p>This example is a whacky text selection mechanisms, showing how these can be implemented in the TextEdit element, to cater for whatever style is appropriate for the target platform." +"<p><b>Press-and-hold</b> to select a word, then drag the selection handles." +"<p><b>Drag outside the selection</b> to scroll the text." +"<p><b>Click inside the selection</b> to cut/copy/paste/cancel selection." +"<p>It's too whacky to let you paste if there is no current selection." + MouseArea { + property string drag: "" + property int pressPos + x: -startHandle.width y: 0 width: parent.width+startHandle.width+endHandle.width height: parent.height - property string drag: ""; - property int pressPos; + onPressAndHold: { if (editor.state == "") { edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y); @@ -118,6 +122,7 @@ Rectangle { editor.state = "selection" } } + onClicked: { if (editor.state == "") { edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y); @@ -126,7 +131,11 @@ Rectangle { edit.openSoftwareInputPanel(); } } - function hitHandle(h,x,y) { return x>=h.x+flick.contentX && x<h.x+flick.contentX+h.width && y>=h.y+flick.contentY && y<h.y+flick.contentY+h.height } + + function hitHandle(h,x,y) { + return x>=h.x+flick.contentX && x<h.x+flick.contentX+h.width && y>=h.y+flick.contentY && y<h.y+flick.contentY+h.height + } + onPressed: { if (editor.state == "selection") { if (hitHandle(startHandle,mouse.x+x,mouse.y+y)) { @@ -147,6 +156,7 @@ Rectangle { } } } + onReleased: { if (editor.state == "selection") { if (drag == "selection") { @@ -156,6 +166,7 @@ Rectangle { } flick.interactive = true } + onPositionChanged: { if (editor.state == "selection" && drag != "") { if (drag == "start") { @@ -183,6 +194,7 @@ Rectangle { width: 100 height: 120 anchors.centerIn: parent + Rectangle { border.width: 1 border.color: "darkBlue" @@ -190,48 +202,73 @@ Rectangle { color: "#806080FF" anchors.fill: parent } + Column { anchors.centerIn: parent spacing: 8 + Rectangle { border.width: 1 border.color: "darkBlue" color: "#ff7090FF" width: 60 height: 16 + Text { anchors.centerIn: parent; text: "Cut" } - MouseArea { anchors.fill: parent; - onClicked: { edit.cut(); editor.state = "" } } + + MouseArea { + anchors.fill: parent + onClicked: { edit.cut(); editor.state = "" } + } } + Rectangle { border.width: 1 border.color: "darkBlue" color: "#ff7090FF" width: 60 height: 16 + Text { anchors.centerIn: parent; text: "Copy" } - MouseArea { anchors.fill: parent; - onClicked: { edit.copy(); editor.state = "selection" } } + + MouseArea { + anchors.fill: parent + onClicked: { edit.copy(); editor.state = "selection" } + } } + Rectangle { border.width: 1 border.color: "darkBlue" color: "#ff7090FF" width: 60 height: 16 + Text { anchors.centerIn: parent; text: "Paste" } - MouseArea { anchors.fill: parent; - onClicked: { edit.paste(); edit.cursorPosition = edit.selectionEnd; editor.state = "" } } + + MouseArea { + anchors.fill: parent + onClicked: { edit.paste(); edit.cursorPosition = edit.selectionEnd; editor.state = "" } + } } + Rectangle { border.width: 1 border.color: "darkBlue" color: "#ff7090FF" width: 60 height: 16 + Text { anchors.centerIn: parent; text: "Deselect" } - MouseArea { anchors.fill: parent; - onClicked: { edit.cursorPosition = edit.selectionEnd; edit.select(edit.cursorPosition,edit.cursorPosition); editor.state = "" } } + + MouseArea { + anchors.fill: parent + onClicked: { + edit.cursorPosition = edit.selectionEnd; + edit.select(edit.cursorPosition, edit.cursorPosition); + editor.state = "" + } + } } } } diff --git a/examples/declarative/text/textselection/textselection.qmlproject b/examples/declarative/text/textselection/textselection.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/text/textselection/textselection.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/touchinteraction/mousearea/mouse.qml b/examples/declarative/touchinteraction/mousearea/mousearea-example.qml index 9d2ace3..64f72a9 100644 --- a/examples/declarative/touchinteraction/mousearea/mouse.qml +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example.qml @@ -41,34 +41,42 @@ import Qt 4.7 Rectangle { - width: 200; height: 200 + id: box + width: 350; height: 250 + + function showInfo(text) { + statusText.text = text + } Rectangle { - width: 50; height: 50 + width: 80; height: 80 color: "red" - Text { text: "Click"; anchors.centerIn: parent } + Text { text: "Click"; font.pixelSize: 16; anchors.centerIn: parent } MouseArea { anchors.fill: parent hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton - onPressed: console.log('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') - onReleased: console.log('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')') - onClicked: console.log('click (x: ' + mouse.x + ' y: ' + mouse.y + ' wasHeld: ' + mouse.wasHeld + ')') - onDoubleClicked: console.log('double click (x: ' + mouse.x + ' y: ' + mouse.y + ')') - onPressAndHold: console.log('press and hold') - onEntered: console.log('entered ' + pressed) - onExited: console.log('exited ' + pressed) + onPressed: box.showInfo('Pressed (x=' + mouse.x + ' y=' + mouse.y + ' button=' + + (mouse.button == Qt.RightButton ? 'right' : 'left') + + ' Shift=' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') + onReleased: box.showInfo('Released (x=' + mouse.x + ' y=' + mouse.y + + ' isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')') + onClicked: box.showInfo('Clicked (x=' + mouse.x + ' y=' + mouse.y + ' wasHeld=' + mouse.wasHeld + ')') + onDoubleClicked: box.showInfo('Double clicked (x=' + mouse.x + ' y=' + mouse.y + ')') + onPressAndHold: box.showInfo('Press and hold') + onEntered: box.showInfo('Entered (pressed=' + pressed + ')') + onExited: box.showInfo('Exited (pressed=' + pressed + ')') } } Rectangle { - y: 100; width: 50; height: 50 + width: 80; height: 80; anchors.right: parent.right color: "blue" - Text { text: "Drag"; anchors.centerIn: parent } + Text { text: "Drag"; font.pixelSize: 16; color: "white"; anchors.centerIn: parent } MouseArea { anchors.fill: parent @@ -77,11 +85,18 @@ Rectangle { drag.minimumX: 0 drag.maximumX: 150 - onPressed: console.log('press') - onReleased: console.log('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')') - onClicked: console.log('click' + '(wasHeld: ' + mouse.wasHeld + ')') - onDoubleClicked: console.log('double click') - onPressAndHold: console.log('press and hold') + onPressed: box.showInfo('Pressed') + onReleased: box.showInfo('Released (isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')') + onClicked: box.showInfo('Clicked' + ' (wasHeld=' + mouse.wasHeld + ')') + onDoubleClicked: box.showInfo('Double clicked') + onPressAndHold: box.showInfo('Press and hold') } } + + Text { + id: statusText + anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30 + + onTextChanged: console.log(text) + } } diff --git a/examples/declarative/ui-components/flipable/content/Card.qml b/examples/declarative/ui-components/flipable/content/Card.qml index 91a442b..fc60ce4 100644 --- a/examples/declarative/ui-components/flipable/content/Card.qml +++ b/examples/declarative/ui-components/flipable/content/Card.qml @@ -49,11 +49,13 @@ Flipable { property int yAxis: 0 property int angle: 0 - width: front.width; height: front.height; state: "back" + width: front.width; height: front.height front: Image { id: frontImage; smooth: true } back: Image { source: "back.png"; smooth: true } + state: "back" + MouseArea { anchors.fill: parent; onClicked: container.flipped = !container.flipped } transform: Rotation { diff --git a/examples/declarative/ui-components/scrollbar/ScrollBar.qml b/examples/declarative/ui-components/scrollbar/ScrollBar.qml index ba9a52a..9927ecb 100644 --- a/examples/declarative/ui-components/scrollbar/ScrollBar.qml +++ b/examples/declarative/ui-components/scrollbar/ScrollBar.qml @@ -60,6 +60,7 @@ Item { color: "white" opacity: 0.3 } + // Size the bar to the required size, depending upon the orientation. Rectangle { x: orientation == Qt.Vertical ? 1 : (scrollBar.position * (scrollBar.width-2) + 1) diff --git a/examples/declarative/ui-components/scrollbar/main.qml b/examples/declarative/ui-components/scrollbar/main.qml index 1f7992b..8f5033b 100644 --- a/examples/declarative/ui-components/scrollbar/main.qml +++ b/examples/declarative/ui-components/scrollbar/main.qml @@ -66,7 +66,6 @@ Rectangle { } transitions: Transition { - from: "*"; to: "*" NumberAnimation { properties: "opacity"; duration: 400 } } } diff --git a/examples/declarative/ui-components/searchbox/SearchBox.qml b/examples/declarative/ui-components/searchbox/SearchBox.qml index eaa6b6b..e6b9c8f 100644 --- a/examples/declarative/ui-components/searchbox/SearchBox.qml +++ b/examples/declarative/ui-components/searchbox/SearchBox.qml @@ -66,7 +66,10 @@ FocusScope { font.italic: true } - MouseArea { anchors.fill: parent; onClicked: { focusScope.focus = true; textInput.openSoftwareInputPanel(); } } + MouseArea { + anchors.fill: parent + onClicked: { focusScope.focus = true; textInput.openSoftwareInputPanel(); } + } TextInput { id: textInput @@ -77,7 +80,7 @@ FocusScope { Image { id: clear anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter } - source: "images/edit-clear-locationbar-rtl.png" + source: "images/clear.png" opacity: 0 MouseArea { diff --git a/examples/declarative/ui-components/searchbox/images/edit-clear-locationbar-rtl.png b/examples/declarative/ui-components/searchbox/images/clear.png Binary files differindex 91eb270..91eb270 100644 --- a/examples/declarative/ui-components/searchbox/images/edit-clear-locationbar-rtl.png +++ b/examples/declarative/ui-components/searchbox/images/clear.png diff --git a/examples/declarative/ui-components/slideswitch/content/Switch.qml b/examples/declarative/ui-components/slideswitch/content/Switch.qml index b0ce0c0..2a89177 100644 --- a/examples/declarative/ui-components/slideswitch/content/Switch.qml +++ b/examples/declarative/ui-components/slideswitch/content/Switch.qml @@ -53,12 +53,13 @@ Item { function toggle() { if (toggleswitch.state == "on") toggleswitch.state = "off"; - else toggleswitch.state = "on"; + else + toggleswitch.state = "on"; } //![2] //![3] - function dorelease() { + function releaseSwitch() { if (knob.x == 1) { if (toggleswitch.state == "off") return; } @@ -87,7 +88,7 @@ Item { anchors.fill: parent drag.target: knob; drag.axis: Drag.XAxis; drag.minimumX: 1; drag.maximumX: 78 onClicked: toggle() - onReleased: dorelease() + onReleased: releaseSwitch() } } //![5] diff --git a/examples/declarative/ui-components/spinner/content/Spinner.qml b/examples/declarative/ui-components/spinner/content/Spinner.qml index 55fc542..1c41239 100644 --- a/examples/declarative/ui-components/spinner/content/Spinner.qml +++ b/examples/declarative/ui-components/spinner/content/Spinner.qml @@ -45,21 +45,26 @@ Image { property alias delegate: view.delegate property alias currentIndex: view.currentIndex property real itemHeight: 30 + source: "spinner-bg.png" clip: true + PathView { id: view anchors.fill: parent + pathItemCount: height/itemHeight preferredHighlightBegin: 0.5 preferredHighlightEnd: 0.5 highlight: Image { source: "spinner-select.png"; width: view.width; height: itemHeight+4 } dragMargin: view.width/2 + path: Path { startX: view.width/2; startY: -itemHeight/2 PathLine { x: view.width/2; y: view.pathItemCount*itemHeight + itemHeight } } } + Keys.onDownPressed: view.incrementCurrentIndex() Keys.onUpPressed: view.decrementCurrentIndex() } diff --git a/examples/declarative/ui-components/spinner/main.qml b/examples/declarative/ui-components/spinner/main.qml index 4403ada..37dd912 100644 --- a/examples/declarative/ui-components/spinner/main.qml +++ b/examples/declarative/ui-components/spinner/main.qml @@ -43,8 +43,10 @@ import "content" Rectangle { width: 240; height: 320 + Column { y: 20; x: 20; spacing: 20 + Spinner { id: spinner width: 200; height: 240 @@ -53,6 +55,7 @@ Rectangle { itemHeight: 30 delegate: Text { font.pixelSize: 25; text: index; height: 30 } } + Text { text: "Current item index: " + spinner.currentIndex } } } diff --git a/examples/declarative/ui-components/tabwidget/TabWidget.qml b/examples/declarative/ui-components/tabwidget/TabWidget.qml index 93db4ff..9642e04 100644 --- a/examples/declarative/ui-components/tabwidget/TabWidget.qml +++ b/examples/declarative/ui-components/tabwidget/TabWidget.qml @@ -49,16 +49,17 @@ Item { onCurrentChanged: setOpacities() Component.onCompleted: setOpacities() - function setOpacities() - { + function setOpacities() { for (var i = 0; i < stack.children.length; ++i) { - stack.children[i].opacity = i == current ? 1 : 0 + stack.children[i].opacity = (i == current ? 1 : 0) } } Row { id: header + Repeater { + model: stack.children.length delegate: Rectangle { width: tabWidget.width / stack.children.length; height: 36 @@ -85,7 +86,6 @@ Item { onClicked: tabWidget.current = index } } - model: stack.children.length } } diff --git a/examples/declarative/xml/xmlhttprequest/test.xml b/examples/declarative/xml/xmlhttprequest/data.xml index 8b7f1e1..8b7f1e1 100644 --- a/examples/declarative/xml/xmlhttprequest/test.xml +++ b/examples/declarative/xml/xmlhttprequest/data.xml diff --git a/examples/declarative/xml/xmlhttprequest/test.qml b/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml index e5f0875..b302729 100644 --- a/examples/declarative/xml/xmlhttprequest/test.qml +++ b/examples/declarative/xml/xmlhttprequest/xmlhttprequest-example.qml @@ -41,36 +41,55 @@ import Qt 4.7 Rectangle { - width: 800; height: 600 + width: 350; height: 400 - MouseArea { - anchors.fill: parent + function showRequestInfo(text) { + log.text = log.text + "\n" + text + console.log(text) + } - onClicked: { - var doc = new XMLHttpRequest(); - doc.onreadystatechange = function() { - if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) { - console.log("Headers -->"); - console.log(doc.getAllResponseHeaders ()); - console.log("Last modified -->"); - console.log(doc.getResponseHeader ("Last-Modified")); - } - else if (doc.readyState == XMLHttpRequest.DONE) { + Text { id: log; anchors.fill: parent; anchors.margins: 10 } - var a = doc.responseXML.documentElement; - for (var ii = 0; ii < a.childNodes.length; ++ii) { - console.log(a.childNodes[ii].nodeName); - } - console.log("Headers -->"); - console.log(doc.getAllResponseHeaders ()); - console.log("Last modified -->"); - console.log(doc.getResponseHeader ("Last-Modified")); + Rectangle { + id: button + anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; anchors.margins: 10 + width: buttonText.width + 10; height: buttonText.height + 10 + border.width: mouseArea.pressed ? 2 : 1 + radius : 5; smooth: true + + Text { id: buttonText; anchors.centerIn: parent; text: "Request data.xml" } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + log.text = "" + console.log("\n") + var doc = new XMLHttpRequest(); + doc.onreadystatechange = function() { + if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) { + showRequestInfo("Headers -->"); + showRequestInfo(doc.getAllResponseHeaders ()); + showRequestInfo("Last modified -->"); + showRequestInfo(doc.getResponseHeader ("Last-Modified")); + + } else if (doc.readyState == XMLHttpRequest.DONE) { + var a = doc.responseXML.documentElement; + for (var ii = 0; ii < a.childNodes.length; ++ii) { + showRequestInfo(a.childNodes[ii].nodeName); + } + showRequestInfo("Headers -->"); + showRequestInfo(doc.getAllResponseHeaders ()); + showRequestInfo("Last modified -->"); + showRequestInfo(doc.getResponseHeader ("Last-Modified")); + } } - } - doc.open("GET", "test.xml"); - doc.send(); + doc.open("GET", "data.xml"); + doc.send(); + } } } } + diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp index 4a408a0..4e5f2a3 100644 --- a/examples/multimedia/audioinput/audioinput.cpp +++ b/examples/multimedia/audioinput/audioinput.cpp @@ -315,6 +315,11 @@ void InputTest::readMore() void InputTest::toggleMode() { // Change bewteen pull and push modes + if (m_input != 0) { + disconnect(m_input, 0, this, 0); + m_input = 0; + } + m_audioInput->stop(); if (m_pullMode) { diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index a49c1a6..afc708a 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -51,8 +51,9 @@ defineTest(qtAddLibrary) { INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE } isEqual(LIB_NAME, QtWebKit) { - # Needed for #include <QtXmlPatterns/QtXmlPatterns> because relative inclusion problem in toolchain + # Needed for because relative inclusion problem in toolchain INCLUDEPATH *= $$QMAKE_INCDIR_QT/QtXmlPatterns + INCLUDEPATH *= $$QMAKE_INCDIR_QT/QtNetwork } isEqual(LIB_NAME, QtXmlPatterns) { # Needed for #include <QtXmlPatterns/QtXmlPatterns> because relative inclusion problem in toolchain diff --git a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp index d23d9ce..de3f46f 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp @@ -43,14 +43,12 @@ namespace Phonon { //normally we should use IID_IMFGetService but this introduces another dependency //so here we simply define our own IId with the same value + ComPointer<T> ret; ComPointer<IMFGetService> getService(filter, IID_IMFGetService); - Q_ASSERT(getService); - T *ptr = 0; - HRESULT hr = getService->GetService(guidService, riid, reinterpret_cast<void **>(&ptr)); - if (!SUCCEEDED(hr) || ptr == 0) - Q_ASSERT(!SUCCEEDED(hr) && ptr != 0); - ComPointer<T> service(ptr); - return service; + if (getService) { + getService->GetService(guidService, riid, reinterpret_cast<void**>(ret.pparam())); + } + return ret; } VideoRendererEVR::~VideoRendererEVR() @@ -70,6 +68,10 @@ namespace Phonon } ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + if (!filterControl) { + m_filter = Filter(); //will release the interface + return; + } filterControl->SetVideoWindow(reinterpret_cast<HWND>(target->winId())); filterControl->SetAspectRatioMode(MFVideoARMode_None); // We're in control of the size diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index ee3c4f2..bcf4477 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -393,6 +393,27 @@ void QAbstractEventDispatcher::closingDown() \snippet doc/src/snippets/code/src_corelib_kernel_qabstracteventdispatcher.cpp 0 + Note that the type of the \a message is platform dependent. The + following table shows the \a {message}'s type on Windows, Mac, and + X11. You can do a static cast to these types. + + \table + \header + \o Platform + \o type + \row + \o Windows + \o MSG + \row + \o X11 + \o XEvent + \row + \o Mac + \o NSEvent + \endtable + + + \sa setEventFilter(), filterEvent() */ @@ -434,6 +455,9 @@ QAbstractEventDispatcher::EventFilter QAbstractEventDispatcher::setEventFilter(E compatibility with any extensions that may be used in the application. + Note that the type of \a message is platform dependent. See + QAbstractEventDispatcher::EventFilter for details. + \sa setEventFilter() */ bool QAbstractEventDispatcher::filterEvent(void *message) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index b0728c1..06a3239 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1972,7 +1972,7 @@ void QDeclarativeListView::setCacheBuffer(int b) \snippet examples/declarative/modelviews/listview/sections.qml 0 - \image ListViewSections.png + \image qml-listview-sections-example.png \sa {declarative/modelviews/listview}{ListView examples} */ diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 9e5dfb5..ec14c78 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -913,6 +913,22 @@ void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev) QDeclarativePaintedItem::keyPressEvent(ev); } +void QDeclarativeTextInput::inputMethodEvent(QInputMethodEvent *ev) +{ + Q_D(QDeclarativeTextInput); + inputMethodPreHandler(ev); + if (ev->isAccepted()) + return; + if (d->control->isReadOnly()) { + ev->ignore(); + } else { + d->control->processInputMethodEvent(ev); + updateSize(); + } + if (!ev->isAccepted()) + QDeclarativePaintedItem::inputMethodEvent(ev); +} + /*! \overload Handles the given mouse \a event. @@ -993,6 +1009,7 @@ bool QDeclarativeTextInput::event(QEvent* ev) switch(ev->type()){ case QEvent::KeyPress: case QEvent::KeyRelease://###Should the control be doing anything with release? + case QEvent::InputMethod: case QEvent::GraphicsSceneMousePress: case QEvent::GraphicsSceneMouseMove: case QEvent::GraphicsSceneMouseRelease: @@ -1000,8 +1017,6 @@ bool QDeclarativeTextInput::event(QEvent* ev) break; default: handled = d->control->processEvent(ev); - if (ev->type() == QEvent::InputMethod) - updateSize(); } if(!handled) handled = QDeclarativePaintedItem::event(ev); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 03f55ae..6934da4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -222,6 +222,7 @@ protected: void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void keyPressEvent(QKeyEvent* ev); + void inputMethodEvent(QInputMethodEvent *); bool event(QEvent *e); void focusInEvent(QFocusEvent *event); diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp index 388f252..c29005a 100644 --- a/src/declarative/qml/qdeclarativeinclude.cpp +++ b/src/declarative/qml/qdeclarativeinclude.cpp @@ -172,6 +172,29 @@ void QDeclarativeInclude::callback(QScriptEngine *engine, QScriptValue &callback } } +/*! +\qmlmethod object Qt::include(url, callback) + +Include another JavaScript file. This method can only be used from within JavaScript files, +and not regular QML files. + +Qt.include() returns an object that describes the status of the operation. The object has +a single property, \c {status} that is set to one of the following values: + +\table +\header \o Symbol \o Value \o Description +\row \o result.OK \o 0 \o The include completed successfully. +\row \o result.LOADING \o 1 \o Data is being loaded from the network. +\row \o result.NETWORK_ERROR \o 2 \o A network error occurred while fetching the url. +\row \o result.EXCEPTION \o 3 \o A JavaScript exception occurred while executing the included code. +An additional \c exception property will be set in this case. +\endtable + +The return object's properties will be updated as the operation progresses. + +If provided, \a callback is invoked when the operation completes. The callback is passed +the same object as is returned from the Qt.include() call. +*/ QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *engine) { if (ctxt->argumentCount() == 0) @@ -184,7 +207,7 @@ QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *e return ctxt->throwError(QLatin1String("Qt.include(): Can only be called from JavaScript files")); QString urlString = ctxt->argument(0).toString(); - QUrl url(ctxt->argument(0).toString()); + QUrl url(urlString); if (url.isRelative()) { url = QUrl(contextUrl).resolved(url); urlString = url.toString(); diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index ff83227..9ed21a6 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -81,8 +81,8 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM Roles (properties) must begin with a lower-case letter. The above example defines a ListModel containing three elements, with the roles "name" and "cost". - Values must be simple constants - either strings (quoted), bools (true, false), numbers, - or enum values (like Text.AlignHCenter). + Values must be simple constants - either strings (quoted and optionally within a call to QT_TR_NOOP), + bools (true, false), numbers, or enum values (like Text.AlignHCenter). The defined model can be used in views such as ListView: @@ -620,8 +620,13 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser QByteArray script = variant.asScript().toUtf8(); int v = evaluateEnum(script); if (v<0) { - error(prop, QDeclarativeListModel::tr("ListElement: cannot use script for property value")); - return false; + if (script.startsWith("QT_TR_NOOP(\"") && script.endsWith("\")")) { + d[0] = char(QDeclarativeParser::Variant::String); + d += script.mid(12,script.length()-14); + } else { + error(prop, QDeclarativeListModel::tr("ListElement: cannot use script for property value")); + return false; + } } else { d[0] = char(QDeclarativeParser::Variant::Number); d += QByteArray::number(v); diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index adc2632..bb8a994 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2274,6 +2274,8 @@ bool QImage::create(const QSize& size, int depth, int numColors, QImage::Endian typedef void (*Image_Converter)(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); +typedef bool (*InPlace_Image_Converter)(QImageData *data, Qt::ImageConversionFlags); + static void convert_ARGB_to_ARGB_PM(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) { Q_ASSERT(src->format == QImage::Format_ARGB32); @@ -2298,6 +2300,169 @@ static void convert_ARGB_to_ARGB_PM(QImageData *dest, const QImageData *src, Qt: } } +static bool convert_ARGB_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags) +{ + Q_ASSERT(data->format == QImage::Format_ARGB32); + + const int pad = (data->bytes_per_line >> 2) - data->width; + QRgb *rgb_data = (QRgb *) data->data; + + for (int i = 0; i < data->height; ++i) { + const QRgb *end = rgb_data + data->width; + while (rgb_data < end) { + *rgb_data = PREMUL(*rgb_data); + ++rgb_data; + } + rgb_data += pad; + } + data->format = QImage::Format_ARGB32_Premultiplied; + return true; +} + +static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags) +{ + Q_ASSERT(data->format == QImage::Format_Indexed8); + const int depth = 32; + + const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const int nbytes = dst_bytes_per_line * data->height; + uchar *const newData = (uchar *)realloc(data->data, nbytes); + if (!newData) + return false; + + data->data = newData; + + // start converting from the end because the end image is bigger than the source + uchar *src_data = newData + data->nbytes; // end of src + quint32 *dest_data = (quint32 *) (newData + nbytes); // end of dest > end of src + const int width = data->width; + const int src_pad = data->bytes_per_line - width; + const int dest_pad = (dst_bytes_per_line >> 2) - width; + + for (int i = 0; i < data->height; ++i) { + src_data -= src_pad; + dest_data -= dest_pad; + for (int pixI = 0; pixI < width; ++pixI) { + --src_data; + --dest_data; + const uint pixel = data->colortable[*src_data]; + *dest_data = (quint32) PREMUL(pixel); + } + } + + data->format = QImage::Format_ARGB32_Premultiplied; + data->bytes_per_line = dst_bytes_per_line; + data->depth = depth; + data->nbytes = nbytes; + + return true; +} + +static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversionFlags) +{ + Q_ASSERT(data->format == QImage::Format_Indexed8); + const int depth = 32; + + const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const int nbytes = dst_bytes_per_line * data->height; + uchar *const newData = (uchar *)realloc(data->data, nbytes); + if (!newData) + return false; + + data->data = newData; + + // start converting from the end because the end image is bigger than the source + uchar *src_data = newData + data->nbytes; + quint32 *dest_data = (quint32 *) (newData + nbytes); + const int width = data->width; + const int src_pad = data->bytes_per_line - width; + const int dest_pad = (dst_bytes_per_line >> 2) - width; + + for (int i = 0; i < data->height; ++i) { + src_data -= src_pad; + dest_data -= dest_pad; + for (int pixI = 0; pixI < width; ++pixI) { + --src_data; + --dest_data; + *dest_data = (quint32) data->colortable[*src_data]; + } + } + + data->format = QImage::Format_RGB32; + data->bytes_per_line = dst_bytes_per_line; + data->depth = depth; + data->nbytes = nbytes; + + return true; +} + +static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags) +{ + Q_ASSERT(data->format == QImage::Format_Indexed8); + const int depth = 16; + + const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const int nbytes = dst_bytes_per_line * data->height; + uchar *const newData = (uchar *)realloc(data->data, nbytes); + if (!newData) + return false; + + data->data = newData; + + // start converting from the end because the end image is bigger than the source + uchar *src_data = newData + data->nbytes; + quint16 *dest_data = (quint16 *) (newData + nbytes); + const int width = data->width; + const int src_pad = data->bytes_per_line - width; + const int dest_pad = (dst_bytes_per_line >> 1) - width; + + for (int i = 0; i < data->height; ++i) { + src_data -= src_pad; + dest_data -= dest_pad; + for (int pixI = 0; pixI < width; ++pixI) { + --src_data; + --dest_data; + const uint pixel = data->colortable[*src_data]; + *dest_data = qt_colorConvert<quint16, quint32>(pixel, 0); + } + } + + data->format = QImage::Format_RGB16; + data->bytes_per_line = dst_bytes_per_line; + data->depth = depth; + data->nbytes = nbytes; + + return true; +} + +static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags) +{ + Q_ASSERT(data->format == QImage::Format_RGB32); + const int depth = 16; + + const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const int src_bytes_per_line = data->bytes_per_line; + quint32 *src_data = (quint32 *) data->data; + quint16 *dst_data = (quint16 *) data->data; + + for (int i = 0; i < data->height; ++i) { + qt_memconvert(dst_data, src_data, data->width); + src_data = (quint32 *) (((char*)src_data) + src_bytes_per_line); + dst_data = (quint16 *) (((char*)dst_data) + dst_bytes_per_line); + } + data->format = QImage::Format_RGB16; + data->bytes_per_line = dst_bytes_per_line; + data->depth = depth; + data->nbytes = dst_bytes_per_line * data->height; + uchar *const newData = (uchar *)realloc(data->data, data->nbytes); + if (newData) { + data->data = newData; + return true; + } else { + return false; + } +} + static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) { Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied); @@ -3447,6 +3612,103 @@ static const Image_Converter converter_map[QImage::NImageFormats][QImage::NImage } // Format_ARGB4444_Premultiplied }; +static const InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] = +{ + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_Mono + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_MonoLSB + { + 0, + 0, + 0, + 0, + 0, + convert_indexed8_to_RGB_inplace, + convert_indexed8_to_ARGB_PM_inplace, + convert_indexed8_to_RGB16_inplace, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + }, // Format_Indexed8 + { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + convert_RGB_to_RGB16_inplace, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + }, // Format_ARGB32 + { + 0, + 0, + 0, + 0, + 0, + 0, + convert_ARGB_to_ARGB_PM_inplace, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + }, // Format_ARGB32 + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_ARGB32_Premultiplied + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_RGB16 + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_ARGB8565_Premultiplied + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_RGB666 + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_ARGB6666_Premultiplied + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_RGB555 + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_ARGB8555_Premultiplied + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_RGB888 + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_RGB444 + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } // Format_ARGB4444_Premultiplied +}; + /*! Returns a copy of the image in the given \a format. @@ -6276,6 +6538,18 @@ QTransform QImage::trueMatrix(const QTransform &matrix, int w, int h) return matrix * QTransform().translate(-delta.x(), -delta.y()); } +bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags flags) +{ + if (format == newFormat) + return true; + + const InPlace_Image_Converter *const converterPtr = &inplace_converter_map[format][newFormat]; + InPlace_Image_Converter converter = *converterPtr; + if (converter) + return converter(this, flags); + else + return false; +} /*! \typedef QImage::DataPtr diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h index 0c19647..f1a0c47 100644 --- a/src/gui/image/qimage_p.h +++ b/src/gui/image/qimage_p.h @@ -96,6 +96,9 @@ struct Q_GUI_EXPORT QImageData { // internal image data bool checkForAlphaPixels() const; + // Convert the image in-place, minimizing memory reallocation + // Return false if the conversion cannot be done in-place. + bool convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags); #ifndef QT_NO_IMAGE_TEXT QMap<QString, QString> text; diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 9dc15fc..13c03a1 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -47,6 +47,9 @@ #include "qbitmap.h" #include "qimage.h" +#include <QBuffer> +#include <QImageReader> +#include <private/qsimd_p.h> #include <private/qwidget_p.h> #include <private/qdrawhelper_p.h> @@ -127,91 +130,26 @@ void QRasterPixmapData::resize(int width, int height) setSerialNumber(image.serialNumber()); } +bool QRasterPixmapData::fromData(const uchar *buffer, uint len, const char *format, + Qt::ImageConversionFlags flags) +{ + QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer), len); + QBuffer b(&a); + b.open(QIODevice::ReadOnly); + QImage image = QImageReader(&b, format).read(); + if (image.isNull()) + return false; + + createPixmapForImage(image, flags, /* inplace = */true); + return !isNull(); +} + void QRasterPixmapData::fromImage(const QImage &sourceImage, Qt::ImageConversionFlags flags) { Q_UNUSED(flags); - -#ifdef Q_WS_QWS - QImage::Format format; - if (pixelType() == BitmapType) { - format = QImage::Format_Mono; - } else { - format = QScreen::instance()->pixelFormat(); - if (format == QImage::Format_Invalid) - format = QImage::Format_ARGB32_Premultiplied; - else if (format == QImage::Format_Indexed8) // currently not supported - format = QImage::Format_RGB444; - } - - if (sourceImage.hasAlphaChannel() - && ((flags & Qt::NoOpaqueDetection) - || const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())) { - switch (format) { - case QImage::Format_RGB16: - format = QImage::Format_ARGB8565_Premultiplied; - break; - case QImage::Format_RGB666: - format = QImage::Format_ARGB6666_Premultiplied; - break; - case QImage::Format_RGB555: - format = QImage::Format_ARGB8555_Premultiplied; - break; - case QImage::Format_RGB444: - format = QImage::Format_ARGB4444_Premultiplied; - break; - default: - format = QImage::Format_ARGB32_Premultiplied; - break; - } - } else if (format == QImage::Format_Invalid) { - format = QImage::Format_ARGB32_Premultiplied; - } - - image = sourceImage.convertToFormat(format); -#else - if (pixelType() == BitmapType) { - image = sourceImage.convertToFormat(QImage::Format_MonoLSB); - } else { - if (sourceImage.depth() == 1) { - image = sourceImage.hasAlphaChannel() - ? sourceImage.convertToFormat(QImage::Format_ARGB32_Premultiplied) - : sourceImage.convertToFormat(QImage::Format_RGB32); - } else { - - QImage::Format opaqueFormat = QNativeImage::systemFormat(); - QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied; - -#ifndef QT_HAVE_NEON - switch (opaqueFormat) { - case QImage::Format_RGB16: - alphaFormat = QImage::Format_ARGB8565_Premultiplied; - break; - default: // We don't care about the others... - break; - } -#endif - - if (!sourceImage.hasAlphaChannel() - || ((flags & Qt::NoOpaqueDetection) == 0 - && !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())) { - image = sourceImage.convertToFormat(opaqueFormat); - } else { - image = sourceImage.convertToFormat(alphaFormat); - } - } - } -#endif - if (image.d) { - w = image.d->width; - h = image.d->height; - d = image.d->depth; - } else { - w = h = d = 0; - } - is_null = (w <= 0 || h <= 0); - - setSerialNumber(image.serialNumber()); + QImage image = sourceImage; + createPixmapForImage(image, flags, /* inplace = */false); } // from qwindowsurface.cpp @@ -240,7 +178,7 @@ void QRasterPixmapData::fill(const QColor &color) if (alpha != 255) { if (!image.hasAlphaChannel()) { QImage::Format toFormat; -#ifndef QT_HAVE_NEON +#if !(defined(QT_HAVE_NEON) || defined(QT_ALWAYS_HAVE_SSE2)) if (image.format() == QImage::Format_RGB16) toFormat = QImage::Format_ARGB8565_Premultiplied; else if (image.format() == QImage::Format_RGB666) @@ -398,6 +336,105 @@ int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const return 0; } +void QRasterPixmapData::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace) +{ + QImage::Format format; +#ifdef Q_WS_QWS + if (pixelType() == BitmapType) { + format = QImage::Format_Mono; + } else { + format = QScreen::instance()->pixelFormat(); + if (format == QImage::Format_Invalid) + format = QImage::Format_ARGB32_Premultiplied; + else if (format == QImage::Format_Indexed8) // currently not supported + format = QImage::Format_RGB444; + } + + if (sourceImage.hasAlphaChannel() + && ((flags & Qt::NoOpaqueDetection) + || const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())) { + switch (format) { + case QImage::Format_RGB16: + format = QImage::Format_ARGB8565_Premultiplied; + break; + case QImage::Format_RGB666: + format = QImage::Format_ARGB6666_Premultiplied; + break; + case QImage::Format_RGB555: + format = QImage::Format_ARGB8555_Premultiplied; + break; + case QImage::Format_RGB444: + format = QImage::Format_ARGB4444_Premultiplied; + break; + default: + format = QImage::Format_ARGB32_Premultiplied; + break; + } + } else if (format == QImage::Format_Invalid) { + format = QImage::Format_ARGB32_Premultiplied; + } +#else + if (pixelType() == BitmapType) { + format = QImage::Format_MonoLSB; + } else { + if (sourceImage.depth() == 1) { + format = sourceImage.hasAlphaChannel() + ? QImage::Format_ARGB32_Premultiplied + : QImage::Format_RGB32; + } else { + QImage::Format opaqueFormat = QNativeImage::systemFormat(); + QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied; + +#if !defined(QT_HAVE_NEON) && !defined(QT_ALWAYS_HAVE_SSE2) + switch (opaqueFormat) { + case QImage::Format_RGB16: + alphaFormat = QImage::Format_ARGB8565_Premultiplied; + break; + default: // We don't care about the others... + break; + } +#endif + + if (!sourceImage.hasAlphaChannel()) { + format = opaqueFormat; + } else if ((flags & Qt::NoOpaqueDetection) == 0 + && !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels()) + { + // image has alpha format but is really opaque, so try to do a + // more efficient conversion + if (sourceImage.format() == QImage::Format_ARGB32 + || sourceImage.format() == QImage::Format_ARGB32_Premultiplied) + { + if (!inPlace) + sourceImage.detach(); + sourceImage.d->format = QImage::Format_RGB32; + } + format = opaqueFormat; + } else { + format = alphaFormat; + } + } + } +#endif + + if (inPlace && sourceImage.d->convertInPlace(format, flags)) { + image = sourceImage; + } else { + image = sourceImage.convertToFormat(format); + } + + if (image.d) { + w = image.d->width; + h = image.d->height; + d = image.d->depth; + } else { + w = h = d = 0; + } + is_null = (w <= 0 || h <= 0); + + setSerialNumber(image.serialNumber()); +} + QImage* QRasterPixmapData::buffer() { return ℑ diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index 6cdd3d7..d7e3f85 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -72,6 +72,7 @@ public: void resize(int width, int height); void fromFile(const QString &filename, Qt::ImageConversionFlags flags); + bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); bool scroll(int dx, int dy, const QRect &rect); @@ -85,6 +86,8 @@ public: protected: int metric(QPaintDevice::PaintDeviceMetric metric) const; + void createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace); + void setImage(const QImage &image); QImage image; private: diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index ea4fe6b..31ca909 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -146,7 +146,7 @@ bool QPixmapData::fromData(const uchar *buf, uint len, const char *format, Qt::I void QPixmapData::copy(const QPixmapData *data, const QRect &rect) { - fromImage(data->toImage().copy(rect), Qt::AutoColor); + fromImage(data->toImage().copy(rect), Qt::NoOpaqueDetection); } bool QPixmapData::scroll(int dx, int dy, const QRect &rect) diff --git a/src/gui/itemviews/qabstractitemdelegate.cpp b/src/gui/itemviews/qabstractitemdelegate.cpp index 775bf7d..0ea6d67 100644 --- a/src/gui/itemviews/qabstractitemdelegate.cpp +++ b/src/gui/itemviews/qabstractitemdelegate.cpp @@ -291,8 +291,14 @@ void QAbstractItemDelegate::updateEditorGeometry(QWidget *, } /*! - Whenever an event occurs, this function is called with the \a event - \a model \a option and the \a index that corresponds to the item being edited. + When editing of an item starts, this function is called with the + \a event that triggered the editing, the \a model, the \a index of + the item, and the \a option used for rendering the item. + + Mouse events are sent to editorEvent() even if they don't start + editing of the item. This can, for instance, be useful if you wish + to open a context menu when the right mouse button is pressed on + an item. The base implementation returns false (indicating that it has not handled the event). diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 0edb8fb..2a85fdc 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -955,6 +955,9 @@ const QString qt_reg_winclass(QWidget *w) // register window class if (qt_widget_private(w)->isGLWidget) { cname = QLatin1String("QGLWidget"); style = CS_DBLCLKS; +#ifndef Q_WS_WINCE + style |= CS_OWNDC; +#endif icon = true; } else if (flags & Qt::MSWindowsOwnDC) { cname = QLatin1String("QWidgetOwnDC"); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index ed53ccf..204e38c 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -253,8 +253,35 @@ private: }; inline QS60Data::QS60Data() +: uid(TUid::Null()), + screenDepth(0), + screenWidthInPixels(0), + screenHeightInPixels(0), + screenWidthInTwips(0), + screenHeightInTwips(0), + defaultDpiX(0), + defaultDpiY(0), + curWin(0), + virtualMousePressedKeys(0), + virtualMouseAccelDX(0), + virtualMouseAccelDY(0), + virtualMouseMaxAccel(0), +#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS + brokenPointerCursors(0), +#endif + hasTouchscreen(0), + mouseInteractionEnabled(0), + virtualMouseRequired(0), + qtOwnsS60Environment(0), + supportsPremultipliedAlpha(0), + avkonComponentsSupportTransparency(0), + menuBeingConstructed(0), + memoryLimitForHwRendering(0), + s60ApplicationFactory(0), +#ifdef Q_WS_S60 + s60InstalledTrapHandler(0) +#endif { - memclr(this, sizeof(QS60Data)); //zero init data } inline void QS60Data::updateScreenSize() diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index d17c711..71bc990 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2391,6 +2391,8 @@ void QPainter::setCompositionMode(CompositionMode mode) qWarning("QPainter::setCompositionMode: Painter not active"); return; } + if (d->state->composition_mode == mode) + return; if (d->extended) { d->state->composition_mode = mode; d->extended->compositionModeChanged(); diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 883f511..ada5293 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -884,7 +884,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, } painter->restore(); break; -#ifndef QT_NO_LINEDIT +#ifndef QT_NO_LINEEDIT case PE_FrameLineEdit: // fall through #endif // QT_NO_LINEEDIT diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index ddf9411..fec9ecc 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1661,7 +1661,7 @@ namespace { { LineBreakHelper() : glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(0), logClusters(0), - manualWrap(false) + manualWrap(false), whiteSpaceOrObject(true) { } @@ -1684,6 +1684,7 @@ namespace { const unsigned short *logClusters; bool manualWrap; + bool whiteSpaceOrObject; bool checkFullOtherwiseExtend(QScriptLine &line); @@ -1693,8 +1694,10 @@ namespace { } inline glyph_t currentGlyph() const - { + { Q_ASSERT(currentPosition > 0); + Q_ASSERT(logClusters[currentPosition - 1] < glyphs.numGlyphs); + return glyphs.glyphs[logClusters[currentPosition - 1]]; } @@ -1829,6 +1832,7 @@ void QTextLine::layout_helper(int maxGlyphs) lbh.tmpData.descent = qMax(lbh.tmpData.descent, current.descent); if (current.analysis.flags == QScriptAnalysis::Tab && (alignment & (Qt::AlignLeft | Qt::AlignRight | Qt::AlignCenter | Qt::AlignJustify))) { + lbh.whiteSpaceOrObject = true; if (lbh.checkFullOtherwiseExtend(line)) goto found; @@ -1845,6 +1849,7 @@ void QTextLine::layout_helper(int maxGlyphs) if (lbh.checkFullOtherwiseExtend(line)) goto found; } else if (current.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator) { + lbh.whiteSpaceOrObject = true; // if the line consists only of the line separator make sure // we have a sane height if (!line.length && !lbh.tmpData.length) @@ -1858,6 +1863,7 @@ void QTextLine::layout_helper(int maxGlyphs) line += lbh.tmpData; goto found; } else if (current.analysis.flags == QScriptAnalysis::Object) { + lbh.whiteSpaceOrObject = true; lbh.tmpData.length++; QTextFormat format = eng->formats()->format(eng->formatIndex(&eng->layoutData->items[item])); @@ -1871,6 +1877,7 @@ void QTextLine::layout_helper(int maxGlyphs) if (lbh.checkFullOtherwiseExtend(line)) goto found; } else if (attributes[lbh.currentPosition].whiteSpace) { + lbh.whiteSpaceOrObject = true; while (lbh.currentPosition < end && attributes[lbh.currentPosition].whiteSpace) addNextCluster(lbh.currentPosition, end, lbh.spaceData, lbh.glyphCount, current, lbh.logClusters, lbh.glyphs); @@ -1880,6 +1887,7 @@ void QTextLine::layout_helper(int maxGlyphs) goto found; } } else { + lbh.whiteSpaceOrObject = false; bool sb_or_ws = false; do { addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, @@ -1941,7 +1949,7 @@ void QTextLine::layout_helper(int maxGlyphs) LB_DEBUG("reached end of line"); lbh.checkFullOtherwiseExtend(line); found: - if (lbh.rightBearing > 0) // If right bearing has not yet been adjusted + if (lbh.rightBearing > 0 && !lbh.whiteSpaceOrObject) // If right bearing has not yet been adjusted lbh.adjustRightBearing(); line.textAdvance = line.textWidth; line.textWidth -= qMin(QFixed(), lbh.rightBearing); diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index cb65f6e..b99fe11 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -259,7 +259,7 @@ public: UInt32 inBusNumber, UInt32 inNumberFrames) { - const bool wasEmpty = m_buffer->used() == 0; + const bool pullMode = m_device == 0; OSStatus err; qint64 framesRendered = 0; @@ -330,7 +330,7 @@ public: framesRendered = copied / m_outputFormat.mBytesPerFrame; } - if (wasEmpty && framesRendered > 0) + if (pullMode && framesRendered > 0) emit readyRead(); return framesRendered; diff --git a/src/multimedia/video/qabstractvideobuffer_p.h b/src/multimedia/video/qabstractvideobuffer_p.h index c72f303..3303b36 100644 --- a/src/multimedia/video/qabstractvideobuffer_p.h +++ b/src/multimedia/video/qabstractvideobuffer_p.h @@ -65,6 +65,9 @@ public: : handleType(QAbstractVideoBuffer::NoHandle) {} + virtual ~QAbstractVideoBufferPrivate() + {} + QAbstractVideoBuffer::HandleType handleType; }; diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 5486f47..4907f2c 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -280,6 +280,12 @@ void QLocalSocketPrivate::startAsyncRead() case ERROR_IO_PENDING: // This is not an error. We're getting notified, when data arrives. return; + case ERROR_MORE_DATA: + // This is not an error. The synchronous read succeeded. + // We're connected to a message mode pipe and the message + // didn't fit into the pipe's system buffer. + completeAsyncRead(); + break; case ERROR_PIPE_NOT_CONNECTED: { // It may happen, that the other side closes the connection directly @@ -309,9 +315,18 @@ bool QLocalSocketPrivate::completeAsyncRead() DWORD bytesRead; if (!GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE)) { - if (GetLastError() != ERROR_PIPE_NOT_CONNECTED) + switch (GetLastError()) { + case ERROR_MORE_DATA: + // This is not an error. We're connected to a message mode + // pipe and the message didn't fit into the pipe's system + // buffer. We will read the remaining data in the next call. + break; + case ERROR_PIPE_NOT_CONNECTED: setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead")); - return false; + // fall through + default: + return false; + } } actualReadBufferSize += bytesRead; diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index c6d7a2c..45caeb0 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -4479,4 +4479,5 @@ EXPORTS ?trUtf8@QEventDispatcherSymbian@@SA?AVQString@@PBD0@Z @ 4478 NONAME ; class QString QEventDispatcherSymbian::trUtf8(char const *, char const *) ?trUtf8@QEventDispatcherSymbian@@SA?AVQString@@PBD0H@Z @ 4479 NONAME ; class QString QEventDispatcherSymbian::trUtf8(char const *, char const *, int) ?staticMetaObject@QEventDispatcherSymbian@@2UQMetaObject@@B @ 4480 NONAME ; struct QMetaObject const QEventDispatcherSymbian::staticMetaObject + ?textDirection@QLocale@@QBE?AW4LayoutDirection@Qt@@XZ @ 4481 NONAME ; enum Qt::LayoutDirection QLocale::textDirection(void) const diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index 2992cf6..0aac72b 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -4025,7 +4025,7 @@ EXPORTS ?get@QDeclarativeXmlListModel@@QBE?AVQScriptValue@@H@Z @ 4024 NONAME ; class QScriptValue QDeclarativeXmlListModel::get(int) const ?setScale@QDeclarativeParentChange@@QAEXVQDeclarativeScriptString@@@Z @ 4025 NONAME ; void QDeclarativeParentChange::setScale(class QDeclarativeScriptString) ?showInputPanelOnFocusChanged@QDeclarativeTextEdit@@IAEX_N@Z @ 4026 NONAME ABSENT ; void QDeclarativeTextEdit::showInputPanelOnFocusChanged(bool) - ?focusOutEvent@QDeclarativeTextInput@@MAEXPAVQFocusEvent@@@Z @ 4027 NONAME ; void QDeclarativeTextInput::focusOutEvent(class QFocusEvent *) + ?focusOutEvent@QDeclarativeTextInput@@MAEXPAVQFocusEvent@@@Z @ 4027 NONAME ABSENT ; void QDeclarativeTextInput::focusOutEvent(class QFocusEvent *) ?height@QDeclarativeParentChange@@QBE?AVQDeclarativeScriptString@@XZ @ 4028 NONAME ; class QDeclarativeScriptString QDeclarativeParentChange::height(void) const ?showInputPanelOnFocus@QDeclarativeTextEdit@@QBE_NXZ @ 4029 NONAME ABSENT ; bool QDeclarativeTextEdit::showInputPanelOnFocus(void) const ?errorString@QDeclarativeComponent@@QBE?AVQString@@XZ @ 4030 NONAME ; class QString QDeclarativeComponent::errorString(void) const @@ -4035,7 +4035,7 @@ EXPORTS ?rotation@QDeclarativeParentChange@@QBE?AVQDeclarativeScriptString@@XZ @ 4034 NONAME ; class QDeclarativeScriptString QDeclarativeParentChange::rotation(void) const ?paintedHeight@QDeclarativeTextEdit@@QBEMXZ @ 4035 NONAME ; float QDeclarativeTextEdit::paintedHeight(void) const ?paintedWidth@QDeclarativeTextEdit@@QBEMXZ @ 4036 NONAME ; float QDeclarativeTextEdit::paintedWidth(void) const - ?focusOutEvent@QDeclarativeTextEdit@@MAEXPAVQFocusEvent@@@Z @ 4037 NONAME ; void QDeclarativeTextEdit::focusOutEvent(class QFocusEvent *) + ?focusOutEvent@QDeclarativeTextEdit@@MAEXPAVQFocusEvent@@@Z @ 4037 NONAME ABSENT ; void QDeclarativeTextEdit::focusOutEvent(class QFocusEvent *) ??0QDeclarativeExpression@@IAE@PAVQDeclarativeContextData@@PAVQObject@@ABVQString@@AAVQDeclarativeExpressionPrivate@@@Z @ 4038 NONAME ; QDeclarativeExpression::QDeclarativeExpression(class QDeclarativeContextData *, class QObject *, class QString const &, class QDeclarativeExpressionPrivate &) ??0QDeclarativeExpression@@QAE@PAVQDeclarativeContext@@PAVQObject@@ABVQString@@1@Z @ 4039 NONAME ; QDeclarativeExpression::QDeclarativeExpression(class QDeclarativeContext *, class QObject *, class QString const &, class QObject *) ?queryError@QDeclarativeXmlListModel@@AAEXPAXABVQString@@@Z @ 4040 NONAME ; void QDeclarativeXmlListModel::queryError(void *, class QString const &) @@ -4088,4 +4088,13 @@ EXPORTS ?positionToRectangle@QDeclarativeTextInput@@QBE?AVQRectF@@H@Z @ 4087 NONAME ; class QRectF QDeclarativeTextInput::positionToRectangle(int) const ?positionAt@QDeclarativeTextInput@@QBEHH@Z @ 4088 NONAME ; int QDeclarativeTextInput::positionAt(int) const ?selectWord@QDeclarativeTextEdit@@QAEXXZ @ 4089 NONAME ; void QDeclarativeTextEdit::selectWord(void) + ?setFooter@QDeclarativeGridView@@QAEXPAVQDeclarativeComponent@@@Z @ 4090 NONAME ; void QDeclarativeGridView::setFooter(class QDeclarativeComponent *) + ?isNamed@QDeclarativeState@@QBE_NXZ @ 4091 NONAME ; bool QDeclarativeState::isNamed(void) const + ?initialSize@QDeclarativeView@@QBE?AVQSize@@XZ @ 4092 NONAME ; class QSize QDeclarativeView::initialSize(void) const + ?childAt@QDeclarativeItem@@QBEPAV1@MM@Z @ 4093 NONAME ; class QDeclarativeItem * QDeclarativeItem::childAt(float, float) const + ?footer@QDeclarativeGridView@@QBEPAVQDeclarativeComponent@@XZ @ 4094 NONAME ; class QDeclarativeComponent * QDeclarativeGridView::footer(void) const + ?headerChanged@QDeclarativeGridView@@IAEXXZ @ 4095 NONAME ; void QDeclarativeGridView::headerChanged(void) + ?setHeader@QDeclarativeGridView@@QAEXPAVQDeclarativeComponent@@@Z @ 4096 NONAME ; void QDeclarativeGridView::setHeader(class QDeclarativeComponent *) + ?header@QDeclarativeGridView@@QBEPAVQDeclarativeComponent@@XZ @ 4097 NONAME ; class QDeclarativeComponent * QDeclarativeGridView::header(void) const + ?footerChanged@QDeclarativeGridView@@IAEXXZ @ 4098 NONAME ; void QDeclarativeGridView::footerChanged(void) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 9b4ecc2..d439927 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12813,4 +12813,11 @@ EXPORTS ?setVerticalMovementX@QTextCursor@@QAEXH@Z @ 12812 NONAME ; void QTextCursor::setVerticalMovementX(int) ?invertedAppearance@QProgressBar@@QBE_NXZ @ 12813 NONAME ; bool QProgressBar::invertedAppearance(void) const ?width@QFontMetrics@@QBEHABVQString@@HH@Z @ 12814 NONAME ; int QFontMetrics::width(class QString const &, int, int) const + ?aboutToDestroy@QWidgetPrivate@@UAEXXZ @ 12815 NONAME ; void QWidgetPrivate::aboutToDestroy(void) + ?setTextOption@QStaticText@@QAEXABVQTextOption@@@Z @ 12816 NONAME ; void QStaticText::setTextOption(class QTextOption const &) + ?pointInsideRectAndMask@QWidgetPrivate@@QBE_NABVQPoint@@@Z @ 12817 NONAME ; bool QWidgetPrivate::pointInsideRectAndMask(class QPoint const &) const + ?childAtRecursiveHelper@QWidgetPrivate@@QBEPAVQWidget@@ABVQPoint@@_N1@Z @ 12818 NONAME ; class QWidget * QWidgetPrivate::childAtRecursiveHelper(class QPoint const &, bool, bool) const + ?textOption@QStaticText@@QBE?AVQTextOption@@XZ @ 12819 NONAME ; class QTextOption QStaticText::textOption(void) const + ?isRightToLeft@QTextEngine@@QBE_NXZ @ 12820 NONAME ; bool QTextEngine::isRightToLeft(void) const + ?textDirection@QTextBlock@@QBE?AW4LayoutDirection@Qt@@XZ @ 12821 NONAME ; enum Qt::LayoutDirection QTextBlock::textDirection(void) const diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 0590d39..48cad39 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -3705,4 +3705,6 @@ EXPORTS _ZlsR11QDataStreamRK12QEasingCurve @ 3704 NONAME _ZltRK13QElapsedTimerS1_ @ 3705 NONAME _ZrsR11QDataStreamR12QEasingCurve @ 3706 NONAME + _ZNK7QLocale13textDirectionEv @ 3707 NONAME + _ZNK7QString13isRightToLeftEv @ 3708 NONAME diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 1c4cd5d..f997454 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -3605,7 +3605,7 @@ EXPORTS _ZN16QDeclarativeText18paintedSizeChangedEv @ 3604 NONAME _ZN20QDeclarativePathView5eventEP6QEvent @ 3605 NONAME _ZN20QDeclarativeTextEdit12focusInEventEP11QFocusEvent @ 3606 NONAME - _ZN20QDeclarativeTextEdit13focusOutEventEP11QFocusEvent @ 3607 NONAME + _ZN20QDeclarativeTextEdit13focusOutEventEP11QFocusEvent @ 3607 NONAME ABSENT _ZN20QDeclarativeTextEdit16setSelectByMouseEb @ 3608 NONAME _ZN20QDeclarativeTextEdit18paintedSizeChangedEv @ 3609 NONAME _ZN20QDeclarativeTextEdit20selectByMouseChangedEb @ 3610 NONAME @@ -3615,7 +3615,7 @@ EXPORTS _ZN20QDeclarativeTextEdit24setShowInputPanelOnFocusEb @ 3614 NONAME ABSENT _ZN20QDeclarativeTextEdit28showInputPanelOnFocusChangedEb @ 3615 NONAME ABSENT _ZN21QDeclarativeTextInput12focusInEventEP11QFocusEvent @ 3616 NONAME - _ZN21QDeclarativeTextInput13focusOutEventEP11QFocusEvent @ 3617 NONAME + _ZN21QDeclarativeTextInput13focusOutEventEP11QFocusEvent @ 3617 NONAME ABSENT _ZN21QDeclarativeTextInput16setSelectByMouseEb @ 3618 NONAME _ZN21QDeclarativeTextInput20selectByMouseChangedEb @ 3619 NONAME _ZN21QDeclarativeTextInput22openSoftwareInputPanelEv @ 3620 NONAME @@ -3653,9 +3653,9 @@ EXPORTS _ZNK24QDeclarativeXmlListModel11errorStringEv @ 3652 NONAME _ZNK24QDeclarativeXmlListModel3getEi @ 3653 NONAME _ZThn8_N20QDeclarativeTextEdit12focusInEventEP11QFocusEvent @ 3654 NONAME - _ZThn8_N20QDeclarativeTextEdit13focusOutEventEP11QFocusEvent @ 3655 NONAME + _ZThn8_N20QDeclarativeTextEdit13focusOutEventEP11QFocusEvent @ 3655 NONAME ABSENT _ZThn8_N21QDeclarativeTextInput12focusInEventEP11QFocusEvent @ 3656 NONAME - _ZThn8_N21QDeclarativeTextInput13focusOutEventEP11QFocusEvent @ 3657 NONAME + _ZThn8_N21QDeclarativeTextInput13focusOutEventEP11QFocusEvent @ 3657 NONAME ABSENT _ZThn8_NK23QDeclarativePaintedItem12boundingRectEv @ 3658 NONAME _ZN20QDeclarativeTextEdit10selectWordEv @ 3659 NONAME _ZN20QDeclarativeTextEdit19moveCursorSelectionEi @ 3660 NONAME @@ -3672,4 +3672,13 @@ EXPORTS _ZNK21QDeclarativeTextInput15cursorRectangleEv @ 3671 NONAME _ZNK21QDeclarativeTextInput19positionToRectangleEi @ 3672 NONAME _ZThn8_N21QDeclarativeTextInput21mouseDoubleClickEventEP24QGraphicsSceneMouseEvent @ 3673 NONAME + _ZN20QDeclarativeGridView13footerChangedEv @ 3674 NONAME + _ZN20QDeclarativeGridView13headerChangedEv @ 3675 NONAME + _ZN20QDeclarativeGridView9setFooterEP21QDeclarativeComponent @ 3676 NONAME + _ZN20QDeclarativeGridView9setHeaderEP21QDeclarativeComponent @ 3677 NONAME + _ZNK16QDeclarativeItem7childAtEff @ 3678 NONAME + _ZNK16QDeclarativeView11initialSizeEv @ 3679 NONAME + _ZNK17QDeclarativeState7isNamedEv @ 3680 NONAME + _ZNK20QDeclarativeGridView6footerEv @ 3681 NONAME + _ZNK20QDeclarativeGridView6headerEv @ 3682 NONAME diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 9c1002d..b59ddee 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12012,4 +12012,9 @@ EXPORTS _ZNK11QTextCursor17verticalMovementXEv @ 12011 NONAME _ZNK11QTextCursor20keepPositionOnInsertEv @ 12012 NONAME _ZNK12QFontMetrics5widthERK7QStringii @ 12013 NONAME + _ZN11QStaticText13setTextOptionERK11QTextOption @ 12014 NONAME + _ZNK10QTextBlock13textDirectionEv @ 12015 NONAME + _ZNK11QStaticText10textOptionEv @ 12016 NONAME + _ZNK11QTextEngine13isRightToLeftEv @ 12017 NONAME + _ZNK14QWidgetPrivate22childAtRecursiveHelperERK6QPointbb @ 12018 NONAME diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 6d8513e..be5fa86 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -71,13 +71,13 @@ symbian: { " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ "ELSEIF package(0x1028315F)" \ " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" \ - " \"$$bearerPluginLocation/qsymbianbearer_3_2$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ + " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}_3_2.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ "ELSEIF package(0x102752AE)" \ " \"$$pluginLocations/qts60plugin_3_2$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_3_2$${QT_LIBINFIX}.dll\"" \ - " \"$$bearerPluginLocation/qsymbianbearer_3_2$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ + " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}_3_2.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ "ELSEIF package(0x102032BE)" \ " \"$$pluginLocations/qts60plugin_3_1$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_3_1$${QT_LIBINFIX}.dll\"" \ - " \"$$bearerPluginLocation/qsymbianbearer_3_1$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ + " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}_3_1.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ "ELSE" \ " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" \ " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ diff --git a/src/s60installs/sqlite3.sis b/src/s60installs/sqlite3.sis Binary files differindex 11e069e..12d01f9 100644 --- a/src/s60installs/sqlite3.sis +++ b/src/s60installs/sqlite3.sis diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index b3b6c20..3d66733 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -48,6 +48,7 @@ #include <QtCore/qtimer.h> #include <QtCore/qdebug.h> +#include <QtCore/qtranslator.h> #include "../../../shared/util.h" @@ -124,14 +125,17 @@ void tst_qdeclarativelistmodel::waitForWorker(QDeclarativeItem *item) void tst_qdeclarativelistmodel::static_i18n() { QString expect = QString::fromUtf8("na\303\257ve"); - QString componentStr = "import Qt 4.7\nListModel { ListElement { prop1: \""+expect+"\" } }"; + + QString componentStr = "import Qt 4.7\nListModel { ListElement { prop1: \""+expect+"\"; prop2: QT_TR_NOOP(\""+expect+"\") } }"; QDeclarativeEngine engine; QDeclarativeComponent component(&engine); component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); QDeclarativeListModel *obj = qobject_cast<QDeclarativeListModel*>(component.create()); QVERIFY(obj != 0); - QString prop = obj->get(0).property(QLatin1String("prop1")).toString(); - QCOMPARE(prop,expect); + QString prop1 = obj->get(0).property(QLatin1String("prop1")).toString(); + QCOMPARE(prop1,expect); + QString prop2 = obj->get(0).property(QLatin1String("prop2")).toString(); + QCOMPARE(prop2,expect); // (no, not translated, QT_TR_NOOP is a no-op) delete obj; } diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 054da4a..998f588 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -153,7 +153,7 @@ void tst_lconvert::verifyReadFail(const QString &fn) { QProcess cvt; cvt.start(binDir + "/lconvert", QStringList() << (dataDir + fn)); - QVERIFY(cvt.waitForFinished(1000)); + QVERIFY(cvt.waitForFinished(10000)); QVERIFY(cvt.exitStatus() == QProcess::NormalExit); QVERIFY2(cvt.exitCode() == 2, "Accepted invalid input"); } diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index c179462..5ba6c52 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -288,7 +288,7 @@ void tst_lupdate::good() proc.setWorkingDirectory(workDir); proc.setProcessChannelMode(QProcess::MergedChannels); proc.start(m_cmdLupdate + ' ' + lupdatecmd, QIODevice::ReadWrite | QIODevice::Text); - QVERIFY2(proc.waitForFinished(5000), qPrintable(lupdatecmd)); + QVERIFY2(proc.waitForFinished(30000), qPrintable(lupdatecmd)); QByteArray output = proc.readAll(); QVERIFY2(proc.exitStatus() == QProcess::NormalExit, "\"lupdate " + lupdatecmd.toLatin1() + "\" crashed\n" + output); diff --git a/tests/auto/qpixmap/loadFromData/designer_argb32.png b/tests/auto/qpixmap/loadFromData/designer_argb32.png Binary files differnew file mode 100644 index 0000000..55d8247 --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_argb32.png diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gif Binary files differnew file mode 100644 index 0000000..26a6da3 --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gif diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.png b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.png Binary files differnew file mode 100644 index 0000000..28cd2f0 --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.png diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gif Binary files differnew file mode 100644 index 0000000..49ec77b --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gif diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.png b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.png Binary files differnew file mode 100644 index 0000000..09735a9 --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.png diff --git a/tests/auto/qpixmap/loadFromData/designer_rgb32.jpg b/tests/auto/qpixmap/loadFromData/designer_rgb32.jpg Binary files differnew file mode 100644 index 0000000..70f39c2 --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_rgb32.jpg diff --git a/tests/auto/qpixmap/loadFromData/designer_rgb32.png b/tests/auto/qpixmap/loadFromData/designer_rgb32.png Binary files differnew file mode 100644 index 0000000..bca471d --- /dev/null +++ b/tests/auto/qpixmap/loadFromData/designer_rgb32.png diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 49b1e52..179f068 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -172,6 +172,9 @@ private slots: void fromData(); void loadFromDataNullValues(); + void loadFromDataImage_data(); + void loadFromDataImage(); + void preserveDepth(); void splash_crash(); @@ -1540,6 +1543,40 @@ void tst_QPixmap::loadFromDataNullValues() } } +void tst_QPixmap::loadFromDataImage_data() +{ + QTest::addColumn<QString>("imagePath"); +#ifdef Q_OS_SYMBIAN + const QString prefix = QLatin1String(SRCDIR) + "loadFromData"; +#else + const QString prefix = QLatin1String(SRCDIR) + "/loadFromData"; +#endif + QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png"; + QTest::newRow("designer_indexed8_no_alpha.png") << prefix + "/designer_indexed8_no_alpha.png"; + QTest::newRow("designer_indexed8_with_alpha.png") << prefix + "/designer_indexed8_with_alpha.png"; + QTest::newRow("designer_rgb32.png") << prefix + "/designer_rgb32.png"; + QTest::newRow("designer_indexed8_no_alpha.gif") << prefix + "/designer_indexed8_no_alpha.gif"; + QTest::newRow("designer_indexed8_with_alpha.gif") << prefix + "/designer_indexed8_with_alpha.gif"; + QTest::newRow("designer_rgb32.jpg") << prefix + "/designer_rgb32.jpg"; +} + +void tst_QPixmap::loadFromDataImage() +{ + QFETCH(QString, imagePath); + + QImage imageRef(imagePath); + QPixmap pixmapWithCopy = QPixmap::fromImage(imageRef); + + QFile file(imagePath); + file.open(QIODevice::ReadOnly); + QByteArray rawData = file.readAll(); + + QPixmap directLoadingPixmap; + directLoadingPixmap.loadFromData(rawData); + + QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap)); +} + void tst_QPixmap::task_246446() { // This crashed without the bugfix in 246446 diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index a631f3d..f798faf 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -112,6 +112,7 @@ private slots: void columnWrapWithTabs(); void boundingRectForUnsetLineWidth(); void boundingRectForSetLineWidth(); + void glyphLessItems(); // QTextLine stuff void setNumColumnsWrapAtWordBoundaryOrAnywhere(); @@ -1339,6 +1340,24 @@ void tst_QTextLayout::lineWidthFromBOM() // Don't spin into an infinite loop } +void tst_QTextLayout::glyphLessItems() +{ + { + QTextLayout layout; + layout.setText("\t\t"); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + } + + { + QTextLayout layout; + layout.setText(QString::fromLatin1("AA") + QChar(QChar::LineSeparator)); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + } +} QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" diff --git a/tests/auto/qtimeline/tst_qtimeline.cpp b/tests/auto/qtimeline/tst_qtimeline.cpp index b15d2a4..47d0550 100644 --- a/tests/auto/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/qtimeline/tst_qtimeline.cpp @@ -247,11 +247,7 @@ void tst_QTimeLine::frameRate() void tst_QTimeLine::value() { -#ifdef Q_OS_WINCE //On WinCE timer resolution is bad - use longer times QTimeLine timeLine(2000); -#else - QTimeLine timeLine(200); -#endif QVERIFY(timeLine.currentValue() == 0.0); // Default speed @@ -270,19 +266,11 @@ void tst_QTimeLine::value() timeLine.setCurrentTime(100); timeLine.start(); // Let it update on its own -#ifdef Q_OS_WINCE QTest::qWait(500); -#else - QTest::qWait(50); -#endif QCOMPARE(timeLine.state(), QTimeLine::Running); qreal value = timeLine.currentValue(); timeLine.setDirection(QTimeLine::Backward); -#ifdef Q_OS_WINCE QTest::qWait(1000); -#else - QTest::qWait(100); -#endif QVERIFY(timeLine.currentValue() < value); timeLine.stop(); } diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 045216a..2d559c8 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -151,16 +151,6 @@ bool macHasAccessToWindowsServer() #undef Bool #endif -// Will try to wait for the condition while allowing event processing -// for a maximum of 2 seconds. -#define WAIT_FOR_CONDITION(expr, expected) \ - do { \ - const int step = 100; \ - for (int i = 0; i < 2000 && expr != expected; i+=step) { \ - QTest::qWait(step); \ - } \ - } while(0) - //TESTED_CLASS= //TESTED_FILES= @@ -1665,13 +1655,11 @@ void tst_QWidget::focusChainOnHide() child->setFocus(); qApp->processEvents(); - WAIT_FOR_CONDITION(child->hasFocus(), true); - QCOMPARE(child->hasFocus(), true); + QTRY_COMPARE(child->hasFocus(), true); child->hide(); qApp->processEvents(); - WAIT_FOR_CONDITION(parent->hasFocus(), true); - QCOMPARE(parent->hasFocus(), true); + QTRY_COMPARE(parent->hasFocus(), true); QCOMPARE(parent, qApp->focusWidget()); delete parent; @@ -9241,7 +9229,8 @@ void tst_QWidget::syntheticEnterLeave() QCOMPARE(grandChild->numLeaveEvents, 0); QCOMPARE(child1->numLeaveEvents, 0); - QCOMPARE(window.numEnterEvents, 1); + // This event arrives asynchronously + QTRY_COMPARE(window.numEnterEvents, 1); QCOMPARE(child2->numEnterEvents, 1); QCOMPARE(grandChild->numEnterEvents, 1); QCOMPARE(child1->numEnterEvents, 0); @@ -9332,7 +9321,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() child.show(); // Make sure the child gets enter event and no mouse move event. - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 0); child.hide(); @@ -9343,7 +9332,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() // Make sure the child gets enter event and mouse move event. // Note that we verify event->button() and event->buttons() // in SELChild::mouseMoveEvent(). - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 1); // Sending synthetic enter/leave trough the parent's mousePressEvent handler. @@ -9354,7 +9343,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() QTest::mouseClick(&parent, Qt::LeftButton); // Make sure the child gets enter event and one mouse move event. - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 1); child.hide(); @@ -9363,7 +9352,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() QTest::mouseClick(&parent, Qt::LeftButton); // Make sure the child gets enter event and no mouse move event. - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 0); } #endif diff --git a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp index 53dc4b5..efe4838 100644 --- a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp +++ b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp @@ -187,12 +187,12 @@ void tst_QWidgetAction::visibilityUpdate() action->setDefaultWidget(combo); tb.addAction(action); - qApp->processEvents(); //the call to show is delayed by the toolbar layout - QVERIFY(combo->isVisible()); + //the call to show is delayed by the toolbar layout + QTRY_VERIFY(combo->isVisible()); QVERIFY(action->isVisible()); action->setVisible(false); - qApp->processEvents(); //the call to hide is delayed by the toolbar layout + //the call to hide is delayed by the toolbar layout QTRY_VERIFY(!combo->isVisible()); delete action; |