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