diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-04-28 23:35:12 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-04-28 23:35:12 (GMT) |
commit | c1b26cc7fc4e23e887758f7907d115851291880d (patch) | |
tree | 75c4fac685f59b684b415f944e2aaf3c51d790e1 | |
parent | 06e14437a7bb1c194d82d97a6e7859ebf7c06226 (diff) | |
parent | f8f87a70993eaed6de9bd7c614663282e8d80e46 (diff) | |
download | Qt-c1b26cc7fc4e23e887758f7907d115851291880d.zip Qt-c1b26cc7fc4e23e887758f7907d115851291880d.tar.gz Qt-c1b26cc7fc4e23e887758f7907d115851291880d.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
84 files changed, 2067 insertions, 758 deletions
diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc index 0051f09..1c07f8e 100644 --- a/doc/src/declarative/integrating.qdoc +++ b/doc/src/declarative/integrating.qdoc @@ -118,34 +118,34 @@ Here is an example. Suppose you have two classes, \c RedSquare and \c BlueCircle that both inherit from QGraphicsWidget: \c [graphicswidgets/redsquare.h] -\snippet doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h 0 +\snippet doc/src/snippets/declarative/graphicswidgets/redsquare.h 0 \c [graphicswidgets/bluecircle.h] -\snippet doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h 0 +\snippet doc/src/snippets/declarative/graphicswidgets/bluecircle.h 0 Then, create a plugin by subclassing QDeclarativeExtensionPlugin, and register the types by calling qmlRegisterType(). Also export the plugin with Q_EXPORT_PLUGIN2. \c [graphicswidgets/shapesplugin.cpp] -\snippet doc/src/declarative/snippets/integrating/graphicswidgets/shapesplugin.cpp 0 +\snippet doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp 0 Now write a project file that creates the plugin: \c [graphicswidgets/graphicswidgets.pro] -\quotefile doc/src/declarative/snippets/integrating/graphicswidgets/graphicswidgets.pro +\quotefile doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro And add a \c qmldir file that includes the \c graphicswidgets plugin from the \c lib subdirectory (as defined in the project file): \c [graphicswidgets/qmldir] -\quotefile doc/src/declarative/snippets/integrating/graphicswidgets/qmldir +\quotefile doc/src/snippets/declarative/graphicswidgets/qmldir Now, we can write a QML file that uses the \c RedSquare and \c BlueCircle widgets. (As an example, we can also create \c QGraphicsWidget items if we import the \c Qt.widgets module.) \c [main.qml] -\quotefile doc/src/declarative/snippets/integrating/graphicswidgets/main.qml +\quotefile doc/src/snippets/declarative/graphicswidgets/main.qml Here is a screenshot of the result: diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index d024ff2..7d696d7 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -97,17 +97,17 @@ The following example shows how to expose a background color to a QML file throu \row \o \c {// main.cpp} -\snippet doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp 0 +\snippet doc/src/snippets/declarative/qtbinding/contextproperties/main.cpp 0 \o \c {// main.qml} -\snippet doc/src/declarative/snippets/qtbinding/contextproperties/main.qml 0 +\snippet doc/src/snippets/declarative/qtbinding/contextproperties/main.qml 0 \endtable Or, if you want \c main.cpp to create the component without showing it in a QDeclarativeView, you could create an instance of QDeclarativeContext using QDeclarativeEngine::rootContext() instead: -\snippet doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp 1 +\snippet doc/src/snippets/declarative/qtbinding/contextproperties/main.cpp 1 Context properties work just like normal properties in QML bindings - if the \c backgroundColor context property in this example was changed to red, the component object instances would @@ -135,15 +135,15 @@ allow QML to set values. The following example creates a \c CustomPalette object, and sets it as the \c palette context property. -\snippet doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h 0 +\snippet doc/src/snippets/declarative/qtbinding/custompalette/custompalette.h 0 -\snippet doc/src/declarative/snippets/qtbinding/custompalette/main.cpp 0 +\snippet doc/src/snippets/declarative/qtbinding/custompalette/main.cpp 0 The QML that follows references the palette object, and its properties, to set the appropriate background and text colors. When the window is clicked, the palette's text color is changed, and the window text will update accordingly. -\snippet doc/src/declarative/snippets/qtbinding/custompalette/main.qml 0 +\snippet doc/src/snippets/declarative/qtbinding/custompalette/main.qml 0 To detect when a C++ property value - in this case the \c CustomPalette's \c text property - changes, the property must have a corresponding NOTIFY signal. The NOTIFY signal specifies a signal @@ -185,12 +185,12 @@ This example toggles the "Stopwatch" object on/off when the MouseArea is clicked \row \o \c {// main.cpp} -\snippet doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h 0 -\snippet doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp 0 +\snippet doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.h 0 +\snippet doc/src/snippets/declarative/qtbinding/stopwatch/main.cpp 0 \o \c {// main.qml} -\snippet doc/src/declarative/snippets/qtbinding/stopwatch/main.qml 0 +\snippet doc/src/snippets/declarative/qtbinding/stopwatch/main.qml 0 \endtable @@ -258,16 +258,16 @@ QML content can be loaded from \l {The Qt Resource System} using the \e qrc: URL For example: \c [project/example.qrc] -\quotefile doc/src/declarative/snippets/qtbinding/resources/example.qrc +\quotefile doc/src/snippets/declarative/qtbinding/resources/example.qrc \c [project/project.pro] -\quotefile doc/src/declarative/snippets/qtbinding/resources/resources.pro +\quotefile doc/src/snippets/declarative/qtbinding/resources/resources.pro \c [project/main.cpp] -\snippet doc/src/declarative/snippets/qtbinding/resources/main.cpp 0 +\snippet doc/src/snippets/declarative/qtbinding/resources/main.cpp 0 \c [project/main.qml] -\snippet doc/src/declarative/snippets/qtbinding/resources/main.qml 0 +\snippet doc/src/snippets/declarative/qtbinding/resources/main.qml 0 */ diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h b/doc/src/snippets/declarative/graphicswidgets/bluecircle.h index 73d66b7..73d66b7 100644 --- a/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h +++ b/doc/src/snippets/declarative/graphicswidgets/bluecircle.h diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/graphicswidgets.pro b/doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro index 21c8a37..21c8a37 100644 --- a/doc/src/declarative/snippets/integrating/graphicswidgets/graphicswidgets.pro +++ b/doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/main.qml b/doc/src/snippets/declarative/graphicswidgets/main.qml index ffcf79d..ffcf79d 100644 --- a/doc/src/declarative/snippets/integrating/graphicswidgets/main.qml +++ b/doc/src/snippets/declarative/graphicswidgets/main.qml diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/qmldir b/doc/src/snippets/declarative/graphicswidgets/qmldir index f94dad2..f94dad2 100644 --- a/doc/src/declarative/snippets/integrating/graphicswidgets/qmldir +++ b/doc/src/snippets/declarative/graphicswidgets/qmldir diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h b/doc/src/snippets/declarative/graphicswidgets/redsquare.h index 3050662..3050662 100644 --- a/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h +++ b/doc/src/snippets/declarative/graphicswidgets/redsquare.h diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/shapesplugin.cpp b/doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp index 4c18ef3..4c18ef3 100644 --- a/doc/src/declarative/snippets/integrating/graphicswidgets/shapesplugin.cpp +++ b/doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp diff --git a/doc/src/snippets/declarative/mouseregion.qml b/doc/src/snippets/declarative/mouseregion.qml index a464069..683770b 100644 --- a/doc/src/snippets/declarative/mouseregion.qml +++ b/doc/src/snippets/declarative/mouseregion.qml @@ -3,13 +3,21 @@ import Qt 4.7 Rectangle { width: 200; height: 100 Row { //! [0] -Rectangle { width: 100; height: 100; color: "green" - MouseArea { anchors.fill: parent; onClicked: { parent.color = 'red' } } +Rectangle { + width: 100; height: 100 + color: "green" + + MouseArea { + anchors.fill: parent + onClicked: { parent.color = 'red' } + } } //! [0] //! [1] Rectangle { - width: 100; height: 100; color: "green" + width: 100; height: 100 + color: "green" + MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro b/doc/src/snippets/declarative/qtbinding/contextproperties/contextproperties.pro index 68eeaf2..68eeaf2 100644 --- a/doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro +++ b/doc/src/snippets/declarative/qtbinding/contextproperties/contextproperties.pro diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp b/doc/src/snippets/declarative/qtbinding/contextproperties/main.cpp index 4073a6c..4073a6c 100644 --- a/doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp +++ b/doc/src/snippets/declarative/qtbinding/contextproperties/main.cpp diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/main.qml b/doc/src/snippets/declarative/qtbinding/contextproperties/main.qml index 1053f73..1053f73 100644 --- a/doc/src/declarative/snippets/qtbinding/contextproperties/main.qml +++ b/doc/src/snippets/declarative/qtbinding/contextproperties/main.qml diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h b/doc/src/snippets/declarative/qtbinding/custompalette/custompalette.h index d0d253a..d0d253a 100644 --- a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h +++ b/doc/src/snippets/declarative/qtbinding/custompalette/custompalette.h diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro b/doc/src/snippets/declarative/qtbinding/custompalette/custompalette.pro index e6af0d0..e6af0d0 100644 --- a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro +++ b/doc/src/snippets/declarative/qtbinding/custompalette/custompalette.pro diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/main.cpp b/doc/src/snippets/declarative/qtbinding/custompalette/main.cpp index dc651f6..dc651f6 100644 --- a/doc/src/declarative/snippets/qtbinding/custompalette/main.cpp +++ b/doc/src/snippets/declarative/qtbinding/custompalette/main.cpp diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/main.qml b/doc/src/snippets/declarative/qtbinding/custompalette/main.qml index f1a3b4f..f1a3b4f 100644 --- a/doc/src/declarative/snippets/qtbinding/custompalette/main.qml +++ b/doc/src/snippets/declarative/qtbinding/custompalette/main.qml diff --git a/doc/src/declarative/snippets/qtbinding/resources/example.qrc b/doc/src/snippets/declarative/qtbinding/resources/example.qrc index 5e49415..5e49415 100644 --- a/doc/src/declarative/snippets/qtbinding/resources/example.qrc +++ b/doc/src/snippets/declarative/qtbinding/resources/example.qrc diff --git a/doc/src/declarative/snippets/qtbinding/resources/images/background.png b/doc/src/snippets/declarative/qtbinding/resources/images/background.png index e69de29..e69de29 100644 --- a/doc/src/declarative/snippets/qtbinding/resources/images/background.png +++ b/doc/src/snippets/declarative/qtbinding/resources/images/background.png diff --git a/doc/src/declarative/snippets/qtbinding/resources/main.cpp b/doc/src/snippets/declarative/qtbinding/resources/main.cpp index 5459b9e..5459b9e 100644 --- a/doc/src/declarative/snippets/qtbinding/resources/main.cpp +++ b/doc/src/snippets/declarative/qtbinding/resources/main.cpp diff --git a/doc/src/declarative/snippets/qtbinding/resources/main.qml b/doc/src/snippets/declarative/qtbinding/resources/main.qml index dfe923f..dfe923f 100644 --- a/doc/src/declarative/snippets/qtbinding/resources/main.qml +++ b/doc/src/snippets/declarative/qtbinding/resources/main.qml diff --git a/doc/src/declarative/snippets/qtbinding/resources/resources.pro b/doc/src/snippets/declarative/qtbinding/resources/resources.pro index cc01ee1..cc01ee1 100644 --- a/doc/src/declarative/snippets/qtbinding/resources/resources.pro +++ b/doc/src/snippets/declarative/qtbinding/resources/resources.pro diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp b/doc/src/snippets/declarative/qtbinding/stopwatch/main.cpp index 537a288..537a288 100644 --- a/doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp +++ b/doc/src/snippets/declarative/qtbinding/stopwatch/main.cpp diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/main.qml b/doc/src/snippets/declarative/qtbinding/stopwatch/main.qml index 2efa542..2efa542 100644 --- a/doc/src/declarative/snippets/qtbinding/stopwatch/main.qml +++ b/doc/src/snippets/declarative/qtbinding/stopwatch/main.qml diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp b/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.cpp index 4954a5f..4954a5f 100644 --- a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp +++ b/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.cpp diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h b/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.h index 8d17121..8d17121 100644 --- a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h +++ b/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.h diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro b/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.pro index d803e6a..d803e6a 100644 --- a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro +++ b/doc/src/snippets/declarative/qtbinding/stopwatch/stopwatch.pro diff --git a/examples/declarative/border-image/animated.qml b/examples/declarative/border-image/animated.qml deleted file mode 100644 index c3ff9ef..0000000 --- a/examples/declarative/border-image/animated.qml +++ /dev/null @@ -1,54 +0,0 @@ -import Qt 4.7 -import "content" - -Rectangle { - id: page - width: 1030; height: 540 - - MyBorderImage { - x: 20; y: 20; minWidth: 120; maxWidth: 240 - minHeight: 120; maxHeight: 240 - source: "content/colors.png"; margin: 30 - } - MyBorderImage { - x: 270; y: 20; minWidth: 120; maxWidth: 240 - minHeight: 120; maxHeight: 240 - source: "content/colors.png"; margin: 30 - horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat - } - MyBorderImage { - x: 520; y: 20; minWidth: 120; maxWidth: 240 - minHeight: 120; maxHeight: 240 - source: "content/colors.png"; margin: 30 - horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat - } - MyBorderImage { - x: 770; y: 20; minWidth: 120; maxWidth: 240 - minHeight: 120; maxHeight: 240 - source: "content/colors.png"; margin: 30 - horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round - } - MyBorderImage { - x: 20; y: 280; minWidth: 60; maxWidth: 200 - minHeight: 40; maxHeight: 200 - source: "content/bw.png"; margin: 10 - } - MyBorderImage { - x: 270; y: 280; minWidth: 60; maxWidth: 200 - minHeight: 40; maxHeight: 200 - source: "content/bw.png"; margin: 10 - horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat - } - MyBorderImage { - x: 520; y: 280; minWidth: 60; maxWidth: 200 - minHeight: 40; maxHeight: 200 - source: "content/bw.png"; margin: 10 - horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat - } - MyBorderImage { - x: 770; y: 280; minWidth: 60; maxWidth: 200 - minHeight: 40; maxHeight: 200 - source: "content/bw.png"; margin: 10 - horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round - } -} diff --git a/examples/declarative/border-image/border-image.qml b/examples/declarative/border-image/border-image.qml new file mode 100644 index 0000000..c334cea --- /dev/null +++ b/examples/declarative/border-image/border-image.qml @@ -0,0 +1,57 @@ +import Qt 4.7 +import "content" + +Rectangle { + id: page + width: 1030; height: 540 + + Grid { + anchors.centerIn: parent; spacing: 20 + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round + } + } +} diff --git a/examples/declarative/border-image/borders.qml b/examples/declarative/border-image/borders.qml deleted file mode 100644 index 3743f7e..0000000 --- a/examples/declarative/border-image/borders.qml +++ /dev/null @@ -1,17 +0,0 @@ -import Qt 4.7 - -Rectangle { - id: page - width: 520; height: 280 - - BorderImage { - x: 20; y: 20; width: 230; height: 240 - smooth: true - source: "content/colors-stretch.sci" - } - BorderImage { - x: 270; y: 20; width: 230; height: 240 - smooth: true - source: "content/colors-round.sci" - } -} diff --git a/examples/declarative/border-image/content/MyBorderImage.qml b/examples/declarative/border-image/content/MyBorderImage.qml index f65f093..2573a14 100644 --- a/examples/declarative/border-image/content/MyBorderImage.qml +++ b/examples/declarative/border-image/content/MyBorderImage.qml @@ -1,6 +1,8 @@ import Qt 4.7 Item { + id: container + property alias horizontalMode: image.horizontalTileMode property alias verticalMode: image.verticalTileMode property alias source: image.source @@ -11,11 +13,10 @@ Item { property int maxHeight property int margin - id: container width: 240; height: 240 BorderImage { - id: image; x: container.width / 2 - width / 2; y: container.height / 2 - height / 2 + id: image; anchors.centerIn: parent SequentialAnimation on width { loops: Animation.Infinite diff --git a/examples/declarative/border-image/content/ShadowRectangle.qml b/examples/declarative/border-image/content/ShadowRectangle.qml new file mode 100644 index 0000000..629478b --- /dev/null +++ b/examples/declarative/border-image/content/ShadowRectangle.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +Item { + property alias color : rectangle.color + + BorderImage { + anchors.fill: rectangle + anchors { leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } + border { left: 10; top: 10; right: 10; bottom: 10 } + source: "shadow.png"; smooth: true + } + + Rectangle { id: rectangle; anchors.fill: parent } +} diff --git a/examples/declarative/border-image/content/shadow.png b/examples/declarative/border-image/content/shadow.png Binary files differnew file mode 100644 index 0000000..431af85 --- /dev/null +++ b/examples/declarative/border-image/content/shadow.png diff --git a/examples/declarative/border-image/shadows.qml b/examples/declarative/border-image/shadows.qml new file mode 100644 index 0000000..a08d133 --- /dev/null +++ b/examples/declarative/border-image/shadows.qml @@ -0,0 +1,24 @@ +import Qt 4.7 +import "content" + +Rectangle { + id: window + + width: 480; height: 320 + color: "gray" + + ShadowRectangle { + anchors.centerIn: parent; width: 250; height: 250 + color: "lightsteelblue" + } + + ShadowRectangle { + anchors.centerIn: parent; width: 200; height: 200 + color: "steelblue" + } + + ShadowRectangle { + anchors.centerIn: parent; width: 150; height: 150 + color: "thistle" + } +} diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index 6f5bb9b..6cc6fc1 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -853,9 +853,7 @@ void **QListData::erase(void **xi) same as takeAt(0). This function assumes the list is not empty. To avoid failure, call isEmpty() before calling this function. - This operation is very fast (\l{constant time}), because QList - preallocates extra space on both sides of its internal buffer to - allow for fast growth at both ends of the list. + This operation takes \l{constant time}. If you don't use the return value, removeFirst() is more efficient. @@ -870,9 +868,7 @@ void **QListData::erase(void **xi) not empty. To avoid failure, call isEmpty() before calling this function. - This operation is very fast (\l{constant time}), because QList - preallocates extra space on both sides of its internal buffer to - allow for fast growth at both ends of the list. + This operation takes \l{constant time}. If you don't use the return value, removeLast() is more efficient. diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 06f8363..14a2cab 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -57,9 +57,25 @@ QT_BEGIN_NAMESPACE \inherits Item \since 4.7 + A BorderImage breaks an image into 9 sections, as shown below: + + \image declarative-scalegrid.png + + When the image is scaled: + \list + \i the corners (sections 1, 3, 7, and 9) are not scaled at all + \i sections 2 and 8 are scaled according to \l{BorderImage::horizontalTileMode}{horizontalTileMode} + \i sections 4 and 6 are scaled according to \l{BorderImage::verticalTileMode}{verticalTileMode} + \i the middle (section 5) is scaled according to both \l{BorderImage::horizontalTileMode}{horizontalTileMode} and \l{BorderImage::verticalTileMode}{verticalTileMode} + \endlist + + Examples: \snippet snippets/declarative/border-image.qml 0 \image BorderImage.png + + The \l{declarative/border-image}{BorderImage example} shows how a BorderImage can be used to simulate a shadow effect on a + rectangular item. */ /*! @@ -255,21 +271,17 @@ void QDeclarativeBorderImage::load() \qmlproperty int BorderImage::border.top \qmlproperty int BorderImage::border.bottom - \target ImagexmlpropertiesscaleGrid - - The 4 border lines (2 horizontal and 2 vertical) break an image into 9 sections, as shown below: + The 4 border lines (2 horizontal and 2 vertical) break the image into 9 sections, as shown below: \image declarative-scalegrid.png - When the image is scaled: - \list - \i the corners (sections 1, 3, 7, and 9) are not scaled at all - \i sections 2 and 8 are scaled according to \l{BorderImage::horizontalTileMode}{horizontalTileMode} - \i sections 4 and 6 are scaled according to \l{BorderImage::verticalTileMode}{verticalTileMode} - \i the middle (section 5) is scaled according to both \l{BorderImage::horizontalTileMode}{horizontalTileMode} and \l{BorderImage::verticalTileMode}{verticalTileMode} - \endlist + Each border line (left, right, top, and bottom) specifies an offset in pixels from the respective side. - Each border line (left, right, top, and bottom) specifies an offset from the respective side. For example, \c{border.bottom: 10} sets the bottom line 10 pixels up from the bottom of the image. + For example: + \qml + border.bottom: 10 + \endqml + sets the bottom line 10 pixels up from the bottom of the image. The border lines can also be specified using a \l {BorderImage::source}{.sci file}. diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index f79a853..febd34a 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -855,10 +855,13 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m qreal adjDist = -data.flickTarget + data.move.value(); if (qAbs(adjDist) > qAbs(dist)) { // Prevent painfully slow flicking - adjust velocity to suit flickDeceleration - v2 = accel * 2.0f * qAbs(dist); - v = qSqrt(v2); - if (dist > 0) - v = -v; + qreal adjv2 = accel * 2.0f * qAbs(adjDist); + if (adjv2 > v2) { + v2 = adjv2; + v = qSqrt(v2); + if (dist > 0) + v = -v; + } } dist = adjDist; accel = v2 / (2.0f * qAbs(dist)); diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 247e348..e00a9fd 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -54,7 +54,27 @@ QT_BEGIN_NAMESPACE \brief The Image element allows you to add bitmaps to a scene. \inherits Item - The Image element supports untransformed, stretched and tiled. + Displays the image from the specified \l source. If a size is not specified explicitly, + the Image element will be sized to the loaded image. + + If the source resolves to a network resource, the image will be loaded asynchronously, + updating the \l progress and \l status properties appropriately. + + Images which are available locally + will be loaded immediately, blocking the user interface. This is typically the + correct behavior for user interface elements. For large local images, which do not need + to be visible immediately, it may be preferable to enable \l asynchronous loading. + This will load the image in the background using a low priority thread. + + Images are cached and shared internally, so if several Image elements have the same source + only one copy of the image will be loaded. + + \bold Note: Images are often the greatest user of memory in QML UIs. It is recommended + that images which do not form part of the user interface have their + size bounded via the \l sourceSize property. This is especially important for content + that is loaded from external sources or provided by the user. + + The Image element supports untransformed, stretched and tiled images. For an explanation of stretching and tiling, see the fillMode property description. @@ -107,7 +127,7 @@ QT_BEGIN_NAMESPACE } \endqml \endtable - */ +*/ /*! \internal diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index bc0c65e..928c504 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1268,11 +1268,6 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec */ /*! - \property QDeclarativeItem::effect - \internal -*/ - -/*! \property QDeclarativeItem::focus \internal */ @@ -2728,29 +2723,48 @@ void QDeclarativeItem::setSmooth(bool smooth) update(); } +/*! + \internal + Return the width of the item +*/ qreal QDeclarativeItem::width() const { Q_D(const QDeclarativeItem); return d->width(); } +/*! + \internal + Set the width of the item +*/ void QDeclarativeItem::setWidth(qreal w) { Q_D(QDeclarativeItem); d->setWidth(w); } +/*! + \internal + Reset the width of the item +*/ void QDeclarativeItem::resetWidth() { Q_D(QDeclarativeItem); d->resetWidth(); } +/*! + \internal + Return the width of the item +*/ qreal QDeclarativeItemPrivate::width() const { return mWidth; } +/*! + \internal +*/ void QDeclarativeItemPrivate::setWidth(qreal w) { Q_Q(QDeclarativeItem); @@ -2770,7 +2784,10 @@ void QDeclarativeItemPrivate::setWidth(qreal w) QRectF(q->x(), q->y(), oldWidth, height())); } -void QDeclarativeItemPrivate ::resetWidth() +/*! + \internal +*/ +void QDeclarativeItemPrivate::resetWidth() { Q_Q(QDeclarativeItem); widthValid = false; @@ -2815,29 +2832,47 @@ bool QDeclarativeItem::widthValid() const return d->widthValid; } +/*! + \internal + Return the height of the item +*/ qreal QDeclarativeItem::height() const { Q_D(const QDeclarativeItem); return d->height(); } +/*! + \internal + Set the height of the item +*/ void QDeclarativeItem::setHeight(qreal h) { Q_D(QDeclarativeItem); d->setHeight(h); } +/*! + \internal + Reset the height of the item +*/ void QDeclarativeItem::resetHeight() { Q_D(QDeclarativeItem); d->resetHeight(); } +/*! + \internal +*/ qreal QDeclarativeItemPrivate::height() const { return mHeight; } +/*! + \internal +*/ void QDeclarativeItemPrivate::setHeight(qreal h) { Q_Q(QDeclarativeItem); @@ -2857,6 +2892,9 @@ void QDeclarativeItemPrivate::setHeight(qreal h) QRectF(q->x(), q->y(), width(), oldHeight)); } +/*! + \internal +*/ void QDeclarativeItemPrivate::resetHeight() { Q_Q(QDeclarativeItem); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index c88dab2..3f150dc 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1230,10 +1230,13 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m qreal adjDist = -data.flickTarget + data.move.value(); if (qAbs(adjDist) > qAbs(dist)) { // Prevent painfully slow flicking - adjust velocity to suit flickDeceleration - v2 = accel * 2.0f * qAbs(dist); - v = qSqrt(v2); - if (dist > 0) - v = -v; + qreal adjv2 = accel * 2.0f * qAbs(adjDist); + if (adjv2 > v2) { + v2 = adjv2; + v = qSqrt(v2); + if (dist > 0) + v = -v; + } } dist = adjDist; accel = v2 / (2.0f * qAbs(dist)); diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 126d041..0b9cf6e 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -599,6 +599,23 @@ void QDeclarativeMouseArea::geometryChanged(const QRectF &newGeometry, d->lastPos = mapFromScene(d->lastScenePos); } +/*! \internal */ +QVariant QDeclarativeMouseArea::itemChange(GraphicsItemChange change, + const QVariant &value) +{ + Q_D(QDeclarativeMouseArea); + switch (change) { + case ItemVisibleHasChanged: + if (acceptHoverEvents() && d->hovered != (isVisible() && isUnderMouse())) + setHovered(!d->hovered); + break; + default: + break; + } + + return QDeclarativeItem::itemChange(change, value); +} + /*! \qmlproperty bool MouseArea::hoverEnabled This property holds whether hover events are handled. @@ -609,6 +626,22 @@ void QDeclarativeMouseArea::geometryChanged(const QRectF &newGeometry, This property affects the containsMouse property and the onEntered, onExited and onPositionChanged signals. */ +bool QDeclarativeMouseArea::hoverEnabled() const +{ + return acceptHoverEvents(); +} + +void QDeclarativeMouseArea::setHoverEnabled(bool h) +{ + Q_D(QDeclarativeMouseArea); + if (h == acceptHoverEvents()) + return; + + setAcceptHoverEvents(h); + emit hoverEnabledChanged(); + if (d->hovered != isUnderMouse()) + setHovered(!d->hovered); +} /*! \qmlproperty bool MouseArea::containsMouse diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h index 4f7df62..e3f523b 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h @@ -121,7 +121,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeMouseArea : public QDeclarativeItem Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedChanged) Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged) - Q_PROPERTY(bool hoverEnabled READ acceptHoverEvents WRITE setAcceptHoverEvents) + Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged) Q_PROPERTY(QDeclarativeDrag *drag READ drag CONSTANT) //### add flicking to QDeclarativeDrag or add a QDeclarativeFlick ??? public: @@ -142,6 +142,9 @@ public: Qt::MouseButtons acceptedButtons() const; void setAcceptedButtons(Qt::MouseButtons buttons); + bool hoverEnabled() const; + void setHoverEnabled(bool h); + QDeclarativeDrag *drag(); Q_SIGNALS: @@ -149,6 +152,7 @@ Q_SIGNALS: void pressedChanged(); void enabledChanged(); void acceptedButtonsChanged(); + void hoverEnabledChanged(); void positionChanged(QDeclarativeMouseEvent *mouse); void mousePositionChanged(QDeclarativeMouseEvent *mouse); @@ -176,6 +180,7 @@ protected: virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); + virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value); private: void handlePress(); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 21c33e2..13ee4e6 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -46,6 +46,7 @@ #include <qdeclarativestate_p.h> #include <qdeclarativestategroup_p.h> #include <qdeclarativestateoperations_p.h> +#include <qdeclarativeinfo.h> #include <QtCore/qmath.h> #include <QDebug> @@ -165,6 +166,7 @@ void QDeclarativeBasePositioner::componentComplete() QDeclarativeItem::componentComplete(); positionedItems.reserve(d->QGraphicsItemPrivate::children.count()); prePositioning(); + reportConflictingAnchors(); } QVariant QDeclarativeBasePositioner::itemChange(GraphicsItemChange change, @@ -329,7 +331,6 @@ Column { \qml Column { spacing: 2 - remove: ... add: ... move: ... ... @@ -436,6 +437,26 @@ void QDeclarativeColumn::doPositioning(QSizeF *contentSize) contentSize->setHeight(voffset - spacing()); } +void QDeclarativeColumn::reportConflictingAnchors() +{ + bool childsWithConflictingAnchors(false); + for (int ii = 0; ii < positionedItems.count(); ++ii) { + const PositionedItem &child = positionedItems.at(ii); + if (child.item) { + QDeclarativeAnchors::Anchors usedAnchors = child.item->anchors()->usedAnchors(); + if (usedAnchors & QDeclarativeAnchors::TopAnchor || + usedAnchors & QDeclarativeAnchors::BottomAnchor || + usedAnchors & QDeclarativeAnchors::VCenterAnchor) { + childsWithConflictingAnchors = true; + break; + } + } + } + if (childsWithConflictingAnchors) { + qmlInfo(this) << "Cannot specify top, bottom or verticalCenter anchors for items inside Column"; + } +} + /*! \qmlclass Row QDeclarativeRow \since 4.7 @@ -551,6 +572,25 @@ void QDeclarativeRow::doPositioning(QSizeF *contentSize) contentSize->setWidth(hoffset - spacing()); } +void QDeclarativeRow::reportConflictingAnchors() +{ + bool childsWithConflictingAnchors(false); + for (int ii = 0; ii < positionedItems.count(); ++ii) { + const PositionedItem &child = positionedItems.at(ii); + if (child.item) { + QDeclarativeAnchors::Anchors usedAnchors = child.item->anchors()->usedAnchors(); + if (usedAnchors & QDeclarativeAnchors::LeftAnchor || + usedAnchors & QDeclarativeAnchors::RightAnchor || + usedAnchors & QDeclarativeAnchors::HCenterAnchor) { + childsWithConflictingAnchors = true; + break; + } + } + } + if (childsWithConflictingAnchors) { + qmlInfo(this) << "Cannot specify left, right or horizontalCenter anchors for items inside Row"; + } +} /*! \qmlclass Grid QDeclarativeGrid @@ -823,6 +863,20 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) } } +void QDeclarativeGrid::reportConflictingAnchors() +{ + bool childsWithConflictingAnchors(false); + for (int ii = 0; ii < positionedItems.count(); ++ii) { + const PositionedItem &child = positionedItems.at(ii); + if (child.item && child.item->anchors()->usedAnchors()) { + childsWithConflictingAnchors = true; + break; + } + } + if (childsWithConflictingAnchors) { + qmlInfo(this) << "Cannot specify anchors for items inside Grid"; + } +} /*! \qmlclass Flow QDeclarativeFlow @@ -966,5 +1020,19 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) } } +void QDeclarativeFlow::reportConflictingAnchors() +{ + bool childsWithConflictingAnchors(false); + for (int ii = 0; ii < positionedItems.count(); ++ii) { + const PositionedItem &child = positionedItems.at(ii); + if (child.item && child.item->anchors()->usedAnchors()) { + childsWithConflictingAnchors = true; + break; + } + } + if (childsWithConflictingAnchors) { + qmlInfo(this) << "Cannot specify anchors for items inside Flow"; + } +} QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index b5fc979..787dcd3 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -94,6 +94,7 @@ protected Q_SLOTS: protected: virtual void doPositioning(QSizeF *contentSize)=0; + virtual void reportConflictingAnchors()=0; struct PositionedItem { PositionedItem(QDeclarativeItem *i) : item(i), isNew(false), isVisible(true) {} bool operator==(const PositionedItem &other) const { return other.item == item; } @@ -118,6 +119,7 @@ public: QDeclarativeColumn(QDeclarativeItem *parent=0); protected: virtual void doPositioning(QSizeF *contentSize); + virtual void reportConflictingAnchors(); private: Q_DISABLE_COPY(QDeclarativeColumn) }; @@ -129,6 +131,7 @@ public: QDeclarativeRow(QDeclarativeItem *parent=0); protected: virtual void doPositioning(QSizeF *contentSize); + virtual void reportConflictingAnchors(); private: Q_DISABLE_COPY(QDeclarativeRow) }; @@ -161,6 +164,7 @@ Q_SIGNALS: protected: virtual void doPositioning(QSizeF *contentSize); + virtual void reportConflictingAnchors(); private: int m_rows; @@ -187,7 +191,7 @@ Q_SIGNALS: protected: virtual void doPositioning(QSizeF *contentSize); - + virtual void reportConflictingAnchors(); protected: QDeclarativeFlow(QDeclarativeFlowPrivate &dd, QDeclarativeItem *parent); private: diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 0328f91..ccabbde 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -43,6 +43,7 @@ #include "private/qdeclarativerectangle_p_p.h" #include <QPainter> +#include <QStringBuilder> #include <QtCore/qmath.h> QT_BEGIN_NAMESPACE @@ -155,8 +156,8 @@ void QDeclarativeGradient::doUpdate() \brief The Rectangle item allows you to add rectangles to a scene. \inherits Item - A Rectangle is painted having a solid fill (color) and an optional border. - You can also create rounded rectangles using the radius property. + A Rectangle is painted using a solid fill (color) and an optional border. + You can also create rounded rectangles using the \l radius property. \qml Rectangle { @@ -223,14 +224,22 @@ QDeclarativePen *QDeclarativeRectangle::border() \o \image declarative-rect_gradient.png \o \qml - Rectangle { y: 0; width: 80; height: 80; color: "lightsteelblue" } - Rectangle { y: 100; width: 80; height: 80 + Rectangle { + y: 0; width: 80; height: 80 + color: "lightsteelblue" + } + + Rectangle { + y: 100; width: 80; height: 80 gradient: Gradient { GradientStop { position: 0.0; color: "lightsteelblue" } GradientStop { position: 1.0; color: "blue" } } } - Rectangle { rotation: 90; y: 200; width: 80; height: 80 + + Rectangle { + y: 200; width: 80; height: 80 + rotation: 90 gradient: Gradient { GradientStop { position: 0.0; color: "lightsteelblue" } GradientStop { position: 1.0; color: "blue" } @@ -334,21 +343,29 @@ void QDeclarativeRectangle::generateRoundedRect() if (d->rectImage.isNull()) { const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; const int radius = qCeil(d->radius); //ensure odd numbered width/height so we get 1-pixel center - d->rectImage = QPixmap(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2); - d->rectImage.fill(Qt::transparent); - QPainter p(&(d->rectImage)); - p.setRenderHint(QPainter::Antialiasing); - if (d->pen && d->pen->isValid()) { - QPen pn(QColor(d->pen->color()), d->pen->width()); - p.setPen(pn); - } else { - p.setPen(Qt::NoPen); + + QString key = QLatin1String("q_") % QString::number(pw) % d->color.name() % QString::number(d->color.alpha(), 16) % QLatin1Char('_') % QString::number(radius); + if (d->pen && d->pen->isValid()) + key += d->pen->color().name() % QString::number(d->pen->color().alpha(), 16); + + if (!QPixmapCache::find(key, &d->rectImage)) { + d->rectImage = QPixmap(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2); + d->rectImage.fill(Qt::transparent); + QPainter p(&(d->rectImage)); + p.setRenderHint(QPainter::Antialiasing); + if (d->pen && d->pen->isValid()) { + QPen pn(QColor(d->pen->color()), d->pen->width()); + p.setPen(pn); + } else { + p.setPen(Qt::NoPen); + } + p.setBrush(d->color); + if (pw%2) + p.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1)), d->radius, d->radius); + else + p.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw), d->radius, d->radius); + QPixmapCache::insert(key, d->rectImage); } - p.setBrush(d->color); - if (pw%2) - p.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1)), d->radius, d->radius); - else - p.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw), d->radius, d->radius); } } @@ -357,22 +374,30 @@ void QDeclarativeRectangle::generateBorderedRect() Q_D(QDeclarativeRectangle); if (d->rectImage.isNull()) { const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0; - d->rectImage = QPixmap(pw*2 + 3, pw*2 + 3); - d->rectImage.fill(Qt::transparent); - QPainter p(&(d->rectImage)); - p.setRenderHint(QPainter::Antialiasing); - if (d->pen && d->pen->isValid()) { - QPen pn(QColor(d->pen->color()), d->pen->width()); - pn.setJoinStyle(Qt::MiterJoin); - p.setPen(pn); - } else { - p.setPen(Qt::NoPen); + + QString key = QLatin1String("q_") % QString::number(pw) % d->color.name() % QString::number(d->color.alpha(), 16); + if (d->pen && d->pen->isValid()) + key += d->pen->color().name() % QString::number(d->pen->color().alpha(), 16); + + if (!QPixmapCache::find(key, &d->rectImage)) { + d->rectImage = QPixmap(pw*2 + 3, pw*2 + 3); + d->rectImage.fill(Qt::transparent); + QPainter p(&(d->rectImage)); + p.setRenderHint(QPainter::Antialiasing); + if (d->pen && d->pen->isValid()) { + QPen pn(QColor(d->pen->color()), d->pen->width()); + pn.setJoinStyle(Qt::MiterJoin); + p.setPen(pn); + } else { + p.setPen(Qt::NoPen); + } + p.setBrush(d->color); + if (pw%2) + p.drawRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1))); + else + p.drawRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw)); + QPixmapCache::insert(key, d->rectImage); } - p.setBrush(d->color); - if (pw%2) - p.drawRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1))); - else - p.drawRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw)); } } diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index d49bb02..ca0b8c6 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -67,7 +67,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \brief The Repeater item allows you to repeat an Item-based component using a model. - The Repeater item is used when you want to create a large number of + The Repeater item is used to create a large number of similar items. For each entry in the model, an item is instantiated in a context seeded with data from the model. If the repeater will be instantiating a large number of instances, it may be more efficient to diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 2b8da8e..37a63eb 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -116,7 +116,7 @@ QSet<QUrl> QTextDocumentWithImageResources::errors; \brief The Text item allows you to add formatted text to a scene. \inherits Item - It can display both plain and rich text. For example: + A Text item can display both plain and rich text. For example: \qml Text { text: "Hello World!"; font.family: "Helvetica"; font.pointSize: 24; color: "red" } @@ -132,8 +132,8 @@ QSet<QUrl> QTextDocumentWithImageResources::errors; The \c elide property can alternatively be used to fit a single line of plain text to a set width. - Note that the \l{Supported HTML Subset} is limited, and that if IMG tags - load remote images, the text reloads (see resourcesLoading). + Note that the \l{Supported HTML Subset} is limited. Also, if the text contains + HTML img tags that load remote images, the text is reloaded. Text provides read-only text. For editable text, see \l TextEdit. */ @@ -191,7 +191,7 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate() /*! \qmlproperty bool Text::font.bold - Sets the font's weight to bold. + Sets whether the font weight is bold. */ /*! @@ -216,25 +216,25 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate() /*! \qmlproperty bool Text::font.italic - Sets the style of the text to italic. + Sets whether the font has an italic style. */ /*! \qmlproperty bool Text::font.underline - Set the style of the text to underline. + Sets whether the text is underlined. */ /*! \qmlproperty bool Text::font.outline - Set the style of the text to outline. + Sets whether the font has an outline style. */ /*! \qmlproperty bool Text::font.strikeout - Set the style of the text to strikeout. + Sets whether the font has a strikeout style. */ /*! @@ -531,7 +531,14 @@ void QDeclarativeText::setWrapMode(WrapMode mode) The way the text property should be displayed. - Supported text formats are \c AutoText, \c PlainText, \c RichText and \c StyledText + Supported text formats are: + + \list + \o AutoText + \o PlainText + \o RichText + \o StyledText + \endlist The default is AutoText. If the text format is AutoText the text element will automatically determine whether the text should be treated as @@ -1069,8 +1076,9 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid /*! \qmlproperty bool Text::smooth - Set this property if you want the text to be smoothly scaled or - transformed. Smooth filtering gives better visual quality, but is slower. If + This property holds whether the text is smoothly scaled or transformed. + + Smooth filtering gives better visual quality, but is slower. If the item is displayed at its natural size, this property has no visual or performance effect. diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 25eaef6..31ed418 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -129,7 +129,7 @@ QString QDeclarativeTextEdit::text() const /*! \qmlproperty bool TextEdit::font.bold - Sets the font's weight to bold. + Sets whether the font weight is bold. */ /*! @@ -154,25 +154,25 @@ QString QDeclarativeTextEdit::text() const /*! \qmlproperty bool TextEdit::font.italic - Sets the style of the text to italic. + Sets whether the font has an italic style. */ /*! \qmlproperty bool TextEdit::font.underline - Set the style of the text to underline. + Sets whether the text is underlined. */ /*! \qmlproperty bool TextEdit::font.outline - Set the style of the text to outline. + Sets whether the font has an outline style. */ /*! \qmlproperty bool TextEdit::font.strikeout - Set the style of the text to strikeout. + Sets whether the font has a strikeout style. */ /*! @@ -255,7 +255,12 @@ void QDeclarativeTextEdit::setText(const QString &text) The way the text property should be displayed. - Supported text formats are \c AutoText, \c PlainText and \c RichText. + \list + \o AutoText + \o PlainText + \o RichText + \o StyledText + \endlist The default is AutoText. If the text format is AutoText the text edit will automatically determine whether the text should be treated as @@ -991,8 +996,9 @@ void QDeclarativeTextEdit::updateImgCache(const QRectF &r) /*! \qmlproperty bool TextEdit::smooth - Set this property if you want the text to be smoothly scaled or - transformed. Smooth filtering gives better visual quality, but is slower. If + This property holds whether the text is smoothly scaled or transformed. + + Smooth filtering gives better visual quality, but is slower. If the item is displayed at its natural size, this property has no visual or performance effect. diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index b618183..775450a 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -108,7 +108,7 @@ void QDeclarativeTextInput::setText(const QString &s) /*! \qmlproperty bool TextInput::font.bold - Sets the font's weight to bold. + Sets whether the font weight is bold. */ /*! @@ -133,25 +133,25 @@ void QDeclarativeTextInput::setText(const QString &s) /*! \qmlproperty bool TextInput::font.italic - Sets the style of the text to italic. + Sets whether the font has an italic style. */ /*! \qmlproperty bool TextInput::font.underline - Set the style of the text to underline. + Sets whether the text is underlined. */ /*! \qmlproperty bool TextInput::font.outline - Set the style of the text to outline. + Sets whether the font has an outline style. */ /*! \qmlproperty bool TextInput::font.strikeout - Set the style of the text to strikeout. + Sets whether the font has a strikeout style. */ /*! @@ -827,7 +827,7 @@ void QDeclarativeTextInput::moveCursor() d->cursorItem->setX(d->control->cursorToX() - d->hscroll); } -/* +/*! \qmlmethod int xToPosition(int x) This function returns the character position at @@ -1044,8 +1044,9 @@ void QDeclarativeTextInput::selectAll() /*! \qmlproperty bool TextInput::smooth - Set this property if you want the text to be smoothly scaled or - transformed. Smooth filtering gives better visual quality, but is slower. If + This property holds whether the text is smoothly scaled or transformed. + + Smooth filtering gives better visual quality, but is slower. If the item is displayed at its natural size, this property has no visual or performance effect. @@ -1054,15 +1055,15 @@ void QDeclarativeTextInput::selectAll() filtering at the beginning of the animation and reenable it at the conclusion. */ -/* +/*! \qmlproperty string TextInput::passwordCharacter This is the character displayed when echoMode is set to Password or PasswordEchoOnEdit. By default it is an asterisk. - Attempting to set this to more than one character will set it to - the first character in the string. Attempting to set this to less - than one character will fail. + If this property is set to a string with more than one character, + the first character is used. If the string is empty, the value + is ignored and the property is not set. */ QString QDeclarativeTextInput::passwordCharacter() const { @@ -1079,15 +1080,15 @@ void QDeclarativeTextInput::setPasswordCharacter(const QString &str) d->control->setPasswordCharacter(str.constData()[0]); } -/* +/*! \qmlproperty string TextInput::displayText - This is the actual text displayed in the TextInput. When - echoMode is set to TextInput::Normal this will be exactly - the same as the TextInput::text property. When echoMode - is set to something else, this property will contain the text - the user sees, while the text property will contain the - entered text. + This is the text displayed in the TextInput. + + If \l echoMode is set to TextInput::Normal, this holds the + same value as the TextInput::text property. Otherwise, + this property holds the text visible to the user, while + the \l text property holds the actual entered text. */ QString QDeclarativeTextInput::displayText() const { @@ -1095,29 +1096,33 @@ QString QDeclarativeTextInput::displayText() const return d->control->displayText(); } -/* - \qmlmethod void moveCursorSelection(int pos) +/*! + \qmlmethod void moveCursorSelection(int position) - This method allows you to move the cursor while modifying the selection accordingly. - To simply move the cursor, set the cursorPosition property. + Moves the cursor to \a position and updates the selection accordingly. + (To only move the cursor, set the \l cursorPosition property.) When this method is called it additionally sets either the selectionStart or the selectionEnd (whichever was at the previous cursor position) to the specified position. This allows you to easily extend and contract the selected text range. - Example: The sequence of calls + For example, take this sequence of calls: + + \code cursorPosition = 5 moveCursorSelection(9) moveCursorSelection(7) - would move the cursor to position 5, extend the selection end from 5 to 9 + \endcode + + This moves the cursor to position 5, extend the selection end from 5 to 9 and then retract the selection end from 9 to 7, leaving the text from position 5 to 7 selected (the 6th and 7th characters). */ -void QDeclarativeTextInput::moveCursorSelection(int pos) +void QDeclarativeTextInput::moveCursorSelection(int position) { Q_D(QDeclarativeTextInput); - d->control->moveCursor(pos, true); + d->control->moveCursor(position, true); } void QDeclarativeTextInputPrivate::init() diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 1727687..f64efcb 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -688,14 +688,12 @@ void QDeclarativeCompiler::compileTree(Object *tree) def.type = QDeclarativeInstruction::SetDefault; output->bytecode << def; - output->imports = unit->imports; - output->importCache = new QDeclarativeTypeNameCache(engine); for (int ii = 0; ii < importedScriptIndexes.count(); ++ii) output->importCache->add(importedScriptIndexes.at(ii), ii); - output->imports.cache(output->importCache, engine); + unit->imports.cache(output->importCache, engine); Q_ASSERT(tree->metatype); @@ -938,19 +936,28 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) meta.storeMeta.propertyCache = output->propertyCaches.count(); // ### Surely the creation of this property cache could be more efficient QDeclarativePropertyCache *propertyCache = 0; - if (tr.component && QDeclarativeComponentPrivate::get(tr.component)->cc->rootPropertyCache) { + if (tr.component) propertyCache = QDeclarativeComponentPrivate::get(tr.component)->cc->rootPropertyCache->copy(); - } else { - propertyCache = QDeclarativePropertyCache::create(engine, obj->metaObject()->superClass()); - } + else + propertyCache = QDeclarativeEnginePrivate::get(engine)->cache(obj->metaObject()->superClass())->copy(); + propertyCache->append(engine, obj->metaObject(), QDeclarativePropertyCache::Data::NoFlags, QDeclarativePropertyCache::Data::IsVMEFunction); + if (obj == unitRoot) { propertyCache->addref(); output->rootPropertyCache = propertyCache; } + output->propertyCaches << propertyCache; output->bytecode << meta; + } else if (obj == unitRoot) { + if (tr.component) + output->rootPropertyCache = QDeclarativeComponentPrivate::get(tr.component)->cc->rootPropertyCache; + else + output->rootPropertyCache = QDeclarativeEnginePrivate::get(engine)->cache(obj->metaObject()); + + output->rootPropertyCache->addref(); } // Set the object id diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index fefab7a..cd612d8 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -84,7 +84,6 @@ public: QString name; QUrl url; - QDeclarativeEnginePrivate::Imports imports; QDeclarativeTypeNameCache *importCache; struct TypeReference diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 0ee6dfe..e097edc 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -456,7 +456,11 @@ QDeclarativeEngine::~QDeclarativeEngine() } /*! \fn void QDeclarativeEngine::quit() - This signal is emitted when the QDeclarativeEngine quits. + This signal is emitted when the QDeclarativeEngine quits. + */ + +/*! \fn void QDeclarativeEngine::warnings(const QList<QDeclarativeError> &warnings) + This signal is emitted when \a warnings messages are generated by QML. */ /*! @@ -1676,280 +1680,300 @@ static bool greaterThan(const QString &s1, const QString &s2) class QDeclarativeImportsPrivate { public: - QDeclarativeImportsPrivate() : ref(1) - { - } + QDeclarativeImportsPrivate(); + ~QDeclarativeImportsPrivate(); - ~QDeclarativeImportsPrivate() - { - foreach (QDeclarativeEnginePrivate::ImportedNamespace* s, set.values()) - delete s; - } + bool importExtension(const QString &absoluteFilePath, const QString &uri, + QDeclarativeEngine *engine, QDeclarativeDirComponents* components, + QString *errorString); - QSet<QString> qmlDirFilesForWhichPluginsHaveBeenLoaded; + QString resolvedUri(const QString &dir_arg, QDeclarativeEngine *engine); + bool add(const QUrl& base, const QDeclarativeDirComponents &qmldircomponentsnetwork, + const QString& uri_arg, const QString& prefix, + int vmaj, int vmin, QDeclarativeScriptParser::Import::Type importType, + QDeclarativeEngine *engine, QString *errorString); + bool find(const QByteArray& type, int *vmajor, int *vminor, + QDeclarativeType** type_return, QUrl* url_return, QString *errorString); - bool importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine, QDeclarativeDirComponents* components, QString *errorString) { - QFile file(absoluteFilePath); - QString filecontent; - if (file.open(QFile::ReadOnly)) { - filecontent = QString::fromUtf8(file.readAll()); - if (qmlImportTrace()) - qDebug() << "QDeclarativeEngine::add: loaded" << absoluteFilePath; - } else { - if (errorString) - *errorString = QDeclarativeEngine::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath); - return false; - } - QDir dir = QFileInfo(file).dir(); + QDeclarativeEnginePrivate::ImportedNamespace *findNamespace(const QString& type); - QDeclarativeDirParser qmldirParser; - qmldirParser.setSource(filecontent); - qmldirParser.parse(); + QUrl base; + int ref; - if (! qmlDirFilesForWhichPluginsHaveBeenLoaded.contains(absoluteFilePath)) { - qmlDirFilesForWhichPluginsHaveBeenLoaded.insert(absoluteFilePath); +private: + friend struct QDeclarativeEnginePrivate::Imports; + QSet<QString> qmlDirFilesForWhichPluginsHaveBeenLoaded; + QDeclarativeEnginePrivate::ImportedNamespace unqualifiedset; + QHash<QString,QDeclarativeEnginePrivate::ImportedNamespace* > set; +}; - foreach (const QDeclarativeDirParser::Plugin &plugin, qmldirParser.plugins()) { +QDeclarativeEnginePrivate::Imports::Imports(const Imports ©) +: d(copy.d) +{ + ++d->ref; +} - QString resolvedFilePath = - QDeclarativeEnginePrivate::get(engine) - ->resolvePlugin(dir, plugin.path, - plugin.name); +QDeclarativeEnginePrivate::Imports & +QDeclarativeEnginePrivate::Imports::operator =(const Imports ©) +{ + ++copy.d->ref; + if (--d->ref == 0) + delete d; + d = copy.d; + return *this; +} - if (!resolvedFilePath.isEmpty()) { - if (!engine->importPlugin(resolvedFilePath, uri, errorString)) { - if (errorString) - *errorString = QDeclarativeEngine::tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(*errorString); - return false; - } - } else { - if (errorString) - *errorString = QDeclarativeEngine::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name); - return false; - } - } - } +QDeclarativeEnginePrivate::Imports::Imports() +: d(new QDeclarativeImportsPrivate) +{ +} - if (components) - *components = qmldirParser.components(); +QDeclarativeEnginePrivate::Imports::~Imports() +{ + if (--d->ref == 0) + delete d; +} - return true; +QDeclarativeImportsPrivate::QDeclarativeImportsPrivate() +: ref(1) +{ +} + +QDeclarativeImportsPrivate::~QDeclarativeImportsPrivate() +{ + foreach (QDeclarativeEnginePrivate::ImportedNamespace* s, set.values()) + delete s; +} + +bool QDeclarativeImportsPrivate::importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine, + QDeclarativeDirComponents* components, QString *errorString) +{ + QFile file(absoluteFilePath); + QString filecontent; + if (file.open(QFile::ReadOnly)) { + filecontent = QString::fromUtf8(file.readAll()); + if (qmlImportTrace()) + qDebug() << "QDeclarativeEngine::add: loaded" << absoluteFilePath; + } else { + if (errorString) + *errorString = QDeclarativeEngine::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath); + return false; } + QDir dir = QFileInfo(file).dir(); - QString resolvedUri(const QString &dir_arg, QDeclarativeEngine *engine) - { - QString dir = dir_arg; - if (dir.endsWith(QLatin1Char('/')) || dir.endsWith(QLatin1Char('\\'))) - dir.chop(1); + QDeclarativeDirParser qmldirParser; + qmldirParser.setSource(filecontent); + qmldirParser.parse(); - QStringList paths = QDeclarativeEnginePrivate::get(engine)->fileImportPath; - qSort(paths.begin(), paths.end(), greaterThan); // Ensure subdirs preceed their parents. + if (! qmlDirFilesForWhichPluginsHaveBeenLoaded.contains(absoluteFilePath)) { + qmlDirFilesForWhichPluginsHaveBeenLoaded.insert(absoluteFilePath); - QString stableRelativePath = dir; - foreach( QString path, paths) { - if (dir.startsWith(path)) { - stableRelativePath = dir.mid(path.length()+1); - break; + + foreach (const QDeclarativeDirParser::Plugin &plugin, qmldirParser.plugins()) { + + QString resolvedFilePath = + QDeclarativeEnginePrivate::get(engine) + ->resolvePlugin(dir, plugin.path, + plugin.name); + + if (!resolvedFilePath.isEmpty()) { + if (!engine->importPlugin(resolvedFilePath, uri, errorString)) { + if (errorString) + *errorString = QDeclarativeEngine::tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(*errorString); + return false; + } + } else { + if (errorString) + *errorString = QDeclarativeEngine::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name); + return false; } } - stableRelativePath.replace(QLatin1Char('/'), QLatin1Char('.')); - stableRelativePath.replace(QLatin1Char('\\'), QLatin1Char('.')); - return stableRelativePath; } + if (components) + *components = qmldirParser.components(); + return true; +} +QString QDeclarativeImportsPrivate::resolvedUri(const QString &dir_arg, QDeclarativeEngine *engine) +{ + QString dir = dir_arg; + if (dir.endsWith(QLatin1Char('/')) || dir.endsWith(QLatin1Char('\\'))) + dir.chop(1); - bool add(const QUrl& base, const QDeclarativeDirComponents &qmldircomponentsnetwork, const QString& uri_arg, const QString& prefix, int vmaj, int vmin, QDeclarativeScriptParser::Import::Type importType, QDeclarativeEngine *engine, QString *errorString) - { - QDeclarativeDirComponents qmldircomponents = qmldircomponentsnetwork; - QString uri = uri_arg; - QDeclarativeEnginePrivate::ImportedNamespace *s; - if (prefix.isEmpty()) { - s = &unqualifiedset; - } else { - s = set.value(prefix); - if (!s) - set.insert(prefix,(s=new QDeclarativeEnginePrivate::ImportedNamespace)); + QStringList paths = QDeclarativeEnginePrivate::get(engine)->fileImportPath; + qSort(paths.begin(), paths.end(), greaterThan); // Ensure subdirs preceed their parents. + + QString stableRelativePath = dir; + foreach( QString path, paths) { + if (dir.startsWith(path)) { + stableRelativePath = dir.mid(path.length()+1); + break; } + } + stableRelativePath.replace(QLatin1Char('/'), QLatin1Char('.')); + stableRelativePath.replace(QLatin1Char('\\'), QLatin1Char('.')); + return stableRelativePath; +} +bool QDeclarativeImportsPrivate::add(const QUrl& base, const QDeclarativeDirComponents &qmldircomponentsnetwork, const QString& uri_arg, + const QString& prefix, int vmaj, int vmin, QDeclarativeScriptParser::Import::Type importType, + QDeclarativeEngine *engine, QString *errorString) +{ + QDeclarativeDirComponents qmldircomponents = qmldircomponentsnetwork; + QString uri = uri_arg; + QDeclarativeEnginePrivate::ImportedNamespace *s; + if (prefix.isEmpty()) { + s = &unqualifiedset; + } else { + s = set.value(prefix); + if (!s) + set.insert(prefix,(s=new QDeclarativeEnginePrivate::ImportedNamespace)); + } - QString url = uri; - if (importType == QDeclarativeScriptParser::Import::Library) { - url.replace(QLatin1Char('.'), QLatin1Char('/')); - bool found = false; - QString dir; + QString url = uri; + if (importType == QDeclarativeScriptParser::Import::Library) { + url.replace(QLatin1Char('.'), QLatin1Char('/')); + bool found = false; + QString dir; - foreach (const QString &p, - QDeclarativeEnginePrivate::get(engine)->fileImportPath) { - dir = p+QLatin1Char('/')+url; - QFileInfo fi(dir+QLatin1String("/qmldir")); - const QString absoluteFilePath = fi.absoluteFilePath(); + foreach (const QString &p, + QDeclarativeEnginePrivate::get(engine)->fileImportPath) { + dir = p+QLatin1Char('/')+url; - if (fi.isFile()) { - found = true; + QFileInfo fi(dir+QLatin1String("/qmldir")); + const QString absoluteFilePath = fi.absoluteFilePath(); - url = QUrl::fromLocalFile(fi.absolutePath()).toString(); - uri = resolvedUri(dir, engine); - if (!importExtension(absoluteFilePath, uri, engine, &qmldircomponents, errorString)) - return false; - break; - } + if (fi.isFile()) { + found = true; + + url = QUrl::fromLocalFile(fi.absolutePath()).toString(); + uri = resolvedUri(dir, engine); + if (!importExtension(absoluteFilePath, uri, engine, &qmldircomponents, errorString)) + return false; + break; } + } + if (!found) { + found = QDeclarativeMetaType::isModule(uri.toUtf8(), vmaj, vmin); if (!found) { - found = QDeclarativeMetaType::isModule(uri.toUtf8(), vmaj, vmin); - if (!found) { - if (errorString) { - bool anyversion = QDeclarativeMetaType::isModule(uri.toUtf8(), -1, -1); - if (anyversion) - *errorString = QDeclarativeEngine::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin); - else - *errorString = QDeclarativeEngine::tr("module \"%1\" is not installed").arg(uri_arg); - } - return false; + if (errorString) { + bool anyversion = QDeclarativeMetaType::isModule(uri.toUtf8(), -1, -1); + if (anyversion) + *errorString = QDeclarativeEngine::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin); + else + *errorString = QDeclarativeEngine::tr("module \"%1\" is not installed").arg(uri_arg); } + return false; } - } else { + } + } else { - if (importType == QDeclarativeScriptParser::Import::File && qmldircomponents.isEmpty()) { - QUrl importUrl = base.resolved(QUrl(uri + QLatin1String("/qmldir"))); - QString localFileOrQrc = toLocalFileOrQrc(importUrl); - if (!localFileOrQrc.isEmpty()) { - QString dir = toLocalFileOrQrc(base.resolved(QUrl(uri))); - if (dir.isEmpty() || !QDir().exists(dir)) { - if (errorString) - *errorString = QDeclarativeEngine::tr("\"%1\": no such directory").arg(uri_arg); - return false; // local import dirs must exist - } - uri = resolvedUri(toLocalFileOrQrc(base.resolved(QUrl(uri))), engine); - if (uri.endsWith(QLatin1Char('/'))) - uri.chop(1); - if (QFile::exists(localFileOrQrc)) { - if (!importExtension(localFileOrQrc,uri,engine,&qmldircomponents,errorString)) - return false; - } - } else { - if (prefix.isEmpty()) { - // directory must at least exist for valid import - QString localFileOrQrc = toLocalFileOrQrc(base.resolved(QUrl(uri))); - if (localFileOrQrc.isEmpty() || !QDir().exists(localFileOrQrc)) { - if (errorString) { - if (localFileOrQrc.isEmpty()) - *errorString = QDeclarativeEngine::tr("import \"%1\" has no qmldir and no namespace").arg(uri); - else - *errorString = QDeclarativeEngine::tr("\"%1\": no such directory").arg(uri); - } - return false; + if (importType == QDeclarativeScriptParser::Import::File && qmldircomponents.isEmpty()) { + QUrl importUrl = base.resolved(QUrl(uri + QLatin1String("/qmldir"))); + QString localFileOrQrc = toLocalFileOrQrc(importUrl); + if (!localFileOrQrc.isEmpty()) { + QString dir = toLocalFileOrQrc(base.resolved(QUrl(uri))); + if (dir.isEmpty() || !QDir().exists(dir)) { + if (errorString) + *errorString = QDeclarativeEngine::tr("\"%1\": no such directory").arg(uri_arg); + return false; // local import dirs must exist + } + uri = resolvedUri(toLocalFileOrQrc(base.resolved(QUrl(uri))), engine); + if (uri.endsWith(QLatin1Char('/'))) + uri.chop(1); + if (QFile::exists(localFileOrQrc)) { + if (!importExtension(localFileOrQrc,uri,engine,&qmldircomponents,errorString)) + return false; + } + } else { + if (prefix.isEmpty()) { + // directory must at least exist for valid import + QString localFileOrQrc = toLocalFileOrQrc(base.resolved(QUrl(uri))); + if (localFileOrQrc.isEmpty() || !QDir().exists(localFileOrQrc)) { + if (errorString) { + if (localFileOrQrc.isEmpty()) + *errorString = QDeclarativeEngine::tr("import \"%1\" has no qmldir and no namespace").arg(uri); + else + *errorString = QDeclarativeEngine::tr("\"%1\": no such directory").arg(uri); } + return false; } } } - - url = base.resolved(QUrl(url)).toString(); - if (url.endsWith(QLatin1Char('/'))) - url.chop(1); } - if (vmaj > -1 && vmin > -1 && !qmldircomponents.isEmpty()) { - QList<QDeclarativeDirParser::Component>::ConstIterator it = qmldircomponents.begin(); - for (; it != qmldircomponents.end(); ++it) { - if (it->majorVersion > vmaj || (it->majorVersion == vmaj && it->minorVersion >= vmin)) - break; - } - if (it == qmldircomponents.end()) { - *errorString = QDeclarativeEngine::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin); - return false; - } - } - - s->uris.prepend(uri); - s->urls.prepend(url); - s->majversions.prepend(vmaj); - s->minversions.prepend(vmin); - s->isLibrary.prepend(importType == QDeclarativeScriptParser::Import::Library); - s->qmlDirComponents.prepend(qmldircomponents); - return true; + url = base.resolved(QUrl(url)).toString(); + if (url.endsWith(QLatin1Char('/'))) + url.chop(1); } - bool find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return, - QUrl* url_return, QString *errorString) - { - QDeclarativeEnginePrivate::ImportedNamespace *s = 0; - int slash = type.indexOf('/'); - if (slash >= 0) { - QString namespaceName = QString::fromUtf8(type.left(slash)); - s = set.value(namespaceName); - if (!s) { - if (errorString) - *errorString = QDeclarativeEngine::tr("- %1 is not a namespace").arg(namespaceName); - return false; - } - int nslash = type.indexOf('/',slash+1); - if (nslash > 0) { - if (errorString) - *errorString = QDeclarativeEngine::tr("- nested namespaces not allowed"); - return false; - } - } else { - s = &unqualifiedset; + if (vmaj > -1 && vmin > -1 && !qmldircomponents.isEmpty()) { + QList<QDeclarativeDirParser::Component>::ConstIterator it = qmldircomponents.begin(); + for (; it != qmldircomponents.end(); ++it) { + if (it->majorVersion > vmaj || (it->majorVersion == vmaj && it->minorVersion >= vmin)) + break; } - QByteArray unqualifiedtype = slash < 0 ? type : type.mid(slash+1); // common-case opt (QString::mid works fine, but slower) - if (s) { - if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return, &base, errorString)) - return true; - if (s->urls.count() == 1 && !s->isLibrary[0] && url_return && s != &unqualifiedset) { - // qualified, and only 1 url - *url_return = QUrl(s->urls[0]+QLatin1Char('/')).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml"))); - return true; - } + if (it == qmldircomponents.end()) { + *errorString = QDeclarativeEngine::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin); + return false; } - - return false; - } - - QDeclarativeEnginePrivate::ImportedNamespace *findNamespace(const QString& type) - { - return set.value(type); } - QUrl base; - int ref; - -private: - friend struct QDeclarativeEnginePrivate::Imports; - QDeclarativeEnginePrivate::ImportedNamespace unqualifiedset; - QHash<QString,QDeclarativeEnginePrivate::ImportedNamespace* > set; -}; - -QDeclarativeEnginePrivate::Imports::Imports(const Imports ©) : - d(copy.d) -{ - ++d->ref; + s->uris.prepend(uri); + s->urls.prepend(url); + s->majversions.prepend(vmaj); + s->minversions.prepend(vmin); + s->isLibrary.prepend(importType == QDeclarativeScriptParser::Import::Library); + s->qmlDirComponents.prepend(qmldircomponents); + return true; } -QDeclarativeEnginePrivate::Imports &QDeclarativeEnginePrivate::Imports::operator =(const Imports ©) +bool QDeclarativeImportsPrivate::find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return, + QUrl* url_return, QString *errorString) { - ++copy.d->ref; - if (--d->ref == 0) - delete d; - d = copy.d; - return *this; -} + QDeclarativeEnginePrivate::ImportedNamespace *s = 0; + int slash = type.indexOf('/'); + if (slash >= 0) { + QString namespaceName = QString::fromUtf8(type.left(slash)); + s = set.value(namespaceName); + if (!s) { + if (errorString) + *errorString = QDeclarativeEngine::tr("- %1 is not a namespace").arg(namespaceName); + return false; + } + int nslash = type.indexOf('/',slash+1); + if (nslash > 0) { + if (errorString) + *errorString = QDeclarativeEngine::tr("- nested namespaces not allowed"); + return false; + } + } else { + s = &unqualifiedset; + } + QByteArray unqualifiedtype = slash < 0 ? type : type.mid(slash+1); // common-case opt (QString::mid works fine, but slower) + if (s) { + if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return, &base, errorString)) + return true; + if (s->urls.count() == 1 && !s->isLibrary[0] && url_return && s != &unqualifiedset) { + // qualified, and only 1 url + *url_return = QUrl(s->urls[0]+QLatin1Char('/')).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml"))); + return true; + } + } -QDeclarativeEnginePrivate::Imports::Imports() : - d(new QDeclarativeImportsPrivate) -{ + return false; } -QDeclarativeEnginePrivate::Imports::~Imports() +QDeclarativeEnginePrivate::ImportedNamespace *QDeclarativeImportsPrivate::findNamespace(const QString& type) { - if (--d->ref == 0) - delete d; + return set.value(type); } static QDeclarativeTypeNameCache *cacheForNamespace(QDeclarativeEngine *engine, const QDeclarativeEnginePrivate::ImportedNamespace &set, QDeclarativeTypeNameCache *cache) @@ -2000,22 +2024,6 @@ void QDeclarativeEnginePrivate::Imports::cache(QDeclarativeTypeNameCache *cache, cacheForNamespace(engine, set, cache); } -/* -QStringList QDeclarativeEnginePrivate::Imports::unqualifiedSet() const -{ - QStringList rv; - - const QDeclarativeEnginePrivate::ImportedNamespace &set = d->unqualifiedset; - - for (int ii = 0; ii < set.urls.count(); ++ii) { - if (set.isBuiltin.at(ii)) - rv << set.urls.at(ii); - } - - return rv; -} -*/ - /*! Sets the base URL to be used for all relative file imports added. */ @@ -2054,7 +2062,6 @@ void QDeclarativeEngine::addImportPath(const QString& path) } } - /*! Returns the list of directories where the engine searches for installed modules in a URL-based directory structure. diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 743275e..ca033bf 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -244,18 +244,8 @@ public: QDeclarativeValueTypeFactory valueTypes; QHash<const QMetaObject *, QDeclarativePropertyCache *> propertyCache; - QDeclarativePropertyCache *cache(QObject *obj) { - Q_Q(QDeclarativeEngine); - if (!obj || QObjectPrivate::get(obj)->metaObject || - QObjectPrivate::get(obj)->wasDeleted) return 0; - const QMetaObject *mo = obj->metaObject(); - QDeclarativePropertyCache *rv = propertyCache.value(mo); - if (!rv) { - rv = QDeclarativePropertyCache::create(q, mo); - propertyCache.insert(mo, rv); - } - return rv; - } + inline QDeclarativePropertyCache *cache(QObject *obj); + inline QDeclarativePropertyCache *cache(const QMetaObject *); // ### This whole class is embarrassing struct Imports { @@ -361,6 +351,48 @@ public: static void defineModule(); }; +/*! +Returns a QDeclarativePropertyCache for \a obj if one is available. + +If \a obj is null, being deleted or contains a dynamic meta object 0 +is returned. +*/ +QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(QObject *obj) +{ + Q_Q(QDeclarativeEngine); + if (!obj || QObjectPrivate::get(obj)->metaObject || QObjectPrivate::get(obj)->wasDeleted) + return 0; + + const QMetaObject *mo = obj->metaObject(); + QDeclarativePropertyCache *rv = propertyCache.value(mo); + if (!rv) { + rv = new QDeclarativePropertyCache(q, mo); + propertyCache.insert(mo, rv); + } + return rv; +} + +/*! +Returns a QDeclarativePropertyCache for \a metaObject. + +As the cache is persisted for the life of the engine, \a metaObject must be +a static "compile time" meta-object, or a meta-object that is otherwise known to +exist for the lifetime of the QDeclarativeEngine. +*/ +QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(const QMetaObject *metaObject) +{ + Q_Q(QDeclarativeEngine); + Q_ASSERT(metaObject); + + QDeclarativePropertyCache *rv = propertyCache.value(metaObject); + if (!rv) { + rv = new QDeclarativePropertyCache(q, metaObject); + propertyCache.insert(metaObject, rv); + } + + return rv; +} + QT_END_NAMESPACE #endif // QDECLARATIVEENGINE_P_H diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index 0870cfb..25777f5 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -188,9 +188,6 @@ namespace QDeclarativeParser QList<int> lineNumbers; QList<Pragmas> pragmas; }; -#if 0 - QList<ScriptBlock> scripts; -#endif // The bytes to cast instances by to get to the QDeclarativeParserStatus // interface. -1 indicates the type doesn't support this interface. diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index 888945b..f04a706 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -106,9 +106,25 @@ void QDeclarativePropertyCache::Data::load(const QMetaMethod &m) } +/*! +Creates a new empty QDeclarativePropertyCache. +*/ QDeclarativePropertyCache::QDeclarativePropertyCache(QDeclarativeEngine *e) : QDeclarativeCleanup(e), engine(e) { + Q_ASSERT(engine); +} + +/*! +Creates a new QDeclarativePropertyCache of \a metaObject. +*/ +QDeclarativePropertyCache::QDeclarativePropertyCache(QDeclarativeEngine *e, const QMetaObject *metaObject) +: QDeclarativeCleanup(e), engine(e) +{ + Q_ASSERT(engine); + Q_ASSERT(metaObject); + + update(engine, metaObject); } QDeclarativePropertyCache::~QDeclarativePropertyCache() @@ -135,7 +151,7 @@ void QDeclarativePropertyCache::clear() } QDeclarativePropertyCache::Data QDeclarativePropertyCache::create(const QMetaObject *metaObject, - const QString &property) + const QString &property) { Q_ASSERT(metaObject); @@ -245,17 +261,6 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb } } -// ### Optimize - check engine for the parent meta object etc. -QDeclarativePropertyCache *QDeclarativePropertyCache::create(QDeclarativeEngine *engine, const QMetaObject *metaObject) -{ - Q_ASSERT(engine); - Q_ASSERT(metaObject); - - QDeclarativePropertyCache *cache = new QDeclarativePropertyCache(engine); - cache->update(engine, metaObject); - return cache; -} - void QDeclarativePropertyCache::update(QDeclarativeEngine *engine, const QMetaObject *metaObject) { Q_ASSERT(engine); diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h index 6b64a96..b01e5cc 100644 --- a/src/declarative/qml/qdeclarativepropertycache_p.h +++ b/src/declarative/qml/qdeclarativepropertycache_p.h @@ -69,6 +69,7 @@ class QDeclarativePropertyCache : public QDeclarativeRefCount, public QDeclarati { public: QDeclarativePropertyCache(QDeclarativeEngine *); + QDeclarativePropertyCache(QDeclarativeEngine *, const QMetaObject *); virtual ~QDeclarativePropertyCache(); struct Data { diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 8b96733..219d759 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -104,17 +104,13 @@ public: void operator()(const QString &code, AST::Node *node); protected: + Object *defineObjectBinding(AST::UiQualifiedId *propertyName, bool onAssignment, - AST::UiQualifiedId *objectTypeName, + const QString &objectType, + AST::SourceLocation typeLocation, LocationSpan location, AST::UiObjectInitializer *initializer = 0); - Object *defineObjectBinding_helper(AST::UiQualifiedId *propertyName, bool onAssignment, - const QString &objectType, - AST::SourceLocation typeLocation, - LocationSpan location, - AST::UiObjectInitializer *initializer = 0); - QDeclarativeParser::Variant getVariant(AST::ExpressionNode *expr); LocationSpan location(AST::SourceLocation start, AST::SourceLocation end); @@ -240,12 +236,12 @@ QString ProcessAST::asString(AST::UiQualifiedId *node) const } Object * -ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, - bool onAssignment, - const QString &objectType, - AST::SourceLocation typeLocation, - LocationSpan location, - AST::UiObjectInitializer *initializer) +ProcessAST::defineObjectBinding(AST::UiQualifiedId *propertyName, + bool onAssignment, + const QString &objectType, + AST::SourceLocation typeLocation, + LocationSpan location, + AST::UiObjectInitializer *initializer) { int lastTypeDot = objectType.lastIndexOf(QLatin1Char('.')); bool isType = !objectType.isEmpty() && @@ -355,41 +351,6 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, } } -Object *ProcessAST::defineObjectBinding(AST::UiQualifiedId *qualifiedId, bool onAssignment, - AST::UiQualifiedId *objectTypeName, - LocationSpan location, - AST::UiObjectInitializer *initializer) -{ - const QString objectType = asString(objectTypeName); - const AST::SourceLocation typeLocation = objectTypeName->identifierToken; - - if (objectType == QLatin1String("Script")) { - - AST::UiObjectMemberList *it = initializer->members; - for (; it; it = it->next) { - AST::UiScriptBinding *scriptBinding = AST::cast<AST::UiScriptBinding *>(it->member); - if (! scriptBinding) - continue; - - QString propertyName = asString(scriptBinding->qualifiedId); - if (propertyName == QLatin1String("source")) { - if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(scriptBinding->statement)) { - QDeclarativeParser::Variant string = getVariant(stmt->expression); - if (string.isStringList()) { - QStringList urls = string.asStringList(); - // We need to add this as a resource - for (int ii = 0; ii < urls.count(); ++ii) - _parser->_refUrls << QUrl(urls.at(ii)); - } - } - } - } - - } - - return defineObjectBinding_helper(qualifiedId, onAssignment, objectType, typeLocation, location, initializer); -} - LocationSpan ProcessAST::location(AST::UiQualifiedId *id) { return location(id->identifierToken, id->identifierToken); @@ -664,10 +625,11 @@ bool ProcessAST::visit(AST::UiObjectDefinition *node) LocationSpan l = location(node->firstSourceLocation(), node->lastSourceLocation()); - defineObjectBinding(/*propertyName = */ 0, false, - node->qualifiedTypeNameId, - l, - node->initializer); + const QString objectType = asString(node->qualifiedTypeNameId); + const AST::SourceLocation typeLocation = node->qualifiedTypeNameId->identifierToken; + + defineObjectBinding(/*propertyName = */ 0, false, objectType, + typeLocation, l, node->initializer); return false; } @@ -679,10 +641,11 @@ bool ProcessAST::visit(AST::UiObjectBinding *node) LocationSpan l = location(node->qualifiedTypeNameId->identifierToken, node->initializer->rbraceToken); - defineObjectBinding(node->qualifiedId, node->hasOnToken, - node->qualifiedTypeNameId, - l, - node->initializer); + const QString objectType = asString(node->qualifiedTypeNameId); + const AST::SourceLocation typeLocation = node->qualifiedTypeNameId->identifierToken; + + defineObjectBinding(node->qualifiedId, node->hasOnToken, objectType, + typeLocation, l, node->initializer); return false; } diff --git a/src/declarative/util/qdeclarativeopenmetaobject.cpp b/src/declarative/util/qdeclarativeopenmetaobject.cpp index 0e5aaa6..ba5d534 100644 --- a/src/declarative/util/qdeclarativeopenmetaobject.cpp +++ b/src/declarative/util/qdeclarativeopenmetaobject.cpp @@ -305,7 +305,7 @@ void QDeclarativeOpenMetaObject::setCached(bool c) QDeclarativeData *qmldata = QDeclarativeData::get(d->object, true); if (d->cacheProperties) { if (!d->type->d->cache) - d->type->d->cache = QDeclarativePropertyCache::create(d->type->d->engine, this); + d->type->d->cache = new QDeclarativePropertyCache(d->type->d->engine, this); qmldata->propertyCache = d->type->d->cache; d->type->d->cache->addref(); } else { diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 326f130..ba674dd 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7637,7 +7637,13 @@ void QGraphicsObject::ungrabGesture(Qt::GestureType gesture) manager->cleanupCachedGestures(this, gesture); } } +/*! + Updates the item's micro focus. This is slot for convenience. + + \since 4.7 + \sa QInputContext +*/ void QGraphicsObject::updateMicroFocus() { QGraphicsItem::updateMicroFocus(); @@ -7946,6 +7952,13 @@ void QGraphicsItemPrivate::resetHeight() */ /*! + \property QGraphicsObject::effect + \brief the effect attached to this item + + \sa QGraphicsItem::setGraphicsEffect(), QGraphicsItem::graphicsEffect() +*/ + +/*! \class QAbstractGraphicsShapeItem \brief The QAbstractGraphicsShapeItem class provides a common base for all path items. diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 1f89714..320395e 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -975,6 +975,7 @@ bool QGraphicsProxyWidget::eventFilter(QObject *object, QEvent *event) d->styleChangeMode = QGraphicsProxyWidgetPrivate::NoMode; } break; +#ifndef QT_NO_TOOLTIP case QEvent::ToolTipChange: // Propagate tooltip change to the proxy. if (!d->tooltipChangeMode) { @@ -983,6 +984,7 @@ bool QGraphicsProxyWidget::eventFilter(QObject *object, QEvent *event) d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::NoMode; } break; +#endif default: break; } diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index bc8ccb01..28b474b 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -408,12 +408,6 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) } /*! - \fn QGraphicsWidget::geometryChanged() - - This signal gets emitted whenever the geometry is changed in setGeometry(). -*/ - -/*! \fn QRectF QGraphicsWidget::rect() const Returns the item's local rect as a QRectF. This function is equivalent @@ -755,6 +749,17 @@ QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c } /*! + \property QGraphicsWidget::layout + \brief The layout of the widget +*/ + +/*! + \fn void QGraphicsWidget::layoutChanged() + This signal gets emitted whenever the layout of the item changes + \internal +*/ + +/*! Returns this widget's layout, or 0 if no layout is currently managing this widget. diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h index e94d247..8652816 100644 --- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h +++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h @@ -363,3 +363,57 @@ QT_END_NAMESPACE } [super displayIfNeeded]; } + +// This is a hack and it should be removed once we find the real cause for +// the painting problems. +// We have a static variable that signals if we have been called before or not. +static bool firstDrawingInvocation = true; + +// The method below exists only as a workaround to draw/not draw the baseline +// in the title bar. This is to support unifiedToolbar look. + +// This method is very special. To begin with, it is a +// method that will get called only if we enable documentMode. +// Furthermore, it won't get called as a normal method, we swap +// this method with the normal implementation of drawRect in +// _NSThemeFrame. When this method is active, its mission is to +// first call the original drawRect implementation so the widget +// gets proper painting. After that, it needs to detect if there +// is a toolbar or not, in order to decide how to handle the unified +// look. The distinction is important since the presence and +// visibility of a toolbar change the way we enter into unified mode. +// When there is a toolbar and that toolbar is visible, the problem +// is as simple as to tell the toolbar not to draw its baseline. +// However when there is not toolbar or the toolbar is not visible, +// we need to draw a line on top of the baseline, because the baseline +// in that case will belong to the title. For this case we need to draw +// a line on top of the baseline. +// As usual, there is a special case. When we first are called, we might +// need to repaint ourselves one more time. We only need that if we +// didn't get the activation, i.e. when we are launched via the command +// line. And this only if the toolbar is visible from the beginning, +// so we have a special flag that signals if we need to repaint or not. +- (void)drawRectSpecial:(NSRect)rect +{ + // Call the original drawing method. + [self drawRectOriginal:rect]; + NSWindow *window = [self window]; + NSToolbar *toolbar = [window toolbar]; + if(!toolbar) { + // There is no toolbar, we have to draw a line on top of the line drawn by Cocoa. + macDrawRectOnTop((void *)window); + } else { + if([toolbar isVisible]) { + // We tell Cocoa to avoid drawing the line at the end. + if(firstDrawingInvocation) { + firstDrawingInvocation = false; + macSyncDrawingOnFirstInvocation((void *)window); + } else + [toolbar setShowsBaselineSeparator:NO]; + } else { + // There is a toolbar but it is not visible so + // we have to draw a line on top of the line drawn by Cocoa. + macDrawRectOnTop((void *)window); + } + } +} diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index dd12f65..4953c48 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1554,7 +1554,8 @@ Qt::DropAction QDragManager::drag(QDrag *o) qt_button_down = 0; [dndParams.view release]; [image release]; - dragPrivate()->executed_action = Qt::IgnoreAction; + if (dragPrivate()) + dragPrivate()->executed_action = Qt::IgnoreAction; object = 0; Qt::DropAction performedAction(qt_mac_mapNSDragOperation(qMacDnDParams()->performedAction)); // do post drag processing, if required. diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index a05c7d5..024c1fc 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1163,15 +1163,81 @@ void qt_mac_updateContentBorderMetricts(void * /*OSWindowRef */window, const ::H #endif } +#if QT_MAC_USE_COCOA +void qt_mac_replaceDrawRect(void * /*OSWindowRef */window, QWidgetPrivate *widget) +{ + QMacCocoaAutoReleasePool pool; + OSWindowRef theWindow = static_cast<OSWindowRef>(window); + if(!theWindow) + return; + id theClass = [[[theWindow contentView] superview] class]; + // What we do here is basically to add a new selector to NSThemeFrame called + // "drawRectOriginal:" which will contain the original implementation of + // "drawRect:". After that we get the new implementation from QCocoaWindow + // and exchange them. The new implementation is called drawRectSpecial. + // We cannot just add the method because it might have been added before and since + // we cannot remove a method once it has been added we need to ask QCocoaWindow if + // we did the swap or not. + if(!widget->drawRectOriginalAdded) { + Method m2 = class_getInstanceMethod(theClass, @selector(drawRect:)); + if(!m2) { + // This case is pretty extreme, no drawRect means no drawing! + return; + } + class_addMethod(theClass, @selector(drawRectOriginal:), method_getImplementation(m2), method_getTypeEncoding(m2)); + widget->drawRectOriginalAdded = true; + } + if(widget->originalDrawMethod) { + Method m0 = class_getInstanceMethod([theWindow class], @selector(drawRectSpecial:)); + if(!m0) { + // Ok, this means the methods were never swapped. Just ignore + return; + } + Method m1 = class_getInstanceMethod(theClass, @selector(drawRect:)); + if(!m1) { + // Ok, this means the methods were never swapped. Just ignore + return; + } + // We have the original method here. Proceed and swap the methods. + method_exchangeImplementations(m1, m0); + widget->originalDrawMethod = false; + [window display]; + } +} + +void qt_mac_replaceDrawRectOriginal(void * /*OSWindowRef */window, QWidgetPrivate *widget) +{ + QMacCocoaAutoReleasePool pool; + OSWindowRef theWindow = static_cast<OSWindowRef>(window); + id theClass = [[[theWindow contentView] superview] class]; + // Now we need to revert the methods to their original state. + // We cannot remove the method, so we just keep track of it in QCocoaWindow. + Method m0 = class_getInstanceMethod([theWindow class], @selector(drawRectSpecial:)); + if(!m0) { + // Ok, this means the methods were never swapped. Just ignore + return; + } + Method m1 = class_getInstanceMethod(theClass, @selector(drawRect:)); + if(!m1) { + // Ok, this means the methods were never swapped. Just ignore + return; + } + method_exchangeImplementations(m1, m0); + widget->originalDrawMethod = true; + [window display]; +} +#endif // QT_MAC_USE_COCOA + void qt_mac_showBaseLineSeparator(void * /*OSWindowRef */window, bool show) { + if(!window) + return; #if QT_MAC_USE_COCOA QMacCocoaAutoReleasePool pool; OSWindowRef theWindow = static_cast<OSWindowRef>(window); NSToolbar *macToolbar = [theWindow toolbar]; - if (macToolbar) - [macToolbar setShowsBaselineSeparator: show]; -#endif + [macToolbar setShowsBaselineSeparator:show]; +#endif // QT_MAC_USE_COCOA } QStringList qt_mac_NSArrayToQStringList(void *nsarray) @@ -1403,4 +1469,52 @@ void qt_mac_post_retranslateAppMenu() #endif } +#ifdef QT_MAC_USE_COCOA +// This method implements the magic for the drawRectSpecial method. +// We draw a line at the upper edge of the content view in order to +// override the title baseline. +void macDrawRectOnTop(void * /*OSWindowRef */window) +{ + OSWindowRef theWindow = static_cast<OSWindowRef>(window); + NSView *contentView = [theWindow contentView]; + if(!contentView) + return; + // Get coordinates of the content view + NSRect contentRect = [contentView frame]; + // Draw a line on top of the already drawn line. + // We need to check if we are active or not to use the proper color. + if([window isKeyWindow] || [window isMainWindow]) { + [[NSColor colorWithCalibratedRed:1.0 green:1.0 blue:1.0 alpha:1.0] set]; + } else { + [[NSColor colorWithCalibratedRed:1.0 green:1.0 blue:1.0 alpha:1.0] set]; + } + NSPoint origin = NSMakePoint(0, contentRect.size.height); + NSPoint end = NSMakePoint(contentRect.size.width, contentRect.size.height); + [NSBezierPath strokeLineFromPoint:origin toPoint:end]; +} + +// This method will (or at least should) get called only once. +// Its mission is to find out if we are active or not. If we are active +// we assume that we were launched via finder, otherwise we assume +// we were called from the command line. The distinction is important, +// since in the first case we don't need to trigger a paintEvent, while +// in the second case we do. +void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window) +{ + OSWindowRef theWindow = static_cast<OSWindowRef>(window); + NSApplication *application = [NSApplication sharedApplication]; + NSToolbar *toolbar = [window toolbar]; + if([application isActive]) { + // Launched from finder + [toolbar setShowsBaselineSeparator:NO]; + } else { + // Launched from commandline + [toolbar setVisible:false]; + [toolbar setShowsBaselineSeparator:NO]; + [toolbar setVisible:true]; + [theWindow display]; + } +} +#endif // QT_MAC_USE_COCOA + QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 3fd62a4..5db121a 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -131,6 +131,8 @@ void macWindowSetHasShadow( void * /*OSWindowRef*/ window, bool hasShadow ); void macWindowFlush(void * /*OSWindowRef*/ window); void macSendToolbarChangeEvent(QWidget *widget); void qt_mac_updateContentBorderMetricts(void * /*OSWindowRef */window, const ::HIContentBorderMetrics &metrics); +void qt_mac_replaceDrawRect(void * /*OSWindowRef */window, QWidgetPrivate *widget); +void qt_mac_replaceDrawRectOriginal(void * /*OSWindowRef */window, QWidgetPrivate *widget); void qt_mac_showBaseLineSeparator(void * /*OSWindowRef */window, bool show); void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm); void qt_mac_update_mouseTracking(QWidget *widget); @@ -140,6 +142,9 @@ void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent); #ifdef QT_MAC_USE_COCOA bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent); void qt_cocoaChangeOverrideCursor(const QCursor &cursor); +// These methods exists only for supporting unified mode. +void macDrawRectOnTop(void * /*OSWindowRef */ window); +void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window); #endif void qt_mac_menu_collapseSeparators(void * /*NSMenu */ menu, bool collapse); bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent); diff --git a/src/gui/kernel/qt_mac_p.h b/src/gui/kernel/qt_mac_p.h index 7bfb257..3341ce1 100644 --- a/src/gui/kernel/qt_mac_p.h +++ b/src/gui/kernel/qt_mac_p.h @@ -57,6 +57,7 @@ #ifdef __OBJC__ #include <Cocoa/Cocoa.h> +#include <objc/runtime.h> #endif #include <CoreServices/CoreServices.h> diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index b59824c..20d1d30 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -220,6 +220,11 @@ QWidgetPrivate::QWidgetPrivate(int version) isWidget = true; memset(high_attributes, 0, sizeof(high_attributes)); +#if QT_MAC_USE_COCOA + drawRectOriginalAdded = false; + originalDrawMethod = true; + changeMethods = false; +#endif // QT_MAC_USE_COCOA #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; qDebug() << "widgets" << ++count; @@ -12292,6 +12297,28 @@ void QWidgetPrivate::_q_delayedDestroy(WId winId) } #endif +#if QT_MAC_USE_COCOA +void QWidgetPrivate::syncUnifiedMode() { + // The whole purpose of this method is to keep the unifiedToolbar in sync. + // That means making sure we either exchange the drawing methods or we let + // the toolbar know that it does not require to draw the baseline. + Q_Q(QWidget); + // This function makes sense only if this is a top level + if(!q->isWindow()) + return; + OSWindowRef window = qt_mac_window_for(q); + if(changeMethods) { + // Ok, we are in documentMode. + if(originalDrawMethod) + qt_mac_replaceDrawRect(window, this); + } else { + if(!originalDrawMethod) + qt_mac_replaceDrawRectOriginal(window, this); + } +} + +#endif // QT_MAC_USE_COCOA + QT_END_NAMESPACE #include "moc_qwidget.cpp" diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 89ea256..cad60b5 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -773,6 +773,13 @@ public: void finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ windowRef); void syncCocoaMask(); void finishCocoaMaskSetup(); + void syncUnifiedMode(); + // Did we add the drawRectOriginal method? + bool drawRectOriginalAdded; + // Is the original drawRect method available? + bool originalDrawMethod; + // Do we need to change the methods? + bool changeMethods; #endif void determineWindowClass(); void transferChildren(); diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index e8400d6..aaa113b 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -2066,6 +2066,7 @@ bool QMenuBarPrivate::macUpdateMenuBarImmediatly() cancelAllMenuTracking(); QWidget *w = findWindowThatShouldDisplayMenubar(); QMenuBar *mb = findMenubarForWindow(w); + extern bool qt_mac_app_fullscreen; //qapplication_mac.mm // We need to see if we are in full screen mode, if so we need to // switch the full screen mode to be able to show or hide the menubar. @@ -2074,12 +2075,14 @@ bool QMenuBarPrivate::macUpdateMenuBarImmediatly() if(w->isFullScreen()) { // Ok, switch to showing the menubar when hovering over it. SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar); + qt_mac_app_fullscreen = true; } } else if(w) { // Removing a menubar if(w->isFullScreen()) { // Ok, switch to not showing the menubar when hovering on it SetSystemUIMode(kUIModeAllHidden, 0); + qt_mac_app_fullscreen = true; } } diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index d03a2f4..8aaaade 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -69,6 +69,7 @@ QT_BEGIN_NAMESPACE + inline static bool verticalTabs(QTabBar::Shape shape) { return shape == QTabBar::RoundedWest @@ -95,9 +96,20 @@ void QTabBarPrivate::updateMacBorderMetrics() metrics.left = 0; metrics.right = 0; qt_mac_updateContentBorderMetricts(window, metrics); - - // hide the base line separator if the tabs have docuemnt mode enabled (Cocoa) - qt_mac_showBaseLineSeparator(window, !documentMode); +#if QT_MAC_USE_COCOA + // In Cocoa we need to keep track of the drawRect method. + // If documentMode is enabled we need to change it, unless + // a toolbar is present. + // Notice that all the information is kept in the window, + // that's why we get the private widget for it instead of + // the private widget for this widget. + QWidgetPrivate *privateWidget = qt_widget_private(q->window()); + if(privateWidget) + privateWidget->changeMethods = documentMode; + // Since in Cocoa there is no simple way to remove the baseline, so we just ask the + // top level to do the magic for us. + privateWidget->syncUnifiedMode(); +#endif // QT_MAC_USE_COCOA } #endif } @@ -2193,6 +2205,7 @@ bool QTabBar::documentMode() const void QTabBar::setDocumentMode(bool enabled) { Q_D(QTabBar); + d->documentMode = enabled; d->updateMacBorderMetrics(); } diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 7f6df0a..97219f4 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -2311,7 +2311,7 @@ void QFtpPrivate::_q_piError(int errorCode, const QString &text) Q_Q(QFtp); if (pending.isEmpty()) { - qWarning() << "QFtpPrivate::_q_piError was called without pending command!"; + qWarning("QFtpPrivate::_q_piError was called without pending command!"); return; } diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index a0ffb07..95e45f0 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -62,7 +62,7 @@ class QNetworkReply; class QNetworkProxy; class QNetworkProxyFactory; class QSslError; -#ifndef QT_NO_BEARERMANAGEMENT +#if !defined(QT_NO_BEARERMANAGEMENT) && !defined(QT_MOBILITY_BEARER) class QNetworkConfiguration; #endif @@ -121,11 +121,13 @@ public: QNetworkReply *deleteResource(const QNetworkRequest &request); QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data = 0); -#ifndef QT_NO_BEARERMANAGEMENT +#if !defined(QT_NO_BEARERMANAGEMENT) && !defined(QT_MOBILITY_BEARER) void setConfiguration(const QNetworkConfiguration &config); QNetworkConfiguration configuration() const; QNetworkConfiguration activeConfiguration() const; +#endif +#ifndef QT_NO_BEARERMANAGEMENT void setNetworkAccessible(NetworkAccessibility accessible); NetworkAccessibility networkAccessible() const; #endif @@ -140,9 +142,11 @@ Q_SIGNALS: void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors); #endif -#ifndef QT_NO_BEARERMANAGEMENT +#if !defined(QT_NO_BEARERMANAGEMENT) && !defined(QT_MOBILITY_BEARER) void networkSessionConnected(); +#endif +#ifndef QT_NO_BEARERMANAGEMENT void networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility accessible); #endif @@ -155,7 +159,7 @@ private: Q_DECLARE_PRIVATE(QNetworkAccessManager) Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList<QSslError>)) -#ifndef QT_NO_BEARERMANAGEMENT +#if !defined(QT_NO_BEARERMANAGEMENT) && !defined(QT_MOBILITY_BEARER) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionNewConfigurationActivated()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionPreferredConfigurationChanged(QNetworkConfiguration,bool)) diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index daa827e..f39d538 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -605,7 +605,11 @@ int QAccessibleDisplay::navigate(RelationFlag rel, int entry, QAccessibleInterfa /*! \reimp */ QString QAccessibleDisplay::imageDescription() { +#ifndef QT_NO_TOOLTIP return widget()->toolTip(); +#else + return QString::null; +#endif } /*! \reimp */ diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 16b0cbe..058fda1 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -89,6 +89,8 @@ tst_examples::tst_examples() excludedDirs << "examples/declarative/imageprovider"; excludedDirs << "demos/declarative/minehunt"; + excludedDirs << "doc/src/snippets/declarative/graphicswidgets"; + #ifdef QT_NO_WEBKIT excludedDirs << "examples/declarative/webview"; excludedDirs << "demos/declarative/webbrowser"; diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index a951827..6c19566 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -419,10 +419,8 @@ void tst_qdeclarativedom::loadSyntaxErrors() void tst_qdeclarativedom::loadRemoteErrors() { QByteArray qml = "import Qt 4.7\n" + "import \"http://localhost/exampleQmlScript.js\" as Script\n" "Item {\n" - " Script {\n" - " source: \"http://localhost/exampleQmlScript.js\"" - " }\n" "}"; QDeclarativeDomDocument document; QVERIFY(false == document.load(&engine, qml)); diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index b4ac0e1..7a23773 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -41,6 +41,7 @@ #include <QtTest/QtTest> #include <private/qlistmodelinterface_p.h> #include <qdeclarativeview.h> +#include <qdeclarativeengine.h> #include <private/qdeclarativerectangle_p.h> #include <private/qdeclarativepositioners_p.h> #include <private/qdeclarativetransition_p.h> @@ -69,6 +70,7 @@ private slots: void test_repeater(); void test_flow(); void test_flow_resize(); + void test_conflictinganchors(); private: QDeclarativeView *createView(const QString &filename); }; @@ -100,6 +102,8 @@ void tst_QDeclarativePositioners::test_horizontal() QDeclarativeItem *row = canvas->rootObject()->findChild<QDeclarativeItem*>("row"); QCOMPARE(row->width(), 110.0); QCOMPARE(row->height(), 50.0); + + delete canvas; } void tst_QDeclarativePositioners::test_horizontal_spacing() @@ -125,6 +129,8 @@ void tst_QDeclarativePositioners::test_horizontal_spacing() QDeclarativeItem *row = canvas->rootObject()->findChild<QDeclarativeItem*>("row"); QCOMPARE(row->width(), 130.0); QCOMPARE(row->height(), 50.0); + + delete canvas; } void tst_QDeclarativePositioners::test_horizontal_animated() @@ -175,6 +181,8 @@ void tst_QDeclarativePositioners::test_horizontal_animated() QTRY_COMPARE(two->x(), 50.0); QTRY_COMPARE(three->x(), 100.0); + + delete canvas; } void tst_QDeclarativePositioners::test_vertical() @@ -201,6 +209,8 @@ void tst_QDeclarativePositioners::test_vertical() QVERIFY(column); QCOMPARE(column->height(), 80.0); QCOMPARE(column->width(), 50.0); + + delete canvas; } void tst_QDeclarativePositioners::test_vertical_spacing() @@ -226,6 +236,8 @@ void tst_QDeclarativePositioners::test_vertical_spacing() QDeclarativeItem *column = canvas->rootObject()->findChild<QDeclarativeItem*>("column"); QCOMPARE(column->height(), 100.0); QCOMPARE(column->width(), 50.0); + + delete canvas; } void tst_QDeclarativePositioners::test_vertical_animated() @@ -273,6 +285,7 @@ void tst_QDeclarativePositioners::test_vertical_animated() QTRY_COMPARE(two->y(), 50.0); QTRY_COMPARE(three->y(), 100.0); + delete canvas; } void tst_QDeclarativePositioners::test_grid() @@ -304,6 +317,8 @@ void tst_QDeclarativePositioners::test_grid() QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); QCOMPARE(grid->width(), 120.0); QCOMPARE(grid->height(), 100.0); + + delete canvas; } void tst_QDeclarativePositioners::test_grid_topToBottom() @@ -335,6 +350,8 @@ void tst_QDeclarativePositioners::test_grid_topToBottom() QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); QCOMPARE(grid->width(), 100.0); QCOMPARE(grid->height(), 120.0); + + delete canvas; } void tst_QDeclarativePositioners::test_grid_spacing() @@ -366,6 +383,8 @@ void tst_QDeclarativePositioners::test_grid_spacing() QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); QCOMPARE(grid->width(), 128.0); QCOMPARE(grid->height(), 104.0); + + delete canvas; } void tst_QDeclarativePositioners::test_grid_animated() @@ -446,6 +465,7 @@ void tst_QDeclarativePositioners::test_grid_animated() QTRY_COMPARE(five->x(), 50.0); QTRY_COMPARE(five->y(), 50.0); + delete canvas; } void tst_QDeclarativePositioners::test_grid_zero_columns() @@ -477,6 +497,8 @@ void tst_QDeclarativePositioners::test_grid_zero_columns() QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); QCOMPARE(grid->width(), 170.0); QCOMPARE(grid->height(), 60.0); + + delete canvas; } void tst_QDeclarativePositioners::test_propertychanges() @@ -534,6 +556,8 @@ void tst_QDeclarativePositioners::test_propertychanges() grid->setRows(2); QCOMPARE(columnsSpy.count(),2); QCOMPARE(rowsSpy.count(),2); + + delete canvas; } void tst_QDeclarativePositioners::test_repeater() @@ -555,6 +579,8 @@ void tst_QDeclarativePositioners::test_repeater() QCOMPARE(two->y(), 0.0); QCOMPARE(three->x(), 100.0); QCOMPARE(three->y(), 0.0); + + delete canvas; } void tst_QDeclarativePositioners::test_flow() @@ -587,6 +613,8 @@ void tst_QDeclarativePositioners::test_flow() QVERIFY(flow); QCOMPARE(flow->width(), 90.0); QCOMPARE(flow->height(), 120.0); + + delete canvas; } void tst_QDeclarativePositioners::test_flow_resize() @@ -618,6 +646,78 @@ void tst_QDeclarativePositioners::test_flow_resize() QCOMPARE(four->y(), 50.0); QCOMPARE(five->x(), 50.0); QCOMPARE(five->y(), 50.0); + + delete canvas; +} + +QString warningMessage; + +void interceptWarnings(QtMsgType type, const char *msg) +{ + Q_UNUSED( type ); + warningMessage = msg; +} + +void tst_QDeclarativePositioners::test_conflictinganchors() +{ + qInstallMsgHandler(interceptWarnings); + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + + component.setData("import Qt 4.7\nColumn { Item {} }", QUrl::fromLocalFile("")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + + component.setData("import Qt 4.7\nRow { Item {} }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + + component.setData("import Qt 4.7\nGrid { Item {} }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + + component.setData("import Qt 4.7\nFlow { Item {} }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + + component.setData("import Qt 4.7\nColumn { Item { anchors.top: parent.top } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom or verticalCenter anchors for items inside Column")); + warningMessage.clear(); + + component.setData("import Qt 4.7\nColumn { Item { anchors.left: parent.left } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + warningMessage.clear(); + + component.setData("import Qt 4.7\nRow { Item { anchors.left: parent.left } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right or horizontalCenter anchors for items inside Row")); + warningMessage.clear(); + + component.setData("import Qt 4.7\nRow { Item { anchors.top: parent.top } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + warningMessage.clear(); + + component.setData("import Qt 4.7\nGrid { Item { anchors.horizontalCenter: parent.horizontalCenter } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid")); + warningMessage.clear(); + + component.setData("import Qt 4.7\nFlow { Item { anchors.verticalCenter: parent.verticalCenter } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow")); } QDeclarativeView *tst_QDeclarativePositioners::createView(const QString &filename) diff --git a/tests/auto/qlist/tst_qlist.cpp b/tests/auto/qlist/tst_qlist.cpp index e2944cc..ba8aefa 100644 --- a/tests/auto/qlist/tst_qlist.cpp +++ b/tests/auto/qlist/tst_qlist.cpp @@ -62,6 +62,33 @@ private slots: void append() const; void prepend() const; void mid() const; + void at() const; + void first() const; + void last() const; + void begin() const; + void end() const; + void contains() const; + void count() const; + void empty() const; + void endsWith() const; + void lastIndexOf() const; + void move() const; + void removeAll() const; + void removeAt() const; + void removeOne() const; + void replace() const; + void startsWith() const; + void swap() const; + void takeAt() const; + void takeFirst() const; + void takeLast() const; + void toSet() const; + void toStdList() const; + void toVector() const; + void value() const; + + void testSTLIterators() const; + void testOperators() const; }; void tst_QList::length() const @@ -173,5 +200,467 @@ void tst_QList::mid() const QList<QString>() << "bak" << "buck" << "hello"); } +void tst_QList::at() const +{ + // test at() and make sure it functions correctly with some simple list manipulation. + QList<QString> list; + + // create a list + list << "foo" << "bar" << "baz"; + QVERIFY(list.size() == 3); + QCOMPARE(list.at(0), QLatin1String("foo")); + QCOMPARE(list.at(1), QLatin1String("bar")); + QCOMPARE(list.at(2), QLatin1String("baz")); + + // append an item + list << "hello"; + QVERIFY(list.size() == 4); + QCOMPARE(list.at(0), QLatin1String("foo")); + QCOMPARE(list.at(1), QLatin1String("bar")); + QCOMPARE(list.at(2), QLatin1String("baz")); + QCOMPARE(list.at(3), QLatin1String("hello")); + + // remove an item + list.removeAt(1); + QVERIFY(list.size() == 3); + QCOMPARE(list.at(0), QLatin1String("foo")); + QCOMPARE(list.at(1), QLatin1String("baz")); + QCOMPARE(list.at(2), QLatin1String("hello")); +} + +void tst_QList::first() const +{ + QList<QString> list; + list << "foo" << "bar"; + + QCOMPARE(list.first(), QLatin1String("foo")); + + // remove an item, make sure it still works + list.pop_front(); + QVERIFY(list.size() == 1); + QCOMPARE(list.first(), QLatin1String("bar")); +} + +void tst_QList::last() const +{ + QList<QString> list; + list << "foo" << "bar"; + + QCOMPARE(list.last(), QLatin1String("bar")); + + // remove an item, make sure it still works + list.pop_back(); + QVERIFY(list.size() == 1); + QCOMPARE(list.last(), QLatin1String("foo")); +} + +void tst_QList::begin() const +{ + QList<QString> list; + list << "foo" << "bar"; + + QCOMPARE(*list.begin(), QLatin1String("foo")); + + // remove an item, make sure it still works + list.pop_front(); + QVERIFY(list.size() == 1); + QCOMPARE(*list.begin(), QLatin1String("bar")); +} + +void tst_QList::end() const +{ + QList<QString> list; + list << "foo" << "bar"; + + QCOMPARE(*--list.end(), QLatin1String("bar")); + + // remove an item, make sure it still works + list.pop_back(); + QVERIFY(list.size() == 1); + QCOMPARE(*--list.end(), QLatin1String("foo")); +} + +void tst_QList::contains() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + QVERIFY(list.contains(QLatin1String("foo")) == true); + QVERIFY(list.contains(QLatin1String("pirates")) != true); + + // add it and make sure it matches + list.append(QLatin1String("ninjas")); + QVERIFY(list.contains(QLatin1String("ninjas")) == true); +} + +void tst_QList::count() const +{ + QList<QString> list; + + // starts empty + QVERIFY(list.count() == 0); + + // goes up + list.append(QLatin1String("foo")); + QVERIFY(list.count() == 1); + + // and up + list.append(QLatin1String("bar")); + QVERIFY(list.count() == 2); + + // and down + list.pop_back(); + QVERIFY(list.count() == 1); + + // and empty. :) + list.pop_back(); + QVERIFY(list.count() == 0); +} + +void tst_QList::empty() const +{ + QList<QString> list; + + // make sure it starts empty + QVERIFY(list.empty()); + + // and doesn't stay empty + list.append(QLatin1String("foo")); + QVERIFY(!list.empty()); + + // and goes back to being empty + list.pop_back(); + QVERIFY(list.empty()); +} + +void tst_QList::endsWith() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // test it returns correctly in both cases + QVERIFY(list.endsWith(QLatin1String("baz"))); + QVERIFY(!list.endsWith(QLatin1String("bar"))); + + // remove an item and make sure the end item changes + list.pop_back(); + QVERIFY(list.endsWith(QLatin1String("bar"))); +} + +void tst_QList::lastIndexOf() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // one instance of the target item + QVERIFY(list.lastIndexOf(QLatin1String("baz")) == 2); + + // shouldn't find this + QVERIFY(list.lastIndexOf(QLatin1String("shouldntfindme")) == -1); + + // multiple instances + list.append("baz"); + list.append("baz"); + QVERIFY(list.lastIndexOf(QLatin1String("baz")) == 4); + + // search from the middle to find the last one + QVERIFY(list.lastIndexOf(QLatin1String("baz"), 3) == 3); + + // try find none + QVERIFY(list.lastIndexOf(QLatin1String("baz"), 1) == -1); +} + +void tst_QList::move() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // move an item + list.move(0, list.count() - 1); + QCOMPARE(list, QList<QString>() << "bar" << "baz" << "foo"); + + // move it back + list.move(list.count() - 1, 0); + QCOMPARE(list, QList<QString>() << "foo" << "bar" << "baz"); + + // move an item in the middle + list.move(1, 0); + QCOMPARE(list, QList<QString>() << "bar" << "foo" << "baz"); +} + +void tst_QList::removeAll() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // remove one instance + list.removeAll(QLatin1String("bar")); + QCOMPARE(list, QList<QString>() << "foo" << "baz"); + + // many instances + list << "foo" << "bar" << "baz"; + list << "foo" << "bar" << "baz"; + list << "foo" << "bar" << "baz"; + list.removeAll(QLatin1String("bar")); + QCOMPARE(list, QList<QString>() << "foo" << "baz" << "foo" << "baz" << "foo" << "baz" << "foo" << "baz"); + + // try remove something that doesn't exist + list.removeAll(QLatin1String("you won't remove anything I hope")); + QCOMPARE(list, QList<QString>() << "foo" << "baz" << "foo" << "baz" << "foo" << "baz" << "foo" << "baz"); +} + +void tst_QList::removeAt() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // middle + list.removeAt(1); + QCOMPARE(list, QList<QString>() << "foo" << "baz"); + + // start + list.removeAt(0); + QCOMPARE(list, QList<QString>() << "baz"); + + // final + list.removeAt(0); + QCOMPARE(list, QList<QString>()); +} + +void tst_QList::removeOne() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // middle + list.removeOne(QLatin1String("bar")); + QCOMPARE(list, QList<QString>() << "foo" << "baz"); + + // start + list.removeOne(QLatin1String("foo")); + QCOMPARE(list, QList<QString>() << "baz"); + + // last + list.removeOne(QLatin1String("baz")); + QCOMPARE(list, QList<QString>()); + + // make sure it really only removes one :) + list << "foo" << "foo"; + list.removeOne("foo"); + QCOMPARE(list, QList<QString>() << "foo"); + + // try remove something that doesn't exist + list.removeOne(QLatin1String("you won't remove anything I hope")); + QCOMPARE(list, QList<QString>() << "foo"); +} + +void tst_QList::replace() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // start + list.replace(0, "moo"); + QCOMPARE(list, QList<QString>() << "moo" << "bar" << "baz"); + + // middle + list.replace(1, "cow"); + QCOMPARE(list, QList<QString>() << "moo" << "cow" << "baz"); + + // end + list.replace(2, "milk"); + QCOMPARE(list, QList<QString>() << "moo" << "cow" << "milk"); +} + +void tst_QList::startsWith() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // make sure it starts ok + QVERIFY(list.startsWith(QLatin1String("foo"))); + + // remove an item + list.removeFirst(); + QVERIFY(list.startsWith(QLatin1String("bar"))); +} + +void tst_QList::swap() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // swap + list.swap(0, 2); + QCOMPARE(list, QList<QString>() << "baz" << "bar" << "foo"); + + // swap again + list.swap(1, 2); + QCOMPARE(list, QList<QString>() << "baz" << "foo" << "bar"); +} + +void tst_QList::takeAt() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + QCOMPARE(list.takeAt(0), QLatin1String("foo")); + QVERIFY(list.size() == 2); + QCOMPARE(list.takeAt(1), QLatin1String("baz")); + QVERIFY(list.size() == 1); + QCOMPARE(list.takeAt(0), QLatin1String("bar")); + QVERIFY(list.size() == 0); +} + +void tst_QList::takeFirst() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + QCOMPARE(list.takeFirst(), QLatin1String("foo")); + QVERIFY(list.size() == 2); + QCOMPARE(list.takeFirst(), QLatin1String("bar")); + QVERIFY(list.size() == 1); + QCOMPARE(list.takeFirst(), QLatin1String("baz")); + QVERIFY(list.size() == 0); +} + +void tst_QList::takeLast() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + QCOMPARE(list.takeLast(), QLatin1String("baz")); + QCOMPARE(list.takeLast(), QLatin1String("bar")); + QCOMPARE(list.takeLast(), QLatin1String("foo")); +} + +void tst_QList::toSet() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // no duplicates + QCOMPARE(list.toSet(), QSet<QString>() << "foo" << "bar" << "baz"); + QCOMPARE(list, QList<QString>() << "foo" << "bar" << "baz"); + + // duplicates (is this more of a QSet test?) + list << "foo" << "bar" << "baz"; + QCOMPARE(list.toSet(), QSet<QString>() << "foo" << "bar" << "baz"); + QCOMPARE(list, QList<QString>() << "foo" << "bar" << "baz" << "foo" << "bar" << "baz"); +} + +void tst_QList::toStdList() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // yuck. + std::list<QString> slist; + slist.push_back(QLatin1String("foo")); + slist.push_back(QLatin1String("bar")); + slist.push_back(QLatin1String("baz")); + + QCOMPARE(list.toStdList(), slist); + QCOMPARE(list, QList<QString>() << "foo" << "bar" << "baz"); +} + +void tst_QList::toVector() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + QCOMPARE(list.toVector(), QVector<QString>() << "foo" << "bar" << "baz"); +} + +void tst_QList::value() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + // test real values + QCOMPARE(list.value(0), QLatin1String("foo")); + QCOMPARE(list.value(2), QLatin1String("baz")); + + // test empty default + QCOMPARE(list.value(3), QString()); + QCOMPARE(list.value(-1), QString()); + + // test defaults + QLatin1String defaultstr("default"); + QCOMPARE(list.value(-1, defaultstr), defaultstr); + QCOMPARE(list.value(3, defaultstr), defaultstr); +} + +void tst_QList::testOperators() const +{ + QList<QString> list; + list << "foo" << "bar" << "baz"; + + QList<QString> listtwo; + listtwo << "foo" << "bar" << "baz"; + + // test equal + QVERIFY(list == listtwo); + + // not equal + listtwo.append("not equal"); + QVERIFY(list != listtwo); + + // += + list += listtwo; + QVERIFY(list.size() == 7); + QVERIFY(listtwo.size() == 4); + QCOMPARE(list, QList<QString>() << "foo" << "bar" << "baz" << "foo" << "bar" << "baz" << "not equal"); + + // = + list = listtwo; + QCOMPARE(list, listtwo); + QCOMPARE(list, QList<QString>() << "foo" << "bar" << "baz" << "not equal"); + + // [] + QCOMPARE(list[0], QLatin1String("foo")); + QCOMPARE(list[list.size() - 1], QLatin1String("not equal")); +} + +void tst_QList::testSTLIterators() const +{ + QList<QString> list; + + // create a list + list << "foo" << "bar" << "baz"; + QList<QString>::iterator it = list.begin(); + QCOMPARE(*it, QLatin1String("foo")); it++; + QCOMPARE(*it, QLatin1String("bar")); it++; + QCOMPARE(*it, QLatin1String("baz")); it++; + QCOMPARE(it, list.end()); it--; + + // walk backwards + QCOMPARE(*it, QLatin1String("baz")); it--; + QCOMPARE(*it, QLatin1String("bar")); it--; + QCOMPARE(*it, QLatin1String("foo")); + + // test erase + it = list.erase(it); + QVERIFY(list.size() == 2); + QCOMPARE(*it, QLatin1String("bar")); + + // test multiple erase + it = list.erase(it, it + 2); + QVERIFY(list.size() == 0); + QCOMPARE(it, list.end()); + + // insert again + it = list.insert(it, QLatin1String("foo")); + QVERIFY(list.size() == 1); + QCOMPARE(*it, QLatin1String("foo")); + + // insert again + it = list.insert(it, QLatin1String("bar")); + QVERIFY(list.size() == 2); + QCOMPARE(*it++, QLatin1String("bar")); + QCOMPARE(*it, QLatin1String("foo")); +} + QTEST_APPLESS_MAIN(tst_QList) #include "tst_qlist.moc" diff --git a/tests/benchmarks/declarative/compilation/compilation.pro b/tests/benchmarks/declarative/compilation/compilation.pro new file mode 100644 index 0000000..32f4aba --- /dev/null +++ b/tests/benchmarks/declarative/compilation/compilation.pro @@ -0,0 +1,11 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_compilation +QT += declarative +macx:CONFIG -= app_bundle + +CONFIG += release + +SOURCES += tst_compilation.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/benchmarks/declarative/compilation/data/BoomBlock.qml b/tests/benchmarks/declarative/compilation/data/BoomBlock.qml new file mode 100644 index 0000000..47f43c2 --- /dev/null +++ b/tests/benchmarks/declarative/compilation/data/BoomBlock.qml @@ -0,0 +1,65 @@ +import Qt 4.7 +import Qt.labs.particles 1.0 + +Item { + id: block + property bool dying: false + property bool spawned: false + property int type: 0 + property int targetX: 0 + property int targetY: 0 + + SpringFollow on x { enabled: spawned; to: targetX; spring: 2; damping: 0.2 } + SpringFollow on y { to: targetY; spring: 2; damping: 0.2 } + + Image { + id: img + source: { + if(type == 0){ + "pics/redStone.png"; + } else if(type == 1) { + "pics/blueStone.png"; + } else { + "pics/greenStone.png"; + } + } + opacity: 0 + Behavior on opacity { NumberAnimation { duration: 200 } } + anchors.fill: parent + } + + Particles { + id: particles + + width: 1; height: 1 + anchors.centerIn: parent + + emissionRate: 0 + lifeSpan: 700; lifeSpanDeviation: 600 + angle: 0; angleDeviation: 360; + velocity: 100; velocityDeviation: 30 + source: { + if(type == 0){ + "pics/redStar.png"; + } else if (type == 1) { + "pics/blueStar.png"; + } else { + "pics/greenStar.png"; + } + } + } + + states: [ + State { + name: "AliveState"; when: spawned == true && dying == false + PropertyChanges { target: img; opacity: 1 } + }, + + State { + name: "DeathState"; when: dying == true + StateChangeScript { script: particles.burst(50); } + PropertyChanges { target: img; opacity: 0 } + StateChangeScript { script: block.destroy(1000); } + } + ] +} diff --git a/tests/benchmarks/declarative/compilation/tst_compilation.cpp b/tests/benchmarks/declarative/compilation/tst_compilation.cpp new file mode 100644 index 0000000..5694d5b --- /dev/null +++ b/tests/benchmarks/declarative/compilation/tst_compilation.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** 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 test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <QFile> + +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "" +#endif + +class tst_compilation : public QObject +{ + Q_OBJECT +public: + tst_compilation(); + +private slots: + void boomblock(); + +private: + QDeclarativeEngine engine; +}; + +tst_compilation::tst_compilation() +{ +} + +inline QUrl TEST_FILE(const QString &filename) +{ + return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); +} + +void tst_compilation::boomblock() +{ + QFile f(SRCDIR + QLatin1String("/data/BoomBlock.qml")); + QVERIFY(f.open(QIODevice::ReadOnly)); + QByteArray data = f.readAll(); + + QBENCHMARK { + QDeclarativeComponent c(&engine); + c.setData(data, QUrl()); +// QVERIFY(c.isReady()); + } +} + +QTEST_MAIN(tst_compilation) + +#include "tst_compilation.moc" diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 6b7d350..7064160 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -259,6 +259,9 @@ void HtmlGenerator::initializeGenerator(const Config &config) postHeader = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTHEADER); + postPostHeader = config.getString(HtmlGenerator::format() + + Config::dot + + HTMLGENERATOR_POSTPOSTHEADER); footer = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_FOOTER); @@ -1671,31 +1674,44 @@ QString HtmlGenerator::fileExtension(const Node * /* node */) const return "html"; } -#if 0 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>Qt Reference Documentation</title> - <link rel="stylesheet" type="text/css" href="style/style.css" /> - <!--[if IE]> - <meta name="MSSmartTagsPreventParsing" content="true"> - <meta http-equiv="imagetoolbar" content="no"> - <![endif]--> - <!--[if lt IE 7]> - <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> - <![endif]--> - <!--[if IE 7]> - <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> - <![endif]--> - <!--[if IE 8]> - <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> - <![endif]--> - - <script src="scripts/jquery.js" type="text/javascript"></script> - -</head> -#endif +void HtmlGenerator::generateBreadCrumbs(const QString& title, + const Node *node, + CodeMarker *marker) +{ + Text breadcrumb; + if (node->type() == Node::Class) { + const ClassNode* cn = static_cast<const ClassNode*>(node); + QString name = node->moduleName(); + if (!name.isEmpty()) { + out() << " <li>"; + breadcrumb << Atom(Atom::AutoLink,name); + generateText(breadcrumb, node, marker); + out() << "</li>\n"; + } + breadcrumb.clear(); + if (!cn->name().isEmpty()) { + out() << " <li>"; + breadcrumb << Atom(Atom::AutoLink,cn->name()); + generateText(breadcrumb, 0, marker); + out() << "</li>\n"; + } + } + else if (node->type() == Node::Fake) { + const FakeNode* fn = static_cast<const FakeNode*>(node); + if (node->subType() == Node::Module) { + } + else if (node->subType() == Node::Page) { + } + else if (node->subType() == Node::QmlClass) { + } + else if (node->subType() == Node::Example) { + } + } + else if (node->type() == Node::Namespace) { + const NamespaceNode* nsn = static_cast<const NamespaceNode*>(node); + } +} + void HtmlGenerator::generateHeader(const QString& title, const Node *node, @@ -1748,9 +1764,13 @@ void HtmlGenerator::generateHeader(const QString& title, else out() << "<body class=\"\">\n"; +#ifdef GENERATE_MAC_REFS if (mainPage) generateMacRef(node, marker); +#endif out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + generateBreadCrumbs(title,node,marker); + out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); #if 0 // Removed for new docf format. MWS if (node && !node->links().empty()) @@ -3687,10 +3707,14 @@ void HtmlGenerator::generateDetailedMember(const Node *node, { const EnumNode *enume; +#ifdef GENERATE_MAC_REFS generateMacRef(node, marker); +#endif if (node->type() == Node::Enum && (enume = static_cast<const EnumNode *>(node))->flagsType()) { +#ifdef GENERATE_MAC_REFS generateMacRef(enume->flagsType(), marker); +#endif out() << "<h3 class=\"flags\">"; out() << "<a name=\"" + refForNode(node) + "\"></a>"; generateSynopsis(enume, relative, marker, CodeMarker::Detailed); @@ -4204,6 +4228,10 @@ void HtmlGenerator::generateStatus(const Node *node, CodeMarker *marker) } } +#ifdef GENERATE_MAC_REFS +/* + No longer valid. + */ void HtmlGenerator::generateMacRef(const Node *node, CodeMarker *marker) { if (!pleaseGenerateMacRef || marker == 0) @@ -4213,6 +4241,7 @@ void HtmlGenerator::generateMacRef(const Node *node, CodeMarker *marker) foreach (const QString &macRef, macRefs) out() << "<a name=\"" << "//apple_ref/" << macRef << "\"></a>\n"; } +#endif void HtmlGenerator::beginLink(const QString &link, const Node *node, @@ -4314,7 +4343,9 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, CodeMarker *marker) { const QmlPropertyNode* qpn = 0; +#ifdef GENERATE_MAC_REFS generateMacRef(node, marker); +#endif out() << "<div class=\"qmlitem\">"; if (node->subType() == Node::QmlPropertyGroup) { const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(node); @@ -4333,14 +4364,6 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << "<span class=\"qmldefault\">default </span>"; generateQmlItem(qpn, relative, marker, false); out() << "</td></tr>"; - if (qpgn->isDefault()) { - out() << "</table>" - << "</div></div>" - << "<div class=\"qmlitem\">" - << "<div class=\"qmlproto\">" - << "<table class=\"qmlname\">" - << "<tr><td>default</td></tr>"; - } } ++p; } diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 2a365e9..68e620e 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -131,6 +131,9 @@ class HtmlGenerator : public PageGenerator const Node *relative, CodeMarker *marker, const Atom *atom = 0); + void generateBreadCrumbs(const QString& title, + const Node *node, + CodeMarker *marker); void generateHeader(const QString& title, const Node *node = 0, CodeMarker *marker = 0, bool mainPage = true); void generateTitle(const QString& title, @@ -262,7 +265,9 @@ class HtmlGenerator : public PageGenerator virtual void generateIndex(const QString &fileBase, const QString &url, const QString &title); +#ifdef GENERATE_MAC_REFS void generateMacRef(const Node *node, CodeMarker *marker); +#endif void beginLink(const QString &link, const Node *node, const Node *relative, @@ -303,6 +308,7 @@ class HtmlGenerator : public PageGenerator QRegExp funcLeftParen; QString style; QString postHeader; + QString postPostHeader; QString footer; QString address; bool pleaseGenerateMacRef; @@ -337,8 +343,9 @@ class HtmlGenerator : public PageGenerator #define HTMLGENERATOR_ADDRESS "address" #define HTMLGENERATOR_FOOTER "footer" -#define HTMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me +#define HTMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me #define HTMLGENERATOR_POSTHEADER "postheader" +#define HTMLGENERATOR_POSTPOSTHEADER "postpostheader" #define HTMLGENERATOR_STYLE "style" #define HTMLGENERATOR_STYLESHEETS "stylesheets" #define HTMLGENERATOR_CUSTOMHEADELEMENTS "customheadelements" diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 8253c45..944a32c 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -87,8 +87,9 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <div class=\"breadcrumb toolblock\">\n" \ " <ul>\n" \ " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \ - " <!-- Bread crumbs goes here -->\n" \ - " </ul>\n" \ + " <!-- Bread crumbs goes here -->\n" + +HTML.postpostheader = " </ul>\n" \ " </div>\n" \ " <div class=\"toolbuttons toolblock\">\n" \ " <ul>\n" \ diff --git a/tools/qdoc3/text.h b/tools/qdoc3/text.h index fa3ecda..879f6da 100644 --- a/tools/qdoc3/text.h +++ b/tools/qdoc3/text.h @@ -75,6 +75,7 @@ class Text const Atom *lastAtom() const { return last; } Text subText(Atom::Type left, Atom::Type right, const Atom *from = 0) const; void dump() const; + void clear(); static Text subText(const Atom *begin, const Atom *end = 0); static Text sectionHeading(const Atom *sectionBegin); @@ -82,7 +83,6 @@ class Text static int compare(const Text &text1, const Text &text2); private: - void clear(); Atom *first; Atom *last; diff --git a/translations/qt_pl.ts b/translations/qt_pl.ts index dd8a160..ef5e9a2 100644 --- a/translations/qt_pl.ts +++ b/translations/qt_pl.ts @@ -115,7 +115,7 @@ <message> <location line="-3"/> <source><html>Switching to the audio playback device <b>%1</b><br/>which has higher preference or is specifically configured for this stream.</html></source> - <translation type="unfinished"></translation> + <translation><html>Przełączanie na urządzenie dźwiękowe <b>%1</b><br/>które ma wyższy priorytet lub jest specjalnie skonfigurowane dla tego strumienia.</html></translation> </message> </context> <context> @@ -441,7 +441,7 @@ zainstalowałeś libgstreamer-plugins-base.</translation> <location line="+22"/> <location line="+22"/> <source>Video display error</source> - <translation type="unfinished">Błąd wyświetlacza wideo</translation> + <translation>Błąd wyświetlacza wideo</translation> </message> </context> <context> @@ -542,7 +542,7 @@ zainstalowałeś libgstreamer-plugins-base.</translation> <location filename="../src/3rdparty/phonon/mmf/videoplayer_surface.cpp" line="+126"/> <location line="+16"/> <source>Video display error</source> - <translation type="unfinished">Błąd wyświetlacza wideo</translation> + <translation>Błąd wyświetlacza wideo</translation> </message> </context> <context> @@ -1600,17 +1600,17 @@ na <message> <location filename="../src/declarative/util/qdeclarativeanimation.cpp" line="+165"/> <source>Cannot animate non-existent property "%1"</source> - <translation type="unfinished"></translation> + <translation>Nie można animować nieistniejącej właściwości "%1"</translation> </message> <message> <location line="+3"/> <source>Cannot animate read-only property "%1"</source> - <translation type="unfinished"></translation> + <translation>Nie można animować właściwości (tylko do odczytu): "%1"</translation> </message> <message> <location filename="../src/declarative/util/qdeclarativeutilmodule.cpp" line="+122"/> <source>Animation is an abstract class</source> - <translation type="unfinished"></translation> + <translation>"Animation" jest klasą abstrakcyjną</translation> </message> </context> <context> @@ -1618,7 +1618,7 @@ na <message> <location filename="../src/declarative/util/qdeclarativeanimation.cpp" line="+2540"/> <source>Cannot set a duration of < 0</source> - <translation type="unfinished"></translation> + <translation>Nie można ustawić ujemnego czasu trwania</translation> </message> </context> <context> @@ -1626,12 +1626,12 @@ na <message> <location filename="../src/declarative/graphicsitems/qdeclarativeanchors.cpp" line="+181"/> <source>Possible anchor loop detected on fill.</source> - <translation type="unfinished"></translation> + <translation>Wykryto możliwe zapętlenie dla kotwicy "fill".</translation> </message> <message> <location line="+29"/> <source>Possible anchor loop detected on centerIn.</source> - <translation type="unfinished"></translation> + <translation>Wykryto możliwe zapętlenie dla kotwicy "centerIn".</translation> </message> <message> <location line="+201"/> @@ -1639,54 +1639,54 @@ na <location line="+610"/> <location line="+37"/> <source>Cannot anchor to an item that isn't a parent or sibling.</source> - <translation type="unfinished"></translation> + <translation>Nie można doczepić kotwicy do elementu który nie jest rodzicem ani rodzeństwem.</translation> </message> <message> <location line="-534"/> <source>Possible anchor loop detected on vertical anchor.</source> - <translation type="unfinished"></translation> + <translation>Wykryto możliwe zapętlenie dla pionowej kotwicy.</translation> </message> <message> <location line="+59"/> <source>Possible anchor loop detected on horizontal anchor.</source> - <translation type="unfinished"></translation> + <translation>Wykryto możliwe zapętlenie dla poziomej kotwicy.</translation> </message> <message> <location line="+422"/> <source>Cannot specify left, right, and hcenter anchors.</source> - <translation type="unfinished"></translation> + <translation>Nie można jednocześnie podać lewej, prawej i centralnej poziomej kotwicy.</translation> </message> <message> <location line="+10"/> <location line="+37"/> <source>Cannot anchor to a null item.</source> - <translation type="unfinished"></translation> + <translation>Nie można doczepić kotwicy do zerowego elementu.</translation> </message> <message> <location line="-34"/> <source>Cannot anchor a horizontal edge to a vertical edge.</source> - <translation type="unfinished"></translation> + <translation>Nie można doczepić poziomej krawędzi do pionowej.</translation> </message> <message> <location line="+6"/> <location line="+37"/> <source>Cannot anchor item to self.</source> - <translation type="unfinished"></translation> + <translation>Nie można doczepić kotwicy do tego samego elementu.</translation> </message> <message> <location line="-25"/> <source>Cannot specify top, bottom, and vcenter anchors.</source> - <translation type="unfinished"></translation> + <translation>Nie można jednocześnie podać górnej, dolnej i centralnej pionowej kotwicy.</translation> </message> <message> <location line="+6"/> <source>Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors.</source> - <translation type="unfinished"></translation> + <translation>Bazowa kotwica nie może być użyta w połączeniu z górną, dolną lub centralną pionową kotwicą.</translation> </message> <message> <location line="+13"/> <source>Cannot anchor a vertical edge to a horizontal edge.</source> - <translation type="unfinished"></translation> + <translation>Nie można doczepić pionowej krawędzi do poziomej.</translation> </message> </context> <context> @@ -1694,7 +1694,7 @@ na <message> <location filename="../src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp" line="+86"/> <source>Qt was built without support for QMovie</source> - <translation type="unfinished"></translation> + <translation>Qt zostało zbudowane bez obsługi QMovie</translation> </message> </context> <context> @@ -1702,7 +1702,7 @@ na <message> <location filename="../src/declarative/util/qdeclarativebehavior.cpp" line="+122"/> <source>Cannot change the animation assigned to a Behavior.</source> - <translation type="unfinished"></translation> + <translation>Nie można zmienić animacji przypisanej do "Zachowania".</translation> </message> </context> <context> @@ -1710,7 +1710,7 @@ na <message> <location filename="../src/declarative/qml/qdeclarativebinding.cpp" line="+225"/> <source>Binding loop detected for property "%1"</source> - <translation type="unfinished"></translation> + <translation>Zapętlenie powiązania dla właściwości "%1"</translation> </message> </context> <context> @@ -1718,7 +1718,7 @@ na <message> <location filename="../src/declarative/qml/qdeclarativecompiledbindings.cpp" line="+305"/> <source>Binding loop detected for property "%1"</source> - <translation type="unfinished"></translation> + <translation>Zapętlenie powiązania dla właściwości "%1"</translation> </message> </context> <context> @@ -1731,92 +1731,92 @@ na <location line="+75"/> <location line="+488"/> <source>Invalid property assignment: "%1" is a read-only property</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: "%1" jest właściwością tylko do odczytu</translation> </message> <message> <location line="-2384"/> <source>Invalid property assignment: unknown enumeration</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: nieznana wartość wyliczeniowa</translation> </message> <message> <location line="+8"/> <source>Invalid property assignment: string expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano ciągu</translation> </message> <message> <location line="+3"/> <source>Invalid property assignment: url expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano url</translation> </message> <message> <location line="+6"/> <source>Invalid property assignment: unsigned int expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano liczby naturalnej</translation> </message> <message> <location line="+7"/> <source>Invalid property assignment: int expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano liczby całkowitej</translation> </message> <message> <location line="+7"/> <source>Invalid property assignment: float expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano liczby zmiennoprzecinkowej</translation> </message> <message> <location line="+7"/> <source>Invalid property assignment: double expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano liczby zmiennoprzecinkowej podwójnej precyzji</translation> </message> <message> <location line="+7"/> <source>Invalid property assignment: color expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano koloru</translation> </message> <message> <location line="+7"/> <source>Invalid property assignment: date expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano daty</translation> </message> <message> <location line="+7"/> <source>Invalid property assignment: time expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano czasu</translation> </message> <message> <location line="+7"/> <source>Invalid property assignment: datetime expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano daty i czasu</translation> </message> <message> <location line="+8"/> <source>Invalid property assignment: point expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano punktu</translation> </message> <message> <location line="+8"/> <source>Invalid property assignment: size expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano rozmiaru</translation> </message> <message> <location line="+8"/> <source>Invalid property assignment: rect expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano prostokąta</translation> </message> <message> <location line="+5"/> <source>Invalid property assignment: boolean expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano wartości boolowskiej</translation> </message> <message> <location line="+7"/> <source>Invalid property assignment: 3D vector expected</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: oczekiwano wektoru 3D</translation> </message> <message> <location line="+9"/> <source>Invalid property assignment: unsupported type "%1"</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne przypisanie wartości: nieobsługiwany typ "%1"</translation> </message> <message> <location line="+271"/> @@ -1831,13 +1831,13 @@ na <message> <location line="+7"/> <source>Invalid component id specification</source> - <translation type="unfinished"></translation> + <translation>Niepoprawna specyfikacja "id" componentu</translation> </message> <message> <location line="+6"/> <location line="+477"/> <source>id is not unique</source> - <translation type="unfinished"></translation> + <translation>Wartość "id" nie jest unikatowa</translation> </message> <message> <location line="-467"/> @@ -1910,7 +1910,7 @@ na <message> <location line="-324"/> <source>Invalid use of namespace</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne użycie przestrzeni nazw</translation> </message> <message> <location line="+5"/> @@ -1920,7 +1920,7 @@ na <message> <location line="+183"/> <source>Invalid use of id property</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne użycie właściwości "id"</translation> </message> <message> <location line="+89"/> @@ -1942,27 +1942,27 @@ na <message> <location line="+16"/> <source>Invalid property use</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne użycie właściwości</translation> </message> <message> <location line="+13"/> <source>Property assignment expected</source> - <translation type="unfinished"></translation> + <translation>Oczekiwano przypisania wartości</translation> </message> <message> <location line="+3"/> <source>Single property assignment expected</source> - <translation type="unfinished"></translation> + <translation>Oczekiwano przypisania pojedynczej wartości</translation> </message> <message> <location line="+5"/> <source>Unexpected object assignment</source> - <translation type="unfinished"></translation> + <translation>Nieoczekiwane przypisanie obiektu</translation> </message> <message> <location line="+57"/> <source>Cannot assign object to list</source> - <translation type="unfinished"></translation> + <translation>Nie można przypisać obiektu do listy</translation> </message> <message> <location line="+6"/> @@ -1987,7 +1987,7 @@ na <message> <location line="+106"/> <source>Cannot assign object to property</source> - <translation type="unfinished"></translation> + <translation>Nie można przypisać obiektu dla właściwości</translation> </message> <message> <location line="+50"/> @@ -1997,77 +1997,77 @@ na <message> <location line="+117"/> <source>Duplicate default property</source> - <translation type="unfinished"></translation> + <translation>Powielona domyślna właściwość</translation> </message> <message> <location line="+5"/> <source>Duplicate property name</source> - <translation type="unfinished"></translation> + <translation>Powielona nazwa właściwości</translation> </message> <message> <location line="+3"/> <source>Property names cannot begin with an upper case letter</source> - <translation type="unfinished"></translation> + <translation>Nazwy właściwości nie mogą rozpoczynać się wielką literą</translation> </message> <message> <location line="+7"/> <source>Duplicate signal name</source> - <translation type="unfinished"></translation> + <translation>Powielona nazwa sygnału</translation> </message> <message> <location line="+2"/> <source>Signal names cannot begin with an upper case letter</source> - <translation type="unfinished"></translation> + <translation>Nazwy sygnałów nie mogą rozpoczynać się wielką literą</translation> </message> <message> <location line="+6"/> <source>Duplicate method name</source> - <translation type="unfinished"></translation> + <translation>Powielona nazwa medoty</translation> </message> <message> <location line="+2"/> <source>Method names cannot begin with an upper case letter</source> - <translation type="unfinished"></translation> + <translation>Nazwy metod nie mogą rozpoczynać się wielką literą</translation> </message> <message> <location line="+21"/> <source>Property value set multiple times</source> - <translation type="unfinished"></translation> + <translation>Wartość właściwości ustawiona wielokrotnie</translation> </message> <message> <location line="+4"/> <source>Invalid property nesting</source> - <translation type="unfinished"></translation> + <translation>Niepoprawne zagnieżdżenie właściwości</translation> </message> <message> <location line="+53"/> <source>Cannot override FINAL property</source> - <translation type="unfinished"></translation> + <translation>Nie można nadpisać właściwości "FINAL"</translation> </message> <message> <location line="+25"/> <source>Invalid property type</source> - <translation type="unfinished"></translation> + <translation>Niepoprawny typ właściwości</translation> </message> <message> <location line="+159"/> <source>Invalid empty ID</source> - <translation type="unfinished"></translation> + <translation>Niepoprawny pusty identyfikator</translation> </message> <message> <location line="+3"/> <source>IDs cannot start with an uppercase letter</source> - <translation type="unfinished"></translation> + <translation>Identyfikatory nie mogą rozpoczynać się wielką literą</translation> </message> <message> <location line="+6"/> <source>IDs must start with a letter or underscore</source> - <translation type="unfinished"></translation> + <translation>Identyfikatory muszą rozpoczynać się literą lub znakiem podkreślenia</translation> </message> <message> <location line="+2"/> <source>IDs must contain only letters, numbers, and underscores</source> - <translation type="unfinished"></translation> + <translation>Identyfikatory mogą zawierać jedynie litery, cyfry i znaki podkreślenia</translation> </message> <message> <location line="+6"/> @@ -2102,7 +2102,7 @@ na <message> <location filename="../src/declarative/qml/qdeclarativecomponent.cpp" line="+454"/> <source>Invalid empty URL</source> - <translation type="unfinished"></translation> + <translation>Niepoprawny pusty URL</translation> </message> </context> <context> @@ -2111,22 +2111,22 @@ na <location filename="../src/declarative/qml/qdeclarativecompositetypemanager.cpp" line="+482"/> <location line="+268"/> <source>Resource %1 unavailable</source> - <translation type="unfinished"></translation> + <translation>Zasób %1 nie jest dostępny</translation> </message> <message> <location line="-119"/> <source>Namespace %1 cannot be used as a type</source> - <translation type="unfinished"></translation> + <translation>Przestrzeń nazw %1 nie może być użyta jako typ</translation> </message> <message> <location line="+2"/> <source>%1 is not a type</source> - <translation type="unfinished"></translation> + <translation>%1 nie jest typem</translation> </message> <message> <location line="+46"/> <source>Type %1 unavailable</source> - <translation type="unfinished"></translation> + <translation>Typ %1 nie jest dostępny</translation> </message> </context> <context> @@ -2136,22 +2136,22 @@ na <location line="+54"/> <location line="+7"/> <source>Cannot assign to non-existent property "%1"</source> - <translation type="unfinished"></translation> + <translation>Nie można przypisać wartości do nieistniejącej właściwości "%1"</translation> </message> <message> <location line="-51"/> <source>Connections: nested objects not allowed</source> - <translation type="unfinished"></translation> + <translation>Połączenia: zagnieżdżone obiekty nie są dozwolone</translation> </message> <message> <location line="+3"/> <source>Connections: syntax error</source> - <translation type="unfinished"></translation> + <translation>Połączenia: błąd składni</translation> </message> <message> <location line="+8"/> <source>Connections: script expected</source> - <translation type="unfinished"></translation> + <translation>Połączenia: oczekiwano skryptu</translation> </message> </context> <context> @@ -2159,34 +2159,34 @@ na <message> <location filename="../src/declarative/qml/qdeclarativeengine.cpp" line="+1633"/> <source>module "%1" definition "%2" not readable</source> - <translation type="unfinished"></translation> + <translation>definicja "%2" modułu "%1" nie może zostać odczytana</translation> </message> <message> <location line="+23"/> <source>plugin cannot be loaded for module "%1": %2</source> - <translation type="unfinished"></translation> + <translation>wtyczka nie może zostać załadowana dla modułu "%1": %2</translation> </message> <message> <location line="+5"/> <source>module "%1" plugin "%2" not found</source> - <translation type="unfinished"></translation> + <translation>wtyczka "%2" modułu "%1" nie została odnaleziona</translation> </message> <message> <location line="+82"/> <location line="+55"/> <source>module "%1" version %2.%3 is not installed</source> - <translation type="unfinished"></translation> + <translation>wersja %2.%3 modułu %1 nie jest zainstalowana</translation> </message> <message> <location line="-53"/> <source>module "%1" is not installed</source> - <translation type="unfinished"></translation> + <translation>moduł "%1" nie jest zainstalowany</translation> </message> <message> <location line="+14"/> <location line="+19"/> <source>"%1": no such directory</source> - <translation type="unfinished"></translation> + <translation>"%1": brak katalogu</translation> </message> <message> <location line="-2"/> @@ -2196,22 +2196,22 @@ na <message> <location filename="../src/declarative/qml/qdeclarativesqldatabase.cpp" line="+204"/> <source>executeSql called outside transaction()</source> - <translation type="unfinished"></translation> + <translation>"executeSql" zawołane na zewnątrz "transation()"</translation> </message> <message> <location line="+58"/> <source>Read-only Transaction</source> - <translation type="unfinished"></translation> + <translation>Transakcja tylko do odczytu</translation> </message> <message> <location line="+20"/> <source>Version mismatch: expected %1, found %2</source> - <translation type="unfinished"></translation> + <translation>Niezgodność wersji: oczekiwano %1, znaleziono %2</translation> </message> <message> <location line="+14"/> <source>SQL transaction failed</source> - <translation type="unfinished"></translation> + <translation>Transakcja SQL zakończona błędem</translation> </message> <message> <location line="+21"/> @@ -2230,12 +2230,12 @@ na <message> <location filename="../src/declarative/graphicsitems/qdeclarativeflipable.cpp" line="+129"/> <source>front is a write-once property</source> - <translation type="unfinished"></translation> + <translation>"front" jest właściwością tylko do odczytu</translation> </message> <message> <location line="+19"/> <source>back is a write-once property</source> - <translation type="unfinished"></translation> + <translation>"back" jest właściwością tylko do odczytu</translation> </message> </context> <context> @@ -2243,7 +2243,7 @@ na <message> <location filename="../src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp" line="+62"/> <source>KeyNavigation is only available via attached properties</source> - <translation type="unfinished"></translation> + <translation>"KeyNavigation" jest dostępny jedynie poprzez właściwości dołączone</translation> </message> </context> <context> @@ -2251,7 +2251,7 @@ na <message> <location line="+1"/> <source>Keys is only available via attached properties</source> - <translation type="unfinished"></translation> + <translation>"Keys" jest dostępny jedynie poprzez właściwości dołączone</translation> </message> </context> <context> @@ -2259,64 +2259,64 @@ na <message> <location filename="../src/declarative/util/qdeclarativelistmodel.cpp" line="+399"/> <source>remove: index %1 out of range</source> - <translation type="unfinished"></translation> + <translation>remove: indeks %1 poza zakresem</translation> </message> <message> <location line="+33"/> <source>insert: value is not an object</source> - <translation type="unfinished"></translation> + <translation>insert: wartość nie jest obiektem</translation> </message> <message> <location line="+5"/> <source>insert: index %1 out of range</source> - <translation type="unfinished"></translation> + <translation>insert: indeks %1 poza zakresem</translation> </message> <message> <location line="+30"/> <source>move: out of range</source> - <translation type="unfinished"></translation> + <translation>move: poza zakresem</translation> </message> <message> <location line="+40"/> <source>append: value is not an object</source> - <translation type="unfinished"></translation> + <translation>append: wartość nie jest obiektem</translation> </message> <message> <location line="+34"/> <source>get: index %1 out of range</source> - <translation type="unfinished"></translation> + <translation>get: indeks %1 poza zakresem</translation> </message> <message> <location line="+25"/> <source>set: value is not an object</source> - <translation type="unfinished"></translation> + <translation>set: wartość nie jest obiektem</translation> </message> <message> <location line="+4"/> <location line="+34"/> <source>set: index %1 out of range</source> - <translation type="unfinished"></translation> + <translation>set: indeks %1 poza zakresem</translation> </message> <message> <location line="+39"/> <location line="+15"/> <source>ListElement: cannot contain nested elements</source> - <translation type="unfinished"></translation> + <translation>ListElement: nie może zawierać zagnieżdżonych elementów</translation> </message> <message> <location line="+4"/> <source>ListElement: cannot use reserved "id" property</source> - <translation type="unfinished"></translation> + <translation>ListElement: nie można używać zarezerwowanej właściwości "id"</translation> </message> <message> <location line="+49"/> <source>ListElement: cannot use script for property value</source> - <translation type="unfinished"></translation> + <translation>ListElement: nie można używać skryptu jako wartości właściwości</translation> </message> <message> <location line="+29"/> <source>ListModel: undefined property '%1'</source> - <translation type="unfinished"></translation> + <translation>ListModel: niezdefiniowana właściwość "%1"</translation> </message> </context> <context> @@ -2377,12 +2377,12 @@ na <message> <location line="-140"/> <source>Illegal character</source> - <translation type="unfinished"></translation> + <translation>Niepoprawny znak</translation> </message> <message> <location line="+14"/> <source>Unclosed string at end of line</source> - <translation type="unfinished"></translation> + <translation>Niedomknięty ciąg na końcu linii</translation> </message> <message> <location line="+26"/> @@ -2392,7 +2392,7 @@ na <message> <location line="+72"/> <source>Unclosed comment at end of file</source> - <translation type="unfinished"></translation> + <translation>Niedomknięty komentarz na końcu linii</translation> </message> <message> <location line="+102"/> @@ -2434,25 +2434,25 @@ na <message> <location line="-65"/> <source>Unexpected token `%1'</source> - <translation type="unfinished"></translation> + <translation>Nieoczekiwany znak "%1"</translation> </message> <message> <location line="+28"/> <location line="+24"/> <source>Expected token `%1'</source> - <translation type="unfinished"></translation> + <translation>Oczekiwano znaku "%1"</translation> </message> <message> <location filename="../src/declarative/qml/qdeclarativescriptparser.cpp" line="+264"/> <location line="+456"/> <location line="+59"/> <source>Property value set multiple times</source> - <translation type="unfinished"></translation> + <translation>Wartość właściwości ustawiona wielokrotnie</translation> </message> <message> <location line="-504"/> <source>Expected type name</source> - <translation type="unfinished"></translation> + <translation>Oczekiwano nazwy typu</translation> </message> <message> <location line="+171"/> @@ -2510,7 +2510,7 @@ na <message> <location filename="../src/declarative/util/qdeclarativeanimation.cpp" line="-1973"/> <source>Cannot set a duration of < 0</source> - <translation type="unfinished"></translation> + <translation>Nie można ustawić ujemnego czasu trwania</translation> </message> </context> <context> @@ -2518,23 +2518,23 @@ na <message> <location filename="../src/declarative/util/qdeclarativepixmapcache.cpp" line="+197"/> <source>Error decoding: %1: %2</source> - <translation type="unfinished"></translation> + <translation>Błąd dekodowania: %1: %2</translation> </message> <message> <location line="+70"/> <source>Failed to get image from provider: %1</source> - <translation type="unfinished"></translation> + <translation>Pobieranie obrazka od dostawcy zakończone błędem: %1</translation> </message> <message> <location line="+19"/> <location line="+342"/> <source>Cannot open: %1</source> - <translation type="unfinished"></translation> + <translation>Nie można otworzyć: %1</translation> </message> <message> <location line="+37"/> <source>Unknown Error loading %1</source> - <translation type="unfinished"></translation> + <translation>Nieznany błąd ładowania %1</translation> </message> </context> <context> @@ -2542,7 +2542,7 @@ na <message> <location filename="../src/declarative/util/qdeclarativeanimation.cpp" line="+1100"/> <source>Cannot set a duration of < 0</source> - <translation type="unfinished"></translation> + <translation>Nie można ustawić ujemnego czasu trwania</translation> </message> </context> <context> @@ -2550,17 +2550,17 @@ na <message> <location filename="../src/declarative/util/qdeclarativepropertychanges.cpp" line="+231"/> <source>PropertyChanges does not support creating state-specific objects.</source> - <translation type="unfinished"></translation> + <translation>"PropertyChanges" nie obsługuje tworzenia obiektów charakterystycznych dla stanów.</translation> </message> <message> <location line="+151"/> <source>Cannot assign to non-existent property "%1"</source> - <translation type="unfinished"></translation> + <translation>Nie można przypisać wartości do nieistniejącej właściwości "%1"</translation> </message> <message> <location line="+3"/> <source>Cannot assign to read-only property "%1"</source> - <translation type="unfinished"></translation> + <translation>Nie można przypisać wartości do właściwości (tylko do odczytu): "%1"</translation> </message> </context> <context> @@ -2582,22 +2582,22 @@ na <message> <location filename="../src/declarative/qml/qdeclarativevme.cpp" line="+194"/> <source>Unable to create object of type %1</source> - <translation type="unfinished"></translation> + <translation>Nie można utworzyć obiektu typu %1</translation> </message> <message> <location line="+380"/> <source>Cannot assign value %1 to property %2</source> - <translation type="unfinished"></translation> + <translation>Nie można przypisać wartości %1 do właściwości %2</translation> </message> <message> <location line="+22"/> <source>Cannot assign object type %1 with no default method</source> - <translation type="unfinished"></translation> + <translation>Nie można przypisać obiektu typu %1 który nie posiada domyślnej metody</translation> </message> <message> <location line="+3"/> <source>Cannot connect mismatched signal/slot %1 %vs. %2</source> - <translation type="unfinished"></translation> + <translation>Nie można podłączyć niepasujących sygnałów / slotów (%1 i %2)</translation> </message> <message> <location line="+5"/> @@ -2607,7 +2607,7 @@ na <message> <location line="+146"/> <source>Cannot assign object to list</source> - <translation type="unfinished"></translation> + <translation>Nie można przypisać obiektu do listy</translation> </message> <message> <location line="+41"/> @@ -2617,7 +2617,7 @@ na <message> <location line="+11"/> <source>Unable to create attached object</source> - <translation type="unfinished"></translation> + <translation>Nie można utworzyć dołączonego obiektu</translation> </message> <message> <location line="+32"/> @@ -2639,7 +2639,7 @@ na <location filename="../src/declarative/util/qdeclarativeutilmodule.cpp" line="-12"/> <location line="+2"/> <source>Qt was built without support for xmlpatterns</source> - <translation type="unfinished"></translation> + <translation>Qt zostało zbudowane bez obsługi xmlpatterns</translation> </message> </context> <context> @@ -2647,7 +2647,7 @@ na <message> <location filename="../src/declarative/util/qdeclarativexmllistmodel_p.h" line="+168"/> <source>An XmlRole query must not start with '/'</source> - <translation type="unfinished"></translation> + <translation>Zapytanie XmlRole nie może rozpoczynać się od "/"</translation> </message> </context> <context> @@ -2655,7 +2655,7 @@ na <message> <location filename="../src/declarative/util/qdeclarativexmllistmodel.cpp" line="+638"/> <source>An XmlListModel query must start with '/' or "//"</source> - <translation type="unfinished"></translation> + <translation>Zapytanie XmlListModel nie może rozpoczynać się od "/" ani od "//"</translation> </message> </context> <context> @@ -3185,32 +3185,32 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation> <message> <location/> <source>Go back</source> - <translation type="unfinished"></translation> + <translation>Wróć</translation> </message> <message> <location/> <source>Go forward</source> - <translation type="unfinished"></translation> + <translation>Przejdź dalej</translation> </message> <message> <location/> <source>Go to the parent directory</source> - <translation type="unfinished"></translation> + <translation>Przejdź do katalogu wyżej</translation> </message> <message> <location/> <source>Create a New Folder</source> - <translation type="unfinished"></translation> + <translation>Utwórz nowy katalog</translation> </message> <message> <location/> <source>Change to list view mode</source> - <translation type="unfinished"></translation> + <translation>Pokaż listę</translation> </message> <message> <location/> <source>Change to detail view mode</source> - <translation type="unfinished"></translation> + <translation>Pokaż szczegóły</translation> </message> </context> <context> @@ -3721,7 +3721,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation> <location filename="../src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp" line="+423"/> <location line="+16"/> <source>Unable to play %1</source> - <translation type="unfinished"></translation> + <translation>Nie można odtworzyć %1</translation> </message> </context> <context> @@ -4564,23 +4564,23 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation> <location filename="../src/multimedia/base/qmediaplaylist.cpp" line="+455"/> <location line="+46"/> <source>Could not add items to read only playlist.</source> - <translation type="unfinished"></translation> + <translation>Nie można dodać elementów do listy odtwarzania (tylko do odczytu).</translation> </message> <message> <location line="-27"/> <location line="+46"/> <source>Playlist format is not supported</source> - <translation type="unfinished"></translation> + <translation>Format listy odtwarzania nie jest obsługiwany</translation> </message> <message> <location line="+26"/> <source>The file could not be accessed.</source> - <translation type="unfinished"></translation> + <translation>Brak dostępu do pliku.</translation> </message> <message> <location line="+35"/> <source>Playlist format is not supported.</source> - <translation type="unfinished"></translation> + <translation>Format listy odtwarzania nie jest obsługiwany.</translation> </message> </context> <context> @@ -4821,12 +4821,12 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation> <message> <location filename="../src/network/access/qnetworkaccessdatabackend.cpp" line="+76"/> <source>Operation not supported on %1</source> - <translation type="unfinished">Operacja nieobsługiwana na %1</translation> + <translation>Operacja nieobsługiwana na %1</translation> </message> <message> <location line="+25"/> <source>Invalid URI: %1</source> - <translation type="unfinished">Niepoprawny URI: %1</translation> + <translation>Niepoprawny URI: %1</translation> </message> </context> <context> @@ -4839,12 +4839,12 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation> <message> <location line="+60"/> <source>Socket error on %1: %2</source> - <translation type="unfinished">Błąd gniazda na %1: %2</translation> + <translation>Błąd gniazda na %1: %2</translation> </message> <message> <location line="+15"/> <source>Remote host closed the connection prematurely on %1</source> - <translation type="unfinished">Zdalny host przedwcześnie zakończył połączenie na %1</translation> + <translation>Zdalny host przedwcześnie zakończył połączenie na %1</translation> </message> </context> <context> @@ -4919,7 +4919,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation> <message> <location filename="../src/network/access/qnetworkreplyimpl.cpp" line="+910"/> <source>Network access is disabled.</source> - <translation type="unfinished"></translation> + <translation>Dostęp do sieci wyłączony.</translation> </message> </context> <context> @@ -4942,7 +4942,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation> <message> <location line="+329"/> <source>Temporary network failure.</source> - <translation type="unfinished"></translation> + <translation>Chwilowy błąd w sieci.</translation> </message> </context> <context> @@ -4959,7 +4959,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation> <message> <location filename="../src/network/bearer/qnetworksession.cpp" line="+449"/> <source>Invalid configuration.</source> - <translation type="unfinished"></translation> + <translation>Niepoprawna konfiguracja.</translation> </message> </context> <context> @@ -4972,7 +4972,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation> <message> <location line="+3"/> <source>Session aborted by user or system</source> - <translation type="unfinished"></translation> + <translation>Sesja przerwana przez użytkownika lub system</translation> </message> <message> <location line="+4"/> @@ -4989,25 +4989,25 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation> <location line="+2"/> <location filename="../src/plugins/bearer/symbian/qnetworksession_impl.cpp" line="+2"/> <source>The session was aborted by the user or system.</source> - <translation type="unfinished"></translation> + <translation>Sesja została przerwana przez użytkownika lub system.</translation> </message> <message> <location line="+2"/> <location filename="../src/plugins/bearer/symbian/qnetworksession_impl.cpp" line="+2"/> <source>The requested operation is not supported by the system.</source> - <translation type="unfinished"></translation> + <translation>Zażądana operacja nie jest obsługiwana przez system.</translation> </message> <message> <location line="+2"/> <location filename="../src/plugins/bearer/symbian/qnetworksession_impl.cpp" line="+2"/> <source>The specified configuration cannot be used.</source> - <translation type="unfinished"></translation> + <translation>Podana konfiguracja nie może być użyta.</translation> </message> <message> <location line="+2"/> <location filename="../src/plugins/bearer/symbian/qnetworksession_impl.cpp" line="+2"/> <source>Roaming was aborted or is not possible.</source> - <translation type="unfinished"></translation> + <translation>Roaming przerwany albo niemożliwy.</translation> </message> </context> <context> @@ -5413,7 +5413,7 @@ Proszę o sprawdzenie podanej nazwy pliku.</translation> <message> <location line="+40"/> <source>Print current page</source> - <translation type="unfinished"></translation> + <translation>Wydrukuj bieżącą stronę</translation> </message> <message> <location filename="../src/gui/painting/qprinterinfo_unix.cpp" line="+133"/> @@ -6019,7 +6019,7 @@ Proszę wybrać inną nazwę pliku.</translation> <message> <location/> <source>Current Page</source> - <translation type="unfinished"></translation> + <translation>Bieżąca strona</translation> </message> </context> <context> @@ -8663,7 +8663,7 @@ Proszę wybrać inną nazwę pliku.</translation> <location line="+5"/> <source>Go Forward</source> <comment>Forward context menu item</comment> - <translation>Idź dalej</translation> + <translation>Przejdź dalej</translation> </message> <message> <location line="+5"/> @@ -8819,7 +8819,7 @@ Proszę wybrać inną nazwę pliku.</translation> <location line="+110"/> <source>Missing Plug-in</source> <comment>Label text to be used when a plug-in is missing</comment> - <translation type="unfinished"></translation> + <translation>Brakująca wtyczka</translation> </message> <message> <location line="+20"/> @@ -11944,32 +11944,32 @@ Proszę wybrać inną nazwę pliku.</translation> <message> <location line="+15"/> <source>Duration content does not match the maxInclusive facet.</source> - <translation>Wartość długości okresu czasu koliduje z aspektem "maxInclusive".</translation> + <translation>Wartość czasu trwania koliduje z aspektem "maxInclusive".</translation> </message> <message> <location line="+9"/> <source>Duration content does not match the maxExclusive facet.</source> - <translation>Wartość długości okresu czasu koliduje z aspektem "maxExclusive".</translation> + <translation>Wartość czasu trwania koliduje z aspektem "maxExclusive".</translation> </message> <message> <location line="+9"/> <source>Duration content does not match the minInclusive facet.</source> - <translation>Wartość długości okresu czasu koliduje z aspektem "minInclusive".</translation> + <translation>Wartość czasu trwania koliduje z aspektem "minInclusive".</translation> </message> <message> <location line="+9"/> <source>Duration content does not match the minExclusive facet.</source> - <translation>Wartość długości okresu czasu koliduje z aspektem "minExclusive".</translation> + <translation>Wartość czasu trwania koliduje z aspektem "minExclusive".</translation> </message> <message> <location line="+18"/> <source>Duration content is not listed in the enumeration facet.</source> - <translation>Wartość długości okresu czasu nie widnieje na liście aspektu "enumeration".</translation> + <translation>Wartość czasu trwania nie widnieje na liście aspektu "enumeration".</translation> </message> <message> <location line="+18"/> <source>Duration content does not match pattern facet.</source> - <translation>Wartość długości okresu czasu koliduje z aspektem "pattern".</translation> + <translation>Wartość czasu trwania koliduje z aspektem "pattern".</translation> </message> <message> <location line="+27"/> @@ -12280,7 +12280,7 @@ Proszę wybrać inną nazwę pliku.</translation> <message> <location filename="../src/3rdparty/webkit/WebKit/qt/tests/hybridPixmap/widget.ui"/> <source>about:blank</source> - <translation type="unfinished"></translation> + <translation>o:puste</translation> </message> </context> </TS> |