source: trunk/doc/src/examples/qml-examples.qdoc

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 17.5 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation (qt-info@nokia.com)
6**
7** This file is part of the documentation of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:FDL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in a
14** written agreement between you and Nokia.
15**
16** GNU Free Documentation License
17** Alternatively, this file may be used under the terms of the GNU Free
18** Documentation License version 1.3 as published by the Free Software
19** Foundation and appearing in the file included in the packaging of this
20** file.
21**
22** If you have questions regarding the use of this file, please contact
23** Nokia at qt-info@nokia.com.
24** $QT_END_LICENSE$
25**
26****************************************************************************/
27
28/*!
29 \title Animation: Basics Example
30 \example declarative/animation/basics
31
32 This example shows how to create and combine \l{QML Animation}{animations} in QML.
33
34 \table
35 \row
36 \o \image qml-coloranim-example.png
37 \row
38 \o color-animation.qml
39 \endtable
40
41 \table
42 \row
43 \o \image qml-propertyanim-example.png
44 \row
45 \o property-animation.qml
46 \endtable
47*/
48
49/*!
50 \title Animation: Behavior Examples
51 \example declarative/animation/behaviors
52
53 This example shows how to use QML behaviors.
54
55 \image qml-behaviors-example.png
56*/
57
58/*!
59 \title Animation: Easing Example
60 \example declarative/animation/easing
61
62 This example shows the different easing modes available for \l{QML Animation}{animations}.
63
64 \image qml-easing-example.png
65*/
66
67/*!
68 \title Animation: States Example
69 \example declarative/animation/states
70
71 These examples show how to use \l{States}{states} and \l{Transitions}{transitions}.
72
73 The \c states.qml example shows how an item can change between states, and \c transitions.qml
74 shows how these state changes can be animated.
75
76 \table
77 \row
78 \o \image qml-states-example.png
79 \row
80 \o states.qml
81 \endtable
82
83 \table
84 \row
85 \o \image qml-transitions-example.png
86 \row
87 \o transitions.qml
88 \endtable
89*/
90
91/*!
92 \title Image Elements: Border Image Example
93 \example declarative/imageelements/borderimage
94
95 These examples show how to use the BorderImage element.
96
97 \table
98 \row
99 \o \image qml-borderimage-example.png
100 \row
101 \o borderimage.qml
102 \endtable
103
104 \table
105 \row
106 \o \image qml-borderimage-shadows-example.png
107 \row
108 \o shadows.qml
109 \endtable
110*/
111
112/*!
113 \title Image Elements: Image Example
114 \example declarative/imageelements/image
115
116 This example shows how to use the \l Image element and its \l{Image::fillMode}{fillModes}.
117
118 \image qml-image-example.png
119*/
120
121/*!
122 \page declarative-cppextensions-reference.html
123 \title C++ Extensions: Reference examples
124
125 These examples show how QML can be extended from C++ in various ways.
126
127 The code for these examples is used throughout the \l {Extending QML in C++} reference
128 documentation, which highlights the main principles demonstrated in each example.
129
130 Furthermore, here are additional pages that discuss each example in detail:
131
132 \list
133 \o \l {declarative/cppextensions/referenceexamples/adding}{Adding Types}
134 \o \l {declarative/cppextensions/referenceexamples/properties}{Object and List Property Types}
135 \o \l {declarative/cppextensions/referenceexamples/coercion}{Inheritance and Coercion}
136 \o \l {declarative/cppextensions/referenceexamples/default}{Default Property}
137 \o \l {declarative/cppextensions/referenceexamples/grouped}{Grouped Properties}
138 \o \l {declarative/cppextensions/referenceexamples/attached}{Attached Properties}
139 \o \l {declarative/cppextensions/referenceexamples/signal}{Signal Support}
140 \o \l {declarative/cppextensions/referenceexamples/methods}{Methods Support}
141 \o \l {declarative/cppextensions/referenceexamples/valuesource}{Property Value Source}
142 \o \l {declarative/cppextensions/referenceexamples/binding}{Binding}
143 \endlist
144
145 \note These examples all print information to the console to demonstrate the concepts presented.
146 Ensure that you are able to view the application output when running these examples.
147 For example, the dbgView tool on Windows can be used to display application output.
148*/
149
150/*!
151 \title C++ Extensions: Plugins Example
152 \example declarative/cppextensions/plugins
153
154 This example shows how to create a C++ plugin extension by subclassing QDeclarativeExtensionPlugin.
155
156 \image qml-plugins-example.png
157*/
158
159/*!
160 \title LayoutItem Example
161 \example declarative/cppextensions/qgraphicslayouts/layoutitem
162
163 This example show how to use the LayoutItem element to integrate QML items into an existing
164 \l{Graphics View Framework}{Graphics View}-based application.
165
166 \image qml-layoutitem-example.png
167*/
168/*!
169 \title QGraphicsGridLayout Example
170 \example declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout
171
172 This example shows how to use QGraphicsGridLayout to lay out QML items. This is
173 useful if you need to integrate Qt \l{Graphics View Framework}{Graphics View} layouts with
174 QML.
175
176 \image qml-qgraphicsgridlayout-example.png
177*/
178/*!
179 \title QGraphicsLinearLayout Example
180 \example declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout
181
182 This example shows how to use QGraphicsLinearLayout to lay out QML items. This is
183 useful if you need to integrate Qt \l{Graphics View Framework}{Graphics View} layouts with
184 QML.
185
186 \image qml-qgraphicslinearlayout-example.png
187*/
188/*!
189 \title C++ Extensions: QGraphicsLayouts examples
190 \page declarative-cppextensions-qgraphicslayouts.html
191
192 These examples show how to integrate \l{Graphics View Framework}{Graphics View}
193 layout components with QML:
194
195 \list
196 \o \l{declarative/cppextensions/qgraphicslayouts/layoutitem}{LayoutItem}
197 \o \l{declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout}{QGraphicsGridLayout}
198 \o \l{declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout}{QGraphicsLinearLayout}
199 \endlist
200
201 Also see \l {Integrating QML with existing Qt UI code} for information on using QML
202 in Qt applications that use the Graphics View framework or ordinary QWidget-based views.
203*/
204
205/*!
206 \title C++ Extensions: QWidgets Example
207 \example declarative/cppextensions/qwidgets
208
209 This example shows how to embed QWidget-based objects into QML using QGraphicsProxyWidget.
210
211 \image qml-qwidgets-example.png
212*/
213
214/*!
215 \title C++ Extensions: Image Provider Example
216 \example declarative/cppextensions/imageprovider
217
218 This examples shows how to use QDeclarativeImageProvider to serve images
219 to QML image elements.
220
221 \image qml-imageprovider-example.png
222*/
223
224/*!
225 \title C++ Extensions: Network Access Manager Factory Example
226 \example declarative/cppextensions/networkaccessmanagerfactory
227
228 This example shows how to use QDeclarativeNetworkAccessManagerFactory to create a QNetworkAccessManager
229 with a proxy.
230*/
231
232/*!
233 \title Internationalization Example
234 \example declarative/i18n
235
236 This example shows how to enable text translation in QML.
237
238 \image qml-i18n-example.png
239
240 \section1 Introduction
241
242 The QML runtime automatically loads a translation from the i18n subdirectory
243 of the root QML file, based on the system language. The translations are
244 held in QM files that must be generated from TS files.
245
246 \section1 Updating Translations
247
248 The \c{.ts} files are created and updated by running:
249
250 \code
251 lupdate i18n.qml -ts i18n/base.ts
252 \endcode
253
254 If no translation file exists, one will be created. If a file already exists,
255 it will be updated to contain the latest strings from the QML file.
256
257 Translations for new languages are created by copying \c{i18n/base.ts} to
258 \c{i18n/qml_<lang>.ts} The TS files can then be edited with
259 \l{Qt Linguist Manual}{Qt Linguist}:
260
261 \code
262 linguist i18n/qml_fr.ts
263 \endcode
264
265 The run-time translation files are then generated by running:
266
267 \code
268 lrelease i18n/*.ts
269 \endcode
270*/
271
272/*!
273 \title Positioners Example
274 \example declarative/positioners
275
276 This example shows how to use positioner elements such as \l Row, \l Column,
277 \l Grid and \l Flow.
278
279 \image qml-positioners-example.png
280*/
281
282/*!
283 \title Key Interaction: Focus Example
284 \example declarative/keyinteraction/focus
285
286 This example shows how to handle keyboard input and focus in QML.
287
288 \image qml-focus-example.png
289*/
290
291/*!
292 \title Models and Views: AbstractItemModel Example
293 \example declarative/modelviews/abstractitemmodel
294
295 This example shows how to use a QAbstractItemModel subclass as a model in QML.
296
297 \image qml-abstractitemmodel-example.png
298*/
299
300/*!
301 \title Models and Views: GridView Example
302 \example declarative/modelviews/gridview
303
304 This example shows how to use the GridView element.
305
306 \image qml-gridview-example.png
307*/
308
309/*!
310 \title Models and Views: ListView Example
311 \example declarative/modelviews/listview
312
313 These examples show how to use the ListView element.
314
315 \table
316 \row
317 \o \image qml-listview-dynamiclist-example.png
318 \row
319 \o dynamiclist.qml
320 \endtable
321
322 \table
323 \row
324 \o \image qml-listview-expandingdelegates-example.png
325 \row
326 \o expandingdelegates.qml
327 \endtable
328
329 \table
330 \row
331 \o \image qml-listview-highlight-example.png
332 \row
333 \o highlight.qml
334 \endtable
335
336 \table
337 \row
338 \o \image qml-listview-highlightranges-example.png
339 \row
340 \o highlightranges.qml
341 \endtable
342
343 \table
344 \row
345 \o \image qml-listview-sections-example.png
346 \row
347 \o sections.qml
348 \endtable
349*/
350
351/*!
352 \title Models and Views: PathView Example
353 \example declarative/modelviews/pathview
354
355 This example shows how to use the PathView element.
356
357 \image qml-pathview-example.png
358*/
359
360/*!
361 \title Models and Views: Object ListModel Example
362 \example declarative/modelviews/objectlistmodel
363
364 This example shows how to use a QList<QObject*> as a model in QML.
365
366 \image qml-objectlistmodel-example.png
367*/
368
369/*!
370 \title Models and Views: Package Example
371 \example declarative/modelviews/package
372
373 This example shows how to use the \l Package element.
374
375 \image qml-package-example.png
376*/
377
378/*!
379 \title Models and Views: Parallax Example
380 \example declarative/modelviews/parallax
381
382 This example shows how to combine and switch between views.
383
384 \image qml-parallax-example.png
385*/
386
387/*!
388 \title Models and Views: String ListModel Example
389 \example declarative/modelviews/stringlistmodel
390
391 This example shows how to use a QStringList as a model in QML.
392
393 \image qml-stringlistmodel-example.png
394*/
395
396/*!
397 \title Models and Views: VisualItemModel Example
398 \example declarative/modelviews/visualitemmodel
399
400 This example shows how to use the VisualItemModel element.
401
402 \image qml-visualitemmodel-example.png
403*/
404
405/*!
406 \title Models and Views: WebView Example
407 \example declarative/modelviews/webview
408
409 These examples show how to use the WebView element.
410
411 \table
412 \row
413 \o \image qml-webview-alert-example.png
414 \row
415 \o alert.qml
416 \endtable
417
418 \table
419 \row
420 \o \image qml-webview-autosize-example.png
421 \row
422 \o autosize.qml
423 \endtable
424
425 \table
426 \row
427 \o \image qml-webview-googlemaps-example.png
428 \row
429 \o googlemaps.qml
430 \endtable
431
432 \table
433 \row
434 \o \image qml-webview-inlinehtml-example.png
435 \row
436 \o inlinehtml.qml
437 \endtable
438
439 \table
440 \row
441 \o \image qml-webview-newwindows-example.png
442 \row
443 \o newwindows.qml
444 \endtable
445*/
446
447
448/*!
449 \title Screen orientation
450 \example declarative/screenorientation
451
452 This example shows how to implement screen orientation support for your application.
453*/
454
455/*!
456 \title SQL Local Storage Example
457 \example declarative/sqllocalstorage
458
459 This example shows how to use the SQL Local Storage API in QML.
460*/
461
462/*!
463 \title Text: Fonts Example
464 \example declarative/text/fonts
465
466 These examples show how to discover available fonts from QML and manipulate
467 text in various ways.
468
469 \table
470 \row
471 \o \image qml-fonts-availableFonts-example.png
472 \row
473 \o availableFonts.qml
474 \endtable
475
476 \table
477 \row
478 \o \image qml-fonts-banner-example.png
479 \row
480 \o banner.qml
481 \endtable
482
483 \table
484 \row
485 \o \image qml-fonts-fonts-example.png
486 \row
487 \o fonts.qml
488 \endtable
489
490 \table
491 \row
492 \o \image qml-fonts-hello-example.png
493 \row
494 \o hello.qml
495 \endtable
496*/
497
498/*!
499 \title Text: Text Selection Example
500 \example declarative/text/textselection
501
502 This example shows how text selection, copy and paste operations
503 can be implemented on top of the TextEdit element.
504
505 \image qml-textselection-example.png
506*/
507
508/*!
509 \title Threading: Threaded ListModel Example
510 \example declarative/threading/threadedlistmodel
511
512 This example shows how to use a ListModel from multiple threads using
513 WorkerScript.
514*/
515
516/*!
517 \title Threading: WorkerScript Example
518 \example declarative/threading/workerscript
519
520 This example shows how to use the WorkerScript element for threading in QML.
521*/
522
523/*!
524 \title Toys: Clocks Example
525 \example declarative/toys/clocks
526
527 This example displays a set of clocks with different times for different cities.
528 Each clock is created by combining \l Image elements with \l Rotation transforms
529 and \l SpringAnimation behaviors.
530
531 \image qml-clocks-example.png
532*/
533
534/*!
535 \title Toys: Corkboards Example
536 \example declarative/toys/corkboards
537
538 This example presents a flickable set of interactive corkboards. It is created
539 through a combination of elements like \l ListModel, \l Repeater and \l TextEdit
540 together with rotation and scaling transforms, animation and mouse interaction.
541
542 \image qml-corkboards-example.png
543*/
544
545/*!
546 \title Toys: Dynamic Scene Example
547 \example declarative/toys/dynamicscene
548
549 This example presents an interactive drag-and-drop scene. It demonstrates
550 how to use QML's \l{Dynamic Object Creation} support to dynamically create and
551 destroy objects.
552
553 \image qml-dynamicscene-example.png
554*/
555
556/*!
557 \title Toys: Tic-Tac-Toe Example
558 \example declarative/toys/tic-tac-toe
559
560 This example presents a simple implementation of Tic Tac Toe.
561
562 \image qml-tic-tac-toe-example.png
563*/
564
565/*!
566 \title Toys: TV Tennis Example
567 \example declarative/toys/tvtennis
568
569 This example shows how to use animation components such as \l SpringAnimation,
570 \l SequentialAnimation and \l PropertyAction to create a game of TV tennis.
571
572 \image qml-tvtennis-example.png
573*/
574
575/*!
576 \title Touch Interaction: Gestures Example
577 \example declarative/touchinteraction/gestures
578
579 This example shows how to use the GestureArea element.
580*/
581
582/*!
583 \title Touch Interaction: MouseArea Example
584 \example declarative/touchinteraction/mousearea
585
586 This example shows how to use the MouseArea element to access information
587 about mouse input.
588
589 \image qml-mousearea-example.png
590*/
591
592/*!
593 \title UI Components: Dial Control Example
594 \example declarative/ui-components/dialcontrol
595
596 This example shows how to create a dial-type control. It combines
597 \l Image elements with \l Rotation transforms and \l SpringAnimation behaviors
598 to produce an interactive speedometer-type dial.
599
600 \image qml-dialcontrol-example.png
601*/
602
603
604/*!
605 \title UI Components: Flipable Example
606 \example declarative/ui-components/flipable
607
608 This example shows how to use the \l Flipable element.
609
610 \image qml-flipable-example.png
611*/
612
613/*!
614 \title UI Components: Progress Bars Example
615 \example declarative/ui-components/progressbar
616
617 This example shows how to create a progress bar.
618
619 \image qml-progressbar-example.png
620*/
621
622/*!
623 \title UI Components: Scroll Bar Example
624 \example declarative/ui-components/scrollbar
625
626 This example shows how to create scroll bars for a \l Flickable element
627 using the \l {Flickable::visibleArea.xPosition}{Flickable::visibleArea}
628 properties.
629
630 \image qml-scrollbar-example.png
631*/
632
633/*!
634 \title UI Components: Search Box Example
635 \example declarative/ui-components/searchbox
636
637 This example shows how to combine TextInput, FocusScope and BorderImage
638 elements to display multiple text input fields.
639
640 \image qml-searchbox-example.png
641*/
642
643/*!
644 \title UI Components: Slide Switch Example
645 \example declarative/ui-components/slideswitch
646
647 This example shows how to create a slide switch control.
648
649 \image qml-slideswitch-example.png
650*/
651
652/*!
653 \title UI Components: Spinner Example
654 \example declarative/ui-components/spinner
655
656 This example shows how to create a spinner-type component using the PathView element.
657
658 \image qml-spinner-example.png
659*/
660
661/*!
662 \title UI Components: Tab Widget Example
663 \example declarative/ui-components/tabwidget
664
665 This example shows how to create a tab widget. It also demonstrates how
666 \l {Property aliases}{property aliases} and
667 \l {Default Properties}{default properties} can be used to collect and
668 assemble the child items declared within an \l Item.
669
670 \image qml-tabwidget-example.png
671*/
672
673/*!
674 \title XML: XMLHttpRequest Example
675 \example declarative/xml/xmlhttprequest
676
677 This example shows how to use the \l XmlHttpRequest API in QML.
678
679 \image qml-xmlhttprequest-example.png
680*/
Note: See TracBrowser for help on using the repository browser.