Saturday, January 05, 2013

Membuat Aplikasi Currency Converter untuk Platform Ubuntu for Smartphone [bagian 1]

Postingan kali ini saya akan membuat sebuah aplikasi untuk platform Ubuntu for smartphone. Aplikasi yang saya buat ini adalah penghitung kurs mata uang.
Sebelumnya, teman-teman perlu membaca terlebih dahulu postingan-postingan saya berikut:
1. Menjajal Mendevelop Aplikasi untuk Platform Ubuntu for Smartphone [bagian 1]
2. Menjajal Mendevelop Aplikasi untuk Platform Ubuntu for Smartphone [bagian 2]

Langkah-langkah:
1. Buka Qt Creator, tekan Ctrl+N untuk membuat project baru
2. Pilih menu Projects --> Application --> Qt Quick UI template kemudian klik Choose
3. Beri nama project CurrencyConverter, biarkan field-field yang lain dengan nilai default-nya
4. Klik Finish
5. Ganti isi file CurrencyConverter.qml dengan kode berikut:

import QtQuick 2.0
import Ubuntu.Components 0.1
 
Rectangle {
    id: root
    width: units.gu(60)
    height: units.gu(80)
    color: "lightgray"
 
    property real margins: units.gu(2)
    property real buttonWidth: units.gu(9)
 
    Label {
       id: title
       ItemStyle.class: "title"
       text: i18n.tr("Currency Converter")
       height: contentHeight + root.margins
       anchors {
           left: parent.left
           right: parent.right
           top: parent.top
       }
    }
}
6. Simpan file CurrencyConverter.qml
7. Jalankan file dengan menekan menu Tools --> External --> Qt Quick --> Preview (qmlscene)



Kita akan mendapatkan sebuah window berwarna abu-abu dengan tulisan Currency Converter di dalamnya.

bersambung..

sumber:
http://developer.ubuntu.com/resources/app-developer-cookbook/mobile/currency-converter-phone-app/

0 comments:

Post a Comment

ardhi.web.id. Powered by Blogger.