From 41893d3259a477e424667c5400617aae3a7a45a1 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 9 Apr 2010 10:39:17 +1000 Subject: self-doc --- examples/declarative/gestures/experimental-gestures.qml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/declarative/gestures/experimental-gestures.qml b/examples/declarative/gestures/experimental-gestures.qml index 5f904aa..cb190ea 100644 --- a/examples/declarative/gestures/experimental-gestures.qml +++ b/examples/declarative/gestures/experimental-gestures.qml @@ -5,6 +5,14 @@ import Qt.labs.gestures 1.0 Rectangle { id: rect + width: 320 + height: 180 + + Text { + anchors.centerIn: parent + text: "Tap / TapAndHold / Pan / Pinch / Swipe\nOnly works on platforms with Touch support." + horizontalAlignment: Text.Center + } GestureArea { anchors.fill: parent -- cgit v0.12 From ca266d0037713c05d19dd6db9ba04f0c01811676 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 09:42:21 +1000 Subject: Doc fixes --- doc/src/declarative/javascriptblocks.qdoc | 2 +- doc/src/declarative/network.qdoc | 1 - doc/src/declarative/qdeclarativedocument.qdoc | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc index c198295..3544bc9 100644 --- a/doc/src/declarative/javascriptblocks.qdoc +++ b/doc/src/declarative/javascriptblocks.qdoc @@ -163,7 +163,7 @@ component instance) "startup". While it is tempting to just include the startup script as \e {global code} in an external script file, this can have severe limitations as the QML environment may not have been fully established. For example, some objects might not have been created or some \l {Property Binding}s may not have been run. -\l {QML Script Restrictions} covers the exact limitations of global script code. +\l {QML JavaScript Restrictions} covers the exact limitations of global script code. The QML \l Component element provides an \e attached \c onCompleted property that can be used to trigger the execution of script code at startup after the diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc index f1d4db1..0a26c68 100644 --- a/doc/src/declarative/network.qdoc +++ b/doc/src/declarative/network.qdoc @@ -64,7 +64,6 @@ Image { Network transparency is supported throughout QML, for example: \list -\o Scripts - the \c source property of \l Script is a URL \o Fonts - the \c source property of FontLoader is a URL \o WebViews - the \c url property of WebView (obviously!) \endlist diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index bf95a29..cf3aae2 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -83,7 +83,7 @@ modifies the document prior to presentation to the QML runtime. \c import statem do not "include" code in the document, but instead instruct the QML runtime on how to resolve type references found in the document. Any type reference present in a QML document - such as \c Rectangle and \c ListView - including those made within an -\l {JavaScript Block} or \l {Property Binding}s, are \e resolved based exclusively on the +\l {Inline JavaScript}{JavaScript block} or \l {Property Binding}s, are \e resolved based exclusively on the import statements. QML does not import any modules by default, so at least one \c import statement must be present or no elements will be available! -- cgit v0.12 From 8ba89fea4df4045490d7b557dabb753e7f7ae836 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 10:47:00 +1000 Subject: More tutorial improvments --- doc/src/declarative/advtutorial.qdoc | 26 ++--- .../tutorials/samegame/samegame2/samegame.js | 33 +++--- .../tutorials/samegame/samegame2/samegame.qml | 2 +- .../tutorials/samegame/samegame3/Dialog.qml | 2 +- .../tutorials/samegame/samegame3/samegame.js | 54 +++++----- .../tutorials/samegame/samegame3/samegame.qml | 8 +- .../samegame/samegame4/content/Dialog.qml | 2 +- .../samegame/samegame4/content/samegame.js | 117 ++++++++++----------- .../tutorials/samegame/samegame4/samegame.qml | 8 +- 9 files changed, 121 insertions(+), 131 deletions(-) diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 598f47b..4d3bfa8 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -160,18 +160,20 @@ we cannot use \l Repeater to define the blocks. Instead, we will create the blocks in JavaScript. Here is the JavaScript code for generating the blocks, contained in a new -file, \c samegame.js: +file, \c samegame.js. The code is explained below. \snippet declarative/tutorials/samegame/samegame2/samegame.js 0 -The main function here is \c initBoard(). It creates an array to store all the game -blocks, then calls \c createBlock() to create enough blocks to fill the game canvas. +The \c startNewGame() function deletes the blocks created in the previous game and +calculates the number of rows and columns of blocks required to fill the game window for the new game. +Then, it creates an array to store all the game +blocks, and calls \c createBlock() to create enough blocks to fill the game window. -The \c createBlock() function creates a block using the \c Block.qml file +The \c createBlock() function creates a block from the \c Block.qml file and moves the new block to its position on the game canvas. This involves several steps: \list -\o \l {createComponent(url file)} is called to generate an element from \c Block.qml. +\o \l {createComponent(url file)}{createComponent()} is called to generate an element from \c Block.qml. If the component is ready, we can call \c createObject() to create an instance of the \c Block item. (If a component is loaded remotely - over HTTP for example - then we would have to wait for the component to finish loading before calling \c createObject()). @@ -193,13 +195,13 @@ the JavaScript file as a \l{Modules#QML Modules}{module}: \snippet declarative/tutorials/samegame/samegame2/samegame.qml 2 This allows us to refer to any functions within \c samegame.js using "SameGame" -as a prefix: for example, \c SameGame.initBoard() or \c SameGame.createBlock(). -This means we can now connect the New Game button's \c onClicked handler to the \c initBoard() +as a prefix: for example, \c SameGame.startNewGame() or \c SameGame.createBlock(). +This means we can now connect the New Game button's \c onClicked handler to the \c startNewGame() function, like this: \snippet declarative/tutorials/samegame/samegame2/samegame.qml 1 -So, when you click the New Game button, \c initBoard() is called and generates a field of blocks, like this: +So, when you click the New Game button, \c startNewGame() is called and generates a field of blocks, like this: \image declarative-adv-tutorial2.png @@ -247,7 +249,7 @@ To make it easier for the JavaScript code to interface with the QML elements, we The \c gameCanvas item is the exact size of the board, and has a \c score property and a \l MouseArea for input. The blocks are now created as its children, and its dimensions are used to determine the board size so that the application scales to the available screen size. -Since its size is bound to a multiple of \c tileSize, \c tileSize needs to be moved out of \c samegame.js and into \c samegame.qml as a QML property. +Since its size is bound to a multiple of \c blockSize, \c blockSize needs to be moved out of \c samegame.js and into \c samegame.qml as a QML property. Note that it can still be accessed from the script. The \l MouseArea simply calls \c{handleClick()} in \c samegame.js, which determines whether the player's click should cause any blocks to be removed, and updates \c gameCanvas.score with the current score if necessary. Here is the \c handleClick() function: @@ -258,7 +260,7 @@ Note that if \c score was a global variable in the \c{samegame.js} file you woul \section3 Updating the score -When the player clicks a block and triggers \c handleClick(), \c handleClick() also calls victoryCheck() to update the score and to check whether the player has completed the game. Here is the \c victoryCheck() code: +When the player clicks a block and triggers \c handleClick(), \c handleClick() also calls \c victoryCheck() to update the score and to check whether the player has completed the game. Here is the \c victoryCheck() code: \snippet declarative/tutorials/samegame/samegame3/samegame.js 2 @@ -287,7 +289,7 @@ Here is a screenshot of what has been accomplished so far: \image declarative-adv-tutorial3.png -Here is the QML code as it is now in \c samegame.qml: +This is what \c samegame.qml looks like now: \snippet declarative/tutorials/samegame/samegame3/samegame.qml 0 @@ -439,7 +441,7 @@ By following this tutorial you've seen how you can write a fully functional appl \o Build your application with \l {{QML Elements}}{QML elements} \o Add application logic \l{Integrating JavaScript}{with JavaScript code} \o Add animations with \l {Behavior}{Behaviors} and \l{QML States}{states} -\o Store persistent application data through online and offline methods +\o Store persistent application data using the \l{Offline Storage API} or \l XMLHttpRequest \endlist There is so much more to learn about QML that we haven't been able to cover in this tutorial. Check out all the diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js index d7cbd8d..3f12561 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js @@ -1,11 +1,9 @@ //![0] -//Note that X/Y referred to here are in game coordinates -var maxColumn = 10;//Nums are for tileSize 40 +var blockSize = 40; +var maxColumn = 10; var maxRow = 15; -var tileSize = 40; var maxIndex = maxColumn*maxRow; var board = new Array(maxIndex); -var tileSrc = "Block.qml"; var component; //Index function used instead of a 2D array @@ -13,17 +11,17 @@ function index(column,row) { return column + (row * maxColumn); } -function initBoard() +function startNewGame() { - //Delete old blocks + //Delete blocks from previous game for(var i = 0; i= maxColumn || column < 0 || row >= maxRow || row < 0) return; if(board[index(column, row)] == null) return; - //If it's a valid tile, remove it and all connected (does nothing if it's not connected) + //If it's a valid block, remove it and all connected (does nothing if it's not connected) floodFill(column,row, -1); if(fillFound <= 0) return; @@ -108,7 +105,7 @@ function floodFill(column,row,type) floodFill(column,row+1,type); floodFill(column,row-1,type); if(first==true && fillFound == 0) - return;//Can't remove single tiles + return;//Can't remove single blocks board[index(column,row)].opacity = 0; board[index(column,row)] = null; fillFound += 1; @@ -125,7 +122,7 @@ function shuffleDown() }else{ if(fallDist > 0){ var obj = board[index(column,row)]; - obj.y += fallDist * gameCanvas.tileSize; + obj.y += fallDist * gameCanvas.blockSize; board[index(column,row+fallDist)] = obj; board[index(column,row)] = null; } @@ -143,7 +140,7 @@ function shuffleDown() var obj = board[index(column,row)]; if(obj == null) continue; - obj.x -= fallDist * gameCanvas.tileSize; + obj.x -= fallDist * gameCanvas.blockSize; board[index(column-fallDist,row)] = obj; board[index(column,row)] = null; } @@ -155,20 +152,21 @@ function shuffleDown() //![2] function victoryCheck() { - //awards bonuses for no tiles left + //Award bonus points if no blocks left var deservesBonus = true; for(var column=maxColumn-1; column>=0; column--) if(board[index(column, maxRow - 1)] != null) deservesBonus = false; if(deservesBonus) gameCanvas.score += 500; - //Checks for game over + + //Check whether game has finished if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))) dialog.show("Game Over. Your score is " + gameCanvas.score); } //![2] -//only floods up and right, to see if it can find adjacent same-typed tiles +//only floods up and right, to see if it can find adjacent same-typed blocks function floodMoveCheck(column, row, type) { if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml index 9623932..cdf99d7 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml @@ -21,11 +21,11 @@ Rectangle { Item { id: gameCanvas property int score: 0 - property int tileSize: 40 + property int blockSize: 40 z: 20; anchors.centerIn: parent - width: parent.width - (parent.width % tileSize); - height: parent.height - (parent.height % tileSize); + width: parent.width - (parent.width % blockSize); + height: parent.height - (parent.height % blockSize); MouseArea { anchors.fill: parent; onClicked: SameGame.handleClick(mouse.x,mouse.y); @@ -45,7 +45,7 @@ Rectangle { anchors.bottom: screen.bottom Button { - text: "New Game"; onClicked: SameGame.initBoard(); + text: "New Game"; onClicked: SameGame.startNewGame(); anchors.left: parent.left; anchors.leftMargin: 3 anchors.verticalCenter: parent.verticalCenter } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml index 0716bb3..15f5b19 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml @@ -11,7 +11,7 @@ Rectangle { page.opacity = 1; } signal closed(); - color: "white"; border.width: 1; width: dialogText.width + 20; height: 60; + color: "white"; border.width: 1; width: dialogText.width + 20; height: dialogText.height + 20; opacity: 0 Behavior on opacity { NumberAnimation { duration: 1000 } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index a905f7d..0b1c6d6 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -1,38 +1,28 @@ /* This script file handles the game logic */ -//Note that X/Y referred to here are in game coordinates -var maxColumn = 10;//Nums are for gameCanvas.tileSize 40 +var maxColumn = 10; var maxRow = 15; var maxIndex = maxColumn*maxRow; var board = new Array(maxIndex); -var tileSrc = "content/BoomBlock.qml"; -//var scoresURL = "http://qtfx-nokia.trolltech.com.au/samegame/scores.php"; +var component; var scoresURL = ""; -var timer; -var component = createComponent(tileSrc); +var gameDuration; //Index function used instead of a 2D array function index(column,row) { return column + (row * maxColumn); } -function timeStr(msecs) { - var secs = Math.floor(msecs/1000); - var m = Math.floor(secs/60); - var ret = "" + m + "m " + (secs%60) + "s"; - return ret; -} - -function initBoard() +function startNewGame() { for(var i = 0; i= maxColumn || column < 0 || row >= maxRow || row < 0) return; if(board[index(column, row)] == null) return; - //If it's a valid tile, remove it and all connected (does nothing if it's not connected) + //If it's a valid block, remove it and all connected (does nothing if it's not connected) floodFill(column,row, -1); if(fillFound <= 0) return; @@ -95,7 +116,7 @@ function floodFill(column,row,type) floodFill(column,row+1,type); floodFill(column,row-1,type); if(first==true && fillFound == 0) - return;//Can't remove single tiles + return;//Can't remove single blocks board[index(column,row)].dying = true; board[index(column,row)] = null; fillFound += 1; @@ -112,7 +133,7 @@ function shuffleDown() }else{ if(fallDist > 0){ var obj = board[index(column,row)]; - obj.targetY += fallDist * gameCanvas.tileSize; + obj.targetY += fallDist * gameCanvas.blockSize; board[index(column,row+fallDist)] = obj; board[index(column,row)] = null; } @@ -130,7 +151,7 @@ function shuffleDown() obj = board[index(column,row)]; if(obj == null) continue; - obj.targetX -= fallDist * gameCanvas.tileSize; + obj.targetX -= fallDist * gameCanvas.blockSize; board[index(column-fallDist,row)] = obj; board[index(column,row)] = null; } @@ -141,21 +162,22 @@ function shuffleDown() function victoryCheck() { - //awards bonuses for no tiles left + //Award bonus points if no blocks left var deservesBonus = true; for(var column=maxColumn-1; column>=0; column--) if(board[index(column, maxRow - 1)] != null) deservesBonus = false; if(deservesBonus) gameCanvas.score += 500; - //Checks for game over + + //Check whether game has finished if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))){ - timer = new Date() - timer; + gameDuration = new Date() - gameDuration; nameInputDialog.show("You won! Please enter your name: "); } } -//only floods up and right, to see if it can find adjacent same-typed tiles +//only floods up and right, to see if it can find adjacent same-typed blocks function floodMoveCheck(column, row, type) { if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) @@ -169,35 +191,6 @@ function floodMoveCheck(column, row, type) floodMoveCheck(column, row - 1, board[index(column,row)].type); } -function createBlock(column,row){ - // Note that we don't wait for the component to become ready. This will - // only work if the block QML is a local file. Otherwise the component will - // not be ready immediately. There is a statusChanged signal on the - // component you could use if you want to wait to load remote files. - if(component.isReady){ - var dynamicObject = component.createObject(); - if(dynamicObject == null){ - print("error creating block"); - print(component.errorsString()); - return false; - } - dynamicObject.type = Math.floor(Math.random() * 3); - dynamicObject.parent = gameCanvas; - dynamicObject.x = column*gameCanvas.tileSize; - dynamicObject.targetX = column*gameCanvas.tileSize; - dynamicObject.targetY = row*gameCanvas.tileSize; - dynamicObject.width = gameCanvas.tileSize; - dynamicObject.height = gameCanvas.tileSize; - dynamicObject.spawned = true; - board[index(column,row)] = dynamicObject; - }else{//isError or isLoading - print("error loading block component"); - print(component.errorsString()); - return false; - } - return true; -} - //![2] function saveHighScore(name) { if(scoresURL!="") @@ -205,7 +198,7 @@ function saveHighScore(name) { //OfflineStorage var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores",100); var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; - var data = [name, gameCanvas.score, maxColumn+"x"+maxRow ,Math.floor(timer/1000)]; + var data = [name, gameCanvas.score, maxColumn+"x"+maxRow ,Math.floor(gameDuration/1000)]; db.transaction( function(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); @@ -228,7 +221,7 @@ function saveHighScore(name) { function sendHighScore(name) { var postman = new XMLHttpRequest() var postData = "name="+name+"&score="+gameCanvas.score - +"&gridSize="+maxColumn+"x"+maxRow +"&time="+Math.floor(timer/1000); + +"&gridSize="+maxColumn+"x"+maxRow +"&time="+Math.floor(gameDuration/1000); postman.open("POST", scoresURL, true); postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); postman.onreadystatechange = function() { diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml index fe35e3b..5d5c81f 100644 --- a/examples/declarative/tutorials/samegame/samegame4/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml @@ -20,11 +20,11 @@ Rectangle { Item { id: gameCanvas property int score: 0 - property int tileSize: 40 + property int blockSize: 40 z: 20; anchors.centerIn: parent - width: parent.width - (parent.width % tileSize); - height: parent.height - (parent.height % tileSize); + width: parent.width - (parent.width % blockSize); + height: parent.height - (parent.height % blockSize); MouseArea { anchors.fill: parent; onClicked: SameGame.handleClick(mouse.x,mouse.y); @@ -63,7 +63,7 @@ Rectangle { anchors.bottom: screen.bottom Button { - text: "New Game"; onClicked: SameGame.initBoard(); + text: "New Game"; onClicked: SameGame.startNewGame(); anchors.left: parent.left; anchors.leftMargin: 3 anchors.verticalCenter: parent.verticalCenter } -- cgit v0.12 From 60af93993f3465781d894b01d48d31bebfb29708 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 12:00:56 +1000 Subject: Straighten board lines --- .../declarative/tic-tac-toe/content/pics/board.png | Bin 11208 -> 1423 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/declarative/tic-tac-toe/content/pics/board.png b/examples/declarative/tic-tac-toe/content/pics/board.png index e7a7324..29118a9 100644 Binary files a/examples/declarative/tic-tac-toe/content/pics/board.png and b/examples/declarative/tic-tac-toe/content/pics/board.png differ -- cgit v0.12 From 25f17fb8e566fca0838545941d3e0281698ec355 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Fri, 9 Apr 2010 05:19:23 +0200 Subject: Some cleanup in widgets module. Deletion of GraphicsObjectContainer. This commit deletes the uneeded classes/declarations since we have now an inline support for QGraphicsObject based classes. QGraphicsLayout bindings works the same way because the layout property has been added to QGraphicsWidget. The only feature that is missing for now (because of the deletion of GraphicsObjectContainer) is the anchoring support. We will probably take a look on how to support this feature properly with no wrapper. Task-number:QTBUG-9456 Reviewed-by:Michael Brasser --- examples/declarative/layouts/layouts.qml | 35 ++- src/declarative/graphicsitems/graphicsitems.pri | 2 - .../qdeclarativegraphicsobjectcontainer.cpp | 269 --------------------- .../qdeclarativegraphicsobjectcontainer_p.h | 89 ------- .../graphicsitems/qdeclarativeitemsmodule.cpp | 2 - src/imports/widgets/graphicslayouts_p.h | 3 +- src/imports/widgets/graphicswidgets.cpp | 40 --- src/imports/widgets/graphicswidgets_p.h | 68 ------ src/imports/widgets/widgets.cpp | 70 +----- src/imports/widgets/widgets.pro | 1 - 10 files changed, 18 insertions(+), 561 deletions(-) delete mode 100644 src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp delete mode 100644 src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h delete mode 100644 src/imports/widgets/graphicswidgets.cpp delete mode 100644 src/imports/widgets/graphicswidgets_p.h diff --git a/examples/declarative/layouts/layouts.qml b/examples/declarative/layouts/layouts.qml index 231605e..1d34afd 100644 --- a/examples/declarative/layouts/layouts.qml +++ b/examples/declarative/layouts/layouts.qml @@ -4,27 +4,22 @@ Item { id: resizable width:400 height:400 + QGraphicsWidget { + size.width:parent.width + size.height:parent.height - GraphicsObjectContainer { - anchors.fill:parent - - QGraphicsWidget { - size.width:parent.width - size.height:parent.height - - layout: QGraphicsLinearLayout { - LayoutItem { - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { color: "yellow"; anchors.fill: parent } - } - LayoutItem { - minimumSize: "100x100" - maximumSize: "400x400" - preferredSize: "200x200" - Rectangle { color: "green"; anchors.fill: parent } - } + layout: QGraphicsLinearLayout { + LayoutItem { + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "100x100" + Rectangle { color: "yellow"; anchors.fill: parent } + } + LayoutItem { + minimumSize: "100x100" + maximumSize: "400x400" + preferredSize: "200x200" + Rectangle { color: "green"; anchors.fill: parent } } } } diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri index af76a67..eab41e3 100644 --- a/src/declarative/graphicsitems/graphicsitems.pri +++ b/src/declarative/graphicsitems/graphicsitems.pri @@ -48,7 +48,6 @@ HEADERS += \ $$PWD/qdeclarativetext_p_p.h \ $$PWD/qdeclarativevisualitemmodel_p.h \ $$PWD/qdeclarativelistview_p.h \ - $$PWD/qdeclarativegraphicsobjectcontainer_p.h \ $$PWD/qdeclarativelayoutitem_p.h \ $$PWD/qdeclarativeitemchangelistener_p.h \ $$PWD/qdeclarativeeffects.cpp @@ -82,5 +81,4 @@ SOURCES += \ $$PWD/qdeclarativetextedit.cpp \ $$PWD/qdeclarativevisualitemmodel.cpp \ $$PWD/qdeclarativelistview.cpp \ - $$PWD/qdeclarativegraphicsobjectcontainer.cpp \ $$PWD/qdeclarativelayoutitem.cpp diff --git a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp deleted file mode 100644 index f5beebd..0000000 --- a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE: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 "private/qdeclarativegraphicsobjectcontainer_p.h" - -#include "private/qdeclarativeitem_p.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeGraphicsObjectContainerPrivate : public QDeclarativeItemPrivate -{ - Q_DECLARE_PUBLIC(QDeclarativeGraphicsObjectContainer) - -public: - QDeclarativeGraphicsObjectContainerPrivate() : QDeclarativeItemPrivate(), graphicsObject(0), syncedResize(false) - { } - - void _q_updateSize(); - - void setFiltering(bool on) - { - Q_Q(QDeclarativeGraphicsObjectContainer); - if (graphicsObject && graphicsObject->isWidget()) { - if (!on) { - graphicsObject->removeEventFilter(q); - QObject::disconnect(q, SIGNAL(widthChanged()), q, SLOT(_q_updateSize())); - QObject::disconnect(q, SIGNAL(heightChanged()), q, SLOT(_q_updateSize())); - } else { - graphicsObject->installEventFilter(q); - QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(_q_updateSize())); - QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(_q_updateSize())); - } - } - } - - - QGraphicsObject *graphicsObject; - bool syncedResize; -}; - - -/*! - \qmlclass GraphicsObjectContainer QDeclarativeGraphicsObjectContainer - \since 4.7 - \brief The GraphicsObjectContainer element allows you to add QGraphicsObjects into Fluid UI elements. - - While any QObject based class can be exposed to QML, QDeclarativeItem - provides a lot of important functionality, including anchors and proper - management of child items. GraphicsObjectContainer helps provide these - functions to other QGraphicsObjects, so that they can be used unaltered in - a QML scene. QGraphicsObjects, which are not QDeclarativeItems, and which are - placed in a QML scene outside of a GraphicsObjectContainer, will not appear - on screen at all. - - A GraphicsObjectContainer can have one element inside it, and it must be a - QGraphicsObject or subclass which has been exposed to the QML engine. - The graphics object inside the GraphicsObjectContainer can then be used - like any other item in QML with the exception of not being reparentable - and not having the standard properties of QML items (such as anchors). - - As the contained object is positioned relative to the container, anchors - affecting the container item will affect the onscreen position of the - contained item. If synchronizedResizing is set to true, then anchors - affecting the container item's size will also affect the contained item's - size. - - Example: - \code - import Qt 4.7 - import MyApp 2.1 as Widgets - Rectangle{ - id: rect - property alias widgetPropertyThree: widget.myThirdProperty; - GraphicsObjectContainer{ - synchronizedResizing: true - anchors.margins: 10 - anchors.fill: parent - Widgets.MyWidget{ - myProperty: "A Value" - myOtherProperty: rect.color - } - } - } - \endcode -*/ - -/*! - \internal - \class QDeclarativeGraphicsObjectContainer - \brief The QDeclarativeGraphicsObjectContainer class allows you to add QGraphicsObjects into Fluid UI applications. -*/ - -QDeclarativeGraphicsObjectContainer::QDeclarativeGraphicsObjectContainer(QDeclarativeItem *parent) -: QDeclarativeItem(*new QDeclarativeGraphicsObjectContainerPrivate, parent) -{ -} - -QDeclarativeGraphicsObjectContainer::~QDeclarativeGraphicsObjectContainer() -{ -} - -QGraphicsObject *QDeclarativeGraphicsObjectContainer::graphicsObject() const -{ - Q_D(const QDeclarativeGraphicsObjectContainer); - return d->graphicsObject; -} - -/*! - \qmlproperty QGraphicsObject GraphicsObjectContainer::graphicsObject - The QGraphicsObject associated with this element. -*/ -void QDeclarativeGraphicsObjectContainer::setGraphicsObject(QGraphicsObject *object) -{ - Q_D(QDeclarativeGraphicsObjectContainer); - if (object == d->graphicsObject) - return; - - //### remove previously set item? - - d->setFiltering(false); - - d->graphicsObject = object; - - if (d->graphicsObject) { - d->graphicsObject->setParentItem(this); - - if (d->syncedResize && d->graphicsObject->isWidget()) { - QGraphicsWidget *gw = static_cast(d->graphicsObject); - QSizeF gwSize = gw->size(); //### should we use sizeHint? - QSizeF newSize = gwSize; - if (heightValid()) - newSize.setHeight(height()); - if (widthValid()) - newSize.setWidth(width()); - if (gwSize != newSize) - gw->resize(newSize); - - gwSize = gw->size(); - setImplicitWidth(gwSize.width()); - setImplicitHeight(gwSize.height()); - - d->setFiltering(true); - } - } -} - -QVariant QDeclarativeGraphicsObjectContainer::itemChange(GraphicsItemChange change, const QVariant &value) -{ - Q_D(QDeclarativeGraphicsObjectContainer); - if (change == ItemSceneHasChanged) { - QGraphicsObject *o = d->graphicsObject; - d->graphicsObject = 0; - setGraphicsObject(o); - } - return QDeclarativeItem::itemChange(change, value); -} - -bool QDeclarativeGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e) -{ - Q_D(QDeclarativeGraphicsObjectContainer); - if (watched == d->graphicsObject && e->type() == QEvent::GraphicsSceneResize) { - if (d->graphicsObject && d->graphicsObject->isWidget() && d->syncedResize) { - QSizeF newSize = static_cast(d->graphicsObject)->size(); - setImplicitWidth(newSize.width()); - setImplicitHeight(newSize.height()); - } - } - return QDeclarativeItem::eventFilter(watched, e); -} - -/*! - \qmlproperty bool GraphicsObjectContainer::synchronizedResizing - - This property determines whether or not the container and graphics object will synchronize their - sizes. - - \note This property only applies when wrapping a QGraphicsWidget. - - If synchronizedResizing is enabled, the container and widget will - synchronize their sizes as follows. - \list - \o If a size has been set on the container, the widget will be resized to the container. - Any changes in the container's size will be reflected in the widget. - - \o \e Otherwise, the container will initially be sized to the preferred size of the widget. - Any changes to the container's size will be reflected in the widget, and any changes to the - widget's size will be reflected in the container. - \endlist -*/ -bool QDeclarativeGraphicsObjectContainer::synchronizedResizing() const -{ - Q_D(const QDeclarativeGraphicsObjectContainer); - return d->syncedResize; -} - -void QDeclarativeGraphicsObjectContainer::setSynchronizedResizing(bool on) -{ - Q_D(QDeclarativeGraphicsObjectContainer); - if (on == d->syncedResize) - return; - - d->syncedResize = on; - d->setFiltering(on); -} - -void QDeclarativeGraphicsObjectContainerPrivate::_q_updateSize() -{ - if (!graphicsObject || !graphicsObject->isWidget() || !syncedResize) - return; - - QGraphicsWidget *gw = static_cast(graphicsObject); - const QSizeF newSize(width(), height()); - gw->resize(newSize); - - //### will respecting the widgets min/max ever get us in trouble? (all other items always - // size to exactly what you tell them) - /*QSizeF constrainedSize = newSize.expandedTo(gw->minimumSize()).boundedTo(gw->maximumSize()); - gw->resize(constrainedSize); - if (constrainedSize != newSize) { - setImplicitWidth(constrainedSize.width()); - setImplicitHeight(constrainedSize.height()); - }*/ -} - -#include - -QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h deleted file mode 100644 index 20c5bcf..0000000 --- a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE: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$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEGRAPHICSOBJECTCONTAINER_H -#define QDECLARATIVEGRAPHICSOBJECTCONTAINER_H - -#include "qdeclarativeitem.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QGraphicsObject; -class QDeclarativeGraphicsObjectContainerPrivate; - -class Q_DECLARATIVE_EXPORT QDeclarativeGraphicsObjectContainer : public QDeclarativeItem -{ - Q_OBJECT - - Q_CLASSINFO("DefaultProperty", "graphicsObject") - Q_PROPERTY(QGraphicsObject *graphicsObject READ graphicsObject WRITE setGraphicsObject) - Q_PROPERTY(bool synchronizedResizing READ synchronizedResizing WRITE setSynchronizedResizing) - -public: - QDeclarativeGraphicsObjectContainer(QDeclarativeItem *parent = 0); - ~QDeclarativeGraphicsObjectContainer(); - - QGraphicsObject *graphicsObject() const; - void setGraphicsObject(QGraphicsObject *); - - bool synchronizedResizing() const; - void setSynchronizedResizing(bool on); - -protected: - QVariant itemChange(GraphicsItemChange change, const QVariant &value); - bool eventFilter(QObject *watched, QEvent *e); - -private: - Q_PRIVATE_SLOT(d_func(), void _q_updateSize()) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeGraphicsObjectContainer) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeGraphicsObjectContainer) - -QT_END_HEADER - -#endif // QDECLARATIVEGRAPHICSOBJECTCONTAINER_H diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 35a4d00..7664af1 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -57,7 +57,6 @@ #include "private/qdeclarativeflipable_p.h" #include "private/qdeclarativefocuspanel_p.h" #include "private/qdeclarativefocusscope_p.h" -#include "private/qdeclarativegraphicsobjectcontainer_p.h" #include "private/qdeclarativegridview_p.h" #include "private/qdeclarativeimage_p.h" #include "private/qdeclarativeitem_p.h" @@ -96,7 +95,6 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("Qt",4,6,"FocusScope"); qmlRegisterType("Qt",4,6,"Gradient"); qmlRegisterType("Qt",4,6,"GradientStop"); - qmlRegisterType("Qt",4,6,"GraphicsObjectContainer"); qmlRegisterType("Qt",4,6,"Grid"); qmlRegisterType("Qt",4,6,"GridView"); qmlRegisterType("Qt",4,6,"Image"); diff --git a/src/imports/widgets/graphicslayouts_p.h b/src/imports/widgets/graphicslayouts_p.h index f9b9ae8..1c3dfe5 100644 --- a/src/imports/widgets/graphicslayouts_p.h +++ b/src/imports/widgets/graphicslayouts_p.h @@ -42,10 +42,9 @@ #ifndef GRAPHICSLAYOUTS_H #define GRAPHICSLAYOUTS_H -#include "graphicswidgets_p.h" - #include #include +#include QT_BEGIN_HEADER diff --git a/src/imports/widgets/graphicswidgets.cpp b/src/imports/widgets/graphicswidgets.cpp deleted file mode 100644 index 062e516..0000000 --- a/src/imports/widgets/graphicswidgets.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE: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$ -** -****************************************************************************/ diff --git a/src/imports/widgets/graphicswidgets_p.h b/src/imports/widgets/graphicswidgets_p.h deleted file mode 100644 index 2c2b707..0000000 --- a/src/imports/widgets/graphicswidgets_p.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE: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$ -** -****************************************************************************/ - -#ifndef GRAPHICSWIDGETS_H -#define GRAPHICSWIDGETS_H - -#include - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QGraphicsView) -QML_DECLARE_TYPE_HASMETATYPE(QGraphicsScene) -QML_DECLARE_TYPE(QGraphicsWidget) -QML_DECLARE_TYPE(QGraphicsObject) -QML_DECLARE_INTERFACE_HASMETATYPE(QGraphicsItem) - -QT_END_HEADER - -#endif // GRAPHICSWIDGETS_H diff --git a/src/imports/widgets/widgets.cpp b/src/imports/widgets/widgets.cpp index bc18e8a..f26969a 100644 --- a/src/imports/widgets/widgets.cpp +++ b/src/imports/widgets/widgets.cpp @@ -41,75 +41,12 @@ #include #include +#include #include "graphicslayouts_p.h" -#include "graphicswidgets_p.h" QT_BEGIN_NAMESPACE -class QGraphicsViewDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QGraphicsScene *scene READ scene WRITE setScene) - Q_CLASSINFO("DefaultProperty", "scene") -public: - QGraphicsViewDeclarativeUI(QObject *other) : QObject(other) {} - - QGraphicsScene *scene() const { return static_cast(parent())->scene(); } - void setScene(QGraphicsScene *scene) - { - static_cast(parent())->setScene(scene); - } -}; - -class QGraphicsSceneDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other) {} - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this->parent(), 0, children_append); } - -private: - static void children_append(QDeclarativeListProperty *prop, QObject *o) { - if (QGraphicsObject *go = qobject_cast(o)) - static_cast(prop->object)->addItem(go); - } -}; - -class QGraphicsWidgetDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other) {} - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append); } - - QGraphicsLayout *layout() const { return static_cast(parent())->layout(); } - void setLayout(QGraphicsLayout *lo) - { - static_cast(parent())->setLayout(lo); - } - -private: - void setItemParent(QGraphicsItem *wid) - { - wid->setParentItem(static_cast(parent())); - } - - static void children_append(QDeclarativeListProperty *prop, QGraphicsItem *i) { - static_cast(prop->object)->setItemParent(i); - } -}; - class QWidgetsQmlModule : public QDeclarativeExtensionPlugin { Q_OBJECT @@ -123,10 +60,7 @@ public: qmlRegisterType(uri,4,6,"QGraphicsLinearLayoutStretchItem"); qmlRegisterType(uri,4,6,"QGraphicsLinearLayout"); qmlRegisterType(uri,4,6,"QGraphicsGridLayout"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsView"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsScene"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsWidget"); - qmlRegisterInterface("QGraphicsItem"); + qmlRegisterType(uri,4,6,"QGraphicsWidget"); } }; diff --git a/src/imports/widgets/widgets.pro b/src/imports/widgets/widgets.pro index 408f878..f26e4b9 100644 --- a/src/imports/widgets/widgets.pro +++ b/src/imports/widgets/widgets.pro @@ -9,7 +9,6 @@ SOURCES += \ widgets.cpp HEADERS += \ - graphicswidgets_p.h \ graphicslayouts_p.h QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH -- cgit v0.12 From 45ca7aff2c04c302906a1af0d9d671bb9cb452f0 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 13:31:25 +1000 Subject: Use variant instead of var in QML In QML "var"s are not the same as JavaScript vars - they are QVariants instead. However, as they behave in a similar enough fashion to native JavaScript it can be confusing to developers when they are called "var". --- src/declarative/qml/qdeclarativebinding.cpp | 13 ------------- src/declarative/qml/qdeclarativeobjectscriptclass.cpp | 7 +------ src/declarative/qml/qdeclarativescriptparser.cpp | 11 +++++++++-- .../data/propertyAssignmentErrors.qml | 6 ------ .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 4 +--- 5 files changed, 11 insertions(+), 30 deletions(-) diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 6a99855..91eb915 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -170,19 +170,6 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) if (data->error.isValid()) { - } else if (!scriptValue.isVariant() && value.userType() == QMetaType::QVariantList && - data->property.propertyType() == qMetaTypeId()) { - - // This case catches QtScript's automatic conversion to QVariantList for arrays - QUrl url = QUrl(data->url); - int line = data->line; - if (url.isEmpty()) url = QUrl(QLatin1String("")); - - data->error.setUrl(url); - data->error.setLine(line); - data->error.setColumn(-1); - data->error.setDescription(QLatin1String("Unable to assign JavaScript array to QML variant property")); - } else if (isUndefined && data->property.isResettable()) { data->property.reset(); diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index ec84da9..4601aaa 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -361,12 +361,7 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, else v = enginePriv->scriptValueToVariant(value, lastData->propType); - if (!value.isVariant() && v.userType() == QMetaType::QVariantList && - lastData->propType == qMetaTypeId()) { - - QString error = QLatin1String("Cannot assign JavaScript array to QML variant property"); - context->throwError(error); - } else if (!QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext)) { + if (!QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext)) { const char *valueType = 0; if (v.userType() == QVariant::Invalid) valueType = "null"; else valueType = QMetaType::typeName(v.userType()); diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 507ff5b..92a10aa 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -535,7 +535,8 @@ bool ProcessAST::visit(AST::UiPublicMember *node) // { "time", Object::DynamicProperty::Time, "QTime" }, // { "date", Object::DynamicProperty::Date, "QDate" }, { "date", Object::DynamicProperty::DateTime, "QDateTime" }, - { "var", Object::DynamicProperty::Variant, "QVariant" } + { "var", Object::DynamicProperty::Variant, "QVariant" }, + { "variant", Object::DynamicProperty::Variant, "QVariant" } }; const int propTypeNameToTypesCount = sizeof(propTypeNameToTypes) / sizeof(propTypeNameToTypes[0]); @@ -563,7 +564,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node) _parser->_errors << error; return false; } - + signal.parameterTypes << qtType; signal.parameterNames << p->name->asString().toUtf8(); p = p->finish(); @@ -646,6 +647,11 @@ bool ProcessAST::visit(AST::UiPublicMember *node) property.location = location(node->firstSourceLocation(), node->lastSourceLocation()); + if (memberType == QByteArray("var")) + qWarning().nospace() << qPrintable(_parser->_scriptFile) << ":" << property.location.start.line << ":" + << property.location.start.column << ": var type has been replaced by variant. " + << "Support will be removed entirely shortly."; + if (node->expression) { // default value property.defaultValue = new Property; property.defaultValue->parent = _stateStack.top().object; @@ -909,6 +915,7 @@ bool QDeclarativeScriptParser::parse(const QByteArray &qmldata, const QUrl &url) clear(); const QString fileName = url.toString(); + _scriptFile = fileName; QTextStream stream(qmldata, QIODevice::ReadOnly); stream.setCodec("UTF-8"); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml index 483179a..416dbce 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml @@ -14,12 +14,6 @@ QtObject { } try { - root.b = [ 10, root ] - } catch(e) { - console.log (e.fileName + ":" + e.lineNumber + ":" + e); - } - - try { root.a = "Hello"; } catch(e) { console.log (e.fileName + ":" + e.lineNumber + ":" + e); diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 72f14f9..c6bb276 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -1026,12 +1026,10 @@ void tst_qdeclarativeecmascript::propertyAssignmentErrors() QString url = component.url().toString(); QString warning1 = url + ":11:Error: Cannot assign [undefined] to int"; - QString warning2 = url + ":17:Error: Cannot assign JavaScript array to QML variant property"; - QString warning3 = url + ":23:Error: Cannot assign QString to int"; + QString warning2 = url + ":17:Error: Cannot assign QString to int"; QTest::ignoreMessage(QtDebugMsg, warning1.toLatin1().constData()); QTest::ignoreMessage(QtDebugMsg, warning2.toLatin1().constData()); - QTest::ignoreMessage(QtDebugMsg, warning3.toLatin1().constData()); QObject *object = component.create(); QVERIFY(object != 0); -- cgit v0.12 From e0dcdbd2984299665b9b784b201289219b9978d3 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 9 Apr 2010 13:37:00 +1000 Subject: Better reporting of extension plugin loading errors. --- src/declarative/qml/qdeclarativeengine.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 68ce953..8905713 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1479,13 +1479,17 @@ public: QSet qmlDirFilesForWhichPluginsHaveBeenLoaded; - QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine) { + QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine, 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 QDeclarativeDirComponents(); } QDir dir = QFileInfo(file).dir(); @@ -1505,7 +1509,15 @@ public: plugin.name); if (!resolvedFilePath.isEmpty()) { - engine->importPlugin(resolvedFilePath, uri); + if (!engine->importPlugin(resolvedFilePath, uri)) { + if (errorString) + *errorString = QDeclarativeEngine::tr("plugin \"%1\" cannot be loaded for module \"%2\"").arg(resolvedFilePath).arg(uri); + return QDeclarativeDirComponents(); + } + } else { + if (errorString) + *errorString = QDeclarativeEngine::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name); + return QDeclarativeDirComponents(); } } } @@ -1570,7 +1582,9 @@ public: url = QUrl::fromLocalFile(fi.absolutePath()).toString(); uri = resolvedUri(dir, engine); - qmldircomponents = importExtension(absoluteFilePath, uri, engine); + qmldircomponents = importExtension(absoluteFilePath, uri, engine, errorString); + if (qmldircomponents.isEmpty()) // error (or empty) + return false; break; } } @@ -1601,12 +1615,14 @@ public: return false; // local import dirs must exist } uri = resolvedUri(toLocalFileOrQrc(base.resolved(QUrl(uri))), engine); - qmldircomponents = importExtension(localFileOrQrc, - uri, - engine); - if (uri.endsWith(QLatin1Char('/'))) uri.chop(1); + if (QFile::exists(localFileOrQrc)) { + qmldircomponents = importExtension(localFileOrQrc, + uri,engine,errorString); + if (qmldircomponents.isEmpty()) // error (or empty) + return false; + } } else { if (prefix.isEmpty()) { // directory must at least exist for valid import -- cgit v0.12 From 51a8ca0c1fe9d5cce6b430632446a2d3c42989c8 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 13:38:04 +1000 Subject: Replace "property var " with "property variant " in QML code --- demos/declarative/flickr/common/Progress.qml | 2 +- demos/declarative/flickr/common/ScrollBar.qml | 2 +- demos/declarative/flickr/mobile/ImageDetails.qml | 4 ++-- demos/declarative/snake/snake.qml | 2 +- demos/declarative/twitter/TwitterCore/RssModel.qml | 2 +- demos/declarative/twitter/TwitterCore/UserModel.qml | 2 +- demos/declarative/twitter/twitter.qml | 2 +- examples/declarative/clocks/content/Clock.qml | 8 ++++---- examples/declarative/dynamic/qml/Button.qml | 2 +- examples/declarative/listview/content/MediaButton.qml | 2 +- .../plugins/com/nokia/TimeExample/Clock.qml | 6 +++--- examples/declarative/scrollbar/ScrollBar.qml | 2 +- examples/declarative/tvtennis/tvtennis.qml | 2 +- examples/declarative/velocity/Day.qml | 2 +- examples/declarative/webview/content/SpinSquare.qml | 4 ++-- .../data/NestedTypeTransientErrors.qml | 2 +- .../qdeclarativeecmascript/data/compiled.qml | 6 +++--- .../qdeclarativeecmascript/data/deletedObject.qml | 2 +- .../data/idShortcutInvalidates.1.qml | 2 +- .../data/idShortcutInvalidates.qml | 2 +- .../qdeclarativeecmascript/data/listToVariant.qml | 2 +- .../data/objectsCompareAsEqual.qml | 2 +- .../data/propertyAssignmentErrors.qml | 2 +- .../data/signalParameterTypes.qml | 4 ++-- .../qdeclarativeecmascript/data/transientErrors.qml | 4 ++-- .../qdeclarativegridview/data/gridview1.qml | 2 +- .../declarative/qdeclarativeinfo/data/NestedObject.qml | 2 +- .../qdeclarativeinfo/data/nestedQmlObject.qml | 4 ++-- .../declarative/qdeclarativeinfo/data/qmlObject.qml | 2 +- .../declarative/qdeclarativelanguage/data/Alias2.qml | 2 +- .../declarative/qdeclarativelanguage/data/Alias3.qml | 2 +- .../qdeclarativelanguage/data/HelperAlias.qml | 2 +- .../declarative/qdeclarativelanguage/data/alias.3.qml | 2 +- .../declarative/qdeclarativelanguage/data/alias.5.qml | 2 +- .../declarative/qdeclarativelanguage/data/alias.8.qml | 2 +- .../declarative/qdeclarativelanguage/data/alias.9.qml | 2 +- .../data/assignLiteralToVariant.qml | 18 +++++++++--------- .../data/assignObjectToVariant.qml | 2 +- .../data/componentCompositeType.qml | 2 +- .../qdeclarativelanguage/data/dynamicProperties.qml | 2 +- .../qdeclarativelanguage/data/idProperty.qml | 2 +- .../data/invalidGroupedProperty.1.qml | 2 +- .../qdeclarativelanguage/data/readOnly.3.qml | 2 +- .../declarative/qdeclarativelistmodel/data/model.qml | 4 ++-- .../qdeclarativelistreference/data/variantToList.qml | 2 +- tests/auto/declarative/qdeclarativeqt/data/darker.qml | 12 ++++++------ .../declarative/qdeclarativeqt/data/formatting.qml | 4 ++-- tests/auto/declarative/qdeclarativeqt/data/lighter.qml | 12 ++++++------ tests/auto/declarative/qdeclarativeqt/data/point.qml | 8 ++++---- tests/auto/declarative/qdeclarativeqt/data/rect.qml | 10 +++++----- tests/auto/declarative/qdeclarativeqt/data/size.qml | 10 +++++----- tests/auto/declarative/qdeclarativeqt/data/vector.qml | 8 ++++---- .../qdeclarativetextedit/data/navigation.qml | 2 +- .../declarative/qdeclarativetextedit/data/readOnly.qml | 2 +- .../qdeclarativetextinput/data/navigation.qml | 2 +- .../qdeclarativetextinput/data/readOnly.qml | 2 +- .../qdeclarativetextinput/data/validators.qml | 6 +++--- .../data/autoBindingRemoval.3.qml | 2 +- .../qdeclarativevaluetypes/data/bindingVariantCopy.qml | 2 +- .../qdeclarativevaluetypes/data/deletedObject.qml | 2 +- .../qdeclarativevaluetypes/data/font_read.qml | 2 +- .../qdeclarativevaluetypes/data/point_read.qml | 2 +- .../qdeclarativevaluetypes/data/pointf_read.qml | 2 +- .../qdeclarativevaluetypes/data/rect_read.qml | 2 +- .../qdeclarativevaluetypes/data/rectf_read.qml | 2 +- .../qdeclarativevaluetypes/data/scriptVariantCopy.qml | 2 +- .../qdeclarativevaluetypes/data/size_read.qml | 2 +- .../qdeclarativevaluetypes/data/sizef_read.qml | 2 +- .../qdeclarativevaluetypes/data/sizereadonly_read.qml | 2 +- .../qdeclarativevaluetypes/data/vector3d_read.qml | 2 +- .../qdeclarativeworkerscript/data/worker.qml | 2 +- .../qmlvisual/qdeclarativespringfollow/clock.qml | 6 +++--- .../declarative/qmlvisual/webview/embedding/egg.qml | 4 ++-- .../data/synthesized_properties.2.qml | 2 +- tools/qml/content/Browser.qml | 4 ++-- 75 files changed, 127 insertions(+), 127 deletions(-) diff --git a/demos/declarative/flickr/common/Progress.qml b/demos/declarative/flickr/common/Progress.qml index 33c6180..f4d25a4 100644 --- a/demos/declarative/flickr/common/Progress.qml +++ b/demos/declarative/flickr/common/Progress.qml @@ -1,7 +1,7 @@ import Qt 4.7 Item { - property var progress: 0 + property variant progress: 0 Rectangle { anchors.fill: parent; smooth: true diff --git a/demos/declarative/flickr/common/ScrollBar.qml b/demos/declarative/flickr/common/ScrollBar.qml index 4296eca..4022d23 100644 --- a/demos/declarative/flickr/common/ScrollBar.qml +++ b/demos/declarative/flickr/common/ScrollBar.qml @@ -3,7 +3,7 @@ import Qt 4.7 Item { id: container - property var flickableArea + property variant flickableArea Rectangle { radius: 5 diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index d86fd2d..58b0b83 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -4,7 +4,7 @@ import "../common" as Common Flipable { id: container - property var frontContainer: containerFront + property variant frontContainer: containerFront property string photoTitle: "" property string photoTags: "" property int photoWidth @@ -14,7 +14,7 @@ Flipable { property string photoDate property string photoUrl property int rating: 2 - property var prevScale: 1.0 + property variant prevScale: 1.0 signal closed diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 014f04e..47bced4 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -24,7 +24,7 @@ Rectangle { property int direction property int headDirection - property var head; + property variant head; Content.HighScoreModel { id: highScores diff --git a/demos/declarative/twitter/TwitterCore/RssModel.qml b/demos/declarative/twitter/TwitterCore/RssModel.qml index 5015e18..dca8499 100644 --- a/demos/declarative/twitter/TwitterCore/RssModel.qml +++ b/demos/declarative/twitter/TwitterCore/RssModel.qml @@ -1,7 +1,7 @@ import Qt 4.7 Item { id: wrapper - property var model: xmlModel + property variant model: xmlModel property string tags : "" property string authName : "" property string authPass : "" diff --git a/demos/declarative/twitter/TwitterCore/UserModel.qml b/demos/declarative/twitter/TwitterCore/UserModel.qml index 449e96c..8a8eb7b 100644 --- a/demos/declarative/twitter/TwitterCore/UserModel.qml +++ b/demos/declarative/twitter/TwitterCore/UserModel.qml @@ -4,7 +4,7 @@ import Qt 4.7 //Copied from RssModel Item { id: wrapper - property var model: xmlModel + property variant model: xmlModel property string user : "" property int status: xmlModel.status function reload() { xmlModel.reload(); } diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index c5e5002..84926cd 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -4,7 +4,7 @@ import "TwitterCore" 1.0 as Twitter Item { id: screen; width: 320; height: 480 property bool userView : false - property var tmpStr + property variant tmpStr function setMode(m){ screen.userView = m; if(m == false){ diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml index c853174..036df46 100644 --- a/examples/declarative/clocks/content/Clock.qml +++ b/examples/declarative/clocks/content/Clock.qml @@ -5,10 +5,10 @@ Item { width: 200; height: 230 property alias city: cityLabel.text - property var hours - property var minutes - property var seconds - property var shift : 0 + property variant hours + property variant minutes + property variant seconds + property variant shift : 0 property bool night: false function timeChanged() { diff --git a/examples/declarative/dynamic/qml/Button.qml b/examples/declarative/dynamic/qml/Button.qml index 946da21..53588bb 100644 --- a/examples/declarative/dynamic/qml/Button.qml +++ b/examples/declarative/dynamic/qml/Button.qml @@ -3,7 +3,7 @@ import Qt 4.7 Rectangle { id: container - property var text + property variant text signal clicked SystemPalette { id: activePalette } diff --git a/examples/declarative/listview/content/MediaButton.qml b/examples/declarative/listview/content/MediaButton.qml index ec69000..a625b4c 100644 --- a/examples/declarative/listview/content/MediaButton.qml +++ b/examples/declarative/listview/content/MediaButton.qml @@ -1,7 +1,7 @@ import Qt 4.7 Item { - property var text + property variant text signal clicked id: container diff --git a/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml index ce1dd69..0048372 100644 --- a/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml +++ b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml @@ -5,9 +5,9 @@ Rectangle { width: 200; height: 200; color: "gray" property alias city: cityLabel.text - property var hours - property var minutes - property var shift : 0 + property variant hours + property variant minutes + property variant shift : 0 Image { id: background; source: "clock.png" } diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml index d2f52d5..2186b35 100644 --- a/examples/declarative/scrollbar/ScrollBar.qml +++ b/examples/declarative/scrollbar/ScrollBar.qml @@ -9,7 +9,7 @@ Item { // orientation can be either 'Vertical' or 'Horizontal' property real position property real pageSize - property var orientation : "Vertical" + property variant orientation : "Vertical" // A light, semi-transparent background Rectangle { diff --git a/examples/declarative/tvtennis/tvtennis.qml b/examples/declarative/tvtennis/tvtennis.qml index 240183f..9d107ad 100644 --- a/examples/declarative/tvtennis/tvtennis.qml +++ b/examples/declarative/tvtennis/tvtennis.qml @@ -10,7 +10,7 @@ Rectangle { Rectangle { // Add a property for the target y coordinate property int targetY : page.height - 10 - property var direction : "right" + property variant direction : "right" id: ball color: "Lime" diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 724fcc8..a39ec94 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -2,7 +2,7 @@ import Qt 4.7 Component { Item { - property var stickies + property variant stickies id: page width: 840; height: 480 diff --git a/examples/declarative/webview/content/SpinSquare.qml b/examples/declarative/webview/content/SpinSquare.qml index ccd68df..dba48d4 100644 --- a/examples/declarative/webview/content/SpinSquare.qml +++ b/examples/declarative/webview/content/SpinSquare.qml @@ -1,8 +1,8 @@ import Qt 4.7 Item { - property var period : 250 - property var color : "black" + property variant period : 250 + property variant color : "black" id: root Item { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml index 7c32e56..28252df 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml @@ -3,7 +3,7 @@ import Qt 4.6 QtObject { property int b: obj.prop.a - property var prop; + property variant prop; prop: QtObject { property int a: 10 } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml index 2fec9da..1c88700 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml @@ -38,7 +38,7 @@ QtObject { property int d: 176 property string e: "Hello" property string f: "World" - property var g: 6.7 - property var h: "!" - property var i: true + property variant g: 6.7 + property variant h: "!" + property variant i: true } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml index 6bc3a17..29eba42 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml @@ -2,7 +2,7 @@ import Qt 4.6 import Qt.test 1.0 QtObject { - property var obj + property variant obj obj: MyQmlObject { id: myObject value: 92 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml index 2db0fc6..93054f8 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml @@ -4,7 +4,7 @@ import Qt 4.6 MyQmlObject { objectProperty: if(1) otherObject - property var obj + property variant obj obj: QtObject { id: otherObject diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml index f66428d..5ae8b14 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml @@ -4,7 +4,7 @@ import Qt 4.6 MyQmlObject { objectProperty: otherObject - property var obj + property variant obj obj: QtObject { id: otherObject diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml b/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml index 47f4e50..e6d31c7 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml @@ -1,5 +1,5 @@ import Qt 4.6 QtObject { - property var test: children + property variant test: children } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml b/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml index 18e488a..edcd340 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml @@ -3,7 +3,7 @@ import Qt 4.6 Item { id: root - property var item: child + property variant item: child Item { id: child } property bool test1: child == child diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml index 416dbce..c66f071 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml @@ -4,7 +4,7 @@ QtObject { id: root property int a - property var b + property variant b Component.onCompleted: { try { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/signalParameterTypes.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalParameterTypes.qml index 6fc8b02..ffbe317 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/signalParameterTypes.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalParameterTypes.qml @@ -6,9 +6,9 @@ MyQmlObject property int intProperty property real realProperty property color colorProperty - property var variantProperty + property variant variantProperty - signal mySignal(int a, real b, color c, var d) + signal mySignal(int a, real b, color c, variant d) onMySignal: { intProperty = a; realProperty = b; colorProperty = c; variantProperty = d; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml index fa7e01c..bd23544 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml @@ -1,9 +1,9 @@ import Qt 4.6 QtObject { - property var obj: nested + property variant obj: nested - property var obj2 + property variant obj2 obj2: NestedTypeTransientErrors { id: nested } diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml index ba6b807..a061ae2 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml @@ -3,7 +3,7 @@ import Qt 4.6 Rectangle { id: root property int added: -1 - property var removed + property variant removed width: 240 height: 320 diff --git a/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml index cd5b426..548e498 100644 --- a/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var nested + property variant nested nested: QtObject {} } diff --git a/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml index a2ce78a..eac0b73 100644 --- a/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml @@ -1,8 +1,8 @@ import Qt 4.6 QtObject { - property var nested + property variant nested nested: NestedObject { } - property var nested2: nested.nested + property variant nested2: nested.nested } diff --git a/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml index ce05f89..176636a 100644 --- a/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var nested + property variant nested nested: QtObject { } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml index 6362b2d..f62c860 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml @@ -2,7 +2,7 @@ import Test 1.0 import Qt 4.6 QtObject { - property var other + property variant other other: MyTypeObject { id: obj } property alias enumAlias: obj.enumProperty; } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml index d1e78f8..9050c3a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml @@ -3,7 +3,7 @@ import Qt 4.6 QtObject { property alias obj : otherObj - property var child + property variant child child: QtObject { id: otherObj property int myValue: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml b/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml index dc3b382..df8c851 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml @@ -2,7 +2,7 @@ import Test 1.0 import Qt 4.6 QtObject { - property var child + property variant child child: QtObject { id: obj } property alias objAlias: obj; } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml index e059937..0b968c2 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var other + property variant other other: Alias { id: myAliasObject } property alias value: myAliasObject.aliasValue diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml index 4316d0d..125c518 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml @@ -4,7 +4,7 @@ import Test 1.0 QtObject { property alias otherAlias: otherObject - property var other + property variant other other: MyQmlObject { id: otherObject value: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml index 2b9ad85..629dd2a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var other + property variant other other: Alias3 { id: myAliasObject } property int value: myAliasObject.obj.myValue diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml index a2a41a1..7c072e1 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var other + property variant other other: Alias4 { id: myAliasObject } property int value: myAliasObject.obj.myValue diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml index a1d33ef..91fd833 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml @@ -1,14 +1,14 @@ import Qt 4.6 QtObject { - property var test1: 1 - property var test2: 1.7 - property var test3: "Hello world!" - property var test4: "#FF008800" - property var test5: "10,10,10x10" - property var test6: "10,10" - property var test7: "10x10" - property var test8: "100,100,100" - property var test9: String("#FF008800") + property variant test1: 1 + property variant test2: 1.7 + property variant test3: "Hello world!" + property variant test4: "#FF008800" + property variant test5: "10,10,10x10" + property variant test6: "10,10" + property variant test7: "10x10" + property variant test8: "100,100,100" + property variant test9: String("#FF008800") } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml index 0ff9370..774762a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml @@ -2,6 +2,6 @@ import Test 1.0 import Qt 4.6 QtObject { - property var a; + property variant a; a: MyQmlObject {} } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml b/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml index 0a7249a..e745e91 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var test + property variant test test: ComponentComposite {} } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml index bedab8c..6411609 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml @@ -9,5 +9,5 @@ QtObject { property color colorProperty: "red" property url urlProperty: "main.qml" property date dateProperty: "1945-09-02" - property var varProperty: "Hello World!" + property variant varProperty: "Hello World!" } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/idProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/idProperty.qml index 90c1483..bf048ea 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/idProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/idProperty.qml @@ -1,6 +1,6 @@ import Test 1.0 MyContainer { - property var object : myObjectId + property variant object : myObjectId MyTypeObject { id: "myObjectId" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml index 1167e39..9012aa6 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml @@ -1,6 +1,6 @@ import Qt 4.6 QtObject { - property var o; + property variant o; o.blah: 10 } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml index cd86a48..a4a976e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml @@ -2,7 +2,7 @@ import Test 1.0 import Qt 4.6 QtObject { - property var child + property variant child child: HelperAlias { objAlias: QtObject {} } } diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/model.qml b/tests/auto/declarative/qdeclarativelistmodel/data/model.qml index ebd4ebf..4019948 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/data/model.qml +++ b/tests/auto/declarative/qdeclarativelistmodel/data/model.qml @@ -2,9 +2,9 @@ import Qt 4.6 Item { id: item - property var model + property variant model property bool done: false - property var result + property variant result function evalExpressionViaWorker(commands) { done = false diff --git a/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml b/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml index 0c2d0aa..d64be0f 100644 --- a/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml +++ b/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml @@ -4,7 +4,7 @@ QtObject { property list myList; myList: QtObject {} - property var value: myList + property variant value: myList property int test: value.length } diff --git a/tests/auto/declarative/qdeclarativeqt/data/darker.qml b/tests/auto/declarative/qdeclarativeqt/data/darker.qml index 2df067e..b265a0e 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/darker.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/darker.qml @@ -1,11 +1,11 @@ import Qt 4.6 QtObject { - property var test1: Qt.darker(Qt.rgba(1, 0.8, 0.3)) - property var test2: Qt.darker() - property var test3: Qt.darker(Qt.rgba(1, 0.8, 0.3), 10) - property var test4: Qt.darker("red"); - property var test5: Qt.darker("perfectred"); // Non-existant color - property var test6: Qt.darker(10); + property variant test1: Qt.darker(Qt.rgba(1, 0.8, 0.3)) + property variant test2: Qt.darker() + property variant test3: Qt.darker(Qt.rgba(1, 0.8, 0.3), 10) + property variant test4: Qt.darker("red"); + property variant test5: Qt.darker("perfectred"); // Non-existant color + property variant test6: Qt.darker(10); } diff --git a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml index e62749a..4cf0602 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml @@ -6,13 +6,13 @@ QtObject { property string test2: Qt.formatDate(date1, Qt.DefaultLocaleLongDate) property string test3: Qt.formatDate(date1, "ddd MMMM d yy") - property var time1: new Date(0,0,0,14,15,38,200) + property variant time1: new Date(0,0,0,14,15,38,200) property string test4: Qt.formatTime(time1) property string test5: Qt.formatTime(time1, Qt.DefaultLocaleLongDate) property string test6: Qt.formatTime(time1, "H:m:s a") property string test7: Qt.formatTime(time1, "hh:mm:ss.zzz") - property var dateTime1: new Date(1978,2,4,9,13,54) + property variant dateTime1: new Date(1978,2,4,9,13,54) property string test8: Qt.formatDateTime(dateTime1) property string test9: Qt.formatDateTime(dateTime1, Qt.DefaultLocaleLongDate) property string test10: Qt.formatDateTime(dateTime1, "M/d/yy H:m:s a") diff --git a/tests/auto/declarative/qdeclarativeqt/data/lighter.qml b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml index 4e0c431..2d2b835 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/lighter.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml @@ -1,10 +1,10 @@ import Qt 4.6 QtObject { - property var test1: Qt.lighter(Qt.rgba(1, 0.8, 0.3)) - property var test2: Qt.lighter() - property var test3: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 10) - property var test4: Qt.lighter("red"); - property var test5: Qt.lighter("perfectred"); // Non-existant color - property var test6: Qt.lighter(10); + property variant test1: Qt.lighter(Qt.rgba(1, 0.8, 0.3)) + property variant test2: Qt.lighter() + property variant test3: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 10) + property variant test4: Qt.lighter("red"); + property variant test5: Qt.lighter("perfectred"); // Non-existant color + property variant test6: Qt.lighter(10); } diff --git a/tests/auto/declarative/qdeclarativeqt/data/point.qml b/tests/auto/declarative/qdeclarativeqt/data/point.qml index c383beb..1054ac9 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/point.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/point.qml @@ -1,9 +1,9 @@ import Qt 4.6 QtObject { - property var test1: Qt.point(19, 34); - property var test2: Qt.point(-3, 109.2); - property var test3: Qt.point(-3); - property var test4: Qt.point(-3, 109.2, 1); + property variant test1: Qt.point(19, 34); + property variant test2: Qt.point(-3, 109.2); + property variant test3: Qt.point(-3); + property variant test4: Qt.point(-3, 109.2, 1); } diff --git a/tests/auto/declarative/qdeclarativeqt/data/rect.qml b/tests/auto/declarative/qdeclarativeqt/data/rect.qml index 82b6428..e008656 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/rect.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/rect.qml @@ -1,9 +1,9 @@ import Qt 4.6 QtObject { - property var test1: Qt.rect(10, 13, 100, 109) - property var test2: Qt.rect(-10, 13, 100, 109.6) - property var test3: Qt.rect(10, 13); - property var test4: Qt.rect(10, 13, 100, 109, 10) - property var test5: Qt.rect(10, 13, 100, -109) + property variant test1: Qt.rect(10, 13, 100, 109) + property variant test2: Qt.rect(-10, 13, 100, 109.6) + property variant test3: Qt.rect(10, 13); + property variant test4: Qt.rect(10, 13, 100, 109, 10) + property variant test5: Qt.rect(10, 13, 100, -109) } diff --git a/tests/auto/declarative/qdeclarativeqt/data/size.qml b/tests/auto/declarative/qdeclarativeqt/data/size.qml index 05b0317..93577f2 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/size.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/size.qml @@ -1,11 +1,11 @@ import Qt 4.6 QtObject { - property var test1: Qt.size(19, 34); - property var test2: Qt.size(3, 109.2); - property var test3: Qt.size(-3, 10); - property var test4: Qt.size(3); - property var test5: Qt.size(3, 109.2, 1); + property variant test1: Qt.size(19, 34); + property variant test2: Qt.size(3, 109.2); + property variant test3: Qt.size(-3, 10); + property variant test4: Qt.size(3); + property variant test5: Qt.size(3, 109.2, 1); } diff --git a/tests/auto/declarative/qdeclarativeqt/data/vector.qml b/tests/auto/declarative/qdeclarativeqt/data/vector.qml index a471c7a..16716db 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/vector.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/vector.qml @@ -1,8 +1,8 @@ import Qt 4.6 QtObject { - property var test1: Qt.vector3d(1, 0, 0.9); - property var test2: Qt.vector3d(102, -10, -982.1); - property var test3: Qt.vector3d(102, -10); - property var test4: Qt.vector3d(102, -10, -982.1, 10); + property variant test1: Qt.vector3d(1, 0, 0.9); + property variant test2: Qt.vector3d(102, -10, -982.1); + property variant test3: Qt.vector3d(102, -10); + property variant test4: Qt.vector3d(102, -10, -982.1, 10); } diff --git a/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml b/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml index 8d7dbbc..1aed8d8 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - property var myInput: input + property variant myInput: input width: 800; height: 600; color: "blue" diff --git a/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml b/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml index 103a627..69a6479 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - property var myInput: input + property variant myInput: input width: 800; height: 600; color: "blue" diff --git a/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml b/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml index 493db5b..04f06da 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - property var myInput: input + property variant myInput: input width: 800; height: 600; color: "blue" diff --git a/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml b/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml index c47371a..41e8b59 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - property var myInput: input + property variant myInput: input width: 800; height: 600; color: "blue" diff --git a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml index 531a232..4b1ba27 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml @@ -1,9 +1,9 @@ import Qt 4.7 Item { - property var intInput: intInput - property var dblInput: dblInput - property var strInput: strInput + property variant intInput: intInput + property variant dblInput: dblInput + property variant strInput: strInput width: 800; height: 600; diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml index c82b533..d431b4a 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml @@ -1,7 +1,7 @@ import Test 1.0 MyTypeObject { - property var value + property variant value rect: value diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml index 691a56c..3a48c8b 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml @@ -1,7 +1,7 @@ import Test 1.0 MyTypeObject { - property var object + property variant object object: MyTypeObject { rect.x: 19 rect.y: 33 diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml index 785c250..7c22775 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml @@ -3,7 +3,7 @@ import Qt 4.6 import "deletedObject.js" as JS MyTypeObject { - property var object + property variant object object: MyTypeObject {} Component.onCompleted: JS.startup() diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml index e1d1ce0..d73bb13 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml @@ -13,6 +13,6 @@ MyTypeObject { property int f_capitalization: font.capitalization property real f_letterSpacing: font.letterSpacing property real f_wordSpacing: font.wordSpacing; - property var copy: font + property variant copy: font } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml index 3e67de6..4bb6c53 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml @@ -3,5 +3,5 @@ import Test 1.0 MyTypeObject { property int p_x: point.x property int p_y: point.y - property var copy: point + property variant copy: point } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml index d845a5b..0eab6da 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml @@ -3,6 +3,6 @@ import Test 1.0 MyTypeObject { property real p_x: pointf.x property real p_y: pointf.y - property var copy: pointf + property variant copy: pointf } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml index 5364431..c3b37a7 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml @@ -5,6 +5,6 @@ MyTypeObject { property int r_y: rect.y property int r_width: rect.width property int r_height: rect.height - property var copy: rect + property variant copy: rect } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml index aeb9f41..6ff3ce3 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml @@ -5,6 +5,6 @@ MyTypeObject { property real r_y: rectf.y property real r_width: rectf.width property real r_height: rectf.height - property var copy: rectf + property variant copy: rectf } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml index 29157e8..42fccfa 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml @@ -1,7 +1,7 @@ import Test 1.0 MyTypeObject { - property var object + property variant object object: MyTypeObject { rect.x: 19 rect.y: 33 diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml index 86dba03..a49fd9f 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml @@ -3,6 +3,6 @@ import Test 1.0 MyTypeObject { property int s_width: size.width property int s_height: size.height - property var copy: size + property variant copy: size } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml index c6f34e4..96cd425 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml @@ -3,7 +3,7 @@ import Test 1.0 MyTypeObject { property real s_width: sizef.width property real s_height: sizef.height - property var copy: sizef + property variant copy: sizef } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml index 7abe359..7f708a0 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml @@ -3,6 +3,6 @@ import Test 1.0 MyTypeObject { property int s_width: sizereadonly.width property int s_height: sizereadonly.height - property var copy: sizereadonly + property variant copy: sizereadonly } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml index abdf9f0..f1e876d 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml @@ -4,6 +4,6 @@ MyTypeObject { property real v_x: vector.x property real v_y: vector.y property real v_z: vector.z - property var copy: vector + property variant copy: vector } diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml index 1fce155..ca989f8 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml @@ -4,7 +4,7 @@ WorkerScript { id: worker source: "script.js" - property var response + property variant response signal done() diff --git a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml index fbab4b7..0ddcca4 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml @@ -5,9 +5,9 @@ Rectangle { color: "gray" width: 200; height: 200 - property var hours: 10 - property var minutes: 28 - property var seconds: 0 + property variant hours: 10 + property variant minutes: 28 + property variant seconds: 0 Timer { interval: 1000; running: true; repeat: true; triggeredOnStart: true diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml b/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml index fe1bb70..711a747 100644 --- a/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml +++ b/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml @@ -1,8 +1,8 @@ import Qt 4.6 Item { - property var period : 250 - property var color : "black" + property variant period : 250 + property variant color : "black" id: root Item { diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml index 27c5646..972f405 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml @@ -9,7 +9,7 @@ QtObject { property url f property color g property date h - property var i + property variant i property variant j } diff --git a/tools/qml/content/Browser.qml b/tools/qml/content/Browser.qml index 391ded8..8882d5a 100644 --- a/tools/qml/content/Browser.qml +++ b/tools/qml/content/Browser.qml @@ -3,8 +3,8 @@ import Qt 4.6 Rectangle { id: root property bool keyPressed: false - property var folders: folders1 - property var view: view1 + property variant folders: folders1 + property variant view: view1 width: 320 height: 480 color: palette.window -- cgit v0.12 From da56d7c25ce344128d827cfa2ed26f9eea437e4d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 9 Apr 2010 13:42:22 +1000 Subject: Fix url resolution in PropertyChanges. Make sure bindings in PropertyChanges resolve urls correctly. Also refactor the code so that PropertyChanges will always use the standard url resolution support provided by QDeclarativeProperty. Task-number: QTBUG-9571 --- .../util/qdeclarativepropertychanges.cpp | 13 +++------ src/declarative/util/qdeclarativestate.cpp | 12 ++++++++ src/declarative/util/qdeclarativestate_p.h | 2 ++ .../data/Implementation/MyType.qml | 32 +++++++++++++++++++++ .../data/Implementation/images/qt-logo.png | Bin 0 -> 5149 bytes .../qdeclarativestates/data/urlResolution.qml | 12 ++++++++ .../qdeclarativestates/tst_qdeclarativestates.cpp | 23 +++++++++++++++ 7 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml create mode 100644 tests/auto/declarative/qdeclarativestates/data/Implementation/images/qt-logo.png create mode 100644 tests/auto/declarative/qdeclarativestates/data/urlResolution.qml diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index ecbd71e..9c3ee9f 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -377,7 +377,7 @@ QDeclarativeProperty QDeclarativePropertyChangesPrivate::property(const QByteArray &property) { Q_Q(QDeclarativePropertyChanges); - QDeclarativeProperty prop(object, QString::fromUtf8(property)); + QDeclarativeProperty prop(object, QString::fromUtf8(property), qmlContext(q)); if (!prop.isValid()) { qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property)); return QDeclarativeProperty(); @@ -400,16 +400,11 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions() QByteArray property = d->properties.at(ii).first; - QDeclarativeAction a(d->object, QString::fromLatin1(property), - d->properties.at(ii).second); + QDeclarativeAction a(d->object, QString::fromUtf8(property), + qmlContext(this), d->properties.at(ii).second); if (a.property.isValid()) { a.restore = restoreEntryValues(); - - if (a.property.propertyType() == QVariant::Url && - (a.toValue.userType() == QVariant::String || a.toValue.userType() == QVariant::ByteArray) && !a.toValue.isNull()) - a.toValue.setValue(qmlContext(this)->resolvedUrl(QUrl(a.toValue.toString()))); - list << a; } } @@ -436,7 +431,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions() a.property = prop; a.fromValue = a.property.read(); a.specifiedObject = d->object; - a.specifiedProperty = QString::fromLatin1(property); + a.specifiedProperty = QString::fromUtf8(property); if (d->isExplicit) { a.toValue = d->expressions.at(ii).second->value(); diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index e4c968e..78813fa 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -74,6 +74,18 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN fromValue = property.read(); } +QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyName, + QDeclarativeContext *context, const QVariant &value) +: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), + property(target, propertyName, context), toValue(value), + fromBinding(0), toBinding(0), event(0), + specifiedObject(target), specifiedProperty(propertyName) +{ + if (property.isValid()) + fromValue = property.read(); +} + + QDeclarativeActionEvent::~QDeclarativeActionEvent() { } diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h index ee2b7e8..472897e 100644 --- a/src/declarative/util/qdeclarativestate_p.h +++ b/src/declarative/util/qdeclarativestate_p.h @@ -61,6 +61,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeAction public: QDeclarativeAction(); QDeclarativeAction(QObject *, const QString &, const QVariant &); + QDeclarativeAction(QObject *, const QString &, + QDeclarativeContext *, const QVariant &); bool restore:1; bool actionDone:1; diff --git a/tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml b/tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml new file mode 100644 index 0000000..1872de8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml @@ -0,0 +1,32 @@ +import Qt 4.7 + +Item { + Column { + anchors.centerIn: parent + Image { id: image1; objectName: "image1" } + Image { id: image2; objectName: "image2" } + Image { id: image3; objectName: "image3" } + } + + states: State { + name: "SetImageState" + PropertyChanges { + target: image1 + source: "images/qt-logo.png" + } + PropertyChanges { + target: image2 + source: "images/" + "qt-logo.png" + } + PropertyChanges { + target: image3 + source: "images/" + (true ? "qt-logo.png" : "") + } + } + + MouseArea { + anchors.fill: parent + onClicked: parent.state = "SetImageState" + } + +} diff --git a/tests/auto/declarative/qdeclarativestates/data/Implementation/images/qt-logo.png b/tests/auto/declarative/qdeclarativestates/data/Implementation/images/qt-logo.png new file mode 100644 index 0000000..14ddf2a Binary files /dev/null and b/tests/auto/declarative/qdeclarativestates/data/Implementation/images/qt-logo.png differ diff --git a/tests/auto/declarative/qdeclarativestates/data/urlResolution.qml b/tests/auto/declarative/qdeclarativestates/data/urlResolution.qml new file mode 100644 index 0000000..8995b56 --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/urlResolution.qml @@ -0,0 +1,12 @@ +import Qt 4.7 +import "Implementation" + +Rectangle { + width: 100 + height: 200 + + MyType { + objectName: "MyType" + anchors.fill: parent + } +} diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index f0b6759..578bcb4 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -109,6 +110,7 @@ private slots: void reset(); void illegalObjectCreation(); void whenOrdering(); + void urlResolution(); }; void tst_qdeclarativestates::initTestCase() @@ -1016,6 +1018,27 @@ void tst_qdeclarativestates::whenOrdering() QCOMPARE(rect->state(), QLatin1String("")); } +void tst_qdeclarativestates::urlResolution() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/urlResolution.qml"); + QDeclarativeRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect != 0); + + QDeclarativeItem *myType = rect->findChild("MyType"); + QDeclarativeImage *image1 = rect->findChild("image1"); + QDeclarativeImage *image2 = rect->findChild("image2"); + QDeclarativeImage *image3 = rect->findChild("image3"); + QVERIFY(myType != 0 && image1 != 0 && image2 != 0 && image3 != 0); + + myType->setState("SetImageState"); + QUrl resolved = QUrl::fromLocalFile(SRCDIR "/data/Implementation/images/qt-logo.png"); + QCOMPARE(image1->source(), resolved); + QCOMPARE(image2->source(), resolved); + QCOMPARE(image3->source(), resolved); +} + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" -- cgit v0.12 From fb9f0c5c996f2ba27c43657c49f100daf4729e05 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 9 Apr 2010 13:53:30 +1000 Subject: Text.wrap is deprecated --- demos/declarative/minehunt/minehunt.qml | 33 +++++++++++----------- .../twitter/TwitterCore/FatDelegate.qml | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 4e384c0..98955e2 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -86,19 +86,20 @@ Item { field.clicky = flipable.parent.y var row = Math.floor(index / 9) var col = index - (Math.floor(index / 9) * 9) - if (mouse.button == undefined || mouse.button == Qt.RightButton) + if (mouse.button == undefined || mouse.button == Qt.RightButton) { flag(row, col) - else - flip(row, col) - } - onPressAndHold: { - field.clickx = flipable.parent.x - field.clicky = flipable.parent.y - var row = Math.floor(index / 9) - var col = index - (Math.floor(index / 9) * 9) - flag(row, col) - } + } else { + flip(row, col) } + } + onPressAndHold: { + field.clickx = flipable.parent.x + field.clicky = flipable.parent.y + var row = Math.floor(index / 9) + var col = index - (Math.floor(index / 9) * 9) + flag(row, col) + } + } } } @@ -136,13 +137,13 @@ Item { Image { anchors.bottom: field.bottom; anchors.bottomMargin: 15 anchors.right: field.right; anchors.rightMargin: 20 - source: isPlaying ? 'MinehuntCore/pics/face-smile.png' - : hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png' + source: isPlaying ? 'MinehuntCore/pics/face-smile.png' : + hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png' - MouseArea { anchors.fill: parent; onPressed: reset() } - } + MouseArea { anchors.fill: parent; onPressed: reset() } + } Text { - anchors.fill: parent; wrap: true + anchors.fill: parent; wrapMode: Text.WordWrap text: "Minehunt will not run properly if the C++ plugin is not compiled.\nPlease see README." color: "white"; font.bold: true; font.pixelSize: 14 visible: tiles == undefined diff --git a/demos/declarative/twitter/TwitterCore/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml index 3eabd9d..e999bb4 100644 --- a/demos/declarative/twitter/TwitterCore/FatDelegate.qml +++ b/demos/declarative/twitter/TwitterCore/FatDelegate.qml @@ -37,7 +37,7 @@ Component { + ''+userScreenName + " from " +source + "
" + addTags(statusText) + ""; textFormat: Qt.RichText - color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 onLinkActivated: handleLink(link) } -- cgit v0.12 From 430c50648c78e1e8e3b2747779069fe2a0f14ed9 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Fri, 9 Apr 2010 05:58:27 +0200 Subject: Fix test after deletion of GraphicsObjectContainer. Reviewed-by:TrustMe --- .../qdeclarativelayouts/data/layouts.qml | 43 ++++++++++------------ 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml b/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml index 1792500..5c2178f 100644 --- a/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml +++ b/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml @@ -5,29 +5,26 @@ Item { id: resizable width:300 height:300 - - GraphicsObjectContainer { - anchors.fill: parent - synchronizedResizing: true - - QGraphicsWidget { - - layout: QGraphicsLinearLayout { - spacing: 0 - LayoutItem { - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent } - } - LayoutItem { - objectName: "right" - minimumSize: "100x100" - maximumSize: "400x400" - preferredSize: "200x200" - Rectangle { objectName: "greenRect"; color: "green"; anchors.fill: parent } - } + QGraphicsWidget { + x : resizable.x + y : resizable.y + width : resizable.width + height : resizable.height + layout: QGraphicsLinearLayout { + spacing: 0 + LayoutItem { + objectName: "left" + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "100x100" + Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent } + } + LayoutItem { + objectName: "right" + minimumSize: "100x100" + maximumSize: "400x400" + preferredSize: "200x200" + Rectangle { objectName: "greenRect"; color: "green"; anchors.fill: parent } } } } -- cgit v0.12 From efc80769f3274d31e06308717d06a70a4249cced Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 13:59:42 +1000 Subject: Replace "var" with "variant" in tests --- .../qdeclarativecontext/tst_qdeclarativecontext.cpp | 16 ++++++++-------- .../declarative/qdeclarativedom/tst_qdeclarativedom.cpp | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp index be20ba1..ae62363 100644 --- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -228,7 +228,7 @@ private: #define TEST_CONTEXT_PROPERTY(ctxt, name, value) \ { \ QDeclarativeComponent component(&engine); \ - component.setData("import Qt 4.6; QtObject { property var test: " #name " }", QUrl()); \ + component.setData("import Qt 4.6; QtObject { property variant test: " #name " }", QUrl()); \ \ QObject *obj = component.create(ctxt); \ \ @@ -278,7 +278,7 @@ void tst_qdeclarativecontext::setContextProperty() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -290,7 +290,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: b }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant test: b }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -304,7 +304,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: e.a }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant test: e.a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -318,7 +318,7 @@ void tst_qdeclarativecontext::setContextProperty() // New context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -332,7 +332,7 @@ void tst_qdeclarativecontext::setContextProperty() // Setting an object-variant context property { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property var obj: root; }", QUrl()); + component.setData("import Qt 4.6; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property variant obj: root; }", QUrl()); QDeclarativeContext ctxt(engine.rootContext()); ctxt.setContextProperty("ctxtProp", QVariant()); @@ -380,7 +380,7 @@ void tst_qdeclarativecontext::setContextObject() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt); @@ -412,7 +412,7 @@ void tst_qdeclarativecontext::destruction() void tst_qdeclarativecontext::idAsContextProperty() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var a; a: QtObject { id: myObject } }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant a; a: QtObject { id: myObject } }", QUrl()); QObject *obj = component.create(); QVERIFY(obj); diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index 1cbe2ac..d391941 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -450,7 +450,7 @@ void tst_qdeclarativedom::loadDynamicProperty() " property url f\n" " property color g\n" " property date h\n" - " property var i\n" + " property variant i\n" " property QtObject j\n" "}"; @@ -483,8 +483,8 @@ void tst_qdeclarativedom::loadDynamicProperty() DP_TEST(5, f, QVariant::Url, 128, 14, "url"); DP_TEST(6, g, QVariant::Color, 147, 16, "color"); DP_TEST(7, h, QVariant::DateTime, 168, 15, "date"); - DP_TEST(8, i, qMetaTypeId(), 188, 14, "var"); - DP_TEST(9, j, -1, 207, 19, "QtObject"); + DP_TEST(8, i, qMetaTypeId(), 188, 18, "variant"); + DP_TEST(9, j, -1, 211, 19, "QtObject"); } { -- cgit v0.12