For C ++ D evelopers
#ho $m I%
I am R oberto R aggi P rincipal E ngineer at Nokia, QtD F P art of the Qt C reator team In addition, I contrib ted to the design and the implementation of the Q! " lang age
Q t Q ick
Qt Q ick is a set of technologies designed to help developers create modern&looking interfaces
lang age for describing 'Is (Q! ") set of ser interface elements (Item, R ectangle, "ist*ie+, Flickable, , ) Q t C reator -ools For Q! "
E as. to learn
12 3 N&like s.nta/ for the ob4ect declarations 1ava2 cript to define propert. bindings
Q t D eclarative ! od le
-he Q t D eclarative C ++ $P Is
QD eclarativeE ngine
core of the Q! " r ntime provides an environment for Q! " components
-he Q t D eclarative C ++ $P Is
QD eclarativeE ngine
core of the Q! " r ntime provides an environment for Q! " components
QD eclarativeC onte/t
provides a set of properties that can be accessed b. name from Q ! "
-he Q t D eclarative C ++ $P Is
QD eclarativeE ngine
core of the Q! " r ntime provides an environment for Q! " components
QD eclarativeC onte/t
provides a set of properties that can be accessed b. name from Q ! "
QD eclarative*ie+
Q 9raphics*ie+&based +idget that can be sed to displa. Q! " interfaces
-he Q t D eclarative C ++ $P Is
#ell, those classes are connected
Q D eclarative*ie+ holds a Q D eclarativeE ngine Q D eclarativeE ngine keeps a reference to the root Q D eclarativeC onte/t
"et:s do it;
"et:s tr. to se those classes in Q t C reator0
E /posing D ata
QD eclarativeC onte/t allo+s the application to e/pose data
setC onte/tP ropert.(name, val e) setC onte/t3 b4ect(ob4ect)
C stom C ++ -.pes
C stom -.pes are registered sing
<mlR egister-.pe=C pp-.>(mod,ver,<mlName)
#here C ppTy is a C++ t.pe, mod is the mod le name, ver is the initial version n mber and qmlName is the name of the component0
For e/ample,
<mlR egister-.pe=C ontact>(?m.@, A,B, ?C ontact@)
C stom C ++ -.pes
Ne+ t.pes m st
Inherit from a Q3 b4ect based class (e0g0 Q D eclarativeItem, Q $bstractItem! odel) $dd properties sing the QCP R 3 P E R -D macro and the N3 -IFD attrib te
Q CP R 3 P E R -D(int p R E $D p #R I-E setP N3 -IFD pC hanged)
C stom C ++ -.pes
int p() const E ret rn CpG H void setP (int p) E if (Cp II p) ret rnG Cp I pG / /emitted whenever the value changes emit pC hanged()G H
C stom C ++ -.pes
! ethods marked as Q CIN*3 8$5 "E can be sed as normal 12 f nctions
Q CIN*3 8$5 "E void initialiJe()G 6 6 C ++ C omponent0onC ompletedF E initialiJe()G H6 6 Q!"
"et:s do it in Q t C reator
C stom C ++ -.pes
QD eclarativeItem
E /tends Q 9raphics 3 b4ect D efines properties that are common to all vis al items (e0g0 anchors, /, ., +idth, height)
C stom C ++ -.pes
Items s ch as "ist*ie+ and R epeater re< ire data models to displa. data Do can s bclass Q$bstractItem! odel to provide data for those items
remember to set the ser role names sing Q $bstractItem! odelFFsetR oleNames(names)
E /tension P l gins
Ne+ c stom Q ! " E /tensions m st
Inherit from Q D eclarativeE /tensionP l gin
3 verride the method register-.pes(mod le) P erform c stom initialiJation in initialiJeE ngine()
P rovide a <mldir file that tells the Q! " engine to load the pl gin
<mldir files are eas. to +rite
Do need to b ndle the code in a librar. and e/port the pl gin sing the QCE K P 3 R -CP "'9INL macro
$dvanced -opics
QD eclarativeE ngine +itho t a QD eclarative*ie+ $dvanced image loading +ith QD eclarativeImageP rovider $ttached properties
$nnotate t.pes +ith additional properties
C omm nit.
httpF6 6 <t0nokia0com6 httpF6 6 labs0<t0nokia0com6 <t&<ml mailing list
httpF6 6 lists0trolltech0com6 mailman6 listinfo6 <t&<ml
M<t&<ml on irc0freenode0org httpF6 6 <t0gitorio s0org6 <t httpF6 6 <t0gitorio s0org6 <t&components
-hank .o ;