diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-07-02 06:36:54 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-07-02 06:36:54 (GMT) |
commit | 06e8acfd94d61b4239ac5d0ca3f71cc15da7367e (patch) | |
tree | 6e76806b34b35a330d6163912528975b9aab37e2 | |
parent | e4e6b49f555eae41fac024c1b733736a28812e2e (diff) | |
parent | 67536369d13be7be270b903f1d4e46e3193b542b (diff) | |
download | Qt-06e8acfd94d61b4239ac5d0ca3f71cc15da7367e.zip Qt-06e8acfd94d61b4239ac5d0ca3f71cc15da7367e.tar.gz Qt-06e8acfd94d61b4239ac5d0ca3f71cc15da7367e.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
37 files changed, 380 insertions, 299 deletions
diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 9c72e95..2c3610c 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -164,7 +164,7 @@ The \c createBlock() function creates a block from the \c Block.qml file and moves the new block to its position on the game canvas. This involves several steps: \list -\o \l {Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml. +\o \l {QML:Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml. If the component is ready, we can call \c createObject() to create an instance of the \c Block item. \o If \c createObject() returned null (i.e. if there was an error while loading the object), print the error information. diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 2c36d12..48eb09f 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -32,169 +32,107 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt Declarative} module. -\table 80% -\header -\o \bold {States} -\o \bold {Animation and Transitions} -\o \bold {Working with Data} -\o \bold {Utility} -\row - -\o -\list -\o \l State -\o \l PropertyChanges -\o \l StateGroup -\o \l StateChangeScript -\o \l ParentChange (Item-specific) -\o \l AnchorChanges (Item-specific) -\endlist - -\o -\list -\o \l PropertyAnimation -\o \l NumberAnimation -\o \l ColorAnimation -\o \l RotationAnimation -\o \l SequentialAnimation -\o \l ParallelAnimation -\o \l PauseAnimation -\o \l ParentAnimation -\o \l AnchorAnimation -\o \l SmoothedAnimation -\o \l Vector3dAnimation -\o \l PropertyAction -\o \l ScriptAction -\o \l Transition -\o \l SmoothedFollow -\o \l SpringFollow -\o \l Behavior -\endlist - -\o -\list -\o \l Binding -\o \l ListModel -\list -\o \l ListElement -\endlist -\o \l VisualItemModel -\o \l VisualDataModel -\o \l Package -\o \l XmlListModel -\list -\o \l XmlRole -\endlist -\endlist - -\o -\list -\o \l Connections -\o \l Component -\o \l Timer -\o \l QtObject -\o \l WorkerScript -\endlist - -\header -\o \bold {Basic Visual Items} -\o \bold {Basic Interaction Items} -\o \bold {Utility} -\o \bold {Transforms} - -\row -\o -\list -\o \l Item -\o \l Rectangle - \list - \o \l Gradient - \list - \o \l GradientStop - \endlist - \endlist -\o \l Image -\o \l BorderImage -\o \l AnimatedImage -\o \l Text -\o \l TextInput - \list - \o \l IntValidator - \o \l DoubleValidator - \o \l RegExpValidator - \endlist -\o \l TextEdit -\endlist - -\o -\list -\o \l MouseArea -\o \l FocusScope -\o \l Flickable -\o \l Flipable -\o \l GestureArea (experimental) -\endlist - -\o -\list -\o \l Loader -\o \l Repeater -\o \l SystemPalette -\o \l FontLoader -\o \l LayoutItem -\endlist - -\o -\list -\o \l Scale -\o \l Rotation -\o \l Translate -\endlist - -\header -\o \bold {Views} -\o \bold {Positioners} -\o \bold {Effects} -\o - -\row -\o - -\target xmlViews -\list -\o \l ListView -\o \l GridView -\o \l PathView - \list - \o \l Path - \list - \o \l PathLine - \o \l PathQuad - \o \l PathCubic - \o \l PathAttribute - \o \l PathPercent - \endlist - \endlist -\o \l WebView -\endlist - -\o -\list -\o \l Column -\o \l Row -\o \l Grid -\o \l Flow -\endlist - -\o -\list -\o \l Particles (experimental) - \list - \o \l ParticleMotionLinear - \o \l ParticleMotionGravity - \o \l ParticleMotionWander - \endlist -\endlist +\table +\header \o {2,1} \bold {Basic Visual Items} +\row \o \l {Item} \o Basic item element inherited by all visual items in QML +\row \o \l {Rectangle} \o Basic visual rectangle element +\row \o \l {Gradient} \o Defines a gradient between two or more colors +\row \o \l {GradientStop} \o Defines a color used in a \l {Gradient} +\row \o \l {Image} \o Allows the use of bitmaps to a scene +\row \o \l {BorderImage} (Item-specific) \o Defines an image as a border +\row \o \l {AnimatedImage} \o For playing animations stored as a series of frames +\row \o \l {Text} \o Allows the use of formatted text in a scene +\row \o \l {TextInput} \o Displays an editable line of text +\row \o \l {IntValidator} \o Validator for integer values +\row \o \l {DoubleValidator} \o Validator for non-integer values +\row \o \l {RegExpValidator} \o Validator for string regular expressions +\row \o \l {TextEdit} \o Displays multiple lines of editable formatted text + +\header \o {2,1} \bold {Basic Interaction Items} +\row \o \l {MouseArea} \o Handles mouse interactions +\row \o \l {FocusScope} \o For keyboard focus handling +\row \o \l {Flickable} \o Provides a surface that can be "flicked" +\row \o \l {Flipable} \o Provides a surface that produces flipping effects +\row \o \l {GestureArea} (experimental) \o Enables simple gesture handling + +\header \o {2,1} \bold {States} +\row \o \l {State} \o Defines sets of configurations of objects and properties +\row \o \l {PropertyChanges} \o Describes property changes within a state +\row \o \l {StateGroup} \o Contains a set of states and state transitions +\row \o \l {StateChangeScript} \o Allows script binding in a state +\row \o \l {ParentChange} (Item-specific) \o Re-parent an Item in a state change +\row \o \l {AnchorChanges} \o Change the anchors of an item in a state + +\header \o {2,1} \bold {Animation and Transitions} +\row \o \l {Behavior} \o Specifies a default animation for property changes +\row \o \l {SequentialAnimation} \o Runs animations sequentially +\row \o \l {ParallelAnimation} \o Runs animations in parallel +\row \o \l {PropertyAnimation} \o Animates property changes +\row \o \l {NumberAnimation} \o Animates properties of type qreal +\row \o \l {Vector3dAnimation} \o Animates properties of type QVector3d +\row \o \l {ColorAnimation} \o Animates color changes +\row \o \l {RotationAnimation} \o Animates rotations +\row \o \l {ParentAnimation} \o Animates parent changes +\row \o \l {AnchorAnimation} \o Animates anchor changes +\row \o \l {PauseAnimation} \o Pauses an animation +\row \o \l {SmoothedAnimation} \o Allows a property to smoothly track a value +\row \o \l {PropertyAction} \o Sets immediate property changes during animation +\row \o \l {ScriptAction} \o Runs scripts during an animation +\row \o \l {Transition} \o Animates transitions during state changes +\row \o \l {SpringFollow} \o Allows a property to follow value changes +\row \o \l {SmoothedFollow} \o Allows animation to smoothly follow value changes + +\header \o {2,1} \bold {Working with Data} +\row \o \l {Binding} \o Binds any value to any property +\row \o \l {ListModel} \o Defines a list of data +\row \o \l {ListElement} \o Defines a data item in a \l {ListModel} +\row \o \l {VisualItemModel} \o Contains items that already defines its own visual delegate +\row \o \l {VisualDataModel} \o Encapsulates a model and a delegate +\row \o \l {Package} \o Collection that enables sharing of items within different views +\row \o \l {XmlListModel} \o Specifies a model using XPath expressions +\row \o \l {XmlRole} \o Specifies a role for an \l {XmlListModel} + +\header \o {2,1} \bold {Views} +\row \o \l {ListView} \o Provides a list visualization of a model +\row \o \l {GridView} \o Provides a grid visualization of a model +\row \o \l {PathView} \o Visualizes a model's contents along a path +\row \o \l {Path} \o Defines a path used by \l {PathView} +\row \o \l {PathLine} \o Defines a line in \l {Path} +\row \o \l {PathQuad} \o Defines a quadratic Bezier curve in a \l {Path} +\row \o \l {PathCubic} \o Defines a cubic Bezier curve in a \l {Path} +\row \o \l {PathAttribute} \o Allows the setting of attributes along a \l {Path} +\row \o \l {PathPercent} \o Modifies the item distribution along a \l {Path} +\row \o \l {WebView} \o Allows the addition of web content to a canvas + +\header \o {2,1} \bold {Positioners} +\row \o \l {Column} \o Arranges its children vertically +\row \o \l {Row} \o Arranges its children horizontally +\row \o \l {Grid} \o Positions its children in a grid +\row \o \l {Flow} \o Positions its children with wrapping support + +\header \o {2,1} \bold {Utility} +\row \o \l {Connections} \o Explicitly connects signals and signal handlers +\row \o \l {Component} \o Encapsulate QML items as a component +\row \o \l {Timer} \o Provides timed triggers +\row \o \l {QtObject} \o Basic element containing only the objectName property +\row \o \l {WorkerScript} \o Enables the use of threads in QML +\row \o \l {Loader} \o Controls the loading of items or components +\row \o \l {Repeater} \o Uses a model to create multiples of components +\row \o \l {SystemPalette} \o Provides access to the Qt palettes +\row \o \l {FontLoader} \o Loads fonts by name or URL +\row \o \l {LayoutItem} \o Allows declarative UI elements inside Qt's Graphics View layouts + +\header \o {2,1} \bold {Transforms} +\row \o \l {Scale} \o Assigns item scaling behaviors +\row \o \l {Rotation} \o Assigns item rotation behaviors +\row \o \l {Translate} \o Assigns item translation behaviors + +\header \o {2,1} \bold {Effects} +\row \o \l {Particles} (experimental) \o Generates and animates particles +\row \o \l {ParticleMotionLinear} \o Adds linear motion behavior to \l {Particles} +\row \o \l {ParticleMotionGravity} \o Adds gravitational motion to \l {Particles} +\row \o \l {ParticleMotionWander} \o Adds varied motions to \l {Particles} \endtable + */ diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 587cdf2..8a24228 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -36,11 +36,18 @@ 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. For example, from your build directory, run: +To run the examples and demos, open them in Qt Creator or use the included +\l {QML Viewer} tool. The \l {QML Viewer} can be run from the command line: \code - bin/qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml + qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml +\endcode + +On Mac OS X, you can run the included "QMLViewer" application from the +Finder, or use the command line: + +\code + QMLViewer.app/Contents/MacOS/QMLViewer $QTDIR/demos/declarative/samegame/samegame.qml \endcode diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc index 0cb3a7d..2cf00b9 100644 --- a/doc/src/declarative/extending-tutorial.qdoc +++ b/doc/src/declarative/extending-tutorial.qdoc @@ -116,9 +116,9 @@ Now we can build and run the application. Try it yourself with the code in Qt's \example declarative/tutorials/extending/chapter1-basics At the moment, the \c app.qml is run from within a C++ application. -This may seem odd if you're used to running QML files with the standard \c qml tool. +This may seem odd if you're used to running QML files with the \l {QML Viewer}. Later on, we'll show how to create a plugin so that you can run \c app.qml using the -\c qml tool instead. +\l {QML Viewer} instead. */ @@ -301,8 +301,8 @@ Try it out with the code in Qt's \c examples/tutorials/extending/chapter4-custom Currently the \c Musician and \c Instrument types are used by \c app.qml, which is displayed using a QDeclarativeView in a C++ application. An alternative way to use our QML extension is to create a plugin library to make it available -to the QML engine. This means we could load \c app.qml using the standard \c qml tool -(or some other QML runtime application) instead of writing a \c main.cpp file and +to the QML engine. This means we could load \c app.qml using the \l {QML Viewer} +(or some other QML \l{Qt Declarative UI Runtime}{runtime} application) instead of writing a \c main.cpp file and loading our own C++ application. To create a plugin library, we need: @@ -337,12 +337,14 @@ of the example project) can be found in the "lib" subdirectory: \quotefile declarative/tutorials/extending/chapter5-plugins/qmldir Now we have a plugin, and instead of having a main.cpp and an executable, we can build -the project and then run the QML file directly using the \c qml tool: +the project and then load the QML file in the \l {QML Viewer}: \code - qml app.qml + qmlviewer app.qml \endcode +(On Mac OS X, you can launch the "QMLViewer" application instead.) + Notice the "import Music 1.0" statement has disappeared from \c app.qml. This is because the \c qmldir file is in the same directory as \c app.qml: this is equivalent to having Musician.qml and Instrument.qml files inside the project directory, which could both diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index cc546c0..0dd5eb3 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -87,7 +87,7 @@ Text { An \l Item requests focus by setting the \c {Item::focus} property to true. For very simple cases simply setting the \c {Item::focus} property is sometimes -sufficient. If we run the following example with the \l {Qt Declarative UI Runtime}{qml} tool, we see that +sufficient. If we run the following example with the \l {QML Viewer}, we see that the \c {keyHandler} element has \e {active focus} and pressing the 'A', 'B' or 'C' keys modifies the text appropriately. diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 36d91ec..a9aee2f 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -35,7 +35,7 @@ Contains all the properties of the JavaScript global object, plus: \section1 Qt Object -The \l{Qt}{Qt object} provides useful enums and functions from Qt, for use in all QML +The \l{QmlGlobalQtObject}{Qt object} provides useful enums and functions from Qt, for use in all QML files. \section1 XMLHttpRequest diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index 02a2f5f..a77c64e 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -72,7 +72,7 @@ The second exception is explained in more detail in the section below on Namespa \section2 The Import Path Installed modules are searched for on the import path. -The \c -I option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the import path. +The \c -I option to the \l {QML Viewer} adds paths to the import path. From C++, the path is available via \l QDeclarativeEngine::importPathList() and can be prepended to using \l QDeclarativeEngine::addImportPath(). @@ -122,7 +122,7 @@ to the module. of the plugin binary, which is platform dependent; e.g. the library MyAppTypes would produce a libMyAppTypes.so on Linux and MyAppTypes.dll on Windows. By default the engine searches for the plugin library in the directory containing the \c qmldir -file. The \c -P option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the +file. The \c -P option to the \l {QML Viewer} adds paths to the plugin search path. From C++, the path is available via \l QDeclarativeEngine::pluginPathList() and can be prepended to using \l QDeclarativeEngine::addPluginPath(). diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc index b0d19e2..60359de 100644 --- a/doc/src/declarative/network.qdoc +++ b/doc/src/declarative/network.qdoc @@ -54,7 +54,7 @@ Network transparency is supported throughout QML, for example: \o WebViews - the \c url property of WebView (obviously!) \endlist -Even QML types themselves can be on the network - if the \l {Qt Declarative UI Runtime}{qml} tool is used to load +Even QML types themselves can be on the network - if the \l {QML Viewer} is used to load \tt http://example.com/mystuff/Hello.qml and that content refers to a type "World", the engine will load \tt http://example.com/mystuff/qmldir and resolve the type just as it would for a local file. For example if the qmldir file contains the line "World World.qml", it will load @@ -119,7 +119,7 @@ All network access from QML is managed by a QNetworkAccessManager set on the QDe By default, this is an unmodified Qt QNetworkAccessManager. You may set a different manager by providing a QDeclarativeNetworkAccessManagerFactory and setting it via QDeclarativeEngine::setNetworkAccessManagerFactory(). -For example, the \l {Qt Declarative UI Runtime}{qml} tool sets a QDeclarativeNetworkAccessManagerFactory which +For example, the \l {QML Viewer} sets a QDeclarativeNetworkAccessManagerFactory which creates QNetworkAccessManager that trusts HTTP Expiry headers to avoid network cache checks, allows HTTP Pipelining, adds a persistent HTTP CookieJar, a simple disk cache, and supports proxy settings. diff --git a/doc/src/declarative/qdeclarativedebugging.qdoc b/doc/src/declarative/qdeclarativedebugging.qdoc index da6e407..ea21852 100644 --- a/doc/src/declarative/qdeclarativedebugging.qdoc +++ b/doc/src/declarative/qdeclarativedebugging.qdoc @@ -47,7 +47,7 @@ Rectangle { When a transition doesn't look quite right, it can be helpful to view it in slow motion to see what is happening more clearly. This functionality is supported -in the \l {Qt Declarative UI Runtime}{qmlviewer} tool: to enable this, +in the \l {QML Viewer} tool: to enable this, click on the "Debugging" menu, then "Slow Down Animations". @@ -64,7 +64,7 @@ import Qt 4.7 Rectangle { width: 100; height: 100 } \endqml -If you set \c {QML_IMPORT_TRACE=1} before running the \l {Qt Declarative UI Runtime}{qmlviewer} +If you set \c {QML_IMPORT_TRACE=1} before running the \l {QML Viewer} (or your QML C++ application), you will see output similar to this: \code @@ -85,11 +85,11 @@ show QML debugging information and options for your application, including object inspection, property monitoring and application frame-rate analysis. Creator can be used to debug both local and remote QML applications. To -enable remote debugging, start the \l {Qt Declarative UI Runtime}{qml} tool +enable remote debugging, start the \l {QML Viewer} on the remote device with a debugging port defined, like this: \code - QML_DEBUG_SERVER_PORT=3768 qml myqmlfile.qml + QML_DEBUG_SERVER_PORT=3768 qmlviewer myqmlfile.qml \endcode In Creator, open the project settings pane and set the server and port diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc index 40f7919..b6e6c6e 100644 --- a/doc/src/declarative/qdeclarativei18n.qdoc +++ b/doc/src/declarative/qdeclarativei18n.qdoc @@ -49,7 +49,7 @@ capabilities are described more fully in: \o \l {Qt Linguist Manual} \endlist -You can test a translation with the \l {Qt Declarative UI Runtime}{qml} tool using the -translation option. +You can test a translation with the \l {QML Viewer} using the -translation option. \section1 Example @@ -61,8 +61,8 @@ hello.qml: import Qt 4.7 Rectangle { - width: 200; height: 200 - Text { text: qsTr("Hello"); anchors.centerIn: parent } + width: 200; height: 200 + Text { text: qsTr("Hello"); anchors.centerIn: parent } } \endqml @@ -76,7 +76,7 @@ a translation and create the release file \c hello.qm. Finally, we can test the translation: \code -qml -translation hello.qm hello.qml +qmlviewer -translation hello.qm hello.qml \endcode diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc index ac79496..21ce2dd 100644 --- a/doc/src/declarative/qml-intro.qdoc +++ b/doc/src/declarative/qml-intro.qdoc @@ -105,9 +105,17 @@ This is a valid QML script. To run it, copy it and save it to a file, say myexample.qml, and on the command line run the command \code - qml myexample.qml + qmlviewer myexample.qml \endcode +On Mac OS X, open the "QMLViewer" application instead and open the +\c myexample.qml file, or run it from the command line: + + \code + QMLViewer.app/Contents/MacOS/QMLViewer myexample.qml + \endcode + + It will create a very boring rectangle in its own window. diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc index efff9cc..5efc0ce 100644 --- a/doc/src/declarative/qmlviewer.qdoc +++ b/doc/src/declarative/qmlviewer.qdoc @@ -42,7 +42,7 @@ deployment of QML applications. In those cases, the QML runtime should be invoke from a Qt application instead; see \l {Qt Declarative UI Runtime} for more information. -The viewer is located at QTDIR/bin/qmlviewer. To load a \c .qml file +The viewer is located at \c QTDIR/bin/qmlviewer. To load a \c .qml file with the viewer, run the viewer and select the file to be opened, or provide the file path on the command line: @@ -50,7 +50,7 @@ file path on the command line: qmlviewer myqmlfile.qml \endcode -On Mac OS X, the QML Viewer application is named \c QMLViewer.app instead. You +On Mac OS X, the QML Viewer application is named "QMLViewer" instead. You can launch the viewer by opening the QMLViewer application from the Finder, or from the command line: diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc index c884486..7a97eb1 100644 --- a/doc/src/declarative/tutorial.qdoc +++ b/doc/src/declarative/tutorial.qdoc @@ -101,11 +101,11 @@ The \c font.pointSize and \c font.bold properties are related to fonts and use t \section2 Viewing the example -To view what you have created, run the \l{Qt Declarative UI Runtime}{qml} tool (located in the \c bin directory) with your filename as the first argument. +To view what you have created, run the \l{QML Viewer} tool (located in the \c bin directory) with your filename as the first argument. For example, to run the provided completed Tutorial 1 example from the install location, you would type: \code -bin/qml $QTDIR/examples/declarative/tutorials/helloworld/tutorial1.qml +bin/qmlviewer $QTDIR/examples/declarative/tutorials/helloworld/tutorial1.qml \endcode */ diff --git a/doc/src/examples/qml-webbrowser.qdoc b/doc/src/examples/qml-webbrowser.qdoc index da6f600..d322b02 100644 --- a/doc/src/examples/qml-webbrowser.qdoc +++ b/doc/src/examples/qml-webbrowser.qdoc @@ -40,7 +40,7 @@ ****************************************************************************/ /*! - \title Web Browser + \title QML Web Browser \example demos/declarative/webbrowser This demo shows how to write a simple web browser in QML by combining the diff --git a/doc/src/template/images/bullet_up.png b/doc/src/template/images/bullet_up.png Binary files differindex 285e741..7de2f06 100644 --- a/doc/src/template/images/bullet_up.png +++ b/doc/src/template/images/bullet_up.png diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 78a21f6..f1a63a9 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -490,11 +490,20 @@ } .wrap .content h2 { - font: 600 16px/1.2 Arial; + + border-bottom:1px solid #DDDDDD; + font:600 16px/1.2 Arial; + margin-top:15px; + width:100%; + } .wrap .content h3 { font: 600 14px/1.2 Arial; + /*border-bottom:1px solid #DDDDDD;*/ + font:600 16px/1.2 Arial; + margin-top:15px; + width:100%; } .wrap .content p { @@ -755,7 +764,7 @@ font-size: 11px; /*min-width: 395px;*/ margin-bottom: 25px; - display: inline-block; + /* display: inline-block;*/ } thead { @@ -1219,7 +1228,15 @@ pre.highlightedCode { list-style-type:decimal; } - + .navTop{ + float:right; + padding-right:5px; + padding-top:15px; + } + + .wrap .content .toc h3{ + border-bottom:none; + } /* end of screen media */ /* start of print media */ diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 9a17d78..352c3df 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -2144,7 +2144,7 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const \property QDeclarativeItem::baselineOffset \brief The position of the item's baseline in local coordinates. - The baseline of a Text item is the imaginary line on which the text + The baseline of a \l Text item is the imaginary line on which the text sits. Controls containing text usually set their baseline to the baseline of their text. diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index c8c9e44..e745ca6 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -119,7 +119,7 @@ void QDeclarativeLoaderPrivate::initResize() property, or loaded from a URL via the \l source property. Loader can be used to delay the creation of a component until it is required. - For example, this loads "Page1.qml" as a component into the \l Loader element + For example, this loads "Page1.qml" as a component into the Loader element when the \l MouseArea is clicked: \code diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index c6566ff..c066f11 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -203,7 +203,7 @@ QString QDeclarativeTextEdit::text() const Sets the font size in pixels. Using this function makes the font device dependent. - Use \l pointSize to set the size of the font in a device independent manner. + Use \l font.pointSize to set the size of the font in a device independent manner. */ /*! diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index ed999a2..374f371 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -100,8 +100,6 @@ void QDeclarativeTextInput::setText(const QString &s) if(s == text()) return; d->control->setText(s); - d->updateHorizontalScroll(); - //emit textChanged(); } /*! @@ -550,9 +548,9 @@ void QDeclarativeTextInput::setAutoScroll(bool b) return; d->autoScroll = b; - d->updateHorizontalScroll(); //We need to repaint so that the scrolling is taking into account. updateSize(true); + d->updateHorizontalScroll(); emit autoScrollChanged(d->autoScroll); } @@ -1020,27 +1018,43 @@ bool QDeclarativeTextInput::event(QEvent* ev) void QDeclarativeTextInput::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - if (newGeometry.width() != oldGeometry.width()) + Q_D(QDeclarativeTextInput); + if (newGeometry.width() != oldGeometry.width()) { updateSize(); + d->updateHorizontalScroll(); + } QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry); } +int QDeclarativeTextInputPrivate::calculateTextWidth() +{ + int cursorWidth = control->cursorWidth(); + if(cursorItem) + cursorWidth = cursorItem->width(); + + QFontMetrics fm = QFontMetrics(font); + int leftBearing = 0; + int rightBearing = 0; + if (!control->text().isEmpty()) { + leftBearing = qMax(0, -fm.leftBearing(control->text().at(0))); + rightBearing = qMax(0, -fm.rightBearing(control->text().at(control->text().count()-1))); + } + + return qRound(control->naturalTextWidth()) + qMax(cursorWidth, leftBearing) + rightBearing; +} + void QDeclarativeTextInputPrivate::updateHorizontalScroll() { Q_Q(QDeclarativeTextInput); - QFontMetrics fm = QFontMetrics(font); int cix = qRound(control->cursorToX()); QRect br(q->boundingRect().toRect()); - //###Is this using bearing appropriately? - int minLB = qMax(0, -fm.minLeftBearing()); - int minRB = qMax(0, -fm.minRightBearing()); - int widthUsed = qRound(control->naturalTextWidth()) + 1 + minRB; + int widthUsed = calculateTextWidth(); if (autoScroll) { - if ((minLB + widthUsed) <= br.width()) { + if (widthUsed <= br.width()) { // text fits in br; use hscroll for alignment switch (hAlign & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { case Qt::AlignRight: - hscroll = widthUsed - br.width() + 1; + hscroll = widthUsed - br.width() - 1; break; case Qt::AlignHCenter: hscroll = (widthUsed - br.width()) / 2; @@ -1050,7 +1064,6 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll() hscroll = 0; break; } - hscroll -= minLB; } else if (cix - hscroll >= br.width()) { // text doesn't fit, cursor is to the right of br (scroll right) hscroll = cix - br.width() + 1; @@ -1070,7 +1083,6 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll() } else { hscroll = 0; } - hscroll -= minLB; } } @@ -1095,7 +1107,6 @@ void QDeclarativeTextInput::drawContents(QPainter *p, const QRect &r) offset = QPoint(d->hscroll, 0); } d->control->draw(p, offset, r, flags); - p->restore(); } @@ -1448,8 +1459,8 @@ void QDeclarativeTextInput::selectionChanged() void QDeclarativeTextInput::q_textChanged() { Q_D(QDeclarativeTextInput); - d->updateHorizontalScroll(); updateSize(); + d->updateHorizontalScroll(); updateMicroFocus(); emit textChanged(); emit displayTextChanged(); @@ -1475,10 +1486,7 @@ void QDeclarativeTextInput::updateSize(bool needsRedraw) int w = width(); int h = height(); setImplicitHeight(d->control->height()); - int cursorWidth = d->control->cursorWidth(); - if(d->cursorItem) - cursorWidth = d->cursorItem->width(); - setImplicitWidth(d->control->naturalTextWidth() + cursorWidth); + setImplicitWidth(d->calculateTextWidth()); setContentsSize(QSize(width(), height()));//Repaints if changed if(w==width() && h==height() && needsRedraw){ clearCache(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h index 8b74bcc..4ac5134 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h @@ -100,6 +100,7 @@ public: void startCreatingCursor(); void focusChanged(bool hasFocus); void updateHorizontalScroll(); + int calculateTextWidth(); QLineControl* control; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 8b15ae9..8bf7450 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -151,6 +151,7 @@ void QDeclarativeEnginePrivate::defineModule() } /*! +\keyword QmlGlobalQtObject \qmlclass Qt QDeclarativeEnginePrivate \brief The QML global Qt object provides useful enums and functions from Qt. @@ -1077,7 +1078,7 @@ If you are certain the files will be local, you could simplify to: \snippet doc/src/snippets/declarative/componentCreation.js 2 To create a QML object from an arbitrary string of QML (instead of a file), -use \l{Qt::createQmlObject()}{Qt.createQmlObject()}. +use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}. */ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QScriptEngine *engine) @@ -1124,7 +1125,7 @@ Each object in this array has the members \c lineNumber, \c columnNumber, \c fil Note that this function returns immediately, and therefore may not work if the \a qml string loads new components (that is, external QML files that have not yet been loaded). -If this is the case, consider using \l{Qt::createComponent()}{Qt.createComponent()} instead. +If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createComponent()} instead. */ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine) @@ -1728,8 +1729,7 @@ void QDeclarativeEnginePrivate::warning(QDeclarativeEnginePrivate *engine, const /*! \qmlmethod Qt::quit() This function causes the QDeclarativeEngine::quit() signal to be emitted. -Within the \l {Qt Declarative UI Runtime}{qml} application this causes the -launcher application to exit. +Within the \l {QML Viewer}, this causes the launcher application to exit. */ QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptEngine *e) diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 0414e65..12a8d3a 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -611,7 +611,7 @@ void QDeclarativeView::timerEvent(QTimerEvent* e) } } -/*! \reimp */ +/*! \internal */ bool QDeclarativeView::eventFilter(QObject *watched, QEvent *e) { Q_D(QDeclarativeView); diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 0692aaa..5583007 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -589,7 +589,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla with a combined value of all key roles that is not already present in the model. - \sa {declarative/rssnews}{RSS News demo} + \sa {demos/declarative/rssnews}{RSS News demo} */ QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent) diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp index e5647bd..243ba0f 100644 --- a/src/imports/gestures/qdeclarativegesturearea.cpp +++ b/src/imports/gestures/qdeclarativegesturearea.cpp @@ -130,7 +130,7 @@ public: GestureArea is an invisible item: it is never painted. - \sa Gesture, MouseArea, {declarative/touchinteraction/gestures}{Gestures example} + \sa MouseArea, {declarative/touchinteraction/gestures}{Gestures example} */ /*! diff --git a/tests/auto/declarative/qdeclarativetext/data/alignments.qml b/tests/auto/declarative/qdeclarativetext/data/alignments.qml index b1f701b..762e2b6 100644 --- a/tests/auto/declarative/qdeclarativetext/data/alignments.qml +++ b/tests/auto/declarative/qdeclarativetext/data/alignments.qml @@ -20,9 +20,9 @@ Rectangle { id: t anchors.fill: parent - horizontalAlignment: TextEdit.AlignRight - verticalAlignment: TextEdit.AlignBottom - wrapMode: TextEdit.WordWrap + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignBottom + wrapMode: Text.WordWrap text: top.txt } Timer { diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 8a4f152..80198eb 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -48,6 +48,7 @@ #include <QGraphicsSceneMouseEvent> #include <qmath.h> #include <QDeclarativeView> +#include <private/qapplication_p.h> #include "../../../shared/util.h" #include "testhttpserver.h" @@ -452,7 +453,9 @@ void tst_qdeclarativetext::alignments() #ifdef Q_WS_X11 // Font-specific, but not likely platform-specific, so only test on one platform - QCOMPARE(actual,expect); + if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") { + QCOMPARE(actual,expect); + } #endif } diff --git a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml index b1f701b..9281a06 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/alignments.qml @@ -16,7 +16,7 @@ Rectangle { height: 40 color: "green" - Text { + TextEdit { id: t anchors.fill: parent diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index f1a367f..fc329c8 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -55,6 +55,7 @@ #include <QDeclarativeView> #include <QStyle> #include <QInputContext> +#include <private/qapplication_p.h> #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -353,7 +354,9 @@ void tst_qdeclarativetextedit::alignments() #ifdef Q_WS_X11 // Font-specific, but not likely platform-specific, so only test on one platform - QCOMPARE(actual,expect); + if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") { + QCOMPARE(actual,expect); + } #endif } diff --git a/tests/auto/declarative/qdeclarativetextinput/data/halign_center.png b/tests/auto/declarative/qdeclarativetextinput/data/halign_center.png Binary files differnew file mode 100644 index 0000000..53e09a8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextinput/data/halign_center.png diff --git a/tests/auto/declarative/qdeclarativetextinput/data/halign_left.png b/tests/auto/declarative/qdeclarativetextinput/data/halign_left.png Binary files differnew file mode 100644 index 0000000..247acbc --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextinput/data/halign_left.png diff --git a/tests/auto/declarative/qdeclarativetextinput/data/halign_right.png b/tests/auto/declarative/qdeclarativetextinput/data/halign_right.png Binary files differnew file mode 100644 index 0000000..691bc75 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextinput/data/halign_right.png diff --git a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml new file mode 100644 index 0000000..b97f18e --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment.qml @@ -0,0 +1,22 @@ +import Qt 4.7 + +Rectangle { + id: top + width: 70; height: 70; + + property alias horizontalAlignment: text.horizontalAlignment + property string text: "Test" + + Rectangle { + anchors.centerIn: parent + width: 60 + height: 20 + color: "green" + + TextInput { + id: text + anchors.fill: parent + text: top.text + } + } +} diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index a55b42e..a21630b 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -49,6 +49,7 @@ #include <QDebug> #include <QStyle> #include <QInputContext> +#include <private/qapplication_p.h> #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -63,12 +64,16 @@ public: tst_qdeclarativetextinput(); private slots: + void text(); void width(); void font(); void color(); void selection(); + void horizontalAlignment_data(); + void horizontalAlignment(); + void positionAt(); void maxLength(); @@ -153,7 +158,7 @@ void tst_qdeclarativetextinput::width() QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->width(), 1.);//1 for the cursor + QCOMPARE(textinputObject->width(), 1.); // 1 for the cursor delete textinputObject; } @@ -370,6 +375,52 @@ void tst_qdeclarativetextinput::selection() delete textinputObject; } +void tst_qdeclarativetextinput::horizontalAlignment_data() +{ + QTest::addColumn<int>("hAlign"); + QTest::addColumn<QString>("expectfile"); + + QTest::newRow("L") << int(Qt::AlignLeft) << SRCDIR "/data/halign_left.png"; + QTest::newRow("R") << int(Qt::AlignRight) << SRCDIR "/data/halign_right.png"; + QTest::newRow("C") << int(Qt::AlignHCenter) << SRCDIR "/data/halign_center.png"; +} + +void tst_qdeclarativetextinput::horizontalAlignment() +{ + QFETCH(int, hAlign); + QFETCH(QString, expectfile); + +#ifdef Q_WS_X11 + // Font-specific, but not likely platform-specific, so only test on one platform + QFont fn; + fn.setRawName("-misc-fixed-medium-r-*-*-8-*-*-*-*-*-*-*"); + QApplication::setFont(fn); +#endif + + QDeclarativeView *canvas = createView(SRCDIR "/data/horizontalAlignment.qml"); + + canvas->show(); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas)); + QObject *ob = canvas->rootObject(); + QVERIFY(ob != 0); + ob->setProperty("horizontalAlignment",hAlign); + QImage actual(canvas->width(), canvas->height(), QImage::Format_RGB32); + actual.fill(qRgb(255,255,255)); + QPainter p(&actual); + canvas->render(&p); + + QImage expect(expectfile); + +#ifdef Q_WS_X11 + // Font-specific, but not likely platform-specific, so only test on one platform + if (QApplicationPrivate::graphics_system_name == "raster" || QApplicationPrivate::graphics_system_name == "") { + QCOMPARE(actual,expect); + } +#endif +} + void tst_qdeclarativetextinput::positionAt() { QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml"); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 044c458..9f745c5 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -443,7 +443,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, { int skipAhead = 0; static bool in_para = false; - + switch (atom->type()) { case Atom::AbstractLeft: break; @@ -1066,11 +1066,11 @@ int HtmlGenerator::generateAtom(const Atom *atom, } sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); } - out() << "<a name=\"sec-" << sectionNumber.join("-") << "\"></a>\n"; + out() << "<a name=\"sec-" << sectionNumber.join("-") << "\"></a><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; } #else out() << "<a name=\"" << Doc::canonicalTitle(Text::sectionHeading(atom).toString()) - << "\"></a>\n"; + << "\"></a><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; #endif break; case Atom::SectionRight: @@ -1339,19 +1339,19 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, } else { if (!s->members.isEmpty()) { - out() << "<hr />\n"; + // out() << "<hr />\n"; out() << "<a name=\"" << registerRef((*s).name.toLower()) - << "\"></a>\n"; + << "\"></a><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; generateSection(s->members, inner, marker, CodeMarker::Summary); } if (!s->reimpMembers.isEmpty()) { QString name = QString("Reimplemented ") + (*s).name; - out() << "<hr />\n"; + // out() << "<hr />\n"; out() << "<a name=\"" << registerRef(name.toLower()) - << "\"></a>\n"; + << "\"></a><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; out() << "<h2>" << protectEnc(name) << "</h2>\n"; generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); } @@ -1378,11 +1378,11 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, out() << "</ul>\n"; } - out() << "<a name=\"" << registerRef("details") << "\"></a>\n"; + out() << "<a name=\"" << registerRef("details") << "\"></a><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; if (!inner->doc().isEmpty()) { - out() << "<hr />\n" - << "<div class=\"descr\"/>\n" // QTBUG-9504 + //out() << "<hr />\n" + out() << "<div class=\"descr\"/>\n" // QTBUG-9504 << "<h2>" << "Detailed Description" << "</h2>\n"; generateBody(inner, marker); out() << "</div>\n"; // QTBUG-9504 @@ -1392,7 +1392,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { - out() << "<hr />\n"; + //out() << "<hr />\n"; if (!(*s).divClass.isEmpty()) out() << "<div class=\"" << (*s).divClass << "\"/>\n"; // QTBUG-9504 out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; @@ -1518,12 +1518,12 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateStatus(fake, marker); if (moduleNamespaceMap.contains(fake->name())) { - out() << "<a name=\"" << registerRef("namespaces") << "\"></a>\n"; + out() << "<a name=\"" << registerRef("namespaces") << "\"></a><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; out() << "<h2>Namespaces</h2>\n"; generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); } if (moduleClassMap.contains(fake->name())) { - out() << "<a name=\"" << registerRef("classes") << "\"></a>\n"; + out() << "<a name=\"" << registerRef("classes") << "\"></a><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; out() << "<h2>Classes</h2>\n"; generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); } @@ -1586,19 +1586,19 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) sections = marker->qmlSections(qml_cn,CodeMarker::Summary); s = sections.begin(); while (s != sections.end()) { - out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n"; + out() << "<a name=\"" << registerRef((*s).name) << "\"></a><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; generateQmlSummary(*s,fake,marker); ++s; } - out() << "<a name=\"" << registerRef("details") << "\"></a>\n"; + out() << "<a name=\"" << registerRef("details") << "\"></a><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; out() << "<h2>" << "Detailed Description" << "</h2>\n"; generateBody(fake, marker); if (cn) generateQmlText(cn->doc().body(), cn, marker, fake->name()); generateAlsoList(fake, marker); - out() << "<hr />\n"; + //out() << "<hr />\n"; sections = marker->qmlSections(qml_cn,CodeMarker::Detailed); s = sections.begin(); @@ -1622,7 +1622,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { - out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n"; + out() << "<a name=\"" << registerRef((*s).name) << "\"></a><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; generateSectionList(*s, fake, marker, CodeMarker::Summary); ++s; @@ -1630,7 +1630,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) Text brief = fake->doc().briefText(); if (fake->subType() == Node::Module && !brief.isEmpty()) { - out() << "<a name=\"" << registerRef("details") << "\"></a>\n"; + out() << "<a name=\"" << registerRef("details") << "\"></a><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; out() << "<div class=\"descr\"/>\n"; // QTBUG-9504 out() << "<h2>" << "Detailed Description" << "</h2>\n"; } @@ -1655,7 +1655,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { - out() << "<hr />\n"; + //out() << "<hr />\n"; out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; NodeList::ConstIterator m = (*s).members.begin(); @@ -1801,9 +1801,10 @@ void HtmlGenerator::generateHeader(const QString& title, if (offlineDocs) { - out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/OfflineStyle.css\" />"; + out() << " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />"; out() << "</head>\n"; out() << "<body class=\"offline narrow\" >\n"; // narrow mainly for Creator + out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n"; } else { @@ -2039,7 +2040,7 @@ void HtmlGenerator::generateTableOfContents(const Node *node, inLink = true; out() << "<div class=\"toc\">\n"; - out() << "<h3>Contents</h3>\n"; + out() << "<h3><a name=\"toc\">Contents</a></h3>\n"; sectionNumber.append("1"); out() << "<ul>\n"; @@ -2252,7 +2253,7 @@ QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, sections = marker->sections(inner, CodeMarker::Detailed, status); for (i = 0; i < sections.size(); ++i) { - out() << "<hr />\n"; + //out() << "<hr />\n"; out() << "<h2>" << protectEnc(sections.at(i).name) << "</h2>\n"; NodeList::ConstIterator m = sections.at(i).members.begin(); @@ -2621,7 +2622,7 @@ void HtmlGenerator::generateLegaleseList(const Node *relative, QMap<Text, const Node *>::ConstIterator it = legaleseTexts.begin(); while (it != legaleseTexts.end()) { Text text = it.key(); - out() << "<hr />\n"; + //out() << "<hr />\n"; generateText(text, relative, marker); out() << "<ul>\n"; do { @@ -3828,7 +3829,7 @@ void HtmlGenerator::generateDetailedMember(const Node *node, out() << "<h3 class=\"fn\">"; out() << "<a name=\"" + refForNode(node) + "\"></a>"; generateSynopsis(node, relative, marker, CodeMarker::Detailed); - out() << "</h3>\n"; + out() << "</h3><div class=\"navTop\"><a href=\"#toc\"><img src=\"./images/bullet_up.png\"></a></div>\n"; } generateStatus(node, marker); diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 7ad78bd..e888bc4 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -49,6 +49,7 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <li><a href=\"declarativeui.html\">Device UI's & Qt Quick</a></li> \n" \ " <li><a href=\"qt-gui-concepts.html\">Desktop UI components</a></li> \n" \ " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \ + " <li><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \ " </ul> \n" \ " </li> \n" \ " <li><a href=\"#\">Examples</a> \n" \ @@ -57,7 +58,6 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \ " <li><a href=\"demos.html\">Demos</a></li> \n" \ " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \ - " <li><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li> \n" \ " </ul> \n" \ " </li> \n" \ " </ul> \n" \ diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index debc902..03ca798 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -431,65 +431,82 @@ private: mutable QMutex mutex; }; -class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory +class SystemProxyFactory : public QNetworkProxyFactory { public: - NetworkAccessManagerFactory() : cacheSize(0) {} - ~NetworkAccessManagerFactory() {} - - QNetworkAccessManager *create(QObject *parent); + SystemProxyFactory() : proxyDirty(true), httpProxyInUse(false) { + } - void setupProxy(QNetworkAccessManager *nam) + virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) { - class SystemProxyFactory : public QNetworkProxyFactory - { - public: - virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query) - { - QString protocolTag = query.protocolTag(); - if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) { - QList<QNetworkProxy> ret; - ret << httpProxy; - return ret; - } + if (proxyDirty) + setupProxy(); + QString protocolTag = query.protocolTag(); + if (httpProxyInUse && (protocolTag == "http" || protocolTag == "https")) { + QList<QNetworkProxy> ret; + ret << httpProxy; + return ret; + } #ifdef Q_OS_WIN - // systemProxyForQuery can take insanely long on Windows (QTBUG-10106) - return QNetworkProxyFactory::proxyForQuery(query); + // systemProxyForQuery can take insanely long on Windows (QTBUG-10106) + return QNetworkProxyFactory::proxyForQuery(query); #else - return QNetworkProxyFactory::systemProxyForQuery(query); + return QNetworkProxyFactory::systemProxyForQuery(query); #endif - } - void setHttpProxy (QNetworkProxy proxy) - { - httpProxy = proxy; - httpProxyInUse = true; - } - void unsetHttpProxy () - { - httpProxyInUse = false; - } - private: - bool httpProxyInUse; - QNetworkProxy httpProxy; - }; - - SystemProxyFactory *proxyFactory = new SystemProxyFactory; - if (ProxySettings::httpProxyInUse()) - proxyFactory->setHttpProxy(ProxySettings::httpProxy()); - else - proxyFactory->unsetHttpProxy(); - nam->setProxyFactory(proxyFactory); } + void setupProxy() { + // Don't bother locking because we know that the proxy only + // changes in response to the settings dialog and that + // the view will be reloaded. + proxyDirty = false; + httpProxyInUse = ProxySettings::httpProxyInUse(); + if (httpProxyInUse) + httpProxy = ProxySettings::httpProxy(); + } + + void proxyChanged() { + proxyDirty = true; + } + +private: + volatile bool proxyDirty; + bool httpProxyInUse; + QNetworkProxy httpProxy; +}; + +class NetworkAccessManagerFactory : public QObject, public QDeclarativeNetworkAccessManagerFactory +{ + Q_OBJECT +public: + NetworkAccessManagerFactory() : cacheSize(0) {} + ~NetworkAccessManagerFactory() {} + + QNetworkAccessManager *create(QObject *parent); + void setCacheSize(int size) { if (size != cacheSize) { cacheSize = size; } } + void proxyChanged() { + foreach (QNetworkAccessManager *nam, namList) { + static_cast<SystemProxyFactory*>(nam->proxyFactory())->proxyChanged(); + } + } + static PersistentCookieJar *cookieJar; + +private slots: + void managerDestroyed(QObject *obj) { + namList.removeOne(static_cast<QNetworkAccessManager*>(obj)); + } + +private: QMutex mutex; int cacheSize; + QList<QNetworkAccessManager*> namList; }; PersistentCookieJar *NetworkAccessManagerFactory::cookieJar = 0; @@ -510,7 +527,7 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) } manager->setCookieJar(cookieJar); cookieJar->setParent(0); - setupProxy(manager); + manager->setProxyFactory(new SystemProxyFactory); if (cacheSize > 0) { QNetworkDiskCache *cache = new QNetworkDiskCache; cache->setCacheDirectory(QDir::tempPath()+QLatin1String("/qml-viewer-network-cache")); @@ -519,6 +536,8 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) } else { manager->setCache(0); } + connect(manager, SIGNAL(destroyed(QObject*)), this, SLOT(managerDestroyed(QObject*))); + namList.append(manager); qDebug() << "created new network access manager for" << parent; return manager; } @@ -777,6 +796,7 @@ void QDeclarativeViewer::showProxySettings() void QDeclarativeViewer::proxySettingsChanged() { + namFactory->proxyChanged(); reload (); } |