summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2014-12-19 15:24:09 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2014-12-19 15:24:09 +0100
commitab1e3654e767b612e73d917000d82f30e683f360 (patch)
tree95abfa624b7809507da917785608eda3480aa5e0 /examples
parent39595338678d36ba7b7d751a3f66fae3927596fb (diff)
WIP: proper Qt module structure
Diffstat (limited to 'examples')
-rw-r--r--examples/android/catalog/android/AndroidManifest.xml61
-rw-r--r--examples/android/catalog/android/assets/awesome.pngbin0 -> 10864 bytes
-rw-r--r--examples/android/catalog/android/build.gradle55
-rw-r--r--examples/android/catalog/android/gradle/wrapper/gradle-wrapper.properties6
-rw-r--r--examples/android/catalog/android/res/anim/awesome.xml23
-rw-r--r--examples/android/catalog/android/res/drawable/awesome.pngbin0 -> 10864 bytes
-rw-r--r--examples/android/catalog/android/res/drawable/logo.pngbin0 -> 4842 bytes
-rw-r--r--examples/android/catalog/catalog.pro24
-rw-r--r--examples/android/catalog/catalog.qrc11
-rw-r--r--examples/android/catalog/main.cpp13
-rw-r--r--examples/android/catalog/qml/AwesomeView.qml45
-rw-r--r--examples/android/catalog/qml/ButtonView.qml107
-rw-r--r--examples/android/catalog/qml/InputView.qml61
-rw-r--r--examples/android/catalog/qml/ModelView.qml59
-rw-r--r--examples/android/catalog/qml/PickerView.qml19
-rw-r--r--examples/android/catalog/qml/ProgressView.qml86
-rw-r--r--examples/android/catalog/qml/main.qml78
-rw-r--r--examples/examples.pro2
18 files changed, 650 insertions, 0 deletions
diff --git a/examples/android/catalog/android/AndroidManifest.xml b/examples/android/catalog/android/AndroidManifest.xml
new file mode 100644
index 0000000..20c04ba
--- /dev/null
+++ b/examples/android/catalog/android/AndroidManifest.xml
@@ -0,0 +1,61 @@
+<?xml version='1.0' encoding='utf-8'?>
+<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
+ <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:theme="@android:style/Theme.Material.Light.DarkActionBar">
+ <service android:name="qt.android.app.QtService" />
+ <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
+ android:name="qt.android.app.QtActivity"
+ android:label="-- %%INSERT_APP_NAME%% --"
+ android:screenOrientation="unspecified"
+ android:launchMode="singleTop">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
+ <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
+ <meta-data android:name="android.app.repository" android:value="default"/>
+ <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
+ <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
+ <!-- Deploy Qt libs as part of package -->
+ <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
+ <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
+ <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
+ <!-- Run with local libs -->
+ <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
+ <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
+ <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
+ <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
+ <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
+ <!-- Messages maps -->
+ <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
+ <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
+ <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
+ <!-- Messages maps -->
+
+ <!-- Splash screen -->
+ <!--
+ <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/>
+ -->
+ <!-- Splash screen -->
+
+ <!-- Background running -->
+ <!-- Warning: changing this value to true may cause unexpected crashes if the
+ application still try to draw after
+ "applicationStateChanged(Qt::ApplicationSuspended)"
+ signal is sent! -->
+ <meta-data android:name="android.app.background_running" android:value="false"/>
+ <!-- Background running -->
+ </activity>
+ </application>
+ <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/>
+ <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
+
+ <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
+ Remove the comment if you do not require these default permissions. -->
+ <!-- %%INSERT_PERMISSIONS -->
+
+ <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
+ Remove the comment if you do not require these default features. -->
+ <!-- %%INSERT_FEATURES -->
+
+</manifest>
diff --git a/examples/android/catalog/android/assets/awesome.png b/examples/android/catalog/android/assets/awesome.png
new file mode 100644
index 0000000..99a8c13
--- /dev/null
+++ b/examples/android/catalog/android/assets/awesome.png
Binary files differ
diff --git a/examples/android/catalog/android/build.gradle b/examples/android/catalog/android/build.gradle
new file mode 100644
index 0000000..b6805db
--- /dev/null
+++ b/examples/android/catalog/android/build.gradle
@@ -0,0 +1,55 @@
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.12.1'
+ }
+}
+
+apply plugin: 'android'
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:21.0.+'
+ compile 'com.android.support:cardview-v7:21.0.+'
+ compile 'com.android.support:recyclerview-v7:21.0.+'
+ compile 'com.android.support:support-v4:21.0.+'
+}
+
+android {
+ /*******************************************************
+ * The following variables:
+ * - androidBuildToolsVersion,
+ * - androidCompileSdkVersion
+ * - qt5AndroidDir - holds the path to qt android files
+ * needed to build any Qt application
+ * on Android.
+ *
+ * are defined in gradle.properties file. This file is
+ * updated by QtCreator and androiddeployqt tools.
+ * Changing them manually might break the compilation!
+ *******************************************************/
+
+ compileSdkVersion androidCompileSdkVersion.toInteger()
+
+ buildToolsVersion androidBuildToolsVersion
+
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
+ aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
+ res.srcDirs = [qt5AndroidDir + '/res', 'res']
+ resources.srcDirs = ['src']
+ renderscript.srcDirs = ['src']
+ assets.srcDirs = ['assets']
+ jniLibs.srcDirs = ['libs']
+ }
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+}
diff --git a/examples/android/catalog/android/gradle/wrapper/gradle-wrapper.properties b/examples/android/catalog/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..1e61d1f
--- /dev/null
+++ b/examples/android/catalog/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Apr 10 15:27:10 PDT 2013
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/examples/android/catalog/android/res/anim/awesome.xml b/examples/android/catalog/android/res/anim/awesome.xml
new file mode 100644
index 0000000..ee6d387
--- /dev/null
+++ b/examples/android/catalog/android/res/anim/awesome.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shareInterpolator="false" >
+
+ <scale android:duration="4800"
+ android:fromXScale="0.5"
+ android:fromYScale="0.5"
+ android:toXScale="1.0"
+ android:toYScale="1.0"
+ android:pivotX="50%"
+ android:pivotY="50%"
+ android:repeatMode="reverse"
+ android:repeatCount="infinite"
+ android:interpolator="@android:anim/accelerate_decelerate_interpolator" />
+
+ <rotate android:duration="3200"
+ android:fromDegrees="0"
+ android:toDegrees="-360"
+ android:pivotX="50%"
+ android:pivotY="50%"
+ android:repeatCount="infinite"
+ android:interpolator="@android:anim/linear_interpolator" />
+</set>
diff --git a/examples/android/catalog/android/res/drawable/awesome.png b/examples/android/catalog/android/res/drawable/awesome.png
new file mode 100644
index 0000000..99a8c13
--- /dev/null
+++ b/examples/android/catalog/android/res/drawable/awesome.png
Binary files differ
diff --git a/examples/android/catalog/android/res/drawable/logo.png b/examples/android/catalog/android/res/drawable/logo.png
new file mode 100644
index 0000000..f3d4a5e
--- /dev/null
+++ b/examples/android/catalog/android/res/drawable/logo.png
Binary files differ
diff --git a/examples/android/catalog/catalog.pro b/examples/android/catalog/catalog.pro
new file mode 100644
index 0000000..55276bd
--- /dev/null
+++ b/examples/android/catalog/catalog.pro
@@ -0,0 +1,24 @@
+TEMPLATE = app
+TARGET = catalog
+QT += qml
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ catalog.qrc
+
+OTHER_FILES += \
+ qml/main.qml \
+ qml/AwesomeView.qml \
+ qml/ButtonView.qml \
+ qml/InputView.qml \
+ qml/ModelView.qml \
+ qml/PickerView.qml \
+ qml/ProgressView.qml
+
+DISTFILES += \
+ android/build.gradle \
+ android/gradle/wrapper/gradle-wrapper.properties
+
+ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
diff --git a/examples/android/catalog/catalog.qrc b/examples/android/catalog/catalog.qrc
new file mode 100644
index 0000000..9521232
--- /dev/null
+++ b/examples/android/catalog/catalog.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qml/main.qml</file>
+ <file>qml/AwesomeView.qml</file>
+ <file>qml/ButtonView.qml</file>
+ <file>qml/InputView.qml</file>
+ <file>qml/ModelView.qml</file>
+ <file>qml/PickerView.qml</file>
+ <file>qml/ProgressView.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/android/catalog/main.cpp b/examples/android/catalog/main.cpp
new file mode 100644
index 0000000..89e848f
--- /dev/null
+++ b/examples/android/catalog/main.cpp
@@ -0,0 +1,13 @@
+#include <QtQml>
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication app(argc, argv);
+
+ qRegisterMetaType<QQmlPropertyMap *>();
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
+
+ return app.exec();
+}
diff --git a/examples/android/catalog/qml/AwesomeView.qml b/examples/android/catalog/qml/AwesomeView.qml
new file mode 100644
index 0000000..3d1f707
--- /dev/null
+++ b/examples/android/catalog/qml/AwesomeView.qml
@@ -0,0 +1,45 @@
+import android.view 0.21
+import android.widget 0.21
+import android.view.animation 0.21
+
+RelativeLayout {
+ ImageView {
+ imageResource: 2130837555 // TODO: R.drawable.awesome
+ RelativeLayout.centerInParent: true
+
+// animation: Animation {
+// id: anim
+// resource: 2130968582 // TODO: r.anim.awesome
+// }
+
+ animation: AnimationSet {
+ id: anim
+ shareInterpolator: false
+ ScaleAnimation {
+ duration: 4800
+ repeatMode: Animation.REVERSE
+ repeatCount: Animation.INFINITE
+ fromXScale: 0.5
+ fromYScale: 0.5
+ toXScale: 1.0
+ toYScale: 1.0
+ pivotX: 0.5 // "50%"
+ pivotY: 0.5 // "50%"
+ pivotXType: Animation.RELATIVE_TO_SELF
+ pivotYType: Animation.RELATIVE_TO_SELF
+ interpolator: AccelerateDecelerateInterpolator { }
+ }
+ RotateAnimation {
+ duration: 3200
+ repeatCount: Animation.INFINITE
+ fromDegrees: 0
+ toDegrees: -360
+ pivotX: 0.5 // "50%"
+ pivotY: 0.5 // "50%"
+ pivotXType: Animation.RELATIVE_TO_SELF
+ pivotYType: Animation.RELATIVE_TO_SELF
+ interpolator: LinearInterpolator { }
+ }
+ }
+ }
+}
diff --git a/examples/android/catalog/qml/ButtonView.qml b/examples/android/catalog/qml/ButtonView.qml
new file mode 100644
index 0000000..ce09d1e
--- /dev/null
+++ b/examples/android/catalog/qml/ButtonView.qml
@@ -0,0 +1,107 @@
+import android.view 0.21
+import android.widget 0.21
+import android.support.v7.widget 0.21
+
+ScrollView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: "Button"; textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ LinearLayout {
+ Button { text: "Ok" }
+ Button {
+ text: "Cancel"
+ onClick: toast.show()
+ Toast {
+ id: toast
+ text: "Cancelled"
+ }
+ }
+ Space {
+ LinearLayout.weight: 1
+ LinearLayout.width: Layout.WRAP_CONTENT
+ }
+ Button {
+ text: "Attach"
+ onClick: menu.show()
+ PopupMenu {
+ id: menu
+ MenuItem { title: "Image" }
+ MenuItem { title: "Document" }
+ }
+ }
+ }
+ }
+ }
+
+ Space { LinearLayout.height: 48 }
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: "ToggleButton"; textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ LinearLayout {
+ ToggleButton { checked: true }
+ ToggleButton { }
+ }
+ }
+ }
+
+ Space { LinearLayout.height: 48 }
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: "CheckBox"; textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ CheckBox { text: "E-mail"; checked: true }
+ CheckBox { text: "Calendar" }
+ CheckBox { text: "Contacts" }
+ }
+ }
+
+ Space { LinearLayout.height: 48 }
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: "RadioButton"; textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ RadioGroup {
+ RadioButton { text: "Portrait"; checked: true }
+ RadioButton { text: "Landscape" }
+ RadioButton { text: "Automatic" }
+ }
+ }
+ }
+
+ Space { LinearLayout.height: 48 }
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: "Switch"; textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ Switch { text: "Wifi"; checked: true }
+ Space { LinearLayout.height: 24 }
+ Switch { text: "Bluetooth" }
+ }
+ }
+ }
+}
diff --git a/examples/android/catalog/qml/InputView.qml b/examples/android/catalog/qml/InputView.qml
new file mode 100644
index 0000000..aec0bbd
--- /dev/null
+++ b/examples/android/catalog/qml/InputView.qml
@@ -0,0 +1,61 @@
+import android.widget 0.21
+import android.support.v7.widget 0.21
+
+ScrollView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: "EditText (single line)"; textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ EditText {
+ hint: "Username"
+ singleLine: true
+ }
+ Space { LinearLayout.height: 48 }
+ EditText {
+ hint: "Password"
+ singleLine: true
+ inputType: 1 | 128 // TODO: TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
+ }
+ }
+ }
+
+ Space { LinearLayout.height: 48 }
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: "EditText (multi-line)"; textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ EditText {
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer feugiat purus urna, in feugiat diam pulvinar non. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Interdum et malesuada fames ac ante ipsum primis in faucibus."
+ }
+ }
+ }
+
+ Space { LinearLayout.height: 48 }
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: "Spinner"; textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ Spinner {
+ adapter: ArrayAdapter {
+ array: ["Apple", "Banana", "Orange"]
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/android/catalog/qml/ModelView.qml b/examples/android/catalog/qml/ModelView.qml
new file mode 100644
index 0000000..ef42437
--- /dev/null
+++ b/examples/android/catalog/qml/ModelView.qml
@@ -0,0 +1,59 @@
+import android.view 0.21
+import android.widget 0.21
+import android.graphics 0.21
+import android.graphics.drawable 0.21
+import android.support.v4.widget 0.21
+import android.support.v7.widget 0.21
+
+import QtQml 2.1
+
+TabHost {
+ LinearLayout {
+ orientation: LinearLayout.VERTICAL
+ TabWidget { }
+ FrameLayout {
+ LinearLayout.weight: 1
+ LinearLayout.height: Layout.WRAP_CONTENT
+ SwipeRefreshLayout {
+ id: layout
+ TabSpec.label: "ListView"
+ ListView {
+ adapter: ArrayAdapter {
+ array: ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"]
+ }
+ }
+ Timer {
+ interval: 2000
+ running: layout.refreshing
+ onTriggered: layout.refreshing = false
+ }
+ }
+ RecyclerView {
+ TabSpec.label: "RecyclerView"
+ adapter: RecyclerAdapter {
+ count: 50
+ delegate: FrameLayout {
+ CardView {
+ RelativeLayout {
+ padding: 48
+ ImageView {
+ imageResource: 2130837556 // TODO: R.drawable.logo
+ RelativeLayout.centerVertical: true
+ RelativeLayout.alignParentLeft: true
+ }
+ TextView {
+ text: position
+ RelativeLayout.alignParentRight: true
+ RelativeLayout.alignParentBottom: true
+ }
+ }
+ FrameLayout.margin: 48
+ FrameLayout.topMargin: position == 0 ? 48 : 0
+ FrameLayout.width: Layout.MATCH_PARENT
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/android/catalog/qml/PickerView.qml b/examples/android/catalog/qml/PickerView.qml
new file mode 100644
index 0000000..a274cbf
--- /dev/null
+++ b/examples/android/catalog/qml/PickerView.qml
@@ -0,0 +1,19 @@
+import android.view 0.21
+import android.widget 0.21
+
+TabHost {
+ LinearLayout {
+ orientation: LinearLayout.VERTICAL
+ FrameLayout {
+ LinearLayout.weight: 1
+ LinearLayout.height: Layout.WRAP_CONTENT
+ DatePicker {
+ TabSpec.label: "DatePicker"
+ }
+ TimePicker {
+ TabSpec.label: "TimePicker"
+ }
+ }
+ TabWidget { }
+ }
+}
diff --git a/examples/android/catalog/qml/ProgressView.qml b/examples/android/catalog/qml/ProgressView.qml
new file mode 100644
index 0000000..b073ec5
--- /dev/null
+++ b/examples/android/catalog/qml/ProgressView.qml
@@ -0,0 +1,86 @@
+import android.view 0.21
+import android.widget 0.21
+import android.support.v7.widget 0.21
+
+ScrollView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: "ProgressBar"; textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ LinearLayout {
+ ProgressBar { style: ProgressBar.Large }
+ Space { LinearLayout.width: 48 }
+ ProgressBar { style: ProgressBar.Medium }
+ Space { LinearLayout.width: 48 }
+ ProgressBar { style: ProgressBar.Small }
+ }
+ }
+ }
+
+ Space { LinearLayout.height: 48 }
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: "ProgressBar (horizontal)"; textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ ProgressBar {
+ indeterminate: true
+ style: ProgressBar.Horizontal
+ }
+ Space { LinearLayout.height: 24 }
+ ProgressBar {
+ progress: primaryBar.progress
+ secondaryProgress: secondaryBar.progress
+ style: ProgressBar.Horizontal
+ }
+ }
+ }
+
+ Space { LinearLayout.height: 48 }
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: qsTr("SeekBar (%1/%2)").arg(primaryBar.progress).arg(secondaryBar.progress); textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ SeekBar {
+ id: primaryBar
+ progress: 25
+ }
+ SeekBar {
+ id: secondaryBar
+ progress: 75
+ }
+ }
+ }
+
+ Space { LinearLayout.height: 48 }
+
+ CardView {
+ LinearLayout {
+ padding: 48
+ orientation: LinearLayout.VERTICAL
+
+ TextView { text: qsTr("RatingBar (%1)").arg(ratingBar.rating); textSize: 18 }
+ Space { LinearLayout.height: 48 }
+ RatingBar {
+ id: ratingBar
+ rating: 3.5
+ LinearLayout.width: Layout.WRAP_CONTENT
+ }
+ }
+ }
+ }
+}
diff --git a/examples/android/catalog/qml/main.qml b/examples/android/catalog/qml/main.qml
new file mode 100644
index 0000000..10e5cba
--- /dev/null
+++ b/examples/android/catalog/qml/main.qml
@@ -0,0 +1,78 @@
+import android 0.21
+import android.app 0.21
+import android.view 0.21
+import android.widget 0.21
+import android.graphics 0.21
+import android.graphics.drawable 0.21
+import android.support.v4.widget 0.21
+import android.support.v7.app 0.21
+
+Activity {
+ id: activity
+
+ window.statusBarColor: Color.name("#455a64")
+
+ actionBar: ActionBar {
+ title: "QtAndroid"
+ subtitle: adapter.getItem(switcher.displayedChild)
+ background: ColorDrawable {
+ color: Color.name("#607d8b")
+ }
+ }
+
+ optionsMenu: Menu {
+ MenuItem {
+ title: "Search"
+ showAs: MenuItem.SHOW_AS_ACTION_ALWAYS
+ visible: switcher.displayedChild == 2
+ actionView: SearchView { }
+ }
+ MenuItem {
+ title: "About"
+ onClick: dialog.show()
+ }
+ MenuItem {
+ title: "Exit"
+ onClick: Qt.quit()
+ }
+ }
+
+ AlertDialog {
+ id: dialog
+ title: "About"
+ message: "Native UI controls for Android"
+ }
+
+ contentView: DrawerLayout {
+ id: drawer
+
+ ActionBarDrawerToggle { }
+
+ ViewAnimator {
+ id: switcher
+ inAnimation: R.anim.slide_in_left
+ outAnimation: R.anim.slide_out_right
+
+ ButtonView { }
+ ProgressView { }
+ InputView { }
+ PickerView { }
+ ModelView { }
+ AwesomeView { }
+ }
+
+ ListView {
+ DrawerLayout.gravity: Gravity.LEFT
+ backgroundColor: Color.name("#eee")
+ adapter: ArrayAdapter {
+ id: adapter
+ style: R.layout.simple_selectable_list_item
+ array: ["Buttons", "Progress", "Input", "Pickers", "Views", "100%"]
+ }
+ onClick: {
+ drawer.closeDrawer(Gravity.LEFT)
+ switcher.displayedChild = position
+ }
+ }
+ }
+}
diff --git a/examples/examples.pro b/examples/examples.pro
new file mode 100644
index 0000000..d07d8b3
--- /dev/null
+++ b/examples/examples.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS += android/catalog