1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
|
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** GNU Free Documentation License
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms
** and conditions contained in a signed written agreement between you
** and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qt4-intro.html
\title What's New in Qt 4
\startpage index.html Qt Reference Documentation
\nextpage The Tulip Container Classes
This document covers the most important differences between Qt 3
and Qt 4. Although it is not intended to be a comprehensive
porting guide, it tells you about the most important portability
issues that you may encounter. It also explains how to turn on Qt
3 compatibility support.
\section1 New Technologies in Qt 4
Qt 4 introduces the following core technologies:
\list
\o \l{The Tulip Container Classes}{Tulip}, a new set of template container classes.
\o \l{The Interview Framework}{Interview}, a model/view architecture for item views.
\o \l{The Arthur Paint System}{Arthur}, the Qt 4 painting framework.
\o \l{The Scribe Classes}{Scribe}, the Unicode text renderer with a public API
for performing low-level text layout.
\o \l{The Qt 4 Main Window Classes}{Mainwindow}, a modern action-based
mainwindow, toolbar, menu, and docking architecture.
\o The new \l{The New Qt Designer}{\QD} user interface design tool.
\endlist
\section1 Recent Additions to Qt 4
The following features have been added to Qt since the first release of Qt 4.
In Qt 4.8:
\list
\o \l{Qt Quick} 1.1 offers changes to the \l{QML Elements} and performance
upgrades
\
\endlist
In Qt 4.7:
\list
\o Declarative UI Development with \l{Qt Quick}, technologies for creating
fluid, dynamic user interfaces.
\o Support for \l{Bearer Management}{network bearer management}, enabling
features such as control over network interfaces and support for roaming
between networks.
\o Feature and performance improvements in QtWebKit, including a new tiled
backing store, control over scroll bars used in frames and framesets,
accelerated compositing and \l{The QtWebKit Bridge}{support for hybrid
development}.
\o General performance improvements, including the use of "alien widgets"
on Mac OS X, the QStaticText class for optimized text rendering, a new
\l{QPainter::drawPixmapFragments()}{API for rendering pixmap fragments}
and an updated version of the JavaScriptCore engine for the QtScript
module with improved performance.
\endlist
In Qt 4.6:
\list
\o Support for \l{The Symbian platform - Introduction to Qt}{the Symbian Platform}
as a mainstream Qt platform, with integration into the S60 framework.
\o The \l{The Animation Framework}{animation framework} allows animations to be
created using both widgets and graphics items.
\o The \l{The State Machine Framework}{state machine framework} provides a robust
state chart implementation based on Harel statecharts and SCXML.
\o Support for \l{QTouchEvent}{touch input} and \l{Gestures Programming}{gestures}
enable developers to create intuitive user interfaces for touch-based devices.
\o A \l{QWebElement}{DOM access API} for QtWebKit provides a cleaner and safer way
to access elements and structures of Web pages without the use of JavaScript.
\o A collection of performance improvements, covering QGraphicsView, QPixmapCache,
QNetworkAccessManager, QContiguousCache class, hardware-accelerated rendering
support through \l{OpenVG Rendering in Qt}{OpenVG}, and the removal of Win9x
support.
\o A collection of \l{QGraphicsEffect}{graphics effects} make it easy to apply
and simple effects to graphics items and combine them to produce more complex
effects.
\o Support for XML schema validation in the QtXmlPatterns module covering
large parts of version 1.0 of the specification.
\o Qt3D enablers, including math primitives for \l{QMatrix4x4}{matrix multiplication},
\l{QVector3D}{vectors}, \l{QQuaternion}{quaternions} (client-side), and an API
for \l{QGLShader}{vertex and fragment shaders}, GLSL/ES.
\o \l{QtMultimedia Module}{Multimedia services} providing low-level access to the
system's audio system.
\endlist
In Qt 4.5:
\list
\o The WebKit browser engine included with Qt has been
upgraded to the latest upstream (trunk) version of WebKit,
bringing the latest features and improvements to Qt applications.
\o Qt for Mac OS X has been substantially rewritten to use
Apple's Cocoa API, enabling Qt applications to be deployed on
64-bit Macintosh hardware.
\o The QtXmlPatterns module has been extended to cover XSLT, a
transformation language for XML documents.
\o Qt Script introduced its debugger,
providing error reporting for scripts, and to let users track down
bugs in their own scripts.
\o Qt 4.5 includes support for writing rich text documents as
OpenDocument files via the newly-introduced QTextDocumentWriter
class.
\o Qt Linguist can load and edit multiple translation
files simultaneously.
\o Support for ARGB top-level widgets (i.e., translucent
windows).
\endlist
In Qt 4.4:
\list
\o \l{WebKit in Qt}{Qt WebKit integration}, making it possible for developers
to use a fully-featured Web browser to display documents and access online
services.
\o A multimedia API provided by the \l{Phonon Overview}{Phonon Multimedia Framework}.
\o \l{QtXmlPatterns Module}{XQuery and XPath} support, providing facilities for
XML processing beyond that supported by the QtXml module.
\o Support for embedded widgets in \l{Graphics View} scenes.
\o The \l{Thread Support in Qt}{QtConcurrent framework} for
concurrent programming using Qt paradigms and threading features.
\o An \l{QtHelp Module}{improved help system} that can be used in conjunction
with Qt Assistant or as an independent help resource manager.
\o Printing system improvements, including the QPrinterInfo, QPrintPreviewWidget
and QPrintPreviewDialog classes.
\o Support for \l{Windows CE - Introduction to using Qt}{Qt for Windows CE} as
a mainstream Qt platform.
\o Improvements in performance of Qt for Embedded Linux and extended support for
display hardware.
\endlist
In Qt 4.3:
\list
\o Support for different \l{The Qt 4 Main Window Classes}{main window paradigms and styles},
such as those found in Visual Studio or KDevelop.
\o The \l{QtScript} module, providing support for application scripting with ECMAScript.
\o Improved graphics features, including an experimental Direct3D paint engine
and improved provision for hardware accelerated rendering with OpenGL, and
support for OpenGL ES in Qt for Embedded Linux.
\o \l{QSvgGenerator}{Scalable Vector Graphics (SVG) export}, allowing SVG drawings to
be created using the standard QPainter API.
\o Support for arbitrary matrix transformations and set operations on painter paths.
\o Native look and feel on Windows Vista; improved look and feel on Mac OS X.
\o An improved \l{QMdiArea}{Multiple Document Interface (MDI)} implementation.
\o Continuous improvements to \QD, including support for
\l{Qt Designer's Widget Editing Mode#The Property Editor}{dynamic properties}.
\o Support for Secure Socket Layer (SSL) communications via the QSslSocket class.
\o Support for XML Localization Interchange File Format (XLIFF) files in \QL.
\o A new font subsystem for Qt for Embedded Linux.
\endlist
In Qt 4.2:
\list
\o The \l{Graphics View} framework for producing interactive graphics.
\o \l{Desktop Integration}{Desktop integration} facilities for applications.
\o \l{Qt Style Sheets} enable easy, yet powerful customization of
user interfaces.
\o Support for the \l{intro-to-dbus.html}{D-Bus} Inter-Process Communication (IPC) and Remote Procedure Calling (RPC) mechanism.
\o An \l{Undo Framework}{Undo framework} based on the
\l{Books about GUI Design#Design Patterns}{Command pattern}.
\o Support for model-based \l{QCompleter}{text completion} in standard and
custom widgets.
\o New widgets and GUI features, such as QCalendarWidget and
QGLFramebufferObject.
\o Classes to provide higher level application infrastructure, such as
QFileSystemWatcher and QDataWidgetMapper.
\endlist
In Qt 4.1:
\list
\o Integrated support for rendering
\l{The Arthur Paint System#SVG Rendering Support}{Scalable Vector Graphics}
(SVG) drawings and animations.
\o Support for
\l{QWidget#Transparency and Double Buffering}{child widget transparency}
on all platforms.
\o A Portable Document Format (PDF) backend for Qt's printing system.
\o A \l{QTestLib Manual}{unit testing framework} for Qt applications and
libraries.
\o Modules for \l{QtDesigner}{extending \QD} and
\l{QtUiTools}{dynamic user interface building}.
\o New \l{Proxy Models}{proxy models} to enable view-specific sorting and
filtering of data displayed using item views.
\o Support for \l{Installing Qt for Mac OS X}{universal binaries} on Mac OS X.
\o Additional features for developers using \l{QtOpenGL}{OpenGL}, such as
support for pixel and sample buffers.
\o A flexible \l{QSyntaxHighlighter}{syntax highlighting class} based on the
\l{Scribe} rich text framework.
\o Support for \l{QNetworkProxy}{network proxy} servers using the SOCKS5
protocol.
\o Support for OLE verbs and MIME data handling in \l{ActiveQt}.
\endlist
For more information about improvements in each Qt release, see
the \l{http://qt.nokia.com/developer/changes/}
{detailed lists of changes}.
\section1 Significant Improvements
The following modules have been significantly improved for Qt 4:
\list
\o A fully cross-platform \l{accessibility}
module, with support for the emerging SP-API Unix standard in
addition to Microsoft and Mac Accessibility.
\o The \l{qt4-sql.html}{SQL module}, which is now based on the
Interview model/view framework.
\o The \l{qt4-network.html}{network module}, with better support
for UDP and synchronous sockets.
\o The \l{qt4-styles.html}{style API}, which is now decoupled from
the widgets, meaning that you can draw any user interface element on
any device (widget, pixmap, etc.).
\o Enhanced \l{qt4-threads.html}{thread support}, with signal-slot
connections across threads and per-thread event loops.
\o A new \l{resource system} for embedding images
and other resource files into the application executable.
\endlist
\section1 Build System
Unlike previous Qt releases, Qt 4 is a collection of smaller
libraries. A complete list of libraries in the current release
of Qt can be found on the \l{All Modules} page. The following
table describes the initial set of libraries released with Qt 4.
\table
\header \o Library \o Description
\row \o \l{QtCore} \o Core non-GUI functionality
\row \o \l{QtGui} \o Core GUI functionality
\row \o \l{QtNetwork} \o Network module
\row \o \l{QtOpenGL} \o OpenGL module
\row \o \l{QtSql} \o SQL module
\row \o \l{QtSvg} \o SVG rendering classes
\row \o \l{QtXml} \o XML module
\row \o \l{Qt3Support} \o Qt 3 support classes
\row \o \l{QAxContainer} \o ActiveQt client extension
\row \o \l{QAxServer} \o ActiveQt server extension
\row \o \l{QtHelp} \o Classes for integrating online documentation
\row \o \l{QtDesigner} \o Classes for extending and embedding Qt Designer
\row \o \l{QtUiTools} \o Classes for dynamic GUI generation
\row \o \l{QtTest} \o Tool classes for unit testing
\endtable
QtCore contains tool classes like QString, QList, and QFile, as
well as kernel classes like QObject and QTimer. The QApplication
class has been refactored so that it can be used in non-GUI
applications. It is split into QCoreApplication (in \l QtCore)
and QApplication (in \l QtGui).
This split makes it possible to develop server applications using Qt
without linking in any unnecessary GUI-related code and without
requiring GUI-related system libraries to be present on the target
machine (e.g. Xlib on X11, Carbon on Mac OS X).
If you use qmake to generate your makefiles, qmake will by default
link your application against QtCore and QtGui. To remove the
dependency upon QtGui, add the line
\snippet doc/src/snippets/code/doc_src_qt4-intro.pro 0
to your .pro file. To enable the other libraries, add the line
\snippet doc/src/snippets/code/doc_src_qt4-intro.pro 1
Another change to the build system is that moc now understands
preprocessor directives. qmake automatically passes the defines set
for your project (using "DEFINES +=") on to moc, which has its own
built-in C++ preprocessor.
To compile code that uses UI files, you will also need this line in
the .pro file:
\snippet doc/src/snippets/code/doc_src_qt4-intro.pro 2
\section1 Include Syntax
The syntax for including Qt class definitions has become
\snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 3
For example:
\snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 4
This is guaranteed to work for any public Qt class. The old syntax,
\snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 5
still works, but we encourage you to switch to the new syntax.
If you attempt to include a header file from a library that isn't
linked against the application, this will result in a
compile-time warning (e.g., "QSqlQuery: No such file or
directory"). You can remedy to this problem either by removing
the offending include or by specifying the missing library in the
QT entry of your \c .pro file (see \l{Build System} above).
To include the definitions for all the classes in a library, simply
specify the name of that library. For example:
\snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 6
\section1 Namespaces
Qt 2 introduced a class called Qt for global-like constants
(e.g., \c{Qt::yellow}). The C++ namespace construct was not used
because not all compilers understood it when it was released.
With Qt 4, the Qt class has become the Qt namespace. If you want
to access a constant that is part of the Qt namespace, prefix it
with \c{Qt::} (e.g., \c{Qt::yellow}), or add the directive
\snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 7
at the top of your source files, after your \c #include
directives. If you use the \c{using namespace} syntax you don't
need the prefix (e.g., \c yellow is sufficient).
When porting Qt 3 applications, you may run into some source
compatibility problems with some of these symbols. For example,
in Qt 3, it was legal to write \c QWidget::yellow instead of \c
Qt::yellow, because QWidget inherited from Qt. This won't work in
Qt 4; you must write \c Qt::yellow or add the "using namespace"
directive and drop the \c{Qt::} prefix.
The \l{qt3to4 - The Qt 3 to 4 Porting Tool}{qt3to4} porting tool
automates this conversion.
\section1 QObject/QWidget Constructors
In Qt 4 we have tried to simplify the constructors of QObject/QWidget
subclasses. This makes subclassing easier, at the same time as it
helps make the Qt library more efficient.
Constructors no longer take a "const char *name" parameter. If
you want to specify a name for a QObject, you must call
QObject::setObjectName() after construction. The object name is
now a QString. The reasons for this change are:
\list
\o Code that used it looked confusing, for example:
\snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 8
\c label1 is a QLabel that displays the text "Hello"; \c
label2 is a QLabel with no text, with the object name
"Hello".
\o From surveys we did, most users didn't use the name, although
they blindly followed Qt's convention and provided a "const
char *name" in their subclasses's constructors. For example:
\snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 9
\o The name parameter was in Qt since version 1, and it always
was documented as: "It is not very useful in the current
version of Qt, but it will become increasingly important in
the future." Ten years later, it still hasn't fulfilled its
promise.
\endlist
QWidget's \c WFlags data type has been split in two:
Qt::WindowFlags specifies low-level window flags (the type of
window and the frame style), whereas Qt::WidgetAttribute
specifies various higher-level attributes about the widget (e.g.,
WA_StaticContents). Widget attributes can be set at any time
using QWidget::setAttribute(); low-level window flags can be
passed to the QWidget constructor or set later using
QWidget::setParent(). As a consequence, the constructors of most
QWidget subclasses don't need to provide a \c WFlags parameter.
The \e parent parameter of all QObject classes in Qt defaults to
a 0 pointer, as it used to do in Qt 1. This enables a style of
programming where widgets are created without parents and then
inserted in a layout, at which point the layout automatically
reparents them.
\section1 Dynamic Casts
Qt 4 provides a qobject_cast<>() function that performs a dynamic cast
based on the meta-information generated by moc for QObject
subclasses. Unlike the standard C++ dynamic_cast<>() construct,
qobject_cast<>() works even when RTTI is disabled, and it works correctly
across DLL boundaries.
Here's the Qt 3 idiom to cast a type to a subtype:
\snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 10
The Qt 4 idiom is both cleaner and safer, because typos will always
result in compiler errors:
\snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 11
\section1 QPointer<T>
The QPointer<T> class provides a pointer to type T (where T inherits
from QObject) that is automatically set to 0 when the referenced
object is destroyed. Guarded pointers are useful whenever you want to
store a pointer to an object you do not own.
Example:
\snippet doc/src/snippets/code/doc_src_qt4-intro.cpp 12
QPointer<T> is more or less the same as the old QGuardedPtr<T> class,
except that it is now implemented in a much more lightweight manner
than before. The cost of one QPointer<T> object is now approximately
the same as that of a signal--slot connection.
\section1 Paint Events
Qt 4 supports double buffering transparently on all platforms. This
feature can be turned off on a per-widget basis by calling
QWidget::setAttribute(Qt::WA_PaintOnScreen).
A consequence of this is that all painting must now be done from the
paintEvent() function. This is also required by the HIView API on Mac
OS X. In practice, this is seldom a problem, since you can call
update() from anywhere in your code to create a paint event, with the
region to update as the argument.
To help porting, QWidget supports a Qt::WA_PaintOutsidePaintEvent
attribute that can be set to make it possible to paint outside
\l{QWidget::paintEvent()}{paintEvent()} on Windows and X11.
\section1 Qt 3 Support Layer
Qt 4 provides an extension library that applications based on Qt 3,
called Qt3Support, that Qt applications can link against. This allows
for more compatibility than ever before, without bloating Qt.
\list
\o Classes that have been replaced by a different class with the
same name, such as QListView, and classes that no longer exist in Qt 4
are available with a \c 3 in their name (e.g., Q3ListView, Q3Accel).
\o Other classes provide compatibility functions. Most of these are
implemented inline, so that they don't bloat the Qt libraries.
\endlist
To enable the Qt 3 support classes and functions, add the line
\snippet doc/src/snippets/code/doc_src_qt4-intro.pro 13
to your \c .pro file.
On Visual C++ 7 and GCC 3.2+, using compatibility functions often results
in a compiler warning (e.g., "'find' is deprecated"). If you want to turn
off that warning, add the line
\snippet doc/src/snippets/code/doc_src_qt4-intro.pro 14
to your \c .pro file.
If you want to use compatibility functions but don't want to link
against the Qt3Support library, add the line
\snippet doc/src/snippets/code/doc_src_qt4-intro.pro 15
or
\snippet doc/src/snippets/code/doc_src_qt4-intro.pro 16
to your \c .pro file, depending on whether you want compatibility
function calls to generate compiler warnings or not.
*/
/*!
\page qt4-8-intro.html
\title What's New in Qt 4.8
Qt 4.8 provides many improvements and enhancements over the previous
releases in the Qt 4 series. This document covers the most important
features in this release, separated by category.
A list of other Qt 4 features can be found on the \bold{\l{What's
New in Qt 4}} page.
\section1 Qt Quick 1.1
Qt Quick 1.1 introduces \l{What's New in Qt Quick}{new changes} such as
new properties and better performance.
\list
\o \l {QML Right-to-left User Interfaces}{Right-To-Left} text support
\o Improved image caching
\o Text input improvements - Support for split-screen virtual keyboard
\o \l PinchArea Element - enables simple pinch gesture handling
\o New properties for \l{QML Elements}.
\endlist
\section1 Qt Platform Abstraction -- \e Lighthouse
\e QPA allows porting Qt to different windowing systems and devices
easier. It provides a clean abstraction layer for porting QtGui to new
window systems.
\section1 Qt WebKit 2.2
The new Qt WebKit release introduces bug fixes, performance improvements,
and greater compiler compatibility.
\section1 Threaded OpenGL
Many Qt OpenGL functions are now thread-safe. Threads that cater to
different situations are now available.
\list
\o Buffer swapping thread
\o Texture uploading thread
\o \l QPainter thread
\endlist
\section1 Deprecated Items in Qt 4.8
As part of Open Governance, modules in Qt 4.8 will receive maintainers and
receive different support levels.
Currently, a module has an activity classification, the \e{Module Maturity Level}.
As well, a list of modules and their maturity level is in the \l{Qt Developer Network}.
\list
\o \l{Qt Modules' Maturity Level - Description} - description of the
different \e{maturity levels}
\o \l{Qt Modules' Maturity Levels - Modules List} - list of the Qt
modules and their maturity level
\endlist
\section1 Additions to the Qt API
Qt 4.8 introduces changes to the Qt API.
\list
\o C++11 support:
Qt supports some of the features of the C++11 standard. QList, QVector and
QStringList can be initialized with initializer lists. Most of the tool
classes have a move operator. It is possible to use lambda functions in some
of the QtConcurrent functions.
\o Localization API
Changes to the Localization APIs include improvements to \l QLocale and more
support for different language code formats.
\list
\o \l {QLocale::quoteString()} - for localized quotes
\o \l {QLocale::createSeparatedList()} - for localized list separation (e.g. "1, 2 and 3")
\o \l {QLocale::bcp47Name()} - for locale names in the canonical form
according to \l {RFC 5646 - BCP47}
\o \l {QLocale::matchingLocales()} - to get a list of locales that match a
criteria - e.g. a list of locales that use French language.
\o \l {QLocale::firstDayOfWeek()}
\o \l {QLocale::weekdays()}
\o \l{QLocale::currencySymbol()}
\o \l{QLocale::toCurrencyString()} - number formatting for currencies
\o \l{QLocale::uiLanguages()}
\o \l{QLocale::nativeLanguageName()}
\o \l{QLocale::nativeCountryName()}
\endlist
\o IP Multicast API
\o Multithreaded HTTP
\o QThreadLocalStorage can now store simple objects in addition to pointers
\endlist
\section1 New Classes, Functions, Macros, etc.
\sincelist 4.8
*/
/*!
\page qt4-7-intro.html
\title What's New in Qt 4.7
Qt 4.7 provides many improvements and enhancements over the
previous releases in the Qt 4 series. This document covers the
most important features in this release, separated by category.
A list of other Qt 4 features can be found on the \bold{\l{What's
New in Qt 4}} page.
\section1 Declarative UI Development with Qt Quick
\image quick_screens.png
Qt 4.7 introduces \l{Qt Quick}, the Qt UI Creation Kit. that enables
the creation of dynamic user interfaces, easier and more effective
than possible with existing UI technologies. This UI Creation Kit
consists of three technologies:
\list
\i QML is a declarative language oriented on JavaScript that utilizes
Qt's Meta-Object capabilities to enable designers and developers to
collaborate tightly and create animated and fluid user experiences,
using existing knowledge in script language and design.
\i Qt Declarative is a C++ library that provides the underlying engine,
which translates the declarative description of the UI in QML into
items on a QGraphicsScene. The library also provides APIs to bind
custom C++ types and elements to QML, and to connect the QML UI with
the underlying application logic written in C++.
\i Qt Creator has been improved to support interactive editing of
QML UIs through drag-and-drop. The text editor supports the QML
syntax and provides authoring assistance such as auto-completion,
error lookup, help lookup and easy preview of QML UI's. The Qt
Quick features in Qt Creator will be released with Qt Creator 2.1
\endlist
\section1 Network Bearer Management
Bearer Management controls the connectivity state of the system.
The new Bearer Management API in the QtNetwork module allows the
application to identify whether the system is online and how many
interfaces there are, as well as start and stop interfaces, or
roam transparently between access points.
QNetworkAccessManager uses this API for HTTP level roaming.
\section1 Feature Improvements in QtWebKit
The QGraphicsWebView class has a new tiled backing store, which
improves scrolling and zooming performance. You can even create
animated zoom-in or zoom-out effects (see
QWebSettings::TiledBackingStoreEnabled).
On mobile platforms, it is often useful to avoid displaying
separate scrollbars for iframes and framesets. If you switch on
frame flattening, QtWebKit will resize frames to fit their content
to avoid separate scrollbars (see
QWebSettings::FrameFlatteningEnabled).
Qt 4.7 adds support for accelerated compositing, which enhances
the performance of CSS animations and transitions. Read more in
\l{http://labs.trolltech.com/blogs/2010/05/17/qtwebkit-now-accelerates-css-animations-3d-transforms/}{this blog}.
For hybrid QtWebKit and C++ projects, Qt 4.7 has added support for
transporting \l{QPixmap}s between Qt C++ and WebKit. We have also
improved the documentation for hybrid development. Read more here:
\l{The QtWebKit Bridge}.
\section1 QtWebKit Performance Benchmarks
We have introduced a set of performance benchmarks for QtWebKit,
and made numerous improvements in rendering performance, page
loading performance, scrolling performance and CSS performance.
Here are some examples from the benchmarks run on a 64-bit Linux
workstation with the raster graphics system.
In a benchmark that measures the scrolling performance on popular
websites, we found out that Qt 4.7.0 on this platform is 350%
faster than Qt 4.6.0, thanks to several rendering related
improvements.
Our page loading benchmark shows an improvement of 16% in Qt 4.7.0
from Qt 4.6.0. This is due to improvements in text layout speed,
image decoding, resource loading and event handling.
Several CSS animation benchmarks indicate a speed improvement of
31% from Qt 4.6.0 to Qt 4.7.0. These benchmarks are effectively
showing the improvement we get from accelerated compositing (see
above).
\section1 Other Performance Related Improvements
In addition to the QtWebKit module, performance has been a focus
area in Qt 4.7 throughout the Qt framework. Here are a couple of
examples about performance related feature improvements.
On Mac OS X, Qt now uses a different widget implementation (called
"alien widgets"), which improves the responsiveness of
applications that have complex user interfaces with several
widgets.
Qt 4.7 introduces the QStaticText class, which can be used to
improve text rendering performance. More info is available from
\l{http://labs.trolltech.com/blogs/2010/03/01/insanity-is-shaping-the-same-text-again-and-expecting-a-different-result/}{this blog}.
The QPainter class has a new API for rendering pixmap fragments
(QPainter::drawPixmapFragments), which can improve the rendering
performance of applications that need to render
\l{QPainter::drawPixmapFragments()}{pixmap fragments}.
Qt 4.7 has an updated version of the JavaScriptCore engine for the
QtScript module, which improves JavaScript execution performance.
\section1 New Classes, Functions, Macros, etc.
Links to new classes, elements, functions, macros, and other items
introduced in Qt 4.7.
\sincelist 4.7
*/
/*!
\page qt4-6-intro.html
\title What's New in Qt 4.6
Qt 4.6 provides many improvements and enhancements over the
previous releases in the Qt 4 series. This document covers the
most important features in this release, separated by category.
\omit
A comprehensive list of changes between Qt 4.5 and Qt 4.6 is
included in the \c changes-4.6.0 file
\l{http://qt.nokia.com/developer/changes/changes-4.6.0}{available
online}. A \l{Known Issues in %VERSION%}{list of known issues}
for this release is also available.
Changes between this release and the previous release are provided
in the \c{changes-%VERSION%} file (also
\l{http://qt.nokia.com/developer/changes/changes-%VERSION%}{available online}).
\endomit
A list of other Qt 4 features can be found on the \bold{\l{What's
New in Qt 4}} page.
\section1 Support for Symbian
Qt 4.6 is the first release to include support for the Symbian
platform, with integration into the S60 framework. The port to
Symbian and S60 provides all functionality required to develop
rich end-user applications for devices running S60 3.1 and
later.
See the \l{The Symbian platform - Introduction to Qt} for more information.
\section1 Animation Framework
The animation framework helps build highly animated,
high-performance GUIs without the hassle of managing complex
structures, timers, and easing curves, not to mention the large
state graphs that all animated GUIs tend to be full of.
The framework makes it easy to animate \l{QObject}s, including
QWidgets, by allowing Qt properties to be animated. It also allows
creating custom animations and interpolation functions. Graphics
views are not left out; one can animate \l{QGraphicsWidget}s and
new \l{QGraphicsObject}s which inherit from QGraphicsItem
(and thereby enable properties).
Animations are controlled using easing curves and can be grouped
together. This enables animations of arbitrary complexity.
The API is easy to grasp with functions such as start(), stop(),
pause(), and currentTime(). Here is an image from one of the
examples that come with the framework:
\image whatsnewanimatedtiles.png
The animation framework also plugs into the new Qt Statemachine by
allowing an animation to be played when transitions are triggered.
The state machine framework is introduced in 4.6 and is described
below.
See \l{The Animation Framework} documentation for more information.
\section1 State Machine Framework
The state machine framework provides a robust state chart
implementation based on Harel statecharts and SCXML. Qt's API lets
you construct such state graphs and execute them. The key benefits
of a state machine are:
\list
\o Simplify complex application semantics.
\o Use of states to reduce code bloat.
\o Use states to improve maintainability.
\o Makes event-driven programming robust and more
reusable.
\endlist
It is especially the last item here that makes using a state
machine worthwhile. A key characteristic of event-driven systems
(such as Qt applications) is that behavior often depends not only
on the last or current event, but also the events that preceded
it. With statecharts, this information is easy to express.
The framework fits neatly into Qt by allowing transitions to
trigger on signals and \l{QEvent}s. By inserting animations into
the state machine, it is also easier to use the framework for
animating GUIs, for instance.
See \l{The State Machine Framework} documentation for more information.
\section1 Touch and Gestures
Support for touch input enables users to interact with many
parts of a user interface at the same time, and provides the basis
for gestures. Additional infrastructure for gesture recognition
allows a sequence of touch inputs to be combined to create gestures
that can be used to activate features and trigger actions in an
application.
\image gestures.png
This new functionality brings a number of benefits:
\list
\o Allows users to interact with applications in more natural ways.
\o Simplifies finger-based interaction with UI components.
\o Combines support for common basic gestures and touch gestures
in a single general framework.
\o Enables extensibility by design.
\endlist
See the QTouchEvent class documentation for more information on touch
input and QGestureEvent for gestures.
\section1 DOM Access API
Web pages and XML both have very complex document object models.
The W3C selector API provides a very simple way to access and
manipulate such structures. This API makes it intuitive to access
DOM, helps reuse CSS selector knowledge, and gives little
maintenance or footprint overhead.
\snippet webkitsnippets/webelement/main.cpp FindAll
See the QWebElement class documentation for more information.
\section1 Performance Optimizations
As always, Qt continuously strive to optimize its performance.
For this release, we have:
\list
\o Rewritten the QGraphicsView rendering algorithm.
\o Made QPixmapCache support efficient Key data structure.
\o Reduced overhead in QNetworkAccessManager.
\o Added the QContiguousCache class, which provides efficient caching of
contiguous data.
\o Added support for hardware-accelerated rendering through
\l{OpenVG Rendering in Qt}{OpenVG}
\o Removed Win9x support.
\endlist
\section1 Graphics Effects
Effects can be used to alter the appearance of UI elements such as
\l{QGraphicsItem}s and \l{QWidget}s. A couple of standard effects such
as blurring, colorizing and drop shadow are provided, and it is
possible to implement custom effects.
\table
\row
\o{2,1} \img graphicseffect-plain.png
\row
\o \img graphicseffect-blur.png
\o \img graphicseffect-colorize.png
\row
\o \img graphicseffect-opacity.png
\o \img graphicseffect-drop-shadow.png
\endtable
See the QGraphicsEffect class documentation for more information.
\section1 XML Schema Validation
The QtXmlPatterns module can now be used to validate schemas, either
through C++ APIs in the Qt application, or using the xmlpatternsvalidator
command line utility. The implementation of XML Schema Validation supports
the specification version 1.0 in large parts.
\img xml-schema.png
See the \l{XML Processing} and QXmlSchema class documentation for more
information.
\section1 Qt3D Enablers
As more of Qt, and more of the applications built on Qt go 3D,
API's should be provided to simplify this. Mainly, the new API
aims to make it more easy to create 3D applications with OpenGL.
It will also unify the Qt OpenGL codebase, and enable
cross-platform 3D codebase.
The main features of the Qt3D enablers are currently: Math
primitives for matrix multiplication, vectors, quaternions
(client-side), and an API for vertex and fragment shaders, GLSL/ES.
Future research will, among other things include stencils,
scissors, vertex buffers and arrays, texture manipulation, and
geometry shaders.
\section1 Multimedia Services
Qt 4.6 comes with new classes for handling audio. These classes
provide low-level access to the system's audio system. By
specifying the audio format (QAudioFormat) and supplying audio
data through a QIODevice, you get direct access to the
functionality of the sound device. The API also comes with
functions to query audio devices for which audio formats they
support.
See the \l{QtMultimedia Module} documentation for more information.
\section1 New Classes, Functions, Macros, etc.
Links to new classes, functions, macros, and other items
introduced in Qt 4.6.
\sincelist 4.6
*/
/*
\page qt4-5-intro.html
\title What's New in Qt 4.5
Qt 4.5 provides many improvements and enhancements over the previous releases
in the Qt 4 series. This document covers the most important features in this
release, separated by category.
A comprehensive list of changes between Qt 4.4 and Qt 4.5 is included
in the \c changes-4.5.0 file
\l{http://qt.nokia.com/developer/changes/changes-4.5.0}{available online}.
A \l{Known Issues in %VERSION%}{list of known issues} for this release is also
available.
Changes between this release and the previous release are provided
in the \c{changes-%VERSION%} file (also
\l{http://qt.nokia.com/developer/changes/changes-%VERSION%}{available online}).
A list of other Qt 4 features can be found on the
\bold{\l{What's New in Qt 4}} page.
\section1 Qt WebKit Integration
\image webkit-netscape-plugin.png
The WebKit browser engine included with Qt has been upgraded to the latest
upstream (trunk) version of WebKit, bringing the latest features and
improvements to Qt applications. These include:
\list
\o Support for full page zooming, with appropriate rescaling of images and fonts.
\o The CSS-based transformation and animation features provided by a WebKit
extension.
\o Performance improvements due to faster JavaScript engine and optimized
page loading.
\endlist
Standards compatibility improvements include provision for the Netscape plugin
API, allowing most Netscape plugins to be used in-process, support for HTML 5
audio and video elements using Qt's Phonon integration, and
\l{Web Application Support}{facilities for client-side storage of Web content}.
\section1 Performance Improvements
The introduction of the QtBenchLib performance benchmarking library enables
performance benchmarking and regression testing. Core parts of Qt itself have
undergone focused re-engineering for improved graphics performance, including
paint engine and text rendering improvements, Graphics View and style sheet
performance improvements.
The X11 paint engine now uses XSHM (the X shared memory extension), resulting
in reduced overhead for painting operations.
A new OpenGL ES 2.0-based paint engine complements the existing OpenGL paint
engine, but with a focus on embedded devices.
Qt now features a pluggable graphics system, making it possible for users
and developers to select raster, OpenGL or native graphics systems to take
into account the specific needs of their applications and get the best
performance out of them.
\section1 Mac OS X Cocoa Support
\image mac-cocoa.png
Qt for Mac OS X has been substantially rewritten to use Apple's Cocoa API,
enabling Qt applications to be deployed on 64-bit Macintosh hardware.
In addition, the new QMacCocoaViewContainer and QMacNativeWidget classes
provide integration with Cocoa's own features and controls.
For many applications, a simple recompilation is all that is required
to produce an executable for 64-bit systems. Applications that use
specific features may require a few changes first.
\section1 Windows CE Feature Parity
Qt for Windows CE has been updated to bring features of Qt 4.4 and Qt 4.5
to the Windows CE platform, including:
\list
\o Phonon Multimedia Framework, using a Direct-Show based backend for audio
and video playback and a Simple WaveOut backend for devices without DirectShow.
\o The inclusion of Qt WebKit integration features previously unavailable for
Qt 4.4 on Windows CE.
\endlist
Support on all Windows CE platforms; recommended for WinCE 6 and higher.
The inclusion of these features enables developers to easily integrate Web and
multimedia content into Qt applications on Windows CE Standard Edition while
retaining full cross-platform compatibility with other Qt platforms.
\section1 XML Transformations with XSLT
The QtXmlPatterns module has been extended to cover XSLT, a transformation language
for XML documents. A common application of this is the transformation of XML data
into human-readable formats for reporting purposes.
XSLT makes it simple to reformat XML content without changing data structures,
removes the need for an intermediate DOM layer for presentation, and enables
rapid solutions to be created; for example, creating reports as HTML or PDF.
\section1 Qt Script Debugger
\image qtscript-debugger-small.png
Developers using Qt Script in their applications can take advantage of
the new \l{Qt Script Debugger Manual}{Qt Script Debugger} to provide
error reporting for scripts, and to let users track down bugs in their
own scripts.
Many standard features of GUI debugging tools are present, allowing the
developer to step through running script code, inspect variables,
automatically catch exceptions, and set conditional breakpoints.
\section1 OpenDocument File Format Support
Qt 4.5 includes support for writing rich text documents as OpenDocument files via
the newly-introduced QTextDocumentWriter class. This provides an generic mechanism
for file export that can be used to introduce support for additional formats in
future releases.
\section1 Improved Network Proxy Support
Qt's networking classes have been updated with
\l{QtNetwork Module#Support for Network Proxies}{improved proxy support}.
This includes improved integration with system proxy settings and the added
ability to handle non-trivial proxy cases.
\section1 Qt Designer Improvements
\image designer-screenshot-small.png
Qt Designer 4.5 boasts some improvements on usability, for example:
\list
\o \bold{Icon Mode} for the widget box which substantially reduces
scrolling.
\o \bold{Morphing Widgets} which lets you morph similar widget types,
e.g., a QWidget to a QFrame, types via the context menu's
\e{Morph into} entry.
\o \bold{Filters} for the \gui{Property Editor} that lets you find
properties or widgets quickly.
\o \bold{Find option} for the \gui{Object Inspector} that performs an
incremental search on the form's widgets. Also, the objects' layout
state is displayed here with using an icon on the left. Broken
layouts are represented with the same icon used for the
\e{Break Layout} action.
\endlist
In addition, Qt Designer now features an \gui{Embedded Design} tab that can
be found in the \gui Preferences dialog. Within this tab, you can define
embedded device profiles. These profiles contains screen settings, e.g.,
display resolution, default font and default style. Qt Designer will use
these settings when you edit forms.
More information about these improvements can be found in the
\l{What's New in Qt Designer 4.5} overview.
\section1 Qt Linguist Improvements
Qt Linguist can now load and edit multiple translation files simultaneously.
Support for XML Localization Interchange File Format (XLIFF) files, previously added
to the \c lupdate tool in Qt 4.3, has been improved and extended to the rest of the
Qt Linguist toolchain. This enables files stored in Qt's TS translation format to
be exported for use with other tools.
The GNU Gettext PO format, which is commonly used in Open Source projects,
is now supported by Qt Linguist.
Support for a new way to annotate messages, using comments in the source code,
has been added to the toolchain. See the QObject::tr() documentation for a detailed
description and examples.
The new \c lconvert filter tool facilitates conversion between file formats and
can be used to perform other transformations on collections of translatable strings.
\section1 Graphics Enhancements
In addition to the performance improvements in this release, a number of graphics
enhancements extend support for existing features to more platforms and expand Qt's
core set of features with successful add-ons.
Widget style sheets can now be used on Mac OS X, making this approach to theming
and styling viable for truly cross-platform applications.
Support for ARGB top-level widgets, previously available as a separate solution,
is now provided as an integral part of Qt. This makes it possible to create windows
with translucent regions on systems with the appropriate support from the user's
window system. See the \l{QWidget#Creating Translucent Windows}{Creating Translucent
Windows} section of the QWidget documentation for details of this feature.
\image gtk-style-screenshot.png
Improved GTK+ integration provided by the QGtkStyle class improves the look and feel
of Qt applications in GNOME and other GTK-based environments. The screenshot above
illustrates this clearly.
*/
|