「多平台的 QML 應用程式架構設計」 2015/11/1 @ MOPCON 2015, International Convention Center Kaohsiung (ICCK), Kaohsiung, Taiwan.
騗歲涸⮛꧉㢵䎂〵涸2.-䥰欽玑䒭卺圓鏤鎙34$IJBOH!.01$0/ $$#:4"58
View Slide
34$IJBOH荩㣐岁䖒禺♲䎃秹㷸欰鎙皿堥䎃剚ⶰ〮荩㣐彂爢涮饱➃껷㾂爢ꟀIUUQQPSFOUX
鸏㜥怵闍㼟剚䱳鎣˙ 騗䎂〵涸植剤倰呪⿻Ⱖ㔮㞯˙ 2.-僽➊랃⟃⿻捀➊랃銴⢪欽㸐˙ 㥶⡦⢪欽2.-鿈縭㢵䎂〵涸䥰欽玑䒭 "QQ˙ 㢵䎂〵玑䒭鏤鎙䌢鋅涸㉏겗莅㻜⡲倰岁
騗䎂〵ˋ8SJUFPODF SVOFWFSZXIFSF
⾲欰鸒欽笪갤䥰欽玑䒭5JUBOJVN.PCJMF$PSEPWB 3FBDU/BUJWF9BNBSJO+BWB
QMLQt Meta Language / Qt Modeling Language1IPUPGSPN2UPDJBMTJUF
2UGSBNFXPSL8JOEPXT"1* "OESPJE/%, J044%,䎂〵/FUXPSLJOH % 2U2VJDL 8FC,JU⢿㥶⢿㥶䬄韍䥰欽玑䒭
䎙⦐⢪欽2.-涸㥪贖˙ 腋㣁㸤䱾ⵖ䥰欽玑䒭涸遤捀邍植˙ ⾲欰⟃⿻炽넓⸈鸠滑곃涸鸠䏞˙ 鞮㺢涸"1*⟃⿻仍⯏䚍 FYUFOTJCJMJUZ˙ 玑䒭焺〳伟䚍 TPVSDFQPSUBCMF
It’s QML!
ⴲ㒂2.-
import QtQuick 2.0Rectangle {color: '#33b5e5'}
import QtQuick 2.0Rectangle {color: '#33b5e5'radius: 120Text {anchors.centerIn: parentfont.pixelSize: 24text: "Hello, world!"}}
text: {var date = new Date()return ("" +d.getHours() +" 讫")}
-JWF%FNP
import QtQuick 2.0import QtQuick.Window 2.0import QtGraphicalEffects 1.0!Window {id: rootcolor: "#689881"width: 800height: 600visible: trueAnimatedImage {id: wheelwidth: radius * 2height: radius * 2source: "slippy.gif"fillMode: Image.PreserveAspectCropvisible: false!property int radius: 96}Rectangle {id: maskwidth: wheel.widthheight: wheel.heightradius: wheel.radiuscolor: "#000"visible: false}Rectangle {id: clockcolor: "orange"width: (parent.width >= parent.height) ?parent.height : parent.widthheight: widthradius: width / 2anchors.centerIn: parentopacity: 1property int hour: 9property int minute: 41property int second: 0OpacityMask {id: secondCirclewidth: wheel.widthheight: wheel.height!source: wheelmaskSource: maskvisible: (x != 0 || y != 0)x: clock.radius + (clock.radius -wheel.radius) * Math.cos((6.0 * clock.second - 90.0)/ 360.0 * 2 * Math.PI) - wheel.radiusy: clock.radius + (clock.radius -wheel.radius) * Math.sin((6.0 * clock.second - 90.0)/ 360.0 * 2 * Math.PI) - wheel.radiusz: 1Behavior on x {NumberAnimation {easing.type: Easing.OutBackduration: 200}}Behavior on y {NumberAnimation {easing.type: Easing.OutBackduration: 200}}}}Text {id: labelanchors.centerIn: clocktext: (clock.hour > 12 ? clock.hour - 12 :clock.hour) + ":" + (clock.minute < 10 ? "0" +clock.minute : clock.minute)font.family: "Roboto"font.pointSize: 84font.weight: Font.Boldcolor: "#fff"}!Text {id: creditLabelanchors {top: label.bottomhorizontalCenter: label.horizontalCenter}text: "岄傀य़䋊樄რᐒ"font.family: "Source Han Sans TC"font.pointSize: 24color: "#fff"}!NumberAnimation {id: minuteAnimationtarget: labelproperty: "opacity"from: 0.7; to: 1duration: 1000easing.type: Easing.OutExpo}Timer {id: timerinterval: 1000running: truerepeat: trueonTriggered: {var date = new Date()clock.hour = date.getHours()clock.minute = date.getMinutes()clock.second = date.getSeconds()!if (clock.second == 0)minuteAnimation.start()}}// (C) NTUOSC 2014. Released under MIT License.}
HJUIVCDPNSTDIJBOHOUVPTDRNMJOUSPDMPDL
矦㋲涸玑䒭 2.-㽠〳⟃䵆㹁✫
醳꧹♧럊涸梖岁˙ 2.-㛇劥♳僽0QFO(-㜥兞˙ 醳꧹⯋⟝〳⟃欽Ⰹ䒊涸2U2VJDL$POUSPMT˙ 亼⡂8$4QFD涸"1*〳⟃䒸Ⰵ♶㼱+4MJC˙ 殹搭銴荈䊹ⵠ⛳僽〳⟃4*5$0/'SJFOETTUJDLFST $$#:/$34$IJBOH$+0,&3㣐⸔
眕⢿5ISFFKT2.-
㢵䎂〵佅䴂˙ 4ZNCJBO˙ .FF(P)BSNBUUBO˙ #MBDL#FSSZ!˙ 4BJMGJTI04˙ 6CVOUV5PVDI˙ 8JOEPXT˙ 049˙ -JOVY9˙ "OESPJE "3.WW Y˙ J04}}2U2VJDL2U2VJDL
矦㋲♲姿끐˙ 酤湡垦䎂〵涸4%,˙ 管䧭湡垦䎂〵涸玑䒭˙ 駵㖈湡垦䎂〵♳
眕⢿.BUFSJBM2.-MJCSBSZ!.01$0/
ꣳⵖ˙ 剤❉䎂〵涸4%,㼩橇㞯剤暶婌宠˙ 2U尝剤巒覈涸"1*銴鷴麕⾲欰⺫酤˙ 暶ⴽ岤䠑J04"QQ4UPSF鸤䧭涸-(1-㉏겗
5IBOLT㢵䎂〵涸2.-䥰欽玑䒭卺圓鏤鎙34$IJBOH!.01$0/ $$#:4"58