diff options
-rw-r--r-- | demos/declarative/flickr/common/ImageDetails.qml | 10 | ||||
-rw-r--r-- | demos/declarative/flickr/common/MediaButton.qml | 12 | ||||
-rw-r--r-- | demos/declarative/flickr/common/MediaLineEdit.qml | 10 | ||||
-rw-r--r-- | demos/declarative/flickr/common/Star.qml | 4 | ||||
-rw-r--r-- | demos/declarative/flickr/flickr-desktop.qml | 4 | ||||
-rw-r--r-- | demos/declarative/flickr/mobile/Button.qml | 10 | ||||
-rw-r--r-- | demos/declarative/flickr/mobile/ImageDetails.qml | 4 | ||||
-rw-r--r-- | examples/declarative/flowview/flowview.qml | 10 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qmlparser/invalidID.6.errors.txt | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qmlparser/invalidID.6.qml | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmlparser/tst_qmlparser.cpp | 1 |
12 files changed, 44 insertions, 34 deletions
diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml index dcd44eb..6b42910 100644 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ b/demos/declarative/flickr/common/ImageDetails.qml @@ -19,7 +19,7 @@ Flipable { signal closed transform: Rotation { - id: Rotation + id: DetailsRotation origin.x: Container.width / 2; axis.y: 1; axis.z: 0 } @@ -48,7 +48,7 @@ Flipable { LikeOMeter { x: 40; y: 250; rating: Container.rating } - Flickable { id: Flickable; x: 220; width: 480; height: 210; y: 130; clip: true + Flickable { id: FlickSurface; x: 220; width: 480; height: 210; y: 130; clip: true viewportWidth: 480; viewportHeight: DescriptionText.height WebView { id: DescriptionText; width: parent.width @@ -70,8 +70,8 @@ Flipable { anchors.left: TagsLabel.right; anchors.top: Date.bottom; elide: "ElideRight"; text: Container.photoTags } - ScrollBar { id: ScrollBar; x: 720; y: Flickable.y; width: 7; height: Flickable.height; opacity: 0; - flickableArea: Flickable; clip: true } + ScrollBar { id: ScrollBar; x: 720; y: FlickSurface.y; width: 7; height: FlickSurface.height; opacity: 0; + flickableArea: FlickSurface; clip: true } } back: Item { @@ -136,7 +136,7 @@ Flipable { states: [ State { name: "Back" - PropertyChanges { target: Rotation; angle: 180 } + PropertyChanges { target: DetailsRotation; angle: 180 } } ] diff --git a/demos/declarative/flickr/common/MediaButton.qml b/demos/declarative/flickr/common/MediaButton.qml index 0ffd596..e1e09e8 100644 --- a/demos/declarative/flickr/common/MediaButton.qml +++ b/demos/declarative/flickr/common/MediaButton.qml @@ -8,7 +8,7 @@ Item { property string text Image { - id: Image + id: ButtonImage source: "pics/button.png" } Image { @@ -17,21 +17,21 @@ Item { opacity: 0 } MouseRegion { - id: MouseRegion - anchors.fill: Image + id: MyMouseRegion + anchors.fill: ButtonImage onClicked: { Container.clicked(); } } Text { font.bold: true color: "white" - anchors.centerIn: Image + anchors.centerIn: ButtonImage text: Container.text } - width: Image.width + width: ButtonImage.width states: [ State { name: "Pressed" - when: MouseRegion.pressed == true + when: MyMouseRegion.pressed == true PropertyChanges { target: Pressed opacity: 1 diff --git a/demos/declarative/flickr/common/MediaLineEdit.qml b/demos/declarative/flickr/common/MediaLineEdit.qml index 500a402..eab0b95 100644 --- a/demos/declarative/flickr/common/MediaLineEdit.qml +++ b/demos/declarative/flickr/common/MediaLineEdit.qml @@ -7,7 +7,7 @@ Item { property string text width: Math.max(94,Label.width + Editor.width + 20) - height: Image.height + height: ButtonImage.height states: [ State { @@ -48,7 +48,7 @@ Item { BorderImage { - id: Image + id: ButtonImage source: "pics/button.sci" anchors.left: Container.left anchors.right: Container.right @@ -63,12 +63,12 @@ Item { } MouseRegion { - id: MouseRegion - anchors.fill: Image + id: MyMouseRegion + anchors.fill: ButtonImage onClicked: { Container.state = Container.state=="Edit" ? "" : "Edit" } states: [ State { - when: MouseRegion.pressed == true + when: MyMouseRegion.pressed == true PropertyChanges { target: Pressed opacity: 1 diff --git a/demos/declarative/flickr/common/Star.qml b/demos/declarative/flickr/common/Star.qml index 006e86ad..c4d1bec 100644 --- a/demos/declarative/flickr/common/Star.qml +++ b/demos/declarative/flickr/common/Star.qml @@ -11,7 +11,7 @@ Item { signal clicked Image { - id: Image + id: StarImage source: "pics/ghns_star.png" x: 6 y: 7 @@ -27,7 +27,7 @@ Item { name: "on" when: Container.on == true PropertyChanges { - target: Image + target: StarImage opacity: 1 scale: 1 x: 1 diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml index fca7e31..6a4efd9 100644 --- a/demos/declarative/flickr/flickr-desktop.qml +++ b/demos/declarative/flickr/flickr-desktop.qml @@ -15,7 +15,7 @@ Item { scale: Wrapper.PathView.scale; z: Wrapper.PathView.z transform: Rotation { - id: Rotation; origin.x: Wrapper.width/2; origin.y: Wrapper.height/2 + id: ItemRotation; origin.x: Wrapper.width/2; origin.y: Wrapper.height/2 axis.y: 1; axis.z: 0; angle: Wrapper.PathView.angle } @@ -67,7 +67,7 @@ Item { PropertyChanges { target: ImageDetails; z: 2 } ParentChange { target: Wrapper; parent: ImageDetails.frontContainer } PropertyChanges { target: Wrapper; x: 45; y: 35; scale: 1; z: 1000 } - PropertyChanges { target: Rotation; angle: 0 } + PropertyChanges { target: ItemRotation; angle: 0 } PropertyChanges { target: Shadows; opacity: 0 } PropertyChanges { target: ImageDetails; y: 20 } PropertyChanges { target: PhotoGridView; y: "-480" } diff --git a/demos/declarative/flickr/mobile/Button.qml b/demos/declarative/flickr/mobile/Button.qml index 3a0b42e..6887240 100644 --- a/demos/declarative/flickr/mobile/Button.qml +++ b/demos/declarative/flickr/mobile/Button.qml @@ -8,7 +8,7 @@ Item { property string text BorderImage { - id: Image + id: ButtonImage source: "images/toolbutton.sci" width: Container.width; height: Container.height } @@ -19,19 +19,19 @@ Item { width: Container.width; height: Container.height } MouseRegion { - id: MouseRegion - anchors.fill: Image + id: MyMouseRegion + anchors.fill: ButtonImage onClicked: { Container.clicked(); } } Text { color: "white" - anchors.centerIn: Image; font.bold: true + anchors.centerIn: ButtonImage; font.bold: true text: Container.text; style: "Raised"; styleColor: "black" } states: [ State { name: "Pressed" - when: MouseRegion.pressed == true + when: MyMouseRegion.pressed == true PropertyChanges { target: Pressed opacity: 1 diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 5f16a24..617fe40 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -19,7 +19,7 @@ Flipable { signal closed transform: Rotation { - id: Rotation + id: ItemRotation origin.x: Container.width / 2; axis.y: 1; axis.z: 0 } @@ -116,7 +116,7 @@ Flipable { states: State { name: "Back" - PropertyChanges { target: Rotation; angle: 180 } + PropertyChanges { target: ItemRotation; angle: 180 } } transitions: Transition { diff --git a/examples/declarative/flowview/flowview.qml b/examples/declarative/flowview/flowview.qml index ca31bcc..1ab8e92 100644 --- a/examples/declarative/flowview/flowview.qml +++ b/examples/declarative/flowview/flowview.qml @@ -15,7 +15,7 @@ Rectangle { states: State { name: "rotated" - PropertyChanges { target: ListView; z: 2 } + PropertyChanges { target: MyListView; z: 2 } PropertyChanges { target: TopBar; y: -30 } PropertyChanges { target: BottomBar; y: 480 } PropertyChanges { target: LeftBar; x: 0 } @@ -44,7 +44,7 @@ Rectangle { } delegate: Package { Item { id: List; Package.name: "list"; width:120; height: 400; } - Item { id: Grid; Package.name: "grid"; width:400; height: 120; } + Item { id: GridItem; Package.name: "grid"; width:400; height: 120; } Loader { id: MyContent; width:400; height: 120; source: weblet } StateGroup { @@ -58,7 +58,7 @@ Rectangle { State { name: "InGrid" when: MyPhone.state != "rotated" - ParentChange { target: MyContent; parent: Grid } + ParentChange { target: MyContent; parent: GridItem } PropertyChanges { target: MyContent; x: 0; y: 0; } } ] @@ -75,7 +75,7 @@ Rectangle { from: "*"; to: "InList" SequentialAnimation { ParentAction{} - PauseAnimation { duration: 50 * (Grid.FlowView.row * 2 + Grid.FlowView.column) } + PauseAnimation { duration: 50 * (GridItem.FlowView.row * 2 + GridItem.FlowView.column) } NumberAnimation { properties: "x,y,rotation"; easing: "easeInOutQuad" } } } @@ -87,7 +87,7 @@ Rectangle { Item { FlowView { - id: ListView + id: MyListView vertical: true y: 40 x: 40 diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 070add7..c0f7bfd 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -1452,10 +1452,13 @@ bool QmlCompiler::buildIdProperty(QmlParser::Property *prop, if (!isValidId(val)) COMPILE_EXCEPTION(prop, val << "is not a valid object id"); - // We disallow id's that conflict with import prefixes + // We disallow id's that conflict with import prefixes and types QmlEnginePrivate::ImportedNamespace *ns = 0; + QmlType *type = 0; QmlEnginePrivate::get(engine)->resolveType(unit->imports, val.toUtf8(), - 0, 0, 0, 0, &ns); + &type, 0, 0, 0, &ns); + if (type) + COMPILE_EXCEPTION(idValue, "id conflicts with type name"); if (ns) COMPILE_EXCEPTION(idValue, "id conflicts with namespace prefix"); diff --git a/tests/auto/declarative/qmlparser/invalidID.6.errors.txt b/tests/auto/declarative/qmlparser/invalidID.6.errors.txt new file mode 100644 index 0000000..861e3d7 --- /dev/null +++ b/tests/auto/declarative/qmlparser/invalidID.6.errors.txt @@ -0,0 +1 @@ +3:9:id conflicts with type name diff --git a/tests/auto/declarative/qmlparser/invalidID.6.qml b/tests/auto/declarative/qmlparser/invalidID.6.qml new file mode 100644 index 0000000..ea34007 --- /dev/null +++ b/tests/auto/declarative/qmlparser/invalidID.6.qml @@ -0,0 +1,5 @@ +import Test 1.0 +MyQmlObject { + id: MyQmlObject +} + diff --git a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp index e953717..4f2a1f5 100644 --- a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp +++ b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp @@ -143,6 +143,7 @@ void tst_qmlparser::errors_data() QTest::newRow("invalidID.3") << "invalidID.3.qml" << "invalidID.3.errors.txt" << false; QTest::newRow("invalidID.4") << "invalidID.4.qml" << "invalidID.4.errors.txt" << false; QTest::newRow("invalidID.5") << "invalidID.5.qml" << "invalidID.5.errors.txt" << false; + QTest::newRow("invalidID.6") << "invalidID.6.qml" << "invalidID.6.errors.txt" << false; QTest::newRow("unsupportedProperty") << "unsupportedProperty.qml" << "unsupportedProperty.errors.txt" << false; |