diff --git a/doc/images/qtcreator-symbian-components-example-simulated.png b/doc/images/qtcreator-symbian-components-example-simulated.png new file mode 100644 index 0000000000000000000000000000000000000000..f4bb6ff2e32014c638a81fd64ef7c36c0a67b2ae Binary files /dev/null and b/doc/images/qtcreator-symbian-components-example-simulated.png differ diff --git a/doc/images/qtcreator-symbian-components-example-ui.png b/doc/images/qtcreator-symbian-components-example-ui.png new file mode 100644 index 0000000000000000000000000000000000000000..d9093bdf194789b5806593957c999b5264d80861 Binary files /dev/null and b/doc/images/qtcreator-symbian-components-example-ui.png differ diff --git a/doc/images/qtcreator-symbian-components-example.png b/doc/images/qtcreator-symbian-components-example.png new file mode 100644 index 0000000000000000000000000000000000000000..fecf5e9daa96b48734162fc3d7188d680f25448f Binary files /dev/null and b/doc/images/qtcreator-symbian-components-example.png differ diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index cb510dc4d411258e48926fe9dfd60f2661f138f8..20d06ee2841c21a244188df880c66f08c8b4a737 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -56,9 +56,11 @@ \o \l{Getting Started} \list \o \l{Building and Running an Example Application} - \o \l{Creating a Qt Widget Based Application} - \o \l{Creating a Mobile Application with Qt SDK} \o \l{Creating a Qt Quick Application} + \o \l{Creating a Qt Quick Application Using Qt Quick Components} + \o \l{Creating a Qt Widget Based Application} + \o \l{Creating a Qt Widget Based Mobile Application} + \endlist \o \l{Managing Projects} \list @@ -3242,7 +3244,7 @@ /*! \contentspage index.html - \previouspage creator-qml-application.html + \previouspage creator-mobile-example.html \page creator-project-managing.html \nextpage creator-project-creating.html @@ -5995,9 +5997,248 @@ \list \o \l{Building and Running an Example Application} - \o \l{Creating a Qt Widget Based Application} - \o \l{Creating a Mobile Application with Qt SDK} \o \l{Creating a Qt Quick Application} + \o \l{Creating a Qt Quick Application Using Qt Quick Components} + \o \l{Creating a Qt Widget Based Application} + \o \l{Creating a Qt Widget Based Mobile Application} + + \endlist + +*/ + + +/*! + \contentspage index.html + \previouspage creator-qml-application.html + \page creator-qml-components-example.html + \nextpage creator-writing-program.html + + \title Creating a Qt Quick Application Using Qt Quick Components + + \note To complete this tutorial, you must install the Qt Quick Components + for Symbian and the Symbian^3 tool chain as part of the \QSDK. In addition, + you must install the Qt Quick Components on the test device. + + This tutorial describes how to use Qt Creator to create a small Qt + application, Battery Status, that uses the System Information + Mobility API to fetch battery information from the device. + + \image qtcreator-symbian-components-example.png "Mobile example" + + The user interface for the application is designed using Qt Quick Components + for Symbian. This enforces a platform look and feel for Symbian^3 devices. + + \section1 Creating the Project + + \list 1 + + \o Select \gui{File > New File or Project > Qt Quick Project > Qt Quick + Application > Choose}. + + \o In the \gui{Name} field, type \bold {BatteryStatus}. + + \o In the \gui {Create in} field, enter the path for the project files. + For example, \c {C:\Qt\examples}, and then click \gui{Next}. + + \o In the \gui {Application Type} dialog, select \gui {Qt Quick + Components (Symbian Applications)}, and then click \gui{Next}. + + \o Select \gui {Symbian Device} and \gui {Qt Simulator} targets, and + then click \gui{Next}. + + \note Targets are listed if you installed the appropriate + development environment, for example, as part of the \QSDK. You can + add targets later in the \gui Projects mode. + + \o Select \gui Next in the following dialogs to use the default + settings. + + \note Qt Creator contains a default program icon and generates an + \l{Application UID}, for testing the application on a device. You + only need to change the icon and UID if you deliver the application + for public use. + + \o Review the project settings, and click \gui{Finish} to create the + project. + + \endlist + + Qt Creator generates the necessary files that contain boiler plate code. The + wizard creates an application that uses + \l{http://doc.qt.nokia.com/qt-components-symbian-1.0/qt-components-pages-and-navigation-overview.html} + {page-based application navigation}. + + Modify the files as described in the following sections. + + \section1 Declaring the Qt Mobility API + + To use the Qt Mobility APIs or develop applications for Symbian + devices, you must modify the .pro file to declare the Qt Mobility APIs + that you use. + + This example uses the System Info API, so you must declare it, as + illustrated by the following code snippet: + + \code + + CONFIG += mobility + MOBILITY = systeminfo + + \endcode + + Each Mobility API has its corresponding value that you have to add + as a value of MOBILITY to use the API. For a list of the APIs and the + corresponding values that you can assign to MOBILITY, see the + \l {http://doc.qt.nokia.com/qtmobility/quickstart.html}{Quickstart Example}. + + \section1 Adding Import Statements + + The wizard adds the import statements for Qt Quick and the Qt Quick + Components for Symbian to the MainPage.qml file: + + \code + import QtQuick 1.0 + import com.nokia.symbian 1.0 + \endcode + + To use the Qt Mobility APIs, you must add the import statements for the + Qt Mobility APIs that you use. This example uses the System Info API, so you + must import it, as illustrated by the following code snippet: + + \code + import QtMobility.systeminfo 1.1 + \endcode + + Use the values as you can assign to MOBILITY also to construct import + statements. + + \section1 Creating the Main View + + Qt Creator generates a default QML file that you can modify to create the + main view of the application. It displays a progress bar and a text label + that indicate the battery status. + + \list 1 + + \o Click \gui Design to open MainPage.qml in \QMLD. + + \o In the \gui Navigator pane, select the \gui Text element to edit its + properties in the \gui Properties pane. + + \o In the \gui Text field, change the text from \bold {Hello World!} + to \gui {Battery status: 1%}. + + \o In the \gui Library view, \gui Items tab, select the + \gui ProgressBar element, drag and drop it to the canvas, and edit + its properties. + + \image qtcreator-symbian-components-example-ui.png "Qt Quick Components for Symbian" + + \list 1 + + \o Click \gui {Layout}, and then click the top anchor button. + + \o In the \gui Target field, select \gui text1, to anchor the + progress bar to the bottom of the text field. + + \o In the \gui Margin field, select 20. + + \o Click the horizontal anchor button, and select \gui text1 in + the \gui Target field to anchor the progress bar + horizontally to the text field. + + \o To check that the application can be built and run, select + \gui {Qt Simulator} as the target and click the + \inlineimage qtcreator-run.png + button. + + \endlist + + \endlist + + \section1 Fetching Battery Status + + To fetch the battery status, open MainPage.qml in the code editor and add + some code to it: + + \list 1 + + \o Add an invisible + \l{http://doc.qt.nokia.com/qtmobility/qml-deviceinfo.html} + {DeviceInfo element} and an + \l{http://doc.qt.nokia.com/4.7/qml-component.html#onCompleted-signal} + {onCompleted signal}, as illustrated by the following code snippet: + + \code + DeviceInfo { + id: deviceinfo + Component.onCompleted: { + deviceinfo.startBatteryLevelChanged(); + } + } + \endcode + + \o Set an expression as the value of the text property of the Text + element to display the battery level as a percentage: + + \code + Text { + id: text1 + anchors.centerIn: parent + color: platformStyle.colorNormalLight + text: qsTr("Battery status: %1%").arg(deviceinfo.batteryLevel) + font.pixelSize: 20 + \endcode + + \o Set values for the ProgressBar element to display the battery level + on the progress bar: + + \code + ProgressBar { + id: progressbar1 + anchors.horizontalCenter: text1.horizontalCenter + anchors.top: text1.bottom + anchors.topMargin: 20 + minimumValue: 0 + maximumValue: 100 + value: deviceinfo.batteryLevel + } + \endcode + + \endlist + + + \section1 Compiling and Running Your Program + + Now that you have all the necessary code, select \gui {Qt Simulator} + as the target and click the + \inlineimage qtcreator-run.png + button to build your program and run it in the Qt Simulator. + + In Qt Simulator, run the runOutOfBattery.qs example script + to see the value change in the Battery Indicator application. + Select \gui {Scripting > examples > runOutOfBattery.qs > Run}. + + \image qtcreator-symbian-components-example-simulated.png "Mobile example in Qt Simulator" + + \section1 Testing on a Symbian Device + + You also need to test the application on real devices. Before you can + start testing on Symbian devices, you must connect them to the development + PC by using a USB cable and install the necessary software on them. + + \list 1 + + \o Install Qt libraries, Qt mobile libraries, Qt Quick components for + Symbian, and a debugging agent on the device. For more information, + see \l{Connecting Symbian Devices}. + + \o Start the CODA debugging agent on the device. + + \o Click the \gui {Target Selector} and select \gui {Symbian Device}. + + \o Click \gui Run to build the application for the Symbian device. + \endlist */ @@ -6007,9 +6248,9 @@ \contentspage index.html \previouspage creator-writing-program.html \page creator-mobile-example.html - \nextpage creator-qml-application.html + \nextpage creator-project-managing.html - \title Creating a Mobile Application with Qt SDK + \title Creating a Qt Widget Based Mobile Application \note To complete this tutorial, you must install \QSDK. The installation program installs and configures the necessary tool chains @@ -6019,6 +6260,12 @@ application, Battery Indicator, that uses the System Information Mobility API to fetch battery information from the device. + The user interface for the application is designed using Qt widgets. This + enforces a platform look and feel for Symbian devices and Maemo 5 devices. + However, to achieve a platform look and feel for MeeGo Harmattan devices, + \l{Creating Qt Quick Applications}{create a Qt Quick Application} and use + the Qt Quick components for MeeGo. + \image qtcreator-batteryindicator-screenshot.png \section1 Creating the Battery Indicator Project @@ -6265,7 +6512,7 @@ \contentspage index.html \previouspage creator-getting-started.html \page creator-build-example-application.html - \nextpage creator-writing-program.html + \nextpage creator-qml-application.html \title Building and Running an Example Application @@ -6327,9 +6574,9 @@ /*! \contentspage index.html - \previouspage creator-mobile-example.html + \previouspage creator-build-example-application.html \page creator-qml-application.html - \nextpage creator-project-managing.html + \nextpage creator-qml-components-example.html \title Creating a Qt Quick Application @@ -6630,7 +6877,7 @@ /*! \contentspage index.html - \previouspage creator-build-example-application.html + \previouspage creator-qml-components-example.html \page creator-writing-program.html \nextpage creator-mobile-example.html