diff options
Diffstat (limited to 'examples')
4 files changed, 10 insertions, 6 deletions
diff --git a/examples/declarative/samegame/content/samegame.js b/examples/declarative/samegame/content/samegame.js index 8c15af763a..611767584b 100755 --- a/examples/declarative/samegame/content/samegame.js +++ b/examples/declarative/samegame/content/samegame.js @@ -1,5 +1,6 @@ /* This script file handles the game logic */ .pragma library +.import QtQuick.LocalStorage 2.0 as Sql var maxColumn = 10; var maxRow = 15; @@ -229,7 +230,7 @@ function createBlock(column,row) function initHighScoreBar() { - var db = openDatabaseSync( + var db = Sql.openDatabaseSync( "SameGameScores", "1.0", "Local SameGame High Scores", @@ -254,7 +255,7 @@ function saveHighScore(name) if (scoresURL != "") sendHighScore(name); // Offline storage - var db = openDatabaseSync( + var db = Sql.openDatabaseSync( "SameGameScores", "1.0", "Local SameGame High Scores", diff --git a/examples/declarative/snake/content/HighScoreModel.qml b/examples/declarative/snake/content/HighScoreModel.qml index 0a30d7343e..d6ac762859 100644 --- a/examples/declarative/snake/content/HighScoreModel.qml +++ b/examples/declarative/snake/content/HighScoreModel.qml @@ -40,6 +40,7 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQuick.LocalStorage 2.0 as Sql // Models a high score table. // @@ -84,7 +85,7 @@ ListModel { function __db() { - return openDatabaseSync("HighScoreModel", "1.0", "Generic High Score Functionality for QML", 1000000); + return Sql.openDatabaseSync("HighScoreModel", "1.0", "Generic High Score Functionality for QML", 1000000); } function __ensureTables(tx) { diff --git a/examples/declarative/sqllocalstorage/hello.qml b/examples/declarative/sqllocalstorage/hello.qml index 5290f9c38b..8312e8cabe 100644 --- a/examples/declarative/sqllocalstorage/hello.qml +++ b/examples/declarative/sqllocalstorage/hello.qml @@ -39,6 +39,7 @@ ****************************************************************************/ //![0] import QtQuick 2.0 +import QtQuick.LocalStorage 2.0 as LS Rectangle { color: "white" @@ -49,7 +50,7 @@ Rectangle { text: "?" anchors.horizontalCenter: parent.horizontalCenter function findGreetings() { - var db = openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000); + var db = LS.openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000); db.transaction( function(tx) { diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index ccc3f9dae2..7bb7243914 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -1,4 +1,6 @@ /* This script file handles the game logic */ +.import QtQuick.LocalStorage 2.0 as Sql + var maxColumn = 10; var maxRow = 15; var maxIndex = maxColumn * maxRow; @@ -191,7 +193,7 @@ function saveHighScore(name) { if (scoresURL != "") sendHighScore(name); - var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores", 100); + var db = Sql.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(gameDuration / 1000)]; db.transaction(function(tx) { @@ -222,4 +224,3 @@ function sendHighScore(name) { postman.send(postData); } //![1] - |