Commit 2301025c authored by Leena Miettinen's avatar Leena Miettinen

Doc: update the Android tutorial to also cover iOS

Rename as "Creating a Mobile Application".
Add the steps necessary for deploying to iOS devices.
Fix the link in the Tutorials tab in the Welcome mode.

Change-Id: Ie72bf087c789d8d1299b9b5ac19ad732da534012
Reviewed-by: default avatarVenugopal Shivashankar <venugopal.shivashankar@digia.com>
Reviewed-by: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
parent 7f0b1062
/****************************************************************************
/**************************************************************************
**
** Copyright (c) 2014 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator
**
** You may use this file under the terms of the BSD license as follows:
**
** GNU Free Documentation License
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
**
****************************************************************************/
// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************
**************************************************************************/
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtSensors 5.0
......@@ -34,6 +47,29 @@ ApplicationWindow {
height: 480
visible: true
Image {
id: bubble
source: "Bluebubble.svg"
smooth: true
property real centerX: mainWindow.width / 2
property real centerY: mainWindow.height / 2
property real bubbleCenter: bubble.width / 2
x: centerX - bubbleCenter
y: centerY - bubbleCenter
Behavior on y {
SmoothedAnimation {
easing.type: Easing.Linear
duration: 100
}
}
Behavior on x {
SmoothedAnimation {
easing.type: Easing.Linear
duration: 100
}
}
}
Accelerometer {
id: accel
dataRate: 100
......@@ -67,36 +103,12 @@ ApplicationWindow {
return -(Math.atan(x / Math.sqrt(y * y + z * z)) * 57.2957795);
}
Image {
id: bubble
source: "Bluebubble.svg"
smooth: true
property real centerX: mainWindow.width / 2
property real centerY: mainWindow.height / 2
property real bubbleCenter: bubble.width / 2
x: centerX - bubbleCenter
y: centerY - bubbleCenter
Behavior on y {
SmoothedAnimation {
easing.type: Easing.Linear
duration: 100
}
}
Behavior on x {
SmoothedAnimation {
easing.type: Easing.Linear
duration: 100
}
}
MenuBar {
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
}
}
......
......@@ -28,12 +28,11 @@
\page creator-android-app-tutorial.html
\nextpage creator-project-managing.html
\title Creating an Android Application
\title Creating a Mobile Application
This tutorial describes developing Qt Quick applications for Android devices
using Qt Quick Controls.
This tutorial describes how to use \QC to implement a Qt Quick application
This tutorial describes developing Qt Quick applications for Android and iOS
devices using Qt Quick Controls.
We use \QC to implement a Qt Quick application
that accelerates an SVG (Scalable Vector Graphics) image based on the
changing accelerometer values.
......@@ -41,15 +40,23 @@
\section1 Setting up the Development Environment
To be able to build and run the application, you must download and install
To be able to build and run the application on a mobile device, you must
set up the development environment for the device platform and configure a
connection between \QC and the mobile device.
To develop for Android devices, you must download and install
the latest Android NDK and SDK, and update the SDK to get the API and tools
packages needed for development. In addition, you must install the
needed for development. In addition, you must install the
Java SE Development Kit (JDK) and Apache Ant. After you have installed all
these tools, you must specify the paths to them in \QC.
For detailed instructions, see \l{Qt for Android} and
\l{Connecting Android Devices}.
To develop for iOS devices, you must install Xcode and use it to configure
a device. For this, you need an Apple developer account and iOS Developer
Program certificate that you receive from Apple. For more information, see
\l{Connecting iOS Devices}.
\section1 Creating the Project
\list 1
......@@ -64,10 +71,10 @@
\gui Continue on Mac OS X).
\li In the \gui {Qt Quick component set} field, select
\gui {Qt Quick Controls 1.0}.
\gui {Qt Quick Controls 1.1}.
\li Select an Android \l{glossary-buildandrun-kit}{kit} for ARM,
and click \gui{Next}.
\li Select \l{glossary-buildandrun-kit}{kits} for Android ARM and iPhone
OS, and click \gui{Next}.
\note Kits are listed if they have been specified in \gui Tools >
\gui Options > \gui{Build & Run} > \gui Kits.
......@@ -113,7 +120,7 @@
\li Click \gui Design to open the file in \QMLD.
\li In the \gui Navigator pane, select \gui Button and press \key Delete
\li In the \gui Navigator pane, select \gui Text and press \key Delete
to delete it.
\li In the \gui Library view, \gui Resources tab, select Bluebubble.svg
......@@ -143,17 +150,15 @@
\quotefromfile accelbubble/main.qml
\skipto import QtQuick
\printuntil 1.0
\printuntil 1.1
\codeline
\skipto ApplicationWindow
\printuntil true
\skipto Image
\printuntil y:
\skipto /^\}/
\printuntil }
\section1 Moving the Bubble
Now that the visual elements are in place, let us move the bubble based on
......@@ -201,6 +206,19 @@
\printuntil }
\endlist
\section1 Locking Device Orientation
The device display is rotated by default when the device orientation
changes between portrait and landscape. For this example, it would be
better for the screen orientation to be fixed.
To lock the orientation to portrait or landscape on Android, specify it in
an AndroidManifest.xml that you can generate in \QC. For more information,
see \l{Editing Manifest Files}.
On iOS, you can lock the device orientation in a Info.plist file that you
specify in the .pro file as the value of the QMAKE_INFO_PLIST variable.
\section1 Adding Dependencies
Update the accelbubble.pro file with the following library dependency
......@@ -210,13 +228,43 @@
QT += quick sensors svg xml
\endcode
On iOS, you must link to the above libraries statically, by adding the
plugin names explicitly as values of the QTPLUGIN variable. Specify a
qmake scope for iOS builds (which can also contain the QMAKE_INFO_PLIST
variable):
\code
ios {
QTPLUGIN += qsvg qsvgicon qtsensors_ios
QMAKE_INFO_PLIST = Info.plist
}
\endcode
After adding the dependencies, select \gui Build > \gui {Run qmake} to apply
the changes to the Makefile of the project.
\section1 Adding Resources
You need to add the Bluebubble.svg image file to the application resources
for deployment to mobile devices:
\list 1
\li In the \gui Projects view, double-click the qml.qrc file to open it
in the resource editor.
\li Select \gui Add to add Bluebubble.svg.
\endlist
\section1 Running the Application
The application is complete and ready to be deployed to an Android device:
The application is complete and ready to be deployed to a device:
\list 1
\li Enable \e{USB Debugging} on the device.
\li Enable \e{USB Debugging} on the Android device or \e{developer mode}
on the iOS device.
\li Connect the device to the development PC.
......
......@@ -58,7 +58,7 @@
Now you are ready to start developing your own applications.
Pick a tutorial to follow in \l{Tutorials}. To start developing
for Android devices, select \l{Creating an Android Application}.
for mobile devices, select \l{Creating a Mobile Application}.
\endtable
*/
......@@ -46,10 +46,10 @@
Learn how to create a Qt widget based application for the desktop.
\li \l{Creating an Android Application}
\li \l{Creating a Mobile Application}
Learn how to create a Qt Quick application using Qt Quick Controls
for Android devices.
for Android and iOS devices.
\endlist
......
......@@ -133,7 +133,7 @@
\list
\li \l{Creating a Qt Quick Application}
\li \l{Creating a Qt Widget Based Application}
\li \l{Creating an Android Application}
\li \l{Creating a Mobile Application}
\endlist
\endlist
\li \l{Managing Projects}
......
......@@ -17,8 +17,8 @@
<description><![CDATA[Using basic QML elements and learning about basic concepts of Qt Quick.]]></description>
<tags>qt creator,qt quick designer,qt quick,qml,states,transitions</tags>
</tutorial>
<tutorial imageUrl="images/icons/androidapp.png" difficulty="" docUrl="qthelp://org.qt-project.qtcreator/doc/creator-android-app-tutorial.html" projectPath="" name="Creating an Android Application">
<description><![CDATA[Developing Qt Quick applications for Android devices using Qt Quick Controls.]]></description>
<tutorial imageUrl="images/icons/androidapp.png" difficulty="" docUrl="qthelp://org.qt-project.qtcreator/doc/creator-android-app-tutorial.html" projectPath="" name="Creating a Mobile Application">
<description><![CDATA[Developing Qt Quick applications for Android and iOS devices using Qt Quick Controls.]]></description>
<tags>qt creator,qt quick designer,qml,android</tags>
</tutorial>
<tutorial imageUrl="images/icons/tutorialicon.png" difficulty="" docUrl="qthelp://org.qt-project.qtdoc/qtdoc/gettingstartedqml.html" projectPath="" name="Getting Started Programming with Qt Quick">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment