diff options
Diffstat (limited to 'doc/src/declarative/globalobject.qdoc')
-rw-r--r-- | doc/src/declarative/globalobject.qdoc | 79 |
1 files changed, 75 insertions, 4 deletions
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 9f6be12..231e75a 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -189,6 +189,20 @@ This function attempts to open the specified \c target url in an external applic \section3 Qt.md5(data) This function returns a hex string of the md5 hash of \c data. +\section3 Qt.btoa(data) +This function returns a base64 encoding of \c data. + +\section3 Qt.atob(data) +This function returns a base64 decoding of \c data. + +\section3 Qt.quit() +This function causes the QML engine to emit the quit signal, which in +\l {Qt Declarative UI Runtime}{qml} causes the runtime to quit. + +\section3 Qt.resolvedUrl(url) +This function returns \c url resolved relative to the URL of the +caller. + \section1 Dynamic Object Creation The following functions on the global object allow you to dynamically create QML items from files or strings. See \l{Dynamic Object Management} for an overview @@ -273,20 +287,33 @@ of their use. QML script supports the XMLHttpRequest object, which can be used to asynchronously obtain data from over a network. \section2 XMLHttpRequest() In QML you can construct an XMLHttpRequest object just like in a web browser! TODO: Real documentation for this object. + + \section1 Offline Storage API -The \c openDatabase() and related functions +\section2 Database API + +The \c openDatabaseSync() and related functions provide the ability to access local offline storage in an SQL database. -These databases are user-specific and QML-specific. They are stored in the \c Databases subdirectory +These databases are user-specific and QML-specific, but accessible to all QML applications. +They are stored in the \c Databases subdirectory of QDeclarativeEngine::offlineStoragePath(), currently as SQLite databases. +The API can be used from JavaScript functions in your QML: + +\quotefile declarative/sql/hello.qml + The API conforms to the Synchronous API of the HTML5 Web Database API, \link http://www.w3.org/TR/2009/WD-webdatabase-20091029/ W3C Working Draft 29 October 2009\endlink. -The API can be used from JavaScript functions in your QML: +\section3 db = openDatabaseSync(identifier, version, description, estimated_size, callback(db)) -\quotefile declarative/sql/hello.qml +Returns the database identified by \e identifier. If the database does not already exist, it +is created with the properties \e description and \e estimated_size and the function \e callback +is called with the database as a parameter. + +May throw exception with code property SQLException.DATABASE_ERR, or SQLException.VERSION_ERR. When a database is first created, an INI file is also created specifying its characteristics: @@ -301,4 +328,48 @@ When a database is first created, an INI file is also created specifying its cha This data can be used by application tools. +\section3 db.changeVersion(from, to, callback(tx)) + +This method allows you to perform a \e{Scheme Upgrade}. + +If the current version of \e db is not \e from, then an exception is thrown. + +Otherwise, a database transaction is created and passed to \e callback. In this function, +you can call \e executeSql on \e tx to upgrade the database. + +May throw exception with code property SQLException.DATABASE_ERR or SQLException.UNKNOWN_ERR. + +\section3 db.transaction(callback(tx)) + +This method creates a read/write transaction and passed to \e callback. In this function, +you can call \e executeSql on \e tx to read and modify the database. + +If the callback throws exceptions, the transaction is rolled back. + +\section3 db.readTransaction(callback(tx)) + +This method creates a read-only transaction and passed to \e callback. In this function, +you can call \e executeSql on \e tx to read the database (with SELECT statements). + +\section3 results = tx.executeSql(statement, values) + +This method executes a SQL \e statement, binding the list of \e values to SQL positional parameters ("?"). + +It returns a results object, with the following properties: + +\table +\header \o \bold {Type} \o \bold {Property} \o \bold {Value} \o \bold {Applicability} +\row \o int \o rows.length \o The number of rows in the result \o SELECT +\row \o var \o rows.item(i) \o Function that returns row \e i of the result \o SELECT +\row \o int \o rowsAffected \o The number of rows affected by a modification \o UPDATE, DELETE +\row \o string \o insertId \o The id of the row inserted \o INSERT +\endtable + +May throw exception with code property SQLException.DATABASE_ERR, SQLException.SYNTAX_ERR, or SQLException.UNKNOWN_ERR. + +\section1 Logging + +\c console.log() and \c console.debug() can be used to print information +to the console. See \l{Debugging QML} for more information. + */ |