QtWhitepaper: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
'''English''' [[QtWhitepaper Korean|한국어]] [http://qt-devnet.developpez.com/tutoriels/qt/livre-blanc/ French] ''[qt-devnet.developpez.com]''
'''English''' [[QtWhitepaper_Korean|한국어]] "French":http://qt-devnet.developpez.com/tutoriels/qt/livre-blanc/


=Qt Whitepaper=
[toc align_right="yes" depth="2"]


[[Image:Qt_master_logo_CMYK_noback.gif]]
= Qt Whitepaper =


This whitepaper describes the Qt C++ framework. Qt supports the development of cross-platform <span class="caps">GUI</span> applications with its “write once, compile anywhere” approach. Using a single source tree and a simple recompilation, applications can be written for Windows, Mac OS X, Linux, Solaris, HP-UX, and many other versions of Unix with X11.
[[Image:http://qt.digia.com/Documents/Qt_master_logo_CMYK_noback.gif|http://qt.digia.com/Documents/Qt_master_logo_CMYK_noback.gif]]
 
This whitepaper describes the Qt C++ framework. Qt supports the development of cross-platform GUI applications with its &quot;write once, compile anywhere&amp;quot; approach. Using a single source tree and a simple recompilation, applications can be written for Windows, Mac OS X, Linux, Solaris, HP-UX, and many other versions of Unix with X11.


Qt applications can also be compiled to run on embedded Linux, Symbian and Windows CE platforms.
Qt applications can also be compiled to run on embedded Linux, Symbian and Windows CE platforms.


Qt has excellent cross-platform support for multimedia and 3D graphics, internationalization, <span class="caps">SQL</span>, <span class="caps">XML</span> and unit testing, as well as providing platform-specific extensions for specialized applications.
Qt has excellent cross-platform support for multimedia and 3D graphics, internationalization, SQL, XML and unit testing, as well as providing platform-specific extensions for specialized applications.


Qt applications can be built visually using ''Qt Designer'', a flexible user interface builder with support for <span class="caps">IDE</span> integration.
Qt applications can be built visually using ''Qt Designer'', a flexible user interface builder with support for IDE integration.


The release of Qt 4.7 introduces the foundations of Qt Quick, a collection of technologies for rapid prototyping and creation of modern, intuitive user interfaces. These are covered briefly in the ''Qt Quick'' section later in this whitepaper, and are described in more detail in the ''Introduction to Qt Quick for C++ Developers'' whitepaper.
The release of Qt 4.7 introduces the foundations of Qt Quick, a collection of technologies for rapid prototyping and creation of modern, intuitive user interfaces. These are covered briefly in the ''Qt Quick'' section later in this whitepaper, and are described in more detail in the ''Introduction to Qt Quick for C++ Developers'' whitepaper.


=Introduction=
= Introduction =


''Qt is the de facto standard C++ framework for high performance cross-platform software development. In addition to an extensive C++ class library, Qt includes tools to make writing applications fast and straightforward. Qt’s cross-platform capabilities and internationalization support ensure that Qt applications reach the widest possible market.''
''Qt is the de facto standard C++ framework for high performance cross-platform software development. In addition to an extensive C++ class library, Qt includes tools to make writing applications fast and straightforward. Qt's cross-platform capabilities and internationalization support ensure that Qt applications reach the widest possible market.''


The Qt C++ framework has been at the heart of commercial applications since 1995. Qt is used by companies and organizations as diverse as Adobe®, Boeing®, Google®, <span class="caps">IBM</span>, Motorola®, <span class="caps">NASA</span>, Skype®, and by numerous smaller companies and organizations. Qt 4 is designed to be easier to use than previous versions of Qt, while adding more powerful functionality. Qt’s classes are fully featured and provide consistent interfaces to assist learning, reduce developer workload, and increase programmer productivity. Qt is, and always has been, fully object-oriented.
The Qt C++ framework has been at the heart of commercial applications since 1995. Qt is used by companies and organizations as diverse as Adobe®, Boeing®, Google®, IBM (R), Motorola®, NASA, Skype®, and by numerous smaller companies and organizations. Qt 4 is designed to be easier to use than previous versions of Qt, while adding more powerful functionality. Qt's classes are fully featured and provide consistent interfaces to assist learning, reduce developer workload, and increase programmer productivity. Qt is, and always has been, fully object-oriented.


This whitepaper gives an overview of Qt’s tools and functionality. Each section begins with a non-technical introduction before providing a more detailed description of relevant features. Links to online resources are also given for each subject area.
This whitepaper gives an overview of Qt's tools and functionality. Each section begins with a non-technical introduction before providing a more detailed description of relevant features. Links to online resources are also given for each subject area.


To evaluate Qt Commercial for 30 days, visit http://qt.digia.com/en/downloads/ ''[qt.digia.com]''. Qt is also available under a <span class="caps">LGPL</span> license from https://qt.io/download ''[qt.io]''.
To evaluate Qt Commercial for 30 days, visit &quot;http://qt.digia.com/en/downloads/&amp;quot;:http://qt.digia.com/en/downloads/. Qt is also available under a LGPL license from &quot;https://qt.io/download&amp;quot;:https://qt.io/download.


==Executive Summary==
== Executive Summary ==


Qt includes a rich set of widgets (“controls” in Windows terminology) that provide standard <span class="caps">GUI</span> functionality. Qt introduces an innovative alternative for inter-object communication, called “signals and slots”, that replaces the old and unsafe callback technique used in many legacy frameworks. Qt also provides a conventional event model for handling mouse clicks, key presses, and other user input. Qt’s cross-platform <span class="caps">GUI</span> applications can support all the user interface functionality required by modern applications, such as menus, context menus, drag and drop, and dockable toolbars. Desktop integration features provided by Qt can be used to extend applications into the surrounding desktop environment, taking advantage of some of the services provided on each platform.
Qt includes a rich set of widgets (&quot;controls&amp;quot; in Windows terminology) that provide standard GUI functionality. Qt introduces an innovative alternative for inter-object communication, called &quot;signals and slots&amp;quot;, that replaces the old and unsafe callback technique used in many legacy frameworks. Qt also provides a conventional event model for handling mouse clicks, key presses, and other user input. Qt's cross-platform GUI applications can support all the user interface functionality required by modern applications, such as menus, context menus, drag and drop, and dockable toolbars. Desktop integration features provided by Qt can be used to extend applications into the surrounding desktop environment, taking advantage of some of the services provided on each platform.


Qt also includes ''Qt Designer'', a tool for graphically designing user interfaces. ''Qt Designer'' supports Qt’s powerful layout features in addition to absolute positioning. ''Qt Designer'' can be used purely for <span class="caps">GUI</span> design, or to create entire applications with its support for integration with popular integrated development environments (<span class="caps">IDE</span>s).
Qt also includes ''Qt Designer'', a tool for graphically designing user interfaces. ''Qt Designer'' supports Qt's powerful layout features in addition to absolute positioning. ''Qt Designer'' can be used purely for GUI design, or to create entire applications with its support for integration with popular integrated development environments (IDEs).


Qt has excellent support for multimedia and 3D graphics (page). Qt is the ''de facto'' standard <span class="caps">GUI</span> framework for platform-independent OpenGL® programming. Qt’s painting system offers high quality rendering across all supported platforms. A sophisticated canvas framework enables developers to create interactive graphical applications that take advantage of Qt’s advanced painting features.
Qt has excellent support for multimedia and 3D graphics (page). Qt is the ''de facto'' standard GUI framework for platform-independent OpenGL® programming. Qt's painting system offers high quality rendering across all supported platforms. A sophisticated canvas framework enables developers to create interactive graphical applications that take advantage of Qt's advanced painting features.


Qt makes it possible to create platform-independent database applications using standard databases. Qt includes native drivers for Oracle®, Microsoft® <span class="caps">SQL</span> Server, Sybase® Adaptive Server, <span class="caps">IBM</span> DB2, PostgreSQL™, MySQL®, Borland® Interbase, <span class="caps">SQL</span>ite, and <span class="caps">ODBC</span>-compliant databases. Qt includes database-specific widgets, and any built-in or custom widget can be made data-aware.
Qt makes it possible to create platform-independent database applications using standard databases. Qt includes native drivers for Oracle®, Microsoft® SQL Server, Sybase® Adaptive Server, IBM DB2®, PostgreSQL™, MySQL®, Borland® Interbase, SQLite, and ODBC-compliant databases. Qt includes database-specific widgets, and any built-in or custom widget can be made data-aware.


Qt programs have native look and feel on all supported platforms using Qt’s styles and themes support. From a single source tree, recompilation is all that is required to produce applications for Windows®, Mac OS , Linux®, Solaris™, HP-UX™, and many other versions of Unix® with X11. Qt’s <code>qmake</code> build tool produces makefiles or <code>.dsp</code> files appropriate to the target platform.
Qt programs have native look and feel on all supported platforms using Qt's styles and themes support. From a single source tree, recompilation is all that is required to produce applications for Windows®, Mac OS X (R), Linux®, Solaris™, HP-UX™, and many other versions of Unix® with X11™. Qt's &lt;code&amp;gt;qmake&amp;lt;/code&amp;gt; build tool produces makefiles or &lt;code&amp;gt;.dsp&amp;lt;/code&amp;gt; files appropriate to the target platform.


Since Qt’s architecture takes advantage of the underlying platform, many customers use Qt for single-platform development on Windows, Mac OS X, and Unix because they prefer Qt’s approach. Qt includes support for important platform-specific features, such as ActiveX® on Windows, and Motif™ on Unix. See the section on sec:Qt’s-Architecture for more information.
Since Qt's architecture takes advantage of the underlying platform, many customers use Qt for single-platform development on Windows, Mac OS X, and Unix because they prefer Qt's approach. Qt includes support for important platform-specific features, such as ActiveX® on Windows, and Motif™ on Unix. See the section on sec:Qt's-Architecture for more information.


Qt uses Unicode™ throughout and has considerable support for internationalization. Qt includes ''Qt Linguist'' and other tools to support translators. Applications can easily use and mix text in Arabic, Chinese, English, Hebrew, Japanese, Russian, and other languages supported by Unicode.
Qt uses Unicode™ throughout and has considerable support for internationalization. Qt includes ''Qt Linguist'' and other tools to support translators. Applications can easily use and mix text in Arabic, Chinese, English, Hebrew, Japanese, Russian, and other languages supported by Unicode.


Qt includes a variety of domain-specific classes. For example, Qt has an <span class="caps">XML</span> module that includes <span class="caps">SAX</span> and <span class="caps">DOM</span> classes for reading and manipulating data stored in <span class="caps">XML</span>-based formats. Objects can be stored in memory using Qt’s <span class="caps">STL</span>-compatible collection classes, and handled using styles of iterators used in Java® and the C++ Standard Template Library (<span class="caps">STL</span>). Local and remote file handling using standard protocols are provided by Qt’s input/output and networking classes.
Qt includes a variety of domain-specific classes. For example, Qt has an XML module that includes SAX and DOM classes for reading and manipulating data stored in XML-based formats. Objects can be stored in memory using Qt's STL-compatible collection classes, and handled using styles of iterators used in Java® and the C++ Standard Template Library (STL). Local and remote file handling using standard protocols are provided by Qt's input/output and networking classes.


Qt applications can have their functionality extended by plugins and dynamic libraries. Plugins provide additional codecs, database drivers, image formats, styles, and widgets. Plugins and libraries can be sold as products in their own right.
Qt applications can have their functionality extended by plugins and dynamic libraries. Plugins provide additional codecs, database drivers, image formats, styles, and widgets. Plugins and libraries can be sold as products in their own right.


The QtScript module enables applications to be scripted with Qt Script, an <span class="caps">ECMAS</span>cript-based language related to JavaScript. This technology allows developers to give users restricted access to parts of their applications for scripting purposes.
The QtScript module enables applications to be scripted with Qt Script, an ECMAScript-based language related to JavaScript. This technology allows developers to give users restricted access to parts of their applications for scripting purposes.


Qt is a mature C++ framework that is widely used around the world. In addition to Qt’s many commercial uses, the Open Source edition of Qt is the foundation of <span class="caps">KDE</span>, the Linux desktop environment. Qt makes application development a pleasure, with its cross-platform build system, visual form design, and elegant <span class="caps">API</span>.
Qt is a mature C++ framework that is widely used around the world. In addition to Qt's many commercial uses, the Open Source edition of Qt is the foundation of KDE, the Linux desktop environment. Qt makes application development a pleasure, with its cross-platform build system, visual form design, and elegant API.


===Online References===
=== Online References ===


[http://qt.io/videos#c-142 Qt Videos: Qt in Use] ''[qt.io]''
&quot;Qt Videos: Qt in Use&amp;quot;:http://qt.io/videos#c-142


=Graphical User Interfaces=
= Graphical User Interfaces =


''Qt provides a rich set of standard widgets that can be used to create graphical user interfaces for applications. Layout managers are used to arrange and resize widgets to suit the user’s screen, language and fonts.''
''Qt provides a rich set of standard widgets that can be used to create graphical user interfaces for applications. Layout managers are used to arrange and resize widgets to suit the user's screen, language and fonts.''


Widgets are visual elements that are combined to create user interfaces. Buttons, menus and scroll bars, message boxes and application windows are all examples of widgets.
Widgets are visual elements that are combined to create user interfaces. Buttons, menus and scroll bars, message boxes and application windows are all examples of widgets.


Layout managers organize child widgets within their parent widget’s area. They perform automatic positioning and resizing of child widgets, provide sensible minimum and default sizes for top-level widgets, and automatically reposition widgets when their contents change.
Layout managers organize child widgets within their parent widget's area. They perform automatic positioning and resizing of child widgets, provide sensible minimum and default sizes for top-level widgets, and automatically reposition widgets when their contents change.


Signals and slots connect application components together so that they can communicate in a simple, type-safe way. This form of inter-object communication is enabled in all standard widgets and can be used by developers in their own custom widgets.
Signals and slots connect application components together so that they can communicate in a simple, type-safe way. This form of inter-object communication is enabled in all standard widgets and can be used by developers in their own custom widgets.


[[Image:widgets.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/widgets.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/widgets.png]]


''A selection of widgets provided by Qt.''
''A selection of widgets provided by Qt.''


==Widgets==
== Widgets ==


The images above present a selection of widgets. These include standard text entry widgets, check boxes, radio buttons, sliders and push buttons, as well as more specialized widgets for date and time entry.
The images above present a selection of widgets. These include standard text entry widgets, check boxes, radio buttons, sliders and push buttons, as well as more specialized widgets for date and time entry.


Labels, message boxes, tooltips and other textual widgets are not confined to using a single color, font and language. Qt’s text-rendering widgets can display multi-language rich text using a subset of <span class="caps">HTML</span>.
Labels, message boxes, tooltips and other textual widgets are not confined to using a single color, font and language. Qt's text-rendering widgets can display multi-language rich text using a subset of HTML.


Container widgets such as tab widgets and group boxes are also available, and can be used to group related user interface components. These widgets are managed specially in ''Qt Designer'' to help designers create new user interfaces. More complex widgets, such as scrolling views, are often used more by developers than by user interface designers because they are used to display specialized or dynamic content.
Container widgets such as tab widgets and group boxes are also available, and can be used to group related user interface components. These widgets are managed specially in ''Qt Designer'' to help designers create new user interfaces. More complex widgets, such as scrolling views, are often used more by developers than by user interface designers because they are used to display specialized or dynamic content.
Line 77: Line 79:
Developers can create their own widgets and dialogs by subclassing the base '''QWidget''' class or one of its subclasses. Specialized widgets like these can be completely customized to render their own content, respond to user input, and provide their own signals and slots.
Developers can create their own widgets and dialogs by subclassing the base '''QWidget''' class or one of its subclasses. Specialized widgets like these can be completely customized to render their own content, respond to user input, and provide their own signals and slots.


Qt provides many other widgets than those shown here. Many of the available widgets are shown with links to their class documentation in Qt’s online [http://doc.qt.io/qt-4.8/gallery.html Widget Gallery] ''[qt.io]''.
Qt provides many other widgets than those shown here. Many of the available widgets are shown with links to their class documentation in Qt's online &quot;Widget Gallery&amp;quot;:http://doc.qt.io/qt-4.8/gallery.html.


==Layouts==
== Layouts ==


Layouts provide flexibility and responsiveness to user interfaces, enabling them to adapt when their styles, orientations or text fonts are updated.
Layouts provide flexibility and responsiveness to user interfaces, enabling them to adapt when their styles, orientations or text fonts are updated.
Line 85: Line 87:
Layouts help developers to support internationalization in their applications. With fixed sizes and positions, translated text is often truncated; with layouts, the child widgets are automatically resized. Additionally, widget placement can be reversed to provide a more natural appearance for users who work with right-to-left writing systems.
Layouts help developers to support internationalization in their applications. With fixed sizes and positions, translated text is often truncated; with layouts, the child widgets are automatically resized. Additionally, widget placement can be reversed to provide a more natural appearance for users who work with right-to-left writing systems.


Layouts can also run from right-to-left and from bottom-to-top. Right-to-left layouts are convenient for internationalized applications supporting right-to-left writing systems such as Arabic and Hebrew. The built-in layouts are fully integrated with Qt’s style system to provide a consistent look and feel on reversed displays.
Layouts can also run from right-to-left and from bottom-to-top. Right-to-left layouts are convenient for internationalized applications supporting right-to-left writing systems such as Arabic and Hebrew. The built-in layouts are fully integrated with Qt's style system to provide a consistent look and feel on reversed displays.


''Qt Designer'' is fully able to use layouts to position widgets.
''Qt Designer'' is fully able to use layouts to position widgets.


==Signals and Slots==
== Signals and Slots ==
 
&quot;Signals and slots&amp;quot;:http://doc.qt.io/qt-4.8/signalsandslots.html are used for communication between Qt objects. The signals and slots mechanism is a central feature of Qt and probably the part that differs most from the features provided by other frameworks. Signals and slots makes it easy to implement the &quot;Observer pattern&amp;quot;:http://en.wikipedia.org/wiki/Observer_pattern.


[http://doc.qt.io/qt-4.8/signalsandslots.html Signals and slots] ''[qt.io]'' are used for communication between Qt objects. The signals and slots mechanism is a central feature of Qt and probably the part that differs most from the features provided by other frameworks. Signals and slots makes it easy to implement the [http://en.wikipedia.org/wiki/Observer_pattern Observer pattern] ''[en.wikipedia.org]''.
Widgets emit signals when events occur. For example, a button will emit a &quot;clicked&amp;quot; signal when it is clicked. A developer can choose to connect to a signal by creating a function (a &quot;slot&amp;quot;) and calling the &lt;code&amp;gt;connect()&lt;/code&amp;gt; function to relate the signal to the slot. Qt's signals and slots mechanism does not require classes to have knowledge of each other, which makes it much easier to develop highly reusable classes. Since signals and slots are type-safe, type errors are reported as warnings and do not cause crashes to occur.


Widgets emit signals when events occur. For example, a button will emit a “clicked” signal when it is clicked. A developer can choose to connect to a signal by creating a function (a “slot”) and calling the <code>connect()</code> function to relate the signal to the slot. Qt’s signals and slots mechanism does not require classes to have knowledge of each other, which makes it much easier to develop highly reusable classes. Since signals and slots are type-safe, type errors are reported as warnings and do not cause crashes to occur.
For example, if a Quit button's &lt;code&amp;gt;clicked()&lt;/code&amp;gt; signal is connected to the application's &lt;code&amp;gt;quit()&lt;/code&amp;gt; slot, a user's click on Quit makes the application terminate. In code, this is written as


For example, if a Quit button’s <code>clicked()</code> signal is connected to the application’s <code>quit()</code> slot, a user’s click on Quit makes the application terminate. In code, this is written as
<code>connect(button, SIGNAL (clicked()), qApp, SLOT (quit()));<code>


Connections can be added or removed at any time during the execution of a Qt application, they can be set up so that they are executed when a signal is emitted or queued for later execution, and they can be made between objects in different threads.
Connections can be added or removed at any time during the execution of a Qt application, they can be set up so that they are executed when a signal is emitted or queued for later execution, and they can be made between objects in different threads.


The signals and slots mechanism is implemented in standard C++. The implementation uses the C++ preprocessor and <code>moc</code>, the Meta-Object Compiler, included with Qt. Code generation is performed automatically by sub:Qt’s-Build-System. Developers never have to edit or even look at the generated code.
The signals and slots mechanism is implemented in standard C+''. The implementation uses the C''+ preprocessor and &lt;code&amp;gt;moc&amp;lt;/code&amp;gt;, the Meta-Object Compiler, included with Qt. Code generation is performed automatically by sub:Qt's-Build-System. Developers never have to edit or even look at the generated code.


In addition to handling signals and slots, the Meta-Object Compiler supports Qt’s translation mechanism, its property system, and its extended run-time type information. It also makes run-time introspection of C++ programs possible in a way that works on all supported platforms. The underlying system that provides these facilities is known as Qt’s meta-object system &amp;#40;see page.
In addition to handling signals and slots, the Meta-Object Compiler supports Qt's translation mechanism, its property system, and its extended run-time type information. It also makes run-time introspection of C++ programs possible in a way that works on all supported platforms. The underlying system that provides these facilities is known as Qt's meta-object system &amp;amp;#40;see page.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/all-examples.html Qt Examples] ''[qt.io]''
&quot;Qt Examples&amp;quot;:http://doc.qt.io/qt-4.8/all-examples.html


[http://doc.qt.io/qt-4.8/layout.html Layout Management] ''[qt.io]''
&quot;Layout Management&amp;quot;:http://doc.qt.io/qt-4.8/layout.html


[http://doc.qt.io/qt-4.8/object.html Object Model] ''[qt.io]''
&quot;Object Model&amp;quot;:http://doc.qt.io/qt-4.8/object.html


[http://doc.qt.io/qt-4.8/signalsandslots.html Signals and Slots] ''[qt.io]''
&quot;Signals and Slots&amp;quot;:http://doc.qt.io/qt-4.8/signalsandslots.html


=Application Features=
= Application Features =


''Building modern <span class="caps">GUI</span> applications with Qt is fast and simple, and can be achieved by hand coding or by using Qt Designer, Qt’s visual design tool.''
''Building modern GUI applications with Qt is fast and simple, and can be achieved by hand coding or by using Qt Designer, Qt's visual design tool.''


Qt provides all the features necessary to create modern <span class="caps">GUI</span> applications with menus, toolbars and dock windows. Qt supports both <span class="caps">SDI</span> (single document interface&amp;#41; and <span class="caps">MDI</span> (multiple document interface). Qt also supports drag and drop and the clipboard.
Qt provides all the features necessary to create modern GUI applications with menus, toolbars and dock windows. Qt supports both SDI (single document interface&amp;amp;amp;#41; and MDI (multiple document interface). Qt also supports drag and drop and the clipboard.


A full set of standard dialogs are provided, including those for choosing files, folders, fonts, and colors. In practice, a one-line statement using one of Qt’s static convenience functions is all that is necessary to present a standard dialog.
A full set of standard dialogs are provided, including those for choosing files, folders, fonts, and colors. In practice, a one-line statement using one of Qt's static convenience functions is all that is necessary to present a standard dialog.


[[Image:assistant.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/assistant.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/assistant.png]]


''Qt Assistant uses many of the main window application features to display Qt’s documentation.''
''Qt Assistant uses many of the main window application features to display Qt's documentation.''


Qt uses actions to simplify user interface programming. For example, if a menu option, a toolbar button, and a keyboard accelerator all perform the same action, the action need only be coded once.
Qt uses actions to simplify user interface programming. For example, if a menu option, a toolbar button, and a keyboard accelerator all perform the same action, the action need only be coded once.
Line 131: Line 135:
Support for multithreading programming is provided by a collection of classes that represent common constructs, making it possible to write Qt applications that take advantage of threads to perform calculations, long duration tasks, or just to improve responsiveness.
Support for multithreading programming is provided by a collection of classes that represent common constructs, making it possible to write Qt applications that take advantage of threads to perform calculations, long duration tasks, or just to improve responsiveness.


Applications can also use Qt’s desktop integration features to interact with services provided by the user’s desktop environment.
Applications can also use Qt's desktop integration features to interact with services provided by the user's desktop environment.


==Main Window Features==
== Main Window Features ==


The '''QMainWindow''' class provides a framework for typical application main windows. A main window contains a set of standard widgets. The top of the main window is occupied by a menu bar, beneath which toolbars are laid out in toolbar areas around the center of the window. The area of the main window below the bottom toolbar area is occupied by a status bar. Tooltips and “What’s this?help provide balloon help for the user interface elements.
The '''QMainWindow''' class provides a framework for typical application main windows. A main window contains a set of standard widgets. The top of the main window is occupied by a menu bar, beneath which toolbars are laid out in toolbar areas around the center of the window. The area of the main window below the bottom toolbar area is occupied by a status bar. Tooltips and &quot;What's this?&quot; help provide balloon help for the user interface elements.


===QMenu===
=== QMenu ===


The QMenu widget presents menu items to the user in a vertical list. Menus can be standalone (e.g., a context pop-up menu), can appear in a menu bar, or can be a sub-menu of another pop-up menu. Menus can have tear-off handles.
The QMenu widget presents menu items to the user in a vertical list. Menus can be standalone (e.g., a context pop-up menu), can appear in a menu bar, or can be a sub-menu of another pop-up menu. Menus can have tear-off handles.


Each menu item can have an icon, a checkbox, and an accelerator. Menu items usually correspond to actions (e.g., “Save”) and cause their associated slots to be executed when selected by the user. Qt’s layout managers take any menu bar into consideration. On Mac OS X, the menu bar appears at the top of the screen.
Each menu item can have an icon, a checkbox, and an accelerator. Menu items usually correspond to actions (e.g., &quot;Save&amp;quot;) and cause their associated slots to be executed when selected by the user. Qt's layout managers take any menu bar into consideration. On Mac OS X, the menu bar appears at the top of the screen.


Qt’s menus are very flexible and are part of an integrated ''action system'' (see sub:Actions ). Actions can be enabled or disabled, dynamically added to menus, and removed again later.
Qt's menus are very flexible and are part of an integrated ''action system'' (see sub:Actions ). Actions can be enabled or disabled, dynamically added to menus, and removed again later.


===QToolBar===
=== QToolBar ===


[[Image:macintosh-unified-toolbar.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/macintosh-unified-toolbar.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/macintosh-unified-toolbar.png]]


''Unified toolbar support on Mac OS X improves the look and feel of applications by blending adjacent toolbars and window title bars together.''
''Unified toolbar support on Mac OS X improves the look and feel of applications by blending adjacent toolbars and window title bars together.''
Line 161: Line 165:
Customization of dock windows is also possible. They can be displayed with vertical title bars, and given individually-styled title bars and window controls.
Customization of dock windows is also possible. They can be displayed with vertical title bars, and given individually-styled title bars and window controls.


Some applications, including ''Qt Designer'' (see page) and ''Qt Linguist'' (page), use dock windows extensively. provides operators to save and restore the position of dock windows and toolbars, so that applications can easily restore the user’s preferred working environment.
Some applications, including ''Qt Designer'' (see page) and ''Qt Linguist'' (page), use dock windows extensively. provides operators to save and restore the position of dock windows and toolbars, so that applications can easily restore the user's preferred working environment.


===QStatusBar===
=== QStatusBar ===


The QStatusBar class provides a horizontal bar suitable for presenting status information, for example a can be hint:
The QStatusBar class provides a horizontal bar suitable for presenting status information, for example a can be hint:


This snippet will show the message – “Ready” on status bar. You can set property <code>statusHint</code> in any widget.
</code><br />statusBar()<s>&gt;showMessage(&quot;Ready&amp;quot;);<br /><code>
<br />This snippet will show the message</s> &quot;Ready&amp;quot; on status bar. You can set property &lt;code&amp;gt;statusHint&amp;lt;/code&amp;gt; in any widget.


==Actions==
== Actions ==


Applications usually provide the user with several different ways to perform a particular action. For example, most applications have traditionally provided a “Save” action available from the menu, from the toolbar (a toolbar button with an appropriate icon), and as an accelerator (). The '''QAction''' class encapsulates this concept. It allows programmers to define an action in one place.
Applications usually provide the user with several different ways to perform a particular action. For example, most applications have traditionally provided a &quot;Save&amp;quot; action available from the menu, from the toolbar (a toolbar button with an appropriate icon), and as an accelerator (). The '''QAction''' class encapsulates this concept. It allows programmers to define an action in one place.


As well as avoiding duplication of work, using a '''QAction''' ensures that the state of menu items stay in sync with the state of related toolbar buttons, and that interactive help is displayed when necessary. Disabling an action will disable any corresponding menu items and toolbar buttons. Similarly, if the user clicks a toggle button in a toolbar, the corresponding menu item will also be toggled.
As well as avoiding duplication of work, using a '''QAction''' ensures that the state of menu items stay in sync with the state of related toolbar buttons, and that interactive help is displayed when necessary. Disabling an action will disable any corresponding menu items and toolbar buttons. Similarly, if the user clicks a toggle button in a toolbar, the corresponding menu item will also be toggled.


==Dialogs and Wizards==
== Dialogs and Wizards ==


Most <span class="caps">GUI</span> applications use dialog boxes to interact with the user for certain operations. Qt includes ready-made dialog classes with convenience functions for the most common tasks. Screenshots of some of Qt’s standard dialogs are presented below. Qt also provides standard dialogs for color selection, printing, indicating progress and displaying messages.
Most GUI applications use dialog boxes to interact with the user for certain operations. Qt includes ready-made dialog classes with convenience functions for the most common tasks. Screenshots of some of Qt's standard dialogs are presented below. Qt also provides standard dialogs for color selection, printing, indicating progress and displaying messages.


[[Image:filedialog.png]] [[Image:fontdialog.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/filedialog.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/filedialog.png]] [[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/fontdialog.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/fontdialog.png]]


''A '''QFileDialog''' and a '''QFontDialog''' shown in the Plastique style. On Windows and Mac OS X, native dialogs are used instead.''
''A '''QFileDialog''' and a '''QFontDialog''' shown in the Plastique style. On Windows and Mac OS X, native dialogs are used instead.''
Line 185: Line 190:
Programmers can create their own dialogs by subclassing '''QDialog'''. ''Qt Designer'' also includes dialog templates to help developers get started with new designs.
Programmers can create their own dialogs by subclassing '''QDialog'''. ''Qt Designer'' also includes dialog templates to help developers get started with new designs.


Wizards are used to guide users through common tasks and processes, taking them step by step through the available options and providing help where necessary. Qt provides a flexible, yet intuitive <span class="caps">API</span> for building wizards with the appropriate native look and feel on each supported platform.
Wizards are used to guide users through common tasks and processes, taking them step by step through the available options and providing help where necessary. Qt provides a flexible, yet intuitive API for building wizards with the appropriate native look and feel on each supported platform.


The '''QWizard''' class provides features for customizing the appearance of the wizard beyond the basic platform-specific look and feel. Instances of this class also control the order in which pages are presented to the user. '''QWizardPage''' is a standard widget that provides features to store and validate user input.
The '''QWizard''' class provides features for customizing the appearance of the wizard beyond the basic platform-specific look and feel. Instances of this class also control the order in which pages are presented to the user. '''QWizardPage''' is a standard widget that provides features to store and validate user input.


==Interactive Help==
== Interactive Help ==


Applications often use various forms of interactive help to explain the purpose of user interface elements and assist users. Qt provides two mechanisms for giving brief help messages: tooltips for short context-sensitive help and “What’s this?pop-up help containing longer, more informative messages. Both of these are integrated with Qt’s action system.
Applications often use various forms of interactive help to explain the purpose of user interface elements and assist users. Qt provides two mechanisms for giving brief help messages: tooltips for short context-sensitive help and &quot;What's this?&quot; pop-up help containing longer, more informative messages. Both of these are integrated with Qt's action system.


Developers can deploy ''Qt Assistant'' as the help browser for their own applications and documentation sets by using the classes in Qt’s Help module. This module also provides an <span class="caps">API</span> that developers can use to access documentation for custom display purposes, perhaps using the tooltips and “What’s This?classes to show small pieces of relevant information to users.
Developers can deploy ''Qt Assistant'' as the help browser for their own applications and documentation sets by using the classes in Qt's Help module. This module also provides an API that developers can use to access documentation for custom display purposes, perhaps using the tooltips and &quot;What's This?&quot; classes to show small pieces of relevant information to users.


==Settings==
== Settings ==


User settings and other application settings can easily be stored on disk using the '''QSettings''' class. On Windows, Mac OS X and Linux platforms, settings are stored in standard system locations; on other platforms, they are stored in text files.
User settings and other application settings can easily be stored on disk using the '''QSettings''' class. On Windows, Mac OS X and Linux platforms, settings are stored in standard system locations; on other platforms, they are stored in text files.


A variety of Qt data types can be used seamlessly with '''QSettings''' and will be serialized for storage and later retrieval by applications. See sub:File-Handling for more information about serialization of Qt’s data types.
A variety of Qt data types can be used seamlessly with '''QSettings''' and will be serialized for storage and later retrieval by applications. See sub:File-Handling for more information about serialization of Qt's data types.


==Multithreading and Concurrent Programming==
== Multithreading and Concurrent Programming ==


Qt applications can use multiple threads: one thread to keep the user interface responsive, and one or many other threads to perform time-consuming activities such as reading large files and performing complex calculations. Qt provides classes to represent threads, mutexes, semaphores, thread-global storage, and locking primitives.
Qt applications can use multiple threads: one thread to keep the user interface responsive, and one or many other threads to perform time-consuming activities such as reading large files and performing complex calculations. Qt provides classes to represent threads, mutexes, semaphores, thread-global storage, and locking primitives.


Facilities for concurrent programming are also provided, including implementations of the well-known map-reduce and filter-reduce algorithms. These are integrated with Qt’s object model, using standard container classes to make it more convenient to use concurrent techniques in Qt applications.
Facilities for concurrent programming are also provided, including implementations of the well-known map-reduce and filter-reduce algorithms. These are integrated with Qt's object model, using standard container classes to make it more convenient to use concurrent techniques in Qt applications.


Qt’s meta-object system enables objects in different threads to communicate using signals and slots, making it possible for developers to create single-threaded applications that can later be adapted for multithreading without an extensive redesign.
Qt's meta-object system enables objects in different threads to communicate using signals and slots, making it possible for developers to create single-threaded applications that can later be adapted for multithreading without an extensive redesign.


==Desktop Integration==
== Desktop Integration ==


Applications can be extended to interact with services provided by the user’s desktop environment by using Qt’s desktop integration classes. These range from '''QSystemTrayIcon''', which is often used by long-running applications to provide a persistent indicator in the system tray, to '''QDesktopServices''', which allows resources such as <code>mailto:</code> and <code>http://</code> <span class="caps">URL</span>s to be processed by the most appropriate applications on each platform.
Applications can be extended to interact with services provided by the user's desktop environment by using Qt's desktop integration classes. These range from '''QSystemTrayIcon''', which is often used by long-running applications to provide a persistent indicator in the system tray, to '''QDesktopServices''', which allows resources such as &lt;code&amp;gt;mailto:&lt;/code&amp;gt; and &lt;code&amp;gt;http://&amp;lt;/code&amp;gt; URLs to be processed by the most appropriate applications on each platform.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/qt4-mainwindow.html The Qt 4 Main Window Classes] ''[qt.io]''
&quot;The Qt 4 Main Window Classes&amp;quot;:http://doc.qt.io/qt-4.8/qt4-mainwindow.html


=Qt Designer=
= Qt Designer =


''Qt Designer is a graphical user interface design tool for Qt applications. Applications can be written entirely as source code, or using Qt Designer to speed up development. A component-based architecture makes it possible for developers to extend Qt Designer with custom widgets and extensions, and even integrate it into integrated development environments.''
''Qt Designer is a graphical user interface design tool for Qt applications. Applications can be written entirely as source code, or using Qt Designer to speed up development. A component-based architecture makes it possible for developers to extend Qt Designer with custom widgets and extensions, and even integrate it into integrated development environments.''


Designing a form with ''Qt Designer'' is a simple process. Developers drag widgets from a toolbox onto a form, and use standard editing tools to select, cut, paste, and resize them. Each widget’s properties can then be changed using the property editor. The precise positions and sizes of the widgets do not matter. Developers select widgets and apply layouts to them. For example, some button widgets could be selected and laid out side by side by choosing the “lay out horizontally” option. This approach makes design very fast, and the finished forms will scale properly to fit whatever window size the end-user prefers. See sub:Layouts for information about Qt’s automatic layouts.
Designing a form with ''Qt Designer'' is a simple process. Developers drag widgets from a toolbox onto a form, and use standard editing tools to select, cut, paste, and resize them. Each widget's properties can then be changed using the property editor. The precise positions and sizes of the widgets do not matter. Developers select widgets and apply layouts to them. For example, some button widgets could be selected and laid out side by side by choosing the &quot;lay out horizontally&amp;quot; option. This approach makes design very fast, and the finished forms will scale properly to fit whatever window size the end-user prefers. See sub:Layouts for information about Qt's automatic layouts.


''Qt Designer'' eliminates the time-consuming “compile, link, and run” cycle for user interface design. This makes it easy to correct or change designs. ''Qt Designer''’s preview options let developers see their forms in other styles; for example, a Mac OS X developer can preview a form in the Windows style. Forms can be previewed using device “skins” to simulate the display constraints and appearance of the target device.
''Qt Designer'' eliminates the time-consuming &quot;compile, link, and run&amp;quot; cycle for user interface design. This makes it easy to correct or change designs. ''Qt Designer'''s preview options let developers see their forms in other styles; for example, a Mac OS X developer can preview a form in the Windows style. Forms can be previewed using device &quot;skins&amp;quot; to simulate the display constraints and appearance of the target device.


Commercial licensees on Windows can enjoy ''Qt Designer''’s user interface design facilities from within Microsoft Visual Studio®. Qt Development Frameworks also produces a Qt integration plugin for the cross-platform Eclipse™ <span class="caps">IDE</span> that embeds ''Qt Designer'' alongside other Qt technologies into the <span class="caps">IDE</span> framework.
Commercial licensees on Windows can enjoy ''Qt Designer'''s user interface design facilities from within Microsoft Visual Studio®. Qt Development Frameworks also produces a Qt integration plugin for the cross-platform Eclipse™ IDE that embeds ''Qt Designer'' alongside other Qt technologies into the IDE framework.


==Working with Qt Designer==
== Working with Qt Designer ==


Developers can create both “dialog” style applications and “main window” style applications with menus, toolbars, balloon help, and other standard features. Several form templates are supplied, and developers can create their own templates to ensure consistency across an application or family of applications. Programmers can create their own custom widgets that can easily be integrated with ''Qt Designer''.
Developers can create both &quot;dialog&amp;quot; style applications and &quot;main window&amp;quot; style applications with menus, toolbars, balloon help, and other standard features. Several form templates are supplied, and developers can create their own templates to ensure consistency across an application or family of applications. Programmers can create their own custom widgets that can easily be integrated with ''Qt Designer''.


''Qt Designer'' supports a form-based approach to application development. A form is represented by a user interface (<code>.ui</code>) file, which can either be converted into C++ and compiled into an application, or processed at run-time to produce dynamically-generated user interfaces. Qt’s build system &amp;#40;see page&amp;#41; is able to automate the compile-time construction of user interfaces to make the design process easier.
''Qt Designer'' supports a form-based approach to application development. A form is represented by a user interface (&lt;code&amp;gt;.ui&amp;lt;/code&amp;gt;) file, which can either be converted into C++ and compiled into an application, or processed at run-time to produce dynamically-generated user interfaces. Qt's build system &amp;amp;#40;see page&amp;amp;amp;#41; is able to automate the compile-time construction of user interfaces to make the design process easier.


The tools used to create and edit the source code for applications created with ''Qt Designer'' will depend on each developer’s personal preferences; some will want to take advantage of the integration features provided with ''Qt Designer'' to develop from within Microsoft Visual Studio or the Eclipse environment.
The tools used to create and edit the source code for applications created with ''Qt Designer'' will depend on each developer's personal preferences; some will want to take advantage of the integration features provided with ''Qt Designer'' to develop from within Microsoft Visual Studio or the Eclipse environment.


[[Image:designer-46-overview.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/designer-46-overview.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/designer-46-overview.png]]


''An overview of Qt Designer’s user interface.''
''An overview of Qt Designer's user interface.''


==Extending Qt Designer==
== Extending Qt Designer ==


The component-based architecture used as a foundation for ''Qt Designer'' was specifically designed to allow developers to extend its user interface and editing tools with custom components. In addition, the modular nature of the application makes it possible to make ''Qt Designer''’s user interface design features available from within integrated development environments such as Qt Creator, Microsoft Visual Studio and KDevelop.
The component-based architecture used as a foundation for ''Qt Designer'' was specifically designed to allow developers to extend its user interface and editing tools with custom components. In addition, the modular nature of the application makes it possible to make ''Qt Designer'''s user interface design features available from within integrated development environments such as Qt Creator, Microsoft Visual Studio and KDevelop.


In total, the QtDesigner module provides over 20 classes for working with <code>.ui</code> files and extending ''Qt Designer''. Many of these allow third parties to customize the user interface of the application itself.
In total, the QtDesigner module provides over 20 classes for working with &lt;code&amp;gt;.ui&amp;lt;/code&amp;gt; files and extending ''Qt Designer''. Many of these allow third parties to customize the user interface of the application itself.


Third party and custom widgets for in-house work are easily integrated into ''Qt Designer''. Adapting an existing widget for use within ''Qt Designer'' only requires a the widget to be compiled as a plugin, using an interface class to supply default widget properties and construct new instances of the widget. The plugin’s interface is exported to ''Qt Designer'' using a macro similar to that described in sub:Plugins .
Third party and custom widgets for in-house work are easily integrated into ''Qt Designer''. Adapting an existing widget for use within ''Qt Designer'' only requires a the widget to be compiled as a plugin, using an interface class to supply default widget properties and construct new instances of the widget. The plugin's interface is exported to ''Qt Designer'' using a macro similar to that described in sub:Plugins .


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/designer-manual.html Qt Designer Manual] ''[qt.io]''
&quot;Qt Designer Manual&amp;quot;:http://doc.qt.io/qt-4.8/designer-manual.html


[[:Category:Tools::QtCreator|Qt Creator]] ''[qt.io]''
&quot;Qt Creator&amp;quot;:http://wiki.qt.io/Category:Tools::QtCreator


[http://doc.qt.io/qt-4.8/qtdesigner.html QtDesigner Module] ''[qt.io]''
&quot;QtDesigner Module&amp;quot;:http://doc.qt.io/qt-4.8/qtdesigner.html


[http://doc.qt.io/qt-4.8/examples-designer.html Qt Designer Examples] ''[qt.io]''
&quot;Qt Designer Examples&amp;quot;:http://doc.qt.io/qt-4.8/examples-designer.html


=Graphics and Multimedia=
= Graphics and Multimedia =


''Qt provides excellent support for 2D and 3D graphics. Qt’s 2D graphics classes support raster and vector graphics, can load and save a wide and extensible range of image formats, and can export text and graphics to Portable Document Format (<span class="caps">PDF</span>) files. Qt can draw transformed Unicode rich text, Scalable Vector Graphics (<span class="caps">SVG</span>) drawings, and provides a fully-featured canvas for demanding interactive applications. Qt also provides features for playing audio and video files and streams.''
''Qt provides excellent support for 2D and 3D graphics. Qt's 2D graphics classes support raster and vector graphics, can load and save a wide and extensible range of image formats, and can export text and graphics to Portable Document Format (PDF) files. Qt can draw transformed Unicode rich text, Scalable Vector Graphics (SVG) drawings, and provides a fully-featured canvas for demanding interactive applications. Qt also provides features for playing audio and video files and streams.''


Graphics are drawn using device-independent painter objects that allow the developer to reuse the same code to render graphics on different types of device, represented in Qt by paint devices (see sub:Painting on page). This approach ensures that a wide range of powerful painting operations are available for each of the devices supported by Qt, and also allows developers to choose the devices that are most suitable for their needs.
Graphics are drawn using device-independent painter objects that allow the developer to reuse the same code to render graphics on different types of device, represented in Qt by paint devices (see sub:Painting on page). This approach ensures that a wide range of powerful painting operations are available for each of the devices supported by Qt, and also allows developers to choose the devices that are most suitable for their needs.


[[Image:demos-boxes.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/demos-boxes.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/demos-boxes.png]]


''The Boxes demonstration presents a range of Qt’s graphical features.''
''The Boxes demonstration presents a range of Qt's graphical features.''


Graphical applications that require an interactive canvas can take advantage of the Graphics View framework to manage and render scenes with large numbers of interactive items, using multiple views if necessary.
Graphical applications that require an interactive canvas can take advantage of the Graphics View framework to manage and render scenes with large numbers of interactive items, using multiple views if necessary.


Qt’s support for OpenGL and OpenGL ES helps developers to integrate 3D graphics into their applications, yet it also enables them to take advantage of modern graphics hardware to improve 2D rendering performance.
Qt's support for OpenGL and OpenGL ES helps developers to integrate 3D graphics into their applications, yet it also enables them to take advantage of modern graphics hardware to improve 2D rendering performance.
 
Device-independent color support enables colors to be specified by ARGB, AHSV, or ACMYK values, or by common names. The color channels used are 16 bits wide, and an optional level of opacity can be specified. Qt automatically allocates the requested color in the system's palette, or uses a similar color on color-limited displays.


Device-independent color support enables colors to be specified by <span class="caps">ARGB</span>, <span class="caps">AHSV</span>, or <span class="caps">ACMYK</span> values, or by common names. The color channels used are 16 bits wide, and an optional level of opacity can be specified. Qt automatically allocates the requested color in the system’s palette, or uses a similar color on color-limited displays.
== Painting ==


==Painting==
Qt provides a platform-independent API for painting onto widgets and other paint devices. It provides drawing primitives as well as advanced features such as transformations and clipping. All of Qt's built-in widgets paint themselves using '''QPainter''', and programmers use this class when implementing their own custom widgets.


Qt provides a platform-independent <span class="caps">API</span> for painting onto widgets and other paint devices. It provides drawing primitives as well as advanced features such as transformations and clipping. All of Qt’s built-in widgets paint themselves using '''QPainter''', and programmers use this class when implementing their own custom widgets.
=== QPainter ===


===QPainter===
QPainter provides standard functions to draw points, lines, ellipses, arcs, B'ezier curves, and other primitives. More complex painting operations include support for polygons and vector paths, allowing detailed drawings to be prepared in advance and drawn using a single function call. Text can also be painted directly with a painter or incorporated in a path for later use.


QPainter provides standard functions to draw points, lines, ellipses, arcs, B’ezier curves, and other primitives. More complex painting operations include support for polygons and vector paths, allowing detailed drawings to be prepared in advance and drawn using a single function call. Text can also be painted directly with a painter or incorporated in a path for later use.
Qt's painting system also provides a number of features to improve overall rendering quality, including alpha blending, Porter-Duff composition modes, anti-aliasing, and linear, radial and conical gradient fills.


Qt’s painting system also provides a number of features to improve overall rendering quality, including alpha blending, Porter-Duff composition modes, anti-aliasing, and linear, radial and conical gradient fills.
'''Warning:''' When painting on a QWidget, QPainter can only be used inside a paintEvent() function or in a function called by paintEvent(); that is unless the Qt::WA_PaintOutsidePaintEvent widget attribute is set. On Mac OS X and Windows, you can only paint in a paintEvent() function regardless of this attribute's setting.


'''Warning:''' When painting on a QWidget, QPainter can only be used inside a paintEvent() function or in a function called by paintEvent(); that is unless the Qt::WA_PaintOutsidePaintEvent widget attribute is set. On Mac OS X and Windows, you can only paint in a paintEvent() function regardless of this attribute’s setting.
</code><br />void paintEvent(QPaintEvent *)<br />{<br /> QPainter doc(this);<br /> QLineF line(10.0, 80.0, 90.0, 20.0);<br /> doc.drawLine(line);<br />}<br /><code>


This snippet will draw a black line on a widget. [http://doc.qt.io/qt-4.8/qpainter.html There are many methods] ''[qt.io]'' to set brush, pen and aliasing.
This snippet will draw a black line on a widget. &quot;There are many methods&amp;quot;:http://doc.qt.io/qt-4.8/qpainter.html to set brush, pen and aliasing.


==Images==
== Images ==


Qt supports input, output, and manipulation of images in several formats, including <span class="caps">BMP</span>, <span class="caps">GIF</span>, <span class="caps">JPEG</span>, <span class="caps">MNG</span>, <span class="caps">PNG</span>, <span class="caps">PNM</span>, <span class="caps">TIFF</span>, <span class="caps">XBM</span> and <span class="caps">XPM</span>. Both classes can be used as paint devices and used in interactive graphical applications, or they can be used to preprocess images for later use in user interface components.
Qt supports input, output, and manipulation of images in several formats, including BMP, GIF, JPEG, MNG, PNG, PNM, TIFF, XBM and XPM. Both classes can be used as paint devices and used in interactive graphical applications, or they can be used to preprocess images for later use in user interface components.


'''QImage''' is used for image manipulation, and can perform conversions between various color depths and pixel formats. Programmers can manipulate the pixel and palette data, apply transformations such as rotations and shears, and reduce the color depth with dithering if desired. Support for alpha channels enables applications to use transparency and alpha-blending for image composition and other purposes.
'''QImage''' is used for image manipulation, and can perform conversions between various color depths and pixel formats. Programmers can manipulate the pixel and palette data, apply transformations such as rotations and shears, and reduce the color depth with dithering if desired. Support for alpha channels enables applications to use transparency and alpha-blending for image composition and other purposes.
Line 295: Line 302:
The range of graphics file formats that can be used with these classes can be extended through the use of an extensible plugin mechanism.
The range of graphics file formats that can be used with these classes can be extended through the use of an extensible plugin mechanism.


[[Image:graphicsview-map.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/graphicsview-map.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/graphicsview-map.png]]


''The Graphics View framework enables graphical applications to be created which combine high quality rendering with comprehensive features for user interaction.''
''The Graphics View framework enables graphical applications to be created which combine high quality rendering with comprehensive features for user interaction.''


==Paint Devices and Printing==
== Paint Devices and Printing ==


'''QPainter''' can operate on any paint device. The code required to paint on any supported device is the same, regardless of the device.
'''QPainter''' can operate on any paint device. The code required to paint on any supported device is the same, regardless of the device.
Line 305: Line 312:
All widgets are paint devices. Qt uses a ''backing store'' to reduce flickering during the painting process. Translucent and shaped windows can be created on suitably configured systems.
All widgets are paint devices. Qt uses a ''backing store'' to reduce flickering during the painting process. Translucent and shaped windows can be created on suitably configured systems.


OpenGL surfaces used with '''<span class="caps">QGLW</span>idget''' are also paint devices that convert standard '''QPainter''' calls to OpenGL calls, enabling two-dimensional graphics to be accelerated on devices with appropriately supported hardware.
OpenGL surfaces used with '''QGLWidget''' are also paint devices that convert standard '''QPainter''' calls to OpenGL calls, enabling two-dimensional graphics to be accelerated on devices with appropriately supported hardware.


Images can also be created by painting on device-independent '''QImage''' and display-optimized '''QPixmap''' objects. Standard image format files can be created by rendering to an image with the desired color depth and pixel format. Images can be created with support for varying levels of transparency and painted onto custom widgets to achieve certain effects.
Images can also be created by painting on device-independent '''QImage''' and display-optimized '''QPixmap''' objects. Standard image format files can be created by rendering to an image with the desired color depth and pixel format. Images can be created with support for varying levels of transparency and painted onto custom widgets to achieve certain effects.


Vector and meta-file formats are also supported by the paint system. '''QSvgGenerator''' creates Scalable Vector Graphics (<span class="caps">SVG</span>) drawings (see page) by translating painting commands to the corresponding structures in the <span class="caps">SVG</span> file format. '''QPicture''' is used to hold a sequence of painting commands that can be replayed when painting on another paint device or stored in a file.
Vector and meta-file formats are also supported by the paint system. '''QSvgGenerator''' creates Scalable Vector Graphics (SVG) drawings (see page) by translating painting commands to the corresponding structures in the SVG file format. '''QPicture''' is used to hold a sequence of painting commands that can be replayed when painting on another paint device or stored in a file.


Printing is performed by rendering to a '''QPrinter''' device that represents a physical printer. On Windows, the paint commands are sent to the Windows print engine, which uses the installed printer drivers. On Unix, PostScript® or Portable Document Format (<span class="caps">PDF</span>) data is sent to the print daemon — this is handled by the Common Unix Printing System (<span class="caps">CUPS</span>) on modern systems.
Printing is performed by rendering to a '''QPrinter''' device that represents a physical printer. On Windows, the paint commands are sent to the Windows print engine, which uses the installed printer drivers. On Unix, PostScript® or Portable Document Format (PDF) data is sent to the print daemon — this is handled by the Common Unix Printing System &amp;#40;CUPS&amp;amp;#41; on modern systems.


Using Qt’s generic painting <span class="caps">API</span>, applications can create <span class="caps">PDF</span> and PostScript files can be generated on all platforms, enabling applications to create high quality documents that can be viewed using suitable reader applications.
Using Qt's generic painting API, applications can create PDF and PostScript files can be generated on all platforms, enabling applications to create high quality documents that can be viewed using suitable reader applications.


==Graphics View Framework==
== Graphics View Framework ==


Qt introduces a powerful new framework for interactive graphical applications that is used to manage and display large numbers of items in a two-dimensional scene. Graphics View provides both an object-based <span class="caps">API</span> for adding new items to a scene and a traditional canvas-style <span class="caps">API</span> containing convenience functions for creating predefined items.
Qt introduces a powerful new framework for interactive graphical applications that is used to manage and display large numbers of items in a two-dimensional scene. Graphics View provides both an object-based API for adding new items to a scene and a traditional canvas-style API containing convenience functions for creating predefined items.


Once created, items can be placed with the required position, orientation, and scale in a scene. The display and item management functionality are implemented separately in the '''QGraphicsView''' and '''QGraphicsScene''' classes, enabling features such as multiple views onto the same scene and support for switchable renderers.
Once created, items can be placed with the required position, orientation, and scale in a scene. The display and item management functionality are implemented separately in the '''QGraphicsView''' and '''QGraphicsScene''' classes, enabling features such as multiple views onto the same scene and support for switchable renderers.
Line 325: Line 332:
Graphics View has been designed with animations in mind: items can be used to create animated objects that are transformed according to a series of transformations defined at certain points on a timeline.
Graphics View has been designed with animations in mind: items can be used to create animated objects that are transformed according to a series of transformations defined at certain points on a timeline.


Some of the standard items bring features found in other parts of Qt to the Graphics View framework, including rich text editing, Web browsing, display of <span class="caps">SVG</span> drawings and the use of shapes, paths and images. Items on a scene can also be rendered independently of any attached view, enabling scenes to be rendered to image files and printed to <span class="caps">PDF</span> files or printers.
Some of the standard items bring features found in other parts of Qt to the Graphics View framework, including rich text editing, Web browsing, display of SVG drawings and the use of shapes, paths and images. Items on a scene can also be rendered independently of any attached view, enabling scenes to be rendered to image files and printed to PDF files or printers.


A fully-featured event model enables events to be handled efficiently by dispatching them only to the items that require them. Since basic item handling is performed by the framework, items only need to respond to events if they need particular information about their environment.
A fully-featured event model enables events to be handled efficiently by dispatching them only to the items that require them. Since basic item handling is performed by the framework, items only need to respond to events if they need particular information about their environment.
Line 331: Line 338:
Applications that need to mix classical user interface elements with interactive content can embed widgets directly into a scene using '''QGraphicsProxyWidget''', or create widget-like elements from scratch with '''QGraphicsWidget'''. As with conventional user interfaces, layout managers can be used to arrange widgets and items in a scene.
Applications that need to mix classical user interface elements with interactive content can embed widgets directly into a scene using '''QGraphicsProxyWidget''', or create widget-like elements from scratch with '''QGraphicsWidget'''. As with conventional user interfaces, layout managers can be used to arrange widgets and items in a scene.


[[Image:svgviewer-example.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/svgviewer-example.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/svgviewer-example.png]]


''<span class="caps">SVG</span> drawings can be rendered onto any paint device supported by Qt.''
''SVG drawings can be rendered onto any paint device supported by Qt.''


==Scalable Vector Graphics (<span class="caps">SVG</span>)==
== Scalable Vector Graphics (SVG) ==


<span class="caps">SVG</span> is an <span class="caps">XML</span>-based file format and language for describing graphical applications that is commonly associated with two-dimensional Web-based graphics. <span class="caps">SVG</span> support in Qt is based on the <span class="caps">SVG</span> 1.1 standard, a World Wide Web Consortium (W3C) Recommendation, and provides additional features to support the Tiny profiles of <span class="caps">SVG</span> 1.1 and 1.2.
SVG is an XML-based file format and language for describing graphical applications that is commonly associated with two-dimensional Web-based graphics. SVG support in Qt is based on the SVG 1.1 standard, a World Wide Web Consortium (W3C®) Recommendation, and provides additional features to support the Tiny profiles of SVG 1.1 and 1.2.


Qt can render <span class="caps">SVG</span> drawings onto any paint device, including those for images and OpenGL widgets. This flexibility lets developers trade quality for speed as required. <span class="caps">SVG</span> drawings can also be used for icons in standard user interface controls, removing the need to generate bitmaps in a range of predefined sizes.
Qt can render SVG drawings onto any paint device, including those for images and OpenGL widgets. This flexibility lets developers trade quality for speed as required. SVG drawings can also be used for icons in standard user interface controls, removing the need to generate bitmaps in a range of predefined sizes.


Developers can also generate <span class="caps">SVG</span> drawings by using '''QPainter''' functions to draw on a specialized <span class="caps">SVG</span> paint device, allowing graphics used in applications to be exported as <span class="caps">SVG</span> drawings with little additional effort.
Developers can also generate SVG drawings by using '''QPainter''' functions to draw on a specialized SVG paint device, allowing graphics used in applications to be exported as SVG drawings with little additional effort.


==3D Graphics==
== 3D Graphics ==


OpenGL is a standard <span class="caps">API</span> for rendering 3D graphics that can be used by Qt developers to include 3D graphics in their <span class="caps">GUI</span> applications. Qt’s OpenGL module is available on Windows, X11, and Mac OS X, and uses each system’s OpenGL library.
OpenGL is a standard API for rendering 3D graphics that can be used by Qt developers to include 3D graphics in their GUI applications. Qt's OpenGL module is available on Windows, X11, and Mac OS X, and uses each system's OpenGL library.


To use OpenGL in a Qt application, developers only need to subclass '''<span class="caps">QGLW</span>idget''' and draw onto it with standard OpenGL functions. Qt provides functions to convert color values to OpenGL’s color format to help developers provide a consistent user interface for their applications.
To use OpenGL in a Qt application, developers only need to subclass '''QGLWidget''' and draw onto it with standard OpenGL functions. Qt provides functions to convert color values to OpenGL's color format to help developers provide a consistent user interface for their applications.


Qt also enables OpenGL features and extensions to be used conveniently from within Qt applications. Convenience functions allow textures to be created from images, and support for pixel buffers and framebuffer objects are provided by appropriate classes. Support for features such as sample buffers can be enabled if they are available on the underlying platform.
Qt also enables OpenGL features and extensions to be used conveniently from within Qt applications. Convenience functions allow textures to be created from images, and support for pixel buffers and framebuffer objects are provided by appropriate classes. Support for features such as sample buffers can be enabled if they are available on the underlying platform.


2D applications can use '''<span class="caps">QGLW</span>idget''' subclasses to improve rendering performance on appropriate hardware. In this use case, standard '''QPainter''' operations are translated into OpenGL calls. This also makes it possible to overlay controls and decorations onto 3D scenes drawn using pure OpenGL. On embedded platforms, where hardware acceleration is often limited, this paint engine is restricted to using the functionality of OpenGL ES 2.0, ensuring that it works well on as many devices as possible.
2D applications can use '''QGLWidget''' subclasses to improve rendering performance on appropriate hardware. In this use case, standard '''QPainter''' operations are translated into OpenGL calls. This also makes it possible to overlay controls and decorations onto 3D scenes drawn using pure OpenGL. On embedded platforms, where hardware acceleration is often limited, this paint engine is restricted to using the functionality of OpenGL ES 2.0, ensuring that it works well on as many devices as possible.


On suitable hardware, support for anti-aliased rendering can be enabled to enhance both the rendering speed and quality of graphics produced using the OpenGL paint engine. On less-capable hardware, developers can give users the choice between quality and speed by exposing these rendering options to users at run-time.
On suitable hardware, support for anti-aliased rendering can be enabled to enhance both the rendering speed and quality of graphics produced using the OpenGL paint engine. On less-capable hardware, developers can give users the choice between quality and speed by exposing these rendering options to users at run-time.


==Multimedia==
== Multimedia ==


Qt uses the Phonon multimedia framework, an open source project originating from the <span class="caps">KDE</span> project, to provide media playback features that can be accessed using a consistent, cross-platform <span class="caps">API</span>. Qt ensures that applications on Linux/Unix, Windows and Mac OS X transparently use the appropriate multimedia framework for each platform — this means that applications can also take advantage of platform-specific support for audio and video codecs and formats.
Qt uses the Phonon multimedia framework, an open source project originating from the KDE project, to provide media playback features that can be accessed using a consistent, cross-platform API. Qt ensures that applications on Linux/Unix, Windows and Mac OS X transparently use the appropriate multimedia framework for each platform — this means that applications can also take advantage of platform-specific support for audio and video codecs and formats.


Phonon’s features can be integrated into other technologies provided by Qt. For example, movie widgets can be added to Web pages displayed using the WebKit browser engine and to scenes rendered using the Graphics View framework.
Phonon's features can be integrated into other technologies provided by Qt. For example, movie widgets can be added to Web pages displayed using the WebKit browser engine and to scenes rendered using the Graphics View framework.


Additional classes for multimedia are included in the QtMultimedia module. These classes are focused on providing low-level access to audio and video data.
Additional classes for multimedia are included in the QtMultimedia module. These classes are focused on providing low-level access to audio and video data.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/qpainter.html QPainter Class Reference] ''[qt.io]'' [http://doc.qt.io/qt-4.8/graphicsview.html Graphics View Framework] ''[qt.io]''
&quot;QPainter Class Reference&amp;quot;:http://doc.qt.io/qt-4.8/qpainter.html &quot;Graphics View Framework&amp;quot;:http://doc.qt.io/qt-4.8/graphicsview.html


[http://doc.qt.io/qt-4.8/examples-opengl.html OpenGL Examples] ''[qt.io]'' [http://doc.qt.io/qt-4.8/qtmultimedia.html QtMultimedia Module] ''[qt.io]''
&quot;OpenGL Examples&amp;quot;:http://doc.qt.io/qt-4.8/examples-opengl.html &quot;QtMultimedia Module&amp;quot;:http://doc.qt.io/qt-4.8/qtmultimedia.html


[http://doc.qt.io/qt-4.8/qtsvg.html QtSvg Module] ''[qt.io]'' [http://doc.qt.io/qt-4.8/phonon-overview.html Phonon Multimedia Framework] ''[qt.io]''
&quot;QtSvg Module&amp;quot;:http://doc.qt.io/qt-4.8/qtsvg.html &quot;Phonon Multimedia Framework&amp;quot;:http://doc.qt.io/qt-4.8/phonon-overview.html


=Item Views=
= Item Views =


''Qt’s item view widgets provide standard <span class="caps">GUI</span> controls for displaying and modifying large quantities of data. The underlying model/view framework isolates the way data is stored from the way it is presented to the user, enabling features like data sharing, sorting and filtering, multiple views, and multiple data representations to be used for the same data.''
''Qt's item view widgets provide standard GUI controls for displaying and modifying large quantities of data. The underlying model/view framework isolates the way data is stored from the way it is presented to the user, enabling features like data sharing, sorting and filtering, multiple views, and multiple data representations to be used for the same data.''


When writing applications that process large quantities of data, developers typically rely on “item view” widgets to display items of data quickly and efficiently. Standard item views found in modern <span class="caps">GUI</span> toolkits include list views containing simple lists of items, tree views with hierarchical lists of items, and table views which provide layout features similar to those found in spreadsheet applications.
When writing applications that process large quantities of data, developers typically rely on &quot;item view&amp;quot; widgets to display items of data quickly and efficiently. Standard item views found in modern GUI toolkits include list views containing simple lists of items, tree views with hierarchical lists of items, and table views which provide layout features similar to those found in spreadsheet applications.


[[Image:cleanlooks-treeview.png]] [[Image:plastique-listview.png]] [[Image:macintosh-tableview.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/cleanlooks-treeview.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/cleanlooks-treeview.png]] [[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/plastique-listview.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/plastique-listview.png]] [[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/macintosh-tableview.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/macintosh-tableview.png]]


''Qt provides standard item views for trees, lists and tables of items.''
''Qt provides standard item views for trees, lists and tables of items.''


Qt’s item view classes are available in two different forms: as classic item view widgets and as model/view components. Classic list, table and tree widgets are self-contained item views that manage item objects explicitly created by the developer.
Qt's item view classes are available in two different forms: as classic item view widgets and as model/view components. Classic list, table and tree widgets are self-contained item views that manage item objects explicitly created by the developer.


'''QListView''', '''QTableView''' and '''QTreeView''' are the equivalent model/view components to the classic item views. These model/view components provide a cleaner, component-oriented way to handle data sets. Additionally, a set of standard models are provided to help developers organize their data.
'''QListView''', '''QTableView''' and '''QTreeView''' are the equivalent model/view components to the classic item views. These model/view components provide a cleaner, component-oriented way to handle data sets. Additionally, a set of standard models are provided to help developers organize their data.


==Standard Item Views==
== Standard Item Views ==


Standard implementations of list widgets, icon views, tree widgets, and tables are supplied with Qt. These support drag and drop operations within the same view and between different views. As with all Qt widgets, they are also fully integrated with Qt’s resource system.
Standard implementations of list widgets, icon views, tree widgets, and tables are supplied with Qt. These support drag and drop operations within the same view and between different views. As with all Qt widgets, they are also fully integrated with Qt's resource system.


Item view classes are used to display data for various standard dialogs in Qt (Figure ) and are extensively used in ''Qt Designer'', ''Qt Assistant'', and ''Qt Linguist''.
Item view classes are used to display data for various standard dialogs in Qt (Figure ) and are extensively used in ''Qt Designer'', ''Qt Assistant'', and ''Qt Linguist''.
Line 393: Line 400:
Classic item views are typically used to display and manage a few hundred items of data, using an architecture that uses individual objects to encapsulate pieces of data. This approach should be familiar to existing Qt developers, and provides a convenient way to rapidly construct rich user interfaces for handling moderate amounts of data.
Classic item views are typically used to display and manage a few hundred items of data, using an architecture that uses individual objects to encapsulate pieces of data. This approach should be familiar to existing Qt developers, and provides a convenient way to rapidly construct rich user interfaces for handling moderate amounts of data.


For consistency and reliability, the classic item views are built upon Qt’s model/view framework, which provides a more scalable and customizable way to handle item view data.
For consistency and reliability, the classic item views are built upon Qt's model/view framework, which provides a more scalable and customizable way to handle item view data.


==Qt’s Model/View Framework==
== Qt's Model/View Framework ==


The model/view framework provided by Qt is a variation of the well-known ''Model-View-Controller'' pattern, adapted specially for Qt’s item views. In this approach, models are used to supply data to other components, views display items of data to the user, and delegates handle aspects of the rendering and editing processes.
The model/view framework provided by Qt is a variation of the well-known ''Model-View-Controller'' pattern, adapted specially for Qt's item views. In this approach, models are used to supply data to other components, views display items of data to the user, and delegates handle aspects of the rendering and editing processes.


[[Image:modelview-delegates.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/modelview-delegates.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/modelview-delegates.png]]


''The component-oriented architecture of the model/view framework makes it easy to customize item views.''
''The component-oriented architecture of the model/view framework makes it easy to customize item views.''
Line 409: Line 416:
* Since models provide a standard interface for accessing data, they can be designed and written separately from other components, and replaced if necessary.
* Since models provide a standard interface for accessing data, they can be designed and written separately from other components, and replaced if necessary.
* Data obtained from models can be shared between views. This enablesapplications to provide multiple views onto the same data set, andpotentially show different representations of data.
* Data obtained from models can be shared between views. This enablesapplications to provide multiple views onto the same data set, andpotentially show different representations of data.
* Selections can be shared between views, or kept separate, dependingon the user’s requirements and expectations.
* Selections can be shared between views, or kept separate, dependingon the user's requirements and expectations.
* For standard list, tree, and table views, most of the rendering isperformed by delegates. This makes it easy to customize views formost purposes without having to write a lot of new code.
* For standard list, tree, and table views, most of the rendering isperformed by delegates. This makes it easy to customize views formost purposes without having to write a lot of new code.
* By using ''proxy models'', data supplied by models can be transformed before it is supplied to views. This enablesapplications to provide sorting and filtering facilities that can be shared between multiple views.
* By using ''proxy models'', data supplied by models can be transformed before it is supplied to views. This enablesapplications to provide sorting and filtering facilities that can be shared between multiple views.


The model/view system is also used by Qt’s <span class="caps">SQL</span> models to make database integration simpler for non-database developers.
The model/view system is also used by Qt's SQL models to make database integration simpler for non-database developers.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/model-view-programming.html Model/View Programming] ''[qt.io]''
&quot;Model/View Programming&amp;quot;:http://doc.qt.io/qt-4.8/model-view-programming.html


[http://doc.qt.io/qt-4.8/all-examples.html Qt Examples] ''[qt.io]''
&quot;Qt Examples&amp;quot;:http://doc.qt.io/qt-4.8/all-examples.html


=Text Handling=
= Text Handling =


''Qt provides a powerful text editor widget that allows the user to create and edit rich text documents, and can be used to prepare documents for printing. The underlying document structure used by the editor is fully accessible to developers, allowing both the structure and content of documents to be manipulated.''
''Qt provides a powerful text editor widget that allows the user to create and edit rich text documents, and can be used to prepare documents for printing. The underlying document structure used by the editor is fully accessible to developers, allowing both the structure and content of documents to be manipulated.''


Rich text documents typically contain text in a variety of fonts, colors, and sizes arranged in a series of paragraphs. Text can also be organized using lists and tables, and may be visually separated from the main body of a document by using frames. The appearance of each document element can be precisely adjusted using the many properties made available to developers through the rich text <span class="caps">API</span>.
Rich text documents typically contain text in a variety of fonts, colors, and sizes arranged in a series of paragraphs. Text can also be organized using lists and tables, and may be visually separated from the main body of a document by using frames. The appearance of each document element can be precisely adjusted using the many properties made available to developers through the rich text API.


[[Image:textedit-demo.png]] [[Image:textedit-OpenOffice.org.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/textedit-demo.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/textedit-demo.png]] [[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/textedit-OpenOffice.org.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/textedit-OpenOffice.org.png]]


''Qt’s advanced rich text document features allow complex documents to be created and edited in '''QTextEdit''' (left). Documents can be exported in OpenDocument format for use in suitable document processors (right).''
''Qt's advanced rich text document features allow complex documents to be created and edited in '''QTextEdit''' (left). Documents can be exported in OpenDocument format for use in suitable document processors (right).''


==Rich Text Editing==
== Rich Text Editing ==


Interactive rich text display and editing are handled in Qt by the '''QTextBrowser''' and '''QTextEdit''' widgets. These widgets fully support Unicode and are built on a structured document representation provided by '''QTextDocument''' that removes the need to use intermediate mark up languages to create rich text. '''QTextDocument''' also provides support for importing and exporting a subset of <span class="caps">HTML</span> 4.0, full undo/redo capabilities (including grouping of operations), and resource handling.
Interactive rich text display and editing are handled in Qt by the '''QTextBrowser''' and '''QTextEdit''' widgets. These widgets fully support Unicode and are built on a structured document representation provided by '''QTextDocument''' that removes the need to use intermediate mark up languages to create rich text. '''QTextDocument''' also provides support for importing and exporting a subset of HTML 4.0, full undo/redo capabilities (including grouping of operations), and resource handling.


Qt provides an object-based <span class="caps">API</span> for documents that helps developers obtain a high-level overview of their structures. A cursor-based <span class="caps">API</span> is also provided to allow convenient exploration, processing and transformation of documents. In addition to the classes corresponding to structure and content, there are a number of classes which control the appearance of text and document elements. These allow the text styles for tables, lists, frames, and ordinary paragraphs to be customized to give documents the desired appearance.
Qt provides an object-based API for documents that helps developers obtain a high-level overview of their structures. A cursor-based API is also provided to allow convenient exploration, processing and transformation of documents. In addition to the classes corresponding to structure and content, there are a number of classes which control the appearance of text and document elements. These allow the text styles for tables, lists, frames, and ordinary paragraphs to be customized to give documents the desired appearance.


Documents created programatically remain editable in '''QTextEdit''' widgets and maintain a full undo/redo history. Developers can augment the standard editing features available to let users add custom structures and content.
Documents created programatically remain editable in '''QTextEdit''' widgets and maintain a full undo/redo history. Developers can augment the standard editing features available to let users add custom structures and content.


==Customization, Printing and Document Export==
== Customization, Printing and Document Export ==


Qt’s text handling features can also be used to provide specialized text formatting for custom widgets and rich text documents. These can be written using low-level classes such as '''QTextLayout''' to lay out the text line by line, and integrated into the extensible text layout system provided by '''QTextDocument''' for use with '''QTextEdit'''.
Qt's text handling features can also be used to provide specialized text formatting for custom widgets and rich text documents. These can be written using low-level classes such as '''QTextLayout''' to lay out the text line by line, and integrated into the extensible text layout system provided by '''QTextDocument''' for use with '''QTextEdit'''.


Syntax highlighting rules can also be applied to rich text documents with the '''QSyntaxHighlighter''' class. This allows a standard '''QTextEdit''' widget to be used as the basis for a code editor, or to provide highlighting facilities for document search tools.
Syntax highlighting rules can also be applied to rich text documents with the '''QSyntaxHighlighter''' class. This allows a standard '''QTextEdit''' widget to be used as the basis for a code editor, or to provide highlighting facilities for document search tools.
Line 447: Line 454:
Documents can also be formatted according to information obtained from a '''QPrintDialog''' into a series of pages suitable for printing with a '''QPrinter'''.
Documents can also be formatted according to information obtained from a '''QPrintDialog''' into a series of pages suitable for printing with a '''QPrinter'''.


The '''QTextDocumentWriter''' class provides support for document export to <span class="caps">HTML</span>, plain text and OpenDocument Format (<span class="caps">ODF</span>) files. This class exposes its functionality via a generic <span class="caps">API</span> and is designed to be extended to support additional formats in future releases.
The '''QTextDocumentWriter''' class provides support for document export to HTML, plain text and OpenDocument Format (ODF) files. This class exposes its functionality via a generic API and is designed to be extended to support additional formats in future releases.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/qt4-scribe.html The Scribe Classes] ''[qt.io]''
&quot;The Scribe Classes&amp;quot;:http://doc.qt.io/qt-4.8/qt4-scribe.html


[http://doc.qt.io/qt-4.8/richtext.html Rich Text Processing] ''[qt.io]''
&quot;Rich Text Processing&amp;quot;:http://doc.qt.io/qt-4.8/richtext.html


[http://doc.qt.io/qt-4.8/qtextdocumentwriter.html QTextDocumentWriter Class Reference] ''[qt.io]''
&quot;QTextDocumentWriter Class Reference&amp;quot;:http://doc.qt.io/qt-4.8/qtextdocumentwriter.html


=Web Integration with WebKit=
= Web Integration with WebKit =


''Qt’s integration with the WebKit browser engine enables developers to introduce Web functionality into their applications by using Qt-style <span class="caps">API</span>s and paradigms to display and interact with Web content.''
''Qt's integration with the WebKit browser engine enables developers to introduce Web functionality into their applications by using Qt-style APIs and paradigms to display and interact with Web content.''


Qt includes integrated support for WebKit, a fully-featured open source Web rendering engine with a focus on stability and performance. The version of WebKit supplied with Qt supports a number of Web standards, including <span class="caps">HTML</span> 4.01, <span class="caps">XHTML</span> 1.1, <span class="caps">CSS</span> 2.1 and JavaScript 1.5. More advanced features are also available — these are presented in the [http://qt.digia.com/forms/whitepapers/reg-whitepaper-hybrid/ WebKit in Qt] ''[qt.digia.com]'' whitepaper.
Qt includes integrated support for WebKit, a fully-featured open source Web rendering engine with a focus on stability and performance. The version of WebKit supplied with Qt supports a number of Web standards, including HTML 4.01, XHTML 1.1, CSS 2.1 and JavaScript 1.5. More advanced features are also available — these are presented in the &quot;WebKit in Qt&amp;quot;:http://qt.digia.com/forms/whitepapers/reg-whitepaper-hybrid/ whitepaper.


WebKit’s networking is transparently handled using Qt’s networking classes, providing browser components with a fully-compliant <span class="caps">HTTP</span> 1.1 implementation support for Secure Sockets Layer (<span class="caps">SSL</span>) communication and proxy support.
WebKit's networking is transparently handled using Qt's networking classes, providing browser components with a fully-compliant HTTP 1.1 implementation support for Secure Sockets Layer (SSL) communication and proxy support.


[[Image:webkit-plus-graphics-view.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/webkit-plus-graphics-view.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/webkit-plus-graphics-view.png]]


''Qt widgets can be embedded into Web pages displayed with Qt’s WebKit integration; Web Pages can be displayed as items in the Graphics View framework.''
''Qt widgets can be embedded into Web pages displayed with Qt's WebKit integration; Web Pages can be displayed as items in the Graphics View framework.''


==Native Application Integration==
== Native Application Integration ==


Qt’s support for WebKit goes beyond just rendering <span class="caps">HTML</span> by exposing features of WebKit to applications using Qt’s paradigms. For example, support for Qt’s signals and slots communication mechanism makes it easier for developers to connect Web components to widgets and other application objects.
Qt's support for WebKit goes beyond just rendering HTML by exposing features of WebKit to applications using Qt's paradigms. For example, support for Qt's signals and slots communication mechanism makes it easier for developers to connect Web components to widgets and other application objects.


Conversely, the integration between Qt and the browser engine enables native Qt controls to be included within Web pages, making it possible to combine Web content with highly-dynamic native user interfaces.
Conversely, the integration between Qt and the browser engine enables native Qt controls to be included within Web pages, making it possible to combine Web content with highly-dynamic native user interfaces.


WebKit also enables Web applications to use native storage for persistent data, and this features is supported by Qt. Developers can enable native storage for applications that interoperate with remote services, and take advantage of configuration options to set an appropriate location and quota for it on the user’s system.
WebKit also enables Web applications to use native storage for persistent data, and this features is supported by Qt. Developers can enable native storage for applications that interoperate with remote services, and take advantage of configuration options to set an appropriate location and quota for it on the user's system.


==<span class="caps">DOM</span> Access <span class="caps">API</span>==
== DOM Access API ==


The standard way to manipulate the structure of Web pages is via a Document Object Model (<span class="caps">DOM</span>) <span class="caps">API</span>. Qt’s WebKit integration includes an implementation of the W3C selector <span class="caps">API</span> that provides a very simple way to access and manipulate page structures.
The standard way to manipulate the structure of Web pages is via a Document Object Model (DOM) API. Qt's WebKit integration includes an implementation of the W3C selector API that provides a very simple way to access and manipulate page structures.


This <span class="caps">API</span> makes it intuitive to access the <span class="caps">DOM</span> by letting developers reuse their <span class="caps">CSS</span> selector knowledge, and results in little maintenance or footprint overhead.
This API makes it intuitive to access the DOM by letting developers reuse their CSS selector knowledge, and results in little maintenance or footprint overhead.


==Netscape Plugin Support==
== Netscape Plugin Support ==


Plugins conforming to the Netscape plugin <span class="caps">API</span>, a de-facto standard for third party browser components, can be embedded and displayed in Web pages rendered by Qt’s WebKit integration. Configuration of this feature is performed via a Qt class that is also used to configure other kinds of plugins, such as widget plugins exposed by the application to the Web environment.
Plugins conforming to the Netscape plugin API, a de-facto standard for third party browser components, can be embedded and displayed in Web pages rendered by Qt's WebKit integration. Configuration of this feature is performed via a Qt class that is also used to configure other kinds of plugins, such as widget plugins exposed by the application to the Web environment.


[[Image:webkit-netscape-plugin.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/webkit-netscape-plugin.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/webkit-netscape-plugin.png]]


''Third party browser plugins are supported by Qt and WebKit via the Netscape plugin <span class="caps">API</span>.''
''Third party browser plugins are supported by Qt and WebKit via the Netscape plugin API.''


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/qtwebkit.html WebKit in Qt] ''[qt.io]''
&quot;WebKit in Qt&amp;quot;:http://doc.qt.io/qt-4.8/qtwebkit.html


[http://doc.qt.io/qt-4.8/demos-browser.html Web Browser] ''[qt.io]''
&quot;Web Browser&amp;quot;:http://doc.qt.io/qt-4.8/demos-browser.html


=Databases=
= Databases =


''The Qt <span class="caps">SQL</span> module simplifies the creation of cross-platform <span class="caps">GUI</span> database applications. Programmers can easily execute <span class="caps">SQL</span> statements, use database models to supply information to item views for visualization and data entry purposes, and use widget mappers to relate database tables to specific widgets in form-based user interfaces.''
''The Qt SQL module simplifies the creation of cross-platform GUI database applications. Programmers can easily execute SQL statements, use database models to supply information to item views for visualization and data entry purposes, and use widget mappers to relate database tables to specific widgets in form-based user interfaces.''


The Qt <span class="caps">SQL</span> module provides a cross-platform interface for accessing <span class="caps">SQL</span> databases, and includes native drivers for Oracle, Microsoft <span class="caps">SQL</span> Server, Sybase Adaptive Server, <span class="caps">IBM</span> DB2, PostgreSQL, MySQL, Borland Interbase, <span class="caps">SQL</span>ite and <span class="caps">ODBC</span>. The drivers work on all platforms supported by Qt for which client libraries are available. Applications can access multiple databases using multiple drivers simultaneously. Distributions of Qt include the <span class="caps">SQL</span>ite database, and the Qt <span class="caps">SQL</span> module is built with support for this database by default.
The Qt SQL module provides a cross-platform interface for accessing SQL databases, and includes native drivers for Oracle, Microsoft SQL Server, Sybase Adaptive Server, IBM DB2, PostgreSQL, MySQL, Borland Interbase, SQLite and ODBC. The drivers work on all platforms supported by Qt for which client libraries are available. Applications can access multiple databases using multiple drivers simultaneously. Distributions of Qt include the SQLite database, and the Qt SQL module is built with support for this database by default.


Developers can easily execute any <span class="caps">SQL</span> statements. Qt also provides a high-level C++ interface that can be used to generate the appropriate <span class="caps">SQL</span> statements automatically.
Developers can easily execute any SQL statements. Qt also provides a high-level C++ interface that can be used to generate the appropriate SQL statements automatically.


Qt provides a set of <span class="caps">SQL</span> models for use with the other model/view components. These enable view widgets to be automatically populated with the results of database queries, and simplify the process of editing for both users and non-database developers.
Qt provides a set of SQL models for use with the other model/view components. These enable view widgets to be automatically populated with the results of database queries, and simplify the process of editing for both users and non-database developers.


Using the facilities that the <span class="caps">SQL</span> module provides, it is straightforward to create database applications that use foreign key lookups and present master-detail relationships.
Using the facilities that the SQL module provides, it is straightforward to create database applications that use foreign key lookups and present master-detail relationships.


==Executing <span class="caps">SQL</span> Commands==
== Executing SQL Commands ==


The '''QSqlQuery''' class is used to directly execute any <span class="caps">SQL</span> statement and navigate the result sets produced by <code><span class="caps">SELECT</span></code> statements. The <code><span class="caps">INSERT</span></code>, <code><span class="caps">UPDATE</span></code>, and <code><span class="caps">DELETE</span></code> statements are equally simple to use.
The '''QSqlQuery''' class is used to directly execute any SQL statement and navigate the result sets produced by &lt;code&amp;gt;SELECT&amp;lt;/code&amp;gt; statements. The &lt;code&amp;gt;INSERT&amp;lt;/code&amp;gt;, &lt;code&amp;gt;UPDATE&amp;lt;/code&amp;gt;, and &lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; statements are equally simple to use.


Qt’s <span class="caps">SQL</span> module also supports value binding and prepared queries. Value binding can be achieved using named binding and named placeholders, or using positional binding with named or positional placeholders. Qt’s binding syntax works with all supported databases, either using the underlying database support or by emulation.
Qt's SQL module also supports value binding and prepared queries. Value binding can be achieved using named binding and named placeholders, or using positional binding with named or positional placeholders. Qt's binding syntax works with all supported databases, either using the underlying database support or by emulation.


==<span class="caps">SQL</span> Models==
== SQL Models ==


Qt also provides a number of model classes for use with other components in the model/view framework. These allow the developer to set up <span class="caps">SQL</span> queries to automatically provide table views with items of data from a database.
Qt also provides a number of model classes for use with other components in the model/view framework. These allow the developer to set up SQL queries to automatically provide table views with items of data from a database.


Using these database models with other components in the model/view framework requires a minimum of work for developers. Setting up a query model is simply a matter of specifying a query and choosing which headers to examine, and setting up a table view to display the results of the query is similarly straightforward.
Using these database models with other components in the model/view framework requires a minimum of work for developers. Setting up a query model is simply a matter of specifying a query and choosing which headers to examine, and setting up a table view to display the results of the query is similarly straightforward.


Models are provided for accessing <span class="caps">SQL</span> tables in different ways. These include a read-only data model for <span class="caps">SQL</span> result sets, an editable data model for a single database table, and a relational model that allows columns to be set as foreign keys into other database tables. The Qt Books demonstration shown in Figure uses a relational database model to find information about each of the books in a table.
Models are provided for accessing SQL tables in different ways. These include a read-only data model for SQL result sets, an editable data model for a single database table, and a relational model that allows columns to be set as foreign keys into other database tables. The Qt Books demonstration shown in Figure uses a relational database model to find information about each of the books in a table.


The model/view framework contains a number of features that accommodate the requirements of database applications. These include support for transactions and the option to allow the contents of table to be edited on a per-row basis to avoid unnecessary round trips to a database.
The model/view framework contains a number of features that accommodate the requirements of database applications. These include support for transactions and the option to allow the contents of table to be edited on a per-row basis to avoid unnecessary round trips to a database.


[[Image:books-demo.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/books-demo.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/books-demo.png]]


''The Qt Books demonstration shows the integration between Qt’s <span class="caps">SQL</span> classes and the model/view framework.''
''The Qt Books demonstration shows the integration between Qt's SQL classes and the model/view framework.''


==Data-Aware Widgets==
== Data-Aware Widgets ==


Qt provides facilities to allow data obtained from models, such as the <span class="caps">SQL</span> models described above, to be related to specific widgets in a window, allowing the user to see a cross-section of the data available from different locations in the underlying data store. This makes it easier to create data-entry applications with conventional form-based user interfaces.
Qt provides facilities to allow data obtained from models, such as the SQL models described above, to be related to specific widgets in a window, allowing the user to see a cross-section of the data available from different locations in the underlying data store. This makes it easier to create data-entry applications with conventional form-based user interfaces.


The '''QDataWidgetMapper''' class is used to set up the mapping between a model and a selection of widgets. In the Books demonstration supplied with Qt (see above), a data mapper is constructed and assigned to a model, then each of the widgets used to edit fields in the database is mapped to a column.
The '''QDataWidgetMapper''' class is used to set up the mapping between a model and a selection of widgets. In the Books demonstration supplied with Qt (see above), a data mapper is constructed and assigned to a model, then each of the widgets used to edit fields in the database is mapped to a column.
Line 537: Line 544:
The data mapper can be used directly to step through rows in a model, mapping the item in each column to a specific widget, and using it to display the data obtained. Navigation functions make it simple to connect easy-to-use navigation controls to the mapper.
The data mapper can be used directly to step through rows in a model, mapping the item in each column to a specific widget, and using it to display the data obtained. Navigation functions make it simple to connect easy-to-use navigation controls to the mapper.


Since the class also provides a similar <span class="caps">API</span> to the item view classes, different cross-sections of a model can be obtained by changing the mapper’s configuration. The use of the model/view <span class="caps">API</span> also makes it possible for a data mapper to respond to changes to the underlying model. The Books demonstration updates the mapping whenever the user selects a different row in a table view; this behavior is set up with a simple signal-to-slot connection.
Since the class also provides a similar API to the item view classes, different cross-sections of a model can be obtained by changing the mapper's configuration. The use of the model/view API also makes it possible for a data mapper to respond to changes to the underlying model. The Books demonstration updates the mapping whenever the user selects a different row in a table view; this behavior is set up with a simple signal-to-slot connection.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/qtsql.html QtSql Module] ''[qt.io]''
&quot;QtSql Module&amp;quot;:http://doc.qt.io/qt-4.8/qtsql.html


[http://doc.qt.io/qt-4.8/qt4-sql.html The Qt 4 Database <span class="caps">GUI</span> Layer] ''[qt.io]''
&quot;The Qt 4 Database GUI Layer&amp;quot;:http://doc.qt.io/qt-4.8/qt4-sql.html


[http://doc.qt.io/qt-4.8/examples-sql.html <span class="caps">SQL</span> Examples] ''[qt.io]''
&quot;SQL Examples&amp;quot;:http://doc.qt.io/qt-4.8/examples-sql.html


=Internationalization=
= Internationalization =


''Qt fully supports Unicode, the international standard character set. Programmers can freely mix Arabic, English, Hebrew, Japanese, Russian, and other languages supported by Unicode in their applications. Qt also includes tools to support application translation and localization.''
''Qt fully supports Unicode, the international standard character set. Programmers can freely mix Arabic, English, Hebrew, Japanese, Russian, and other languages supported by Unicode in their applications. Qt also includes tools to support application translation and localization.''


Qt supports the Unicode version 5.0 character encoding and uses the '''QString''' class to store Unicode strings, both for the <span class="caps">API</span> and internally.
Qt supports the Unicode version 5.0 character encoding and uses the '''QString''' class to store Unicode strings, both for the API and internally.
 
An extensible set of text codecs provide support for different encodings and charsets, including Big5 and GBK for Chinese, EUC-JP, JIS, and Shift-JIS for Japanese, KOI8-R for Russian, and the ISO-8859 series of standard encodings^1. Qt uses text codecs for fonts, input-output, and input methods.
 
Built-in locale support enables number-to-string and string-to-number conversions to be adapted to suit the user's geographical location and language preferences.
 
Qt includes a set of tools to facilitate the translation process that support XML Localization Interchange File Format (XLIFF), GNU Gettext PO format and Qt's Translation Source (TS) files.
 
== Text Entry and Rendering ==


An extensible set of text codecs provide support for different encodings and charsets, including Big5 and <span class="caps">GBK</span> for Chinese, <span class="caps">EUC</span>-JP, <span class="caps">JIS</span>, and Shift-<span class="caps">JIS</span> for Japanese, KOI8-R for Russian, and the <span class="caps">ISO</span>-8859 series of standard encodings^1. Qt uses text codecs for fonts, input-output, and input methods.
Far-Eastern writing systems require many more characters than are available on a keyboard. The conversion from a sequence of key presses to actual characters is performed at the window-system level by software called ''input methods''. Qt automatically supports the installed input methods on a user's system.


Built-in locale support enables number-to-string and string-to-number conversions to be adapted to suit the user’s geographical location and language preferences.
Qt provides a powerful text-rendering engine for all on-screen text, supporting advanced features such as special line breaking behavior, bidirectional writing, and diacritical marks. It renders most of the world's writing systems, including Arabic, Chinese, Cyrillic, English, Greek, Hebrew, Japanese, Korean, Latin, and Vietnamese. Qt will automatically combine the installed fonts to render multi-language text.


Qt includes a set of tools to facilitate the translation process that support <span class="caps">XML</span> Localization Interchange File Format (<span class="caps">XLIFF</span>), <span class="caps">GNU</span> Gettext PO format and Qt’s Translation Source (TS) files.
== Translating Applications ==


==Text Entry and Rendering==
Qt provides tools and functions to help developers provide applications in their users' native languages. Qt itself contains about several hundred user-visible strings, for which Qt Development Frameworks provides French, German and Simplified Chinese translations.


Far-Eastern writing systems require many more characters than are available on a keyboard. The conversion from a sequence of key presses to actual characters is performed at the window-system level by software called ''input methods''. Qt automatically supports the installed input methods on a user’s system.
To make strings translatable, developers simply wrap them in calls to the &lt;code&amp;gt;tr()&lt;/code&amp;gt; translation function, and can supply additional information to human translators with special C and C++ comments.


Qt provides a powerful text-rendering engine for all on-screen text, supporting advanced features such as special line breaking behavior, bidirectional writing, and diacritical marks. It renders most of the world’s writing systems, including Arabic, Chinese, Cyrillic, English, Greek, Hebrew, Japanese, Korean, Latin, and Vietnamese. Qt will automatically combine the installed fonts to render multi-language text.
</code>//: This name refers to a host name.


==Translating Applications==
hostNameLabel-&gt;setText(tr(&quot;Name:&quot;));


Qt provides tools and functions to help developers provide applications in their users’ native languages. Qt itself contains about several hundred user-visible strings, for which Qt Development Frameworks provides French, German and Simplified Chinese translations.
/*: This text refers to a C++ code example. */


To make strings translatable, developers simply wrap them in calls to the <code>tr()</code> translation function, and can supply additional information to human translators with special C and C++ comments.
QString example = tr(&quot;Example&amp;quot;);<code>


Along with the context, this comment information helps translators to accurately translate user-visible strings. Optional arguments can also be used to help with the translation of plural forms.
Along with the context, this comment information helps translators to accurately translate user-visible strings. Optional arguments can also be used to help with the translation of plural forms.
Line 577: Line 592:
At run-time, applications use '''QTranslator''' objects to load translation files. Each file contains the translations for a particular language. The language can be chosen at run-time, in accordance with the locale or user preferences.
At run-time, applications use '''QTranslator''' objects to load translation files. Each file contains the translations for a particular language. The language can be chosen at run-time, in accordance with the locale or user preferences.


Translators can edit translation files conveniently using ''Qt Linguist'', a <span class="caps">GUI</span> application for performing translation work. The contexts are listed in the left-hand side of the application’s window, and the list of source texts for the current context is displayed in the top-right area, along with translations and their current states (unfinished, obsolete, done). The user interface can be navigated via the keyboard; its dockable windows can be reorganized to suit the translators’ preferences.
Translators can edit translation files conveniently using ''Qt Linguist'', a GUI application for performing translation work. The contexts are listed in the left-hand side of the application's window, and the list of source texts for the current context is displayed in the top-right area, along with translations and their current states (unfinished, obsolete, done). The user interface can be navigated via the keyboard; its dockable windows can be reorganized to suit the translators' preferences.


Applications often use the same phrases many times in different source texts. ''Qt Linguist'' automatically displays intelligent guesses based on previously translated strings and predefined translations; these often serve as a good starting point for new translations. Common translations can also be stored in phrasebooks to make the translation of future applications more efficient. ''Qt Linguist'' can optionally validate translations to ensure that accelerators and ending punctuation are translated correctly.
Applications often use the same phrases many times in different source texts. ''Qt Linguist'' automatically displays intelligent guesses based on previously translated strings and predefined translations; these often serve as a good starting point for new translations. Common translations can also be stored in phrasebooks to make the translation of future applications more efficient. ''Qt Linguist'' can optionally validate translations to ensure that accelerators and ending punctuation are translated correctly.


''Qt Linguist''’s comprehensive manual provides relevant information about the translation process for release managers, translators, and programmers.
''Qt Linguist'''s comprehensive manual provides relevant information about the translation process for release managers, translators, and programmers.


[[Image:qt-linguist.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qt-linguist.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qt-linguist.png]]


''Working on French and Simplified Chinese translations simultaneously with Qt Linguist.''
''Working on French and Simplified Chinese translations simultaneously with Qt Linguist.''


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/i18n.html Qt Classes for Internationalization] ''[qt.io]'' [http://doc.qt.io/qt-4.8/linguist-manual.html Qt Linguist Manual] ''[qt.io]''
&quot;Qt Classes for Internationalization&amp;quot;:http://doc.qt.io/qt-4.8/i18n.html &quot;Qt Linguist Manual&amp;quot;:http://doc.qt.io/qt-4.8/linguist-manual.html


[http://doc.qt.io/qt-4.8/unicode.html Unicode in Qt] ''[qt.io]'' [http://doc.qt.io/qt-4.8/qtextcodec.html QTextCodec Class Reference] ''[qt.io]''
&quot;Unicode in Qt&amp;quot;:http://doc.qt.io/qt-4.8/unicode.html &quot;QTextCodec Class Reference&amp;quot;:http://doc.qt.io/qt-4.8/qtextcodec.html


=Qt Script=
= Qt Script =


''Qt Script is an interpreted <span class="caps">ECMAS</span>cript-based language which can be used to script Qt applications. The QtScript module provides an <span class="caps">API</span> that makes it easy to expose parts of an application to the scripting environment, including support for signals-slot communication and other standard Qt features.''
''Qt Script is an interpreted ECMAScript-based language which can be used to script Qt applications. The QtScript module provides an API that makes it easy to expose parts of an application to the scripting environment, including support for signals-slot communication and other standard Qt features.''


Application scripting allows users to customize and extend the features of applications by accessing simple <span class="caps">API</span>s for user-oriented scripting languages. Traditionally, Qt developers have used a variety of separate solutions to provide scripting support in their applications. The inclusion of Qt Script as a Qt module is intended to reduce the amount of effort required to implement scripting, while also making the process easier for developers who simply require scripting “out of the box”.
Application scripting allows users to customize and extend the features of applications by accessing simple APIs for user-oriented scripting languages. Traditionally, Qt developers have used a variety of separate solutions to provide scripting support in their applications. The inclusion of Qt Script as a Qt module is intended to reduce the amount of effort required to implement scripting, while also making the process easier for developers who simply require scripting &quot;out of the box&amp;quot;.


==Scripting Architecture==
== Scripting Architecture ==


The QtScript module provides an <span class="caps">API</span> based around the '''QScriptEngine''' and '''QScriptValue''' classes. These provide execution and data marshalling facilities.
The QtScript module provides an API based around the '''QScriptEngine''' and '''QScriptValue''' classes. These provide execution and data marshalling facilities.


Instances of '''QScriptEngine''' are responsible for executing Qt Script code within a scripting environment and provide facilities to expose instances of '''QObject''' subclasses to this environment. Additionally, '''QScriptEngine''' allows C++ data types to be converted to their Qt Script equivalents and inserted into the scripting environment. Qt Script data types are represented in C++ as '''QScriptValue''' instances which provide functions to convert data to C++ types.
Instances of '''QScriptEngine''' are responsible for executing Qt Script code within a scripting environment and provide facilities to expose instances of '''QObject''' subclasses to this environment. Additionally, '''QScriptEngine''' allows C++ data types to be converted to their Qt Script equivalents and inserted into the scripting environment. Qt Script data types are represented in C++ as '''QScriptValue''' instances which provide functions to convert data to C++ types.
Line 608: Line 623:


The simplest use of the QtScript module is to provide an interpreter for Qt Script that executes user-defined code.
The simplest use of the QtScript module is to provide an interpreter for Qt Script that executes user-defined code.
</code>QScriptEngine engine;
QScriptValue result = engine.evaluate(userCode);<code>


The '''QScriptEngine''' instance is also able to provide information about any syntax and run-time errors that occur.
The '''QScriptEngine''' instance is also able to provide information about any syntax and run-time errors that occur.


In the above image, we can see the use of the QtScript module’s features for integrating Qt Script into an application. A '''QObject'''-based wrapper for an image, providing a variety of functions and properties, is exposed to the scripting environment in the following way:
In the above image, we can see the use of the QtScript module's features for integrating Qt Script into an application. A '''QObject'''-based wrapper for an image, providing a variety of functions and properties, is exposed to the scripting environment in the following way:
 
</code>image = new ImageWrapper(this);
 
QScriptValue imageObject = engine.newQObject(image);


Once defined in the environment, the user can manipulate the image using a simplified <span class="caps">API</span> that hides all the low-level details of managing the application’s user interface.
engine.globalObject().setProperty(&quot;image&amp;quot;, imageObject);<code>


[[Image:qtscript-debugger.png]]
Once defined in the environment, the user can manipulate the image using a simplified API that hides all the low-level details of managing the application's user interface.


''Debugging a function using the Qt Script debugger’s user interface.''
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qtscript-debugger.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qtscript-debugger.png]]


==Debugging==
''Debugging a function using the Qt Script debugger's user interface.''
 
== Debugging ==


Support for debugging of scripts is provided by the QtScriptTools module, which includes a set of integrated graphical components that developers can use when creating scriptable applications.
Support for debugging of scripts is provided by the QtScriptTools module, which includes a set of integrated graphical components that developers can use when creating scriptable applications.
Line 631: Line 656:
If preferred, the debugger can be used without showing any of the user interface components; the developer has the option of keeping these hidden until an error occurs or a breakpoint is encountered.
If preferred, the debugger can be used without showing any of the user interface components; the developer has the option of keeping these hidden until an error occurs or a breakpoint is encountered.


A comprehensive user manual documents how to use the debugger’s user interface, and contains information on the commands that can be entered at the debugging console.
A comprehensive user manual documents how to use the debugger's user interface, and contains information on the commands that can be entered at the debugging console.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/qtscript.html QtScript Module] ''[qt.io]''
&quot;QtScript Module&amp;quot;:http://doc.qt.io/qt-4.8/qtscript.html


[http://doc.qt.io/qt-4.8/qtscripttools.html QtScriptTools Module] ''[qt.io]''
&quot;QtScriptTools Module&amp;quot;:http://doc.qt.io/qt-4.8/qtscripttools.html


=Styles and Themes=
= Styles and Themes =


''Qt automatically uses the native desktop style for an application’s look and feel. Qt applications respect user preferences for colors, fonts, sounds, and other desktop settings. Qt programmers are free to use any of the supplied styles and can override any preferences. Programmers can modify existing styles or implement their own styles using Qt’s powerful style engine.''
''Qt automatically uses the native desktop style for an application's look and feel. Qt applications respect user preferences for colors, fonts, sounds, and other desktop settings. Qt programmers are free to use any of the supplied styles and can override any preferences. Programmers can modify existing styles or implement their own styles using Qt's powerful style engine.''


A style implements the “look and feel” of the user interface on a particular platform. A style is a '''QStyle''' subclass that implements basic drawing functions such as drawing frames, buttons, and images. Qt performs all the widget drawing itself for maximum speed and flexibility.
A style implements the &quot;look and feel&amp;quot; of the user interface on a particular platform. A style is a '''QStyle''' subclass that implements basic drawing functions such as drawing frames, buttons, and images. Qt performs all the widget drawing itself for maximum speed and flexibility.


==Built-in Styles==
== Built-in Styles ==


Qt provides the following built-in styles: <span class="caps">CDE</span>, Cleanlooks, <span class="caps">GTK</span>, Motif, Mac OS X, Plastique, Windows, Windows XP, and Windows Vista. By default, Qt uses the appropriate style for the user’s platform and desktop environment. The style can also be chosen programmatically by the application developer, or by the user with the <code>-style</code> command line option.
Qt provides the following built-in styles: CDE, Cleanlooks, GTK, Motif, Mac OS X, Plastique, Windows, Windows XP, and Windows Vista. By default, Qt uses the appropriate style for the user's platform and desktop environment. The style can also be chosen programmatically by the application developer, or by the user with the &lt;code&amp;gt;-style&amp;lt;/code&amp;gt; command line option.


[[Image:qstyle-comboboxes.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qstyle-comboboxes.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qstyle-comboboxes.png]]


''Combo boxes in the different native styles.''
''Combo boxes in the different native styles.''


A style is complemented by the user’s desktop settings, which include the user’s preferences for colors, fonts, sounds, etc. Qt automatically adapts to the computer’s active theme. For example, Qt supports scroll and fade transition effects for menus and tooltips.
A style is complemented by the user's desktop settings, which include the user's preferences for colors, fonts, sounds, etc. Qt automatically adapts to the computer's active theme. For example, Qt supports scroll and fade transition effects for menus and tooltips.


The Windows and Mac OS X styles are built on top of native style managers, and are available only on their respective platforms. The other styles are emulated by Qt and are available everywhere.
The Windows and Mac OS X styles are built on top of native style managers, and are available only on their respective platforms. The other styles are emulated by Qt and are available everywhere.


The default styles on many modern X11 platforms are ''Plastique'', a style inspired by the Plastik widget style for <span class="caps">KDE</span>, and ''<span class="caps">GTK</span>'', which uses the <span class="caps">GTK</span>+ theme engine on <span class="caps">GNOME</span> desktops. An alternative style for <span class="caps">GTK</span>-based environments is Cleanlooks, a style designed to look like the Clearlooks theme for <span class="caps">GNOME</span>.
The default styles on many modern X11 platforms are ''Plastique'', a style inspired by the Plastik widget style for KDE, and ''GTK'', which uses the GTK+ theme engine on GNOME desktops. An alternative style for GTK-based environments is Cleanlooks, a style designed to look like the Clearlooks theme for GNOME.


Qt’s built-in widgets are style-aware. Custom widgets and dialogs are almost always combinations of built-in widgets and layouts, and automatically adapt to the style in use. On the rare occasions when it is necessary to write a custom widget from scratch, developers can use Qt’s style <span class="caps">API</span> to draw basic user-interface elements rather than drawing raw graphics primitives directly.
Qt's built-in widgets are style-aware. Custom widgets and dialogs are almost always combinations of built-in widgets and layouts, and automatically adapt to the style in use. On the rare occasions when it is necessary to write a custom widget from scratch, developers can use Qt's style API to draw basic user-interface elements rather than drawing raw graphics primitives directly.


Based on the translation file loaded, Qt applications automatically use right-to-left widget layouts rather than the default left-to-right scheme normally used. Additionally, when used in reversed mode, well-behaved styles render widgets with areas of light and shadow that are appropriate for the user’s desktop environment.
Based on the translation file loaded, Qt applications automatically use right-to-left widget layouts rather than the default left-to-right scheme normally used. Additionally, when used in reversed mode, well-behaved styles render widgets with areas of light and shadow that are appropriate for the user's desktop environment.


==Widget Style Sheets==
== Widget Style Sheets ==


Qt supports the use of widget style sheets with almost all standard widgets. These textual descriptions, written in a language similar to Cascading Style Sheets (<span class="caps">CSS</span>), are used to customize the appearance of widgets in much the same way that <span class="caps">CSS</span> descriptions are used to customize <span class="caps">HTML</span> rendering in <span class="caps">WWW</span> browsers. Each widget’s style sheet is accessed via its <code>styleSheet</code> property, available in '''QWidget''' and its subclasses, and this enables customizations to be easily applied to style-aware widgets while an application is running. Since this property is also available for editing in ''Qt Designer'', graphic designers can directly influence the look and feel of applications. For many common situations where customizations to standard widgets are required, the use of style sheets can eliminate the need for a custom style to be written.
Qt supports the use of widget style sheets with almost all standard widgets. These textual descriptions, written in a language similar to Cascading Style Sheets (CSS), are used to customize the appearance of widgets in much the same way that CSS descriptions are used to customize HTML rendering in WWW browsers. Each widget's style sheet is accessed via its &lt;code&amp;gt;styleSheet&amp;lt;/code&amp;gt; property, available in '''QWidget''' and its subclasses, and this enables customizations to be easily applied to style-aware widgets while an application is running. Since this property is also available for editing in ''Qt Designer'', graphic designers can directly influence the look and feel of applications. For many common situations where customizations to standard widgets are required, the use of style sheets can eliminate the need for a custom style to be written.


[[Image:stylesheets-coffee.png]] [[Image:stylesheets-pagefold.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/stylesheets-coffee.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/stylesheets-coffee.png]] [[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/stylesheets-pagefold.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/stylesheets-pagefold.png]]


''The Style Sheet example allows interactive experiments with style sheets.''
''The Style Sheet example allows interactive experiments with style sheets.''


==Custom Styles==
== Custom Styles ==


Custom styles are used to provide a distinct look to an application or family of applications. Custom styles can be defined by subclassing '''QStyle''' or any of its subclasses. It is easy to make small modifications to existing styles by reimplementing one or two virtual functions from the appropriate base class.
Custom styles are used to provide a distinct look to an application or family of applications. Custom styles can be defined by subclassing '''QStyle''' or any of its subclasses. It is easy to make small modifications to existing styles by reimplementing one or two virtual functions from the appropriate base class.


The style <span class="caps">API</span> provides information about each of the constituent components used to draw widgets, making it possible for highly customized styles to be created and fine-tuned.
The style API provides information about each of the constituent components used to draw widgets, making it possible for highly customized styles to be created and fine-tuned.


A style can also be compiled as a plugin. Plugins make it possible to preview a form using a custom style in ''Qt Designer'' without recompiling either Qt or ''Qt Designer'' itself. The style of an existing Qt application can be changed using a style plugin without recompiling the application. This enables applications like the Qt Styles example and the <code>qtconfig</code> tool to switch styles on-the-fly to provide previews for each of the available styles.
A style can also be compiled as a plugin. Plugins make it possible to preview a form using a custom style in ''Qt Designer'' without recompiling either Qt or ''Qt Designer'' itself. The style of an existing Qt application can be changed using a style plugin without recompiling the application. This enables applications like the Qt Styles example and the &lt;code&amp;gt;qtconfig&amp;lt;/code&amp;gt; tool to switch styles on-the-fly to provide previews for each of the available styles.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/widgets-styles.html Styles Example] ''[qt.io]''
&quot;Styles Example&amp;quot;:http://doc.qt.io/qt-4.8/widgets-styles.html


[http://doc.qt.io/qt-4.8/stylesheet.html Qt Style Sheets] ''[qt.io]''
&quot;Qt Style Sheets&amp;quot;:http://doc.qt.io/qt-4.8/stylesheet.html


=Input/Output and Networking=
= Input/Output and Networking =


''Qt can load and save data in plain text, <span class="caps">XML</span>, and binary formats. Qt handles local files using its own classes, and remote files using the <span class="caps">FTP</span> and <span class="caps">HTTP</span> protocols. Inter-process communication and socket-based <span class="caps">TCP</span> and <span class="caps">UDP</span> networking are fully supported, and information about the network interfaces available can be easily obtained.''
''Qt can load and save data in plain text, XML, and binary formats. Qt handles local files using its own classes, and remote files using the FTP and HTTP protocols. Inter-process communication and socket-based TCP and UDP networking are fully supported, and information about the network interfaces available can be easily obtained.''


==File Handling==
== File Handling ==


At the heart of Qt’s device handling infrastructure is '''<span class="caps">QIOD</span>evice''', a general base class for files, sockets and other devices, which can be subclassed to add support for custom devices. All devices are able to communicate using signals and slots, making it straightforward to integrate file and network communications into applications.
At the heart of Qt's device handling infrastructure is '''QIODevice''', a general base class for files, sockets and other devices, which can be subclassed to add support for custom devices. All devices are able to communicate using signals and slots, making it straightforward to integrate file and network communications into applications.


The '''QFile''' class supports large files, long file names, and internationalized file names. The '''QDir''' and '''QDirIterator''' classes are used to read and traverse directories, and can be used to manipulate path names, create directories, delete files, and perform other common operations. '''QFileInfo''' provides more detailed information about a file, such as its size, permissions and last modification time.
The '''QFile''' class supports large files, long file names, and internationalized file names. The '''QDir''' and '''QDirIterator''' classes are used to read and traverse directories, and can be used to manipulate path names, create directories, delete files, and perform other common operations. '''QFileInfo''' provides more detailed information about a file, such as its size, permissions and last modification time.


Qt includes classes similar to the standard <code>iostream</code> classes that operate on any device. Classes for text and raw data streams are used to stream text to and from devices, and these support the encodings provided by '''QTextCodec'''. Data streams can be used to serialize basic C++ types and many Qt types in a platform-independent binary format.
Qt includes classes similar to the standard &lt;code&amp;gt;iostream&amp;lt;/code&amp;gt; classes that operate on any device. Classes for text and raw data streams are used to stream text to and from devices, and these support the encodings provided by '''QTextCodec'''. Data streams can be used to serialize basic C++ types and many Qt types in a platform-independent binary format.


Transparent access to remote files is provided via a unified network access <span class="caps">API</span>, though specialized classes for <span class="caps">HTTP</span> and <span class="caps">FTP</span> protocols can also be used if required, building on Qt’s networking classes (see page) . <span class="caps">URL</span>s can easily be parsed and reconstructed by using the '''QUrl''' class.
Transparent access to remote files is provided via a unified network access API, though specialized classes for HTTP and FTP protocols can also be used if required, building on Qt's networking classes (see page) . URLs can easily be parsed and reconstructed by using the '''QUrl''' class.


Some types of file can be read directly without requiring the use of a '''QFile''' object. For example, image files are usually read via the '''QImage''' class with its extensible plugin mechanism. Printing text and images is handled by '''QPrinter'''.
Some types of file can be read directly without requiring the use of a '''QFile''' object. For example, image files are usually read via the '''QImage''' class with its extensible plugin mechanism. Printing text and images is handled by '''QPrinter'''.
Line 703: Line 728:
Qt can also be used to monitor files and directories for changes made by other applications and services. The '''QFileSystemWatcher''' class acts as a registry of file paths that need to be monitored, and emits a signal whenever a file or directory on any of these paths is changed.
Qt can also be used to monitor files and directories for changes made by other applications and services. The '''QFileSystemWatcher''' class acts as a registry of file paths that need to be monitored, and emits a signal whenever a file or directory on any of these paths is changed.


==<span class="caps">XML</span>==
== XML ==


Qt’s <span class="caps">XML</span> module provides a <span class="caps">SAX</span> parser and a <span class="caps">DOM</span> parser, both of which read well-formed <span class="caps">XML</span> and are non-validating. The <span class="caps">SAX</span> (Simple <span class="caps">API</span> for <span class="caps">XML</span>) implementation follows the design of the SAX2 Java implementation, with adapted naming conventions. The <span class="caps">DOM</span> (Document Object Model) Level 2 implementation follows the W3C recommendation and includes namespace support.
Qt's XML module provides a SAX parser and a DOM parser, both of which read well-formed XML and are non-validating. The SAX (Simple API for XML) implementation follows the design of the SAX2 Java implementation, with adapted naming conventions. The DOM (Document Object Model) Level 2 implementation follows the W3C recommendation and includes namespace support.


Qt’s stream reading and writing classes present an alternative approach to reading and writing <span class="caps">XML</span> files in which tokens are “pulled” from an input stream and “pushed” to an output stream. The design of these classes makes it easy to write lightweight, high-level parsers for <span class="caps">XML</span>-based file formats.
Qt's stream reading and writing classes present an alternative approach to reading and writing XML files in which tokens are &quot;pulled&amp;quot; from an input stream and &quot;pushed&amp;quot; to an output stream. The design of these classes makes it easy to write lightweight, high-level parsers for XML-based file formats.


Higher level <span class="caps">XML</span> manipulation, including support for XQuery 1.0 and XPath 2.0, is provided by an additional module. This separation between basic <span class="caps">XML</span> handling and more powerful querying facilities allows developers to decide the level of <span class="caps">XML</span> support used in applications. Partial support for <span class="caps">XSLT</span> 2.0 adds another processing option for developers familiar with common <span class="caps">XML</span> technologies.
Higher level XML manipulation, including support for XQuery 1.0 and XPath 2.0, is provided by an additional module. This separation between basic XML handling and more powerful querying facilities allows developers to decide the level of XML support used in applications. Partial support for XSLT 2.0 adds another processing option for developers familiar with common XML technologies.


Validation of <span class="caps">XML</span> documents is performed by classes representing <span class="caps">XML</span> schemas and validators for those schemas. These implement the W3C <span class="caps">XML</span> Schema specification as specified by version 1.0 of the standard.
Validation of XML documents is performed by classes representing XML schemas and validators for those schemas. These implement the W3C XML Schema specification as specified by version 1.0 of the standard.


==Inter-Process Communication==
== Inter-Process Communication ==


Qt provides a process class that is used to start external programs and to communicate with them in a platform-independent way. Communication is achieved by writing to the external program’s standard input and reading from its standard output and standard error streams. The '''QProcess''' class is derived from '''<span class="caps">QIOD</span>evice''', meaning that data can be streamed to and from it with text and data streams.
Qt provides a process class that is used to start external programs and to communicate with them in a platform-independent way. Communication is achieved by writing to the external program's standard input and reading from its standard output and standard error streams. The '''QProcess''' class is derived from '''QIODevice''', meaning that data can be streamed to and from it with text and data streams.


'''QProcess''' works asynchronously, reporting the availability of data by emitting signals. Qt applications can connect to the signals to retrieve the data for processing, and optionally respond by sending data back to the external program. Qt’s process handling also supports a blocking mode of operation, and can redirect input and output from external programs to files.
'''QProcess''' works asynchronously, reporting the availability of data by emitting signals. Qt applications can connect to the signals to retrieve the data for processing, and optionally respond by sending data back to the external program. Qt's process handling also supports a blocking mode of operation, and can redirect input and output from external programs to files.


Additionally, higher-level communication between applications, components and the operating system can be achieved on Unix platforms that support the D-Bus protocol. The QtDBus module allows applications to expose services by creating <span class="caps">XML</span>-based interface files. These are converted to C++ source code by a tool supplied with Qt.
Additionally, higher-level communication between applications, components and the operating system can be achieved on Unix platforms that support the D-Bus protocol. The QtDBus module allows applications to expose services by creating XML-based interface files. These are converted to C++ source code by a tool supplied with Qt.


Access to low-level shared resources, such as shared memory and system semaphores, is provided by dedicated classes. These provide the basis for building alternative communication mechanisms.
Access to low-level shared resources, such as shared memory and system semaphores, is provided by dedicated classes. These provide the basis for building alternative communication mechanisms.


==Networking==
== Networking ==


Qt provides a cross-platform interface for writing <span class="caps">TCP</span>/IP clients and servers, supporting IPv4 and IPv6. All of the networking classes provided are reentrant and can be used from any thread.
Qt provides a cross-platform interface for writing TCP/IP clients and servers, supporting IPv4 and IPv6. All of the networking classes provided are reentrant and can be used from any thread.


[[Image:ftp-example.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/ftp-example.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/ftp-example.png]]


''The Qt <span class="caps">FTP</span> example uses Qt’s networking features to provide simple <span class="caps">FTP</span> browsing capabilities.''
''The Qt FTP example uses Qt's networking features to provide simple FTP browsing capabilities.''


The '''QTcpSocket''' class provides an asynchronous, buffered <span class="caps">TCP</span> connection. As with other '''<span class="caps">QIOD</span>evice''' subclasses, text and data streams can be used to handle socket-level communications. Similarly, '''QUdpSocket''' handles <span class="caps">UDP</span> socket operations. Both classes support blocking and non-blocking modes of operation. All of Qt’s networking classes are reentrant and can be used from any thread.
The '''QTcpSocket''' class provides an asynchronous, buffered TCP connection. As with other '''QIODevice''' subclasses, text and data streams can be used to handle socket-level communications. Similarly, '''QUdpSocket''' handles UDP socket operations. Both classes support blocking and non-blocking modes of operation. All of Qt's networking classes are reentrant and can be used from any thread.


Custom <span class="caps">TCP</span> servers can be implemented by subclassing '''QTcpServer''', which provides an asynchronous framework for handling incoming connections and serving clients. Servers can operate in blocking and non-blocking modes.
Custom TCP servers can be implemented by subclassing '''QTcpServer''', which provides an asynchronous framework for handling incoming connections and serving clients. Servers can operate in blocking and non-blocking modes.


Support for proxy servers is available through the '''QNetworkProxy''' class, enabling both application-wide and per-socket proxying facilities. <span class="caps">HTTP</span>, <span class="caps">FTP</span> and <span class="caps">SOCKS</span> 5 proxy types are supported, and caching facilities can be employed to improve performance. Customization features enable an application-wide policy to be employed that can set up proxies based on the socket type, the protocol in use, and other criteria.
Support for proxy servers is available through the '''QNetworkProxy''' class, enabling both application-wide and per-socket proxying facilities. HTTP, FTP and SOCKS 5 proxy types are supported, and caching facilities can be employed to improve performance. Customization features enable an application-wide policy to be employed that can set up proxies based on the socket type, the protocol in use, and other criteria.


The '''QAbstractSocket''' class is a platform-independent wrapper for native socket <span class="caps">API</span>s. It provides the underlying functionality for <span class="caps">TCP</span>, <span class="caps">UDP</span> and local domain sockets. Support for proxy servers is available through the '''QNetworkProxy''' class, enabling both application-wide and per-socket proxying facilities.
The '''QAbstractSocket''' class is a platform-independent wrapper for native socket APIs. It provides the underlying functionality for TCP, UDP and local domain sockets. Support for proxy servers is available through the '''QNetworkProxy''' class, enabling both application-wide and per-socket proxying facilities.


A management infrastructure for network operations is provided in the form of '''QNetworkAccessManager''', which is used to dispatch requests over common protocols, such as <span class="caps">HTTP</span> and <span class="caps">FTP</span>, and handle replies. Specific classes for requests and replies make common communication easy, while allowing the developer to customize particular requests.
A management infrastructure for network operations is provided in the form of '''QNetworkAccessManager''', which is used to dispatch requests over common protocols, such as HTTP and FTP, and handle replies. Specific classes for requests and replies make common communication easy, while allowing the developer to customize particular requests.


Information about a machine’s network interfaces is provided by the '''QNetworkInterface''' class. This exposes details of each interface, their capabilities, the IP addresses assigned to them, and other interface-dependent information. For example, for Ethernet interfaces, the <span class="caps">MAC</span> address of the underlying hardware can be obtained, and the broadcast address and netmask can be obtained in addition to the IP address.
Information about a machine's network interfaces is provided by the '''QNetworkInterface''' class. This exposes details of each interface, their capabilities, the IP addresses assigned to them, and other interface-dependent information. For example, for Ethernet interfaces, the MAC address of the underlying hardware can be obtained, and the broadcast address and netmask can be obtained in addition to the IP address.


===Encrypted Communications===
=== Encrypted Communications ===


Qt includes features for secure network communications through the use of encrypted <span class="caps">TCP</span> connections based on Secure Socket Layer (<span class="caps">SSL</span>) protocols, including SSLv3 and TLSv1.
Qt includes features for secure network communications through the use of encrypted TCP connections based on Secure Socket Layer (SSL) protocols, including SSLv3 and TLSv1.


'''QSslSocket''' provides an <span class="caps">SSL</span> encrypted socket that can be used for both clients and servers. Abstractions for other aspects of the encryption and authentication processes are addressed by classes for ciphers, keys, certificates.
'''QSslSocket''' provides an SSL encrypted socket that can be used for both clients and servers. Abstractions for other aspects of the encryption and authentication processes are addressed by classes for ciphers, keys, certificates.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/qiodevice.html <span class="caps">QIOD</span>evice Class Reference] ''[qt.io]''
&quot;QIODevice Class Reference&amp;quot;:http://doc.qt.io/qt-4.8/qiodevice.html


[http://doc.qt.io/qt-4.8/qtxml.html QtXml Module] ''[qt.io]''
&quot;QtXml Module&amp;quot;:http://doc.qt.io/qt-4.8/qtxml.html


[http://doc.qt.io/qt-4.8/qtnetwork.html QtNetwork Module] ''[qt.io]''
&quot;QtNetwork Module&amp;quot;:http://doc.qt.io/qt-4.8/qtnetwork.html


=Collection Classes=
= Collection Classes =


''Collection classes are used to store groups of items in memory. Qt provides a set of classes that are compatible with the Standard Template Library (<span class="caps">STL</span>), and that work regardless of whether the compiler supports <span class="caps">STL</span> or not. Java-style iterators are also provided for safety and convenience.''
''Collection classes are used to store groups of items in memory. Qt provides a set of classes that are compatible with the Standard Template Library (STL), and that work regardless of whether the compiler supports STL or not. Java-style iterators are also provided for safety and convenience.''


Applications often need to manage items in memory, such as groups of images, widgets, or custom objects. Many C++ compilers support the <span class="caps">STL</span>, which provides ready-made data structures for storing items. Qt provides lists, stacks, queues, and dictionaries with <span class="caps">STL</span>-syntax. Qt’s collection classes even work with compilers that are not capable of supporting the <span class="caps">STL</span>.
Applications often need to manage items in memory, such as groups of images, widgets, or custom objects. Many C++ compilers support the STL, which provides ready-made data structures for storing items. Qt provides lists, stacks, queues, and dictionaries with STL-syntax. Qt's collection classes even work with compilers that are not capable of supporting the STL.


Qt’s rich set of portable collection classes (“containers”) and associated iterators are heavily used inside Qt, and are provided as part of the Qt <span class="caps">API</span>. Qt’s containers are optimized for speed and memory efficiency. Programmers can also use <span class="caps">STL</span> containers on the platforms that support them, at the cost of losing Qt’s optimizations.
Qt's rich set of portable collection classes (&quot;containers&amp;quot;) and associated iterators are heavily used inside Qt, and are provided as part of the Qt API. Qt's containers are optimized for speed and memory efficiency. Programmers can also use STL containers on the platforms that support them, at the cost of losing Qt's optimizations.


Unlike many template classes, which increase the size of executables dramatically when used, Qt’s template collection classes are optimized for minimal code expansion.
Unlike many template classes, which increase the size of executables dramatically when used, Qt's template collection classes are optimized for minimal code expansion.


==Containers==
== Containers ==


Qt provides sequential container classes for lists, linked lists, vectors, stacks and queues, each with an interface very similar to the corresponding <span class="caps">STL</span> container, and each fully compatible with the <span class="caps">STL</span> algorithms. Qt provides some <span class="caps">STL</span>-equivalent algorithms for copying, finding and sorting items. On platforms with <span class="caps">STL</span> support, Qt provides automatic conversion operators between <span class="caps">STL</span> and Qt containers.
Qt provides sequential container classes for lists, linked lists, vectors, stacks and queues, each with an interface very similar to the corresponding STL container, and each fully compatible with the STL algorithms. Qt provides some STL-equivalent algorithms for copying, finding and sorting items. On platforms with STL support, Qt provides automatic conversion operators between STL and Qt containers.


Additionally, Qt provides Java-style iterators for developers who are more familiar with Java containers than the <span class="caps">STL</span>.
Additionally, Qt provides Java-style iterators for developers who are more familiar with Java containers than the STL.


Qt provides associative container classes for maps, hashes and sets. The “hash” containers use a hash function to improve search performance. One-to-one and one-to-many variants of the map and hash containers are available.
Qt provides associative container classes for maps, hashes and sets. The &quot;hash&amp;quot; containers use a hash function to improve search performance. One-to-one and one-to-many variants of the map and hash containers are available.


Qt’s sequential and associative collection classes can be used to store both value-based and pointer-based types, making them especially useful for handling '''QWidget''' and '''QObject''' pointers. When used to hold pointer-based items, convenience functions can be used to delete the contents of collections in one pass before the collection is destroyed.
Qt's sequential and associative collection classes can be used to store both value-based and pointer-based types, making them especially useful for handling '''QWidget''' and '''QObject''' pointers. When used to hold pointer-based items, convenience functions can be used to delete the contents of collections in one pass before the collection is destroyed.


==Implicit Sharing==
== Implicit Sharing ==


When used with Qt’s value classes, the items held in these collection classes are implicitly shared (“copy on write”). Copies of these classes share the same data in memory. The data sharing is handled automatically; if the application modifies the contents of one of the copied objects, a deep copy of the data is made so that the other objects are left unchanged. When an object is copied, only a pointer is passed and a reference count incremented, which is much faster than actually copying the data, and also saves memory.
When used with Qt's value classes, the items held in these collection classes are implicitly shared (&quot;copy on write&amp;quot;). Copies of these classes share the same data in memory. The data sharing is handled automatically; if the application modifies the contents of one of the copied objects, a deep copy of the data is made so that the other objects are left unchanged. When an object is copied, only a pointer is passed and a reference count incremented, which is much faster than actually copying the data, and also saves memory.


Sharing is used wherever it makes sense: in Qt’s value-based collection classes, and in other commonly-used classes. Programmers can safely and efficiently copy objects of these classes by value, avoiding the risks related to optimizing pointer-based code by hand. In particular, the implicitly shared '''QString''' and '''QRegExp''' classes makes string processing easy and fast.
Sharing is used wherever it makes sense: in Qt's value-based collection classes, and in other commonly-used classes. Programmers can safely and efficiently copy objects of these classes by value, avoiding the risks related to optimizing pointer-based code by hand. In particular, the implicitly shared '''QString''' and '''QRegExp''' classes makes string processing easy and fast.


Qt also provides low-level bit and byte array classes which are very efficient for handling basic data types.
Qt also provides low-level bit and byte array classes which are very efficient for handling basic data types.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/containers.html Container Classes] ''[qt.io]''
&quot;Container Classes&amp;quot;:http://doc.qt.io/qt-4.8/containers.html


[http://doc.qt.io/qt-4.8/implicit-sharing.html Implicit Sharing] ''[qt.io]''
&quot;Implicit Sharing&amp;quot;:http://doc.qt.io/qt-4.8/implicit-sharing.html


=Plugins and the Meta-Object System=
= Plugins and the Meta-Object System =


''Qt applications can access functions from dynamic libraries using a platform-independent <span class="caps">API</span>. Qt also supports plugins, allowing developers to create and distribute codecs, database drivers, image format converters, styles, and custom widgets as separate components.''
''Qt applications can access functions from dynamic libraries using a platform-independent API. Qt also supports plugins, allowing developers to create and distribute codecs, database drivers, image format converters, styles, and custom widgets as separate components.''


==Plugins and Libraries==
== Plugins and Libraries ==


Converting a Qt component into a plugin is achieved by subclassing the appropriate plugin base class, implementing a few simple functions, and adding a macro. Plugins written in this way can expose properties and interact with applications via the signals and slots mechanism.
Converting a Qt component into a plugin is achieved by subclassing the appropriate plugin base class, implementing a few simple functions, and adding a macro. Plugins written in this way can expose properties and interact with applications via the signals and slots mechanism.
Line 801: Line 826:
Components supplied as plugins are detected and used by the application automatically. Many third parties provide Qt components in source form, as precompiled dynamic libraries, and as plugins.
Components supplied as plugins are detected and used by the application automatically. Many third parties provide Qt components in source form, as precompiled dynamic libraries, and as plugins.


The '''QLibrary''' class provides a cross-platform <span class="caps">API</span> for loading dynamic libraries, providing a type-safe way to call functions exported as symbols with C linkage.
The '''QLibrary''' class provides a cross-platform API for loading dynamic libraries, providing a type-safe way to call functions exported as symbols with C linkage.


==The Meta-Object System==
== The Meta-Object System ==


The meta-object system enhances Qt components with additional data at compile-time in order to provide extended run-time type information and other dynamic features. This approach makes it possible for Qt to provide features such as run-time object introspection, a translation mechanism for internationalization purposes, signals and slots, and a generic way to invoke functions and methods.
The meta-object system enhances Qt components with additional data at compile-time in order to provide extended run-time type information and other dynamic features. This approach makes it possible for Qt to provide features such as run-time object introspection, a translation mechanism for internationalization purposes, signals and slots, and a generic way to invoke functions and methods.
Line 811: Line 836:
As mentioned above, these features can also be exposed by plugins to applications and vice versa.
As mentioned above, these features can also be exposed by plugins to applications and vice versa.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/plugins-howto.html How to Create Qt Plugins] ''[qt.io]''
&quot;How to Create Qt Plugins&amp;quot;:http://doc.qt.io/qt-4.8/plugins-howto.html


[http://doc.qt.io/qt-4.8/metaobjects.html The Meta-Object System] ''[qt.io]''
&quot;The Meta-Object System&amp;quot;:http://doc.qt.io/qt-4.8/metaobjects.html


=Building Qt Applications=
= Building Qt Applications =


''Qt developers can take advantage of a suite of tools to simplify the process of building applications on all supported platforms. Applications, libraries, and plugins are described by project files that are processed to produce suitable Makefiles for each platform.''
''Qt developers can take advantage of a suite of tools to simplify the process of building applications on all supported platforms. Applications, libraries, and plugins are described by project files that are processed to produce suitable Makefiles for each platform.''


Qt is designed to work with a range of development tools and environments, from simple command line tools to integration with popular integrated development environments (<span class="caps">IDE</span>s). Alternatively, Qt Creator (see page) is a lightweight, cross-platform <span class="caps">IDE</span> that is specifically tailored to development of Qt applications.
Qt is designed to work with a range of development tools and environments, from simple command line tools to integration with popular integrated development environments (IDEs). Alternatively, Qt Creator (see page) is a lightweight, cross-platform IDE that is specifically tailored to development of Qt applications.


==Qt’s Build System==
== Qt's Build System ==


Projects are described by project files that contain terse, but readable descriptions of source and header files, ''Qt Designer'' forms, and other resources. These are processed by the <code>qmake</code> tool to produce suitable Makefiles for the project on each platform.
Projects are described by project files that contain terse, but readable descriptions of source and header files, ''Qt Designer'' forms, and other resources. These are processed by the &lt;code&amp;gt;qmake&amp;lt;/code&amp;gt; tool to produce suitable Makefiles for the project on each platform.


All of the Qt libraries, tools, and examples are described by project files. A simple example can be described in a few lines of declarations.
All of the Qt libraries, tools, and examples are described by project files. A simple example can be described in a few lines of declarations.
Line 831: Line 856:
Support for conditional builds means that platform-specific code can be incorporated into projects, and will only be built for the appropriate platform.
Support for conditional builds means that platform-specific code can be incorporated into projects, and will only be built for the appropriate platform.


When <code>qmake</code> is used to build a project, all the enhanced features of Qt are automatically handled by the other tools in the build suite: <code>moc</code> processes the header files to enable signals and slots, <code>rcc</code> compiles the specified resources, and <code>uic</code> is used to create code from user interface forms created with ''Qt Designer''.
When &lt;code&amp;gt;qmake&amp;lt;/code&amp;gt; is used to build a project, all the enhanced features of Qt are automatically handled by the other tools in the build suite: &lt;code&amp;gt;moc&amp;lt;/code&amp;gt; processes the header files to enable signals and slots, &lt;code&amp;gt;rcc&amp;lt;/code&amp;gt; compiles the specified resources, and &lt;code&amp;gt;uic&amp;lt;/code&amp;gt; is used to create code from user interface forms created with ''Qt Designer''.


Precompiled header support, <code>pkg-config</code> integration, the ability to generate Visual Studio project files, and other advanced features allow developers to take advantage of platform-specific tools while retaining the use of a cross-platform build system for common project components.
Precompiled header support, &lt;code&amp;gt;pkg-config&amp;lt;/code&amp;gt; integration, the ability to generate Visual Studio project files, and other advanced features allow developers to take advantage of platform-specific tools while retaining the use of a cross-platform build system for common project components.


==Qt’s Resource System==
== Qt's Resource System ==


Qt provides a resource system that allows data files to be stored inside executables, so that any resources required by applications can be accessed at run-time. Qt’s widgets support a naming scheme that allows developers to directly refer to these packaged resources.
Qt provides a resource system that allows data files to be stored inside executables, so that any resources required by applications can be accessed at run-time. Qt's widgets support a naming scheme that allows developers to directly refer to these packaged resources.


The resources to be packaged with an application are listed in a Qt Resource Collection file, containing a list of files in the build directory along with the resource paths that are used in the application. These files are processed using <code>rcc</code> to create data that is compiled into the application. This approach ensures that certain critical resources are always available to applications, avoiding possible distribution and installation problems.
The resources to be packaged with an application are listed in a Qt Resource Collection file, containing a list of files in the build directory along with the resource paths that are used in the application. These files are processed using &lt;code&amp;gt;rcc&amp;lt;/code&amp;gt; to create data that is compiled into the application. This approach ensures that certain critical resources are always available to applications, avoiding possible distribution and installation problems.


The resource system can also be extended at run-time with the '''QResource''' class, allowing additional paths to be searched for resources, and enabling additional resources to be loaded on demand, augmenting those built into the application.
The resource system can also be extended at run-time with the '''QResource''' class, allowing additional paths to be searched for resources, and enabling additional resources to be loaded on demand, augmenting those built into the application.


[[Image:qt-creator-overview.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qt-creator-overview.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qt-creator-overview.png]]


''An overview of Qt Creator.''
''An overview of Qt Creator.''


==Testing and Benchmarking Qt Applications==
== Testing and Benchmarking Qt Applications ==


Support for unit testing is provided as a standard Qt module. Unit tests are written in C++ as '''QObject'''-based classes that contain test functions, and these are compiled into executables that can be run independently of any testing framework. Qt’s unit testing library also provides extensions to allow graphical user interfaces to be tested.
Support for unit testing is provided as a standard Qt module. Unit tests are written in C++ as '''QObject'''-based classes that contain test functions, and these are compiled into executables that can be run independently of any testing framework. Qt's unit testing library also provides extensions to allow graphical user interfaces to be tested.


Unit tests can also be set up to perform benchmarking operations with the use of a simple macro. Test cases can be configured to measure and report performance via the use of different backends, allowing performance data to be visualized using standard tools.
Unit tests can also be set up to perform benchmarking operations with the use of a simple macro. Test cases can be configured to measure and report performance via the use of different backends, allowing performance data to be visualized using standard tools.


==Qt Creator==
== Qt Creator ==


Qt Creator is Qt Development Frameworks’s lightweight <span class="caps">IDE</span> for C++ and Qt software development. Although it is designed to be easy to use, Qt Creator provides all the features developers have come to expect from <span class="caps">IDE</span>s, including syntax coloring and code completion, quick location of classes, functions and other C++ structures, and integrated debugging support.
Qt Creator is Qt Development Frameworks's lightweight IDE for C++ and Qt software development. Although it is designed to be easy to use, Qt Creator provides all the features developers have come to expect from IDEs, including syntax coloring and code completion, quick location of classes, functions and other C++ structures, and integrated debugging support.


Qt-specific features include signals and slots signature completion, integrated support for Qt Designer, and built-in Qt documentation. The [[QtCreatorWhitepaper|Qt Creator whitepaper]] ''[qt.io]'' contains a more detailed introduction to this product.
Qt-specific features include signals and slots signature completion, integrated support for Qt Designer, and built-in Qt documentation. The &quot;Qt Creator whitepaper&amp;quot;:http://wiki.qt.io/QtCreatorWhitepaper contains a more detailed introduction to this product.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/qmake-manual.html qmake Manual] ''[qt.io]''
&quot;qmake Manual&amp;quot;:http://doc.qt.io/qt-4.8/qmake-manual.html


[http://doc.qt.io/qt-4.8/qtestlib-manual.html QTestLib Manual] ''[qt.io]''
&quot;QTestLib Manual&amp;quot;:http://doc.qt.io/qt-4.8/qtestlib-manual.html


=Qt’s Architecture=
= Qt's Architecture =


''Qt’s functionality is built on the low-level <span class="caps">API</span>s of the platforms it supports. This makes Qt flexible and efficient, and enables Qt applications to fit in with single-platform applications.''
''Qt's functionality is built on the low-level APIs of the platforms it supports. This makes Qt flexible and efficient, and enables Qt applications to fit in with single-platform applications.''


Qt is a cross-platform framework which uses native style <span class="caps">API</span>s to accurately follow the human interface guidelines on each supported platform. All widgets are drawn by Qt, and programmers can extend or customize them by reimplementing virtual functions. Qt’s widgets accurately emulate the look and feel of the supported platforms, as described in sec:Styles-and-Themes (see page). This technique also enables developers to derive their own custom styles to provide a distinct look and feel for their applications.
Qt is a cross-platform framework which uses native style APIs to accurately follow the human interface guidelines on each supported platform. All widgets are drawn by Qt, and programmers can extend or customize them by reimplementing virtual functions. Qt's widgets accurately emulate the look and feel of the supported platforms, as described in sec:Styles-and-Themes (see page). This technique also enables developers to derive their own custom styles to provide a distinct look and feel for their applications.


Qt uses the low-level <span class="caps">API</span>s of the different platforms it supports. This differs from traditional “layered” cross-platform toolkits that are thin wrappers over single-platform toolkits (e.g., <span class="caps">MFC</span> on Windows and Motif on X11). Layered toolkits are usually slow, since every function call to the library results in many additional calls down through the different <span class="caps">API</span> layers. Layered toolkits are often restricted by the features and behavior of the underlying toolkits, leading to obscure bugs in applications.
Qt uses the low-level APIs of the different platforms it supports. This differs from traditional &quot;layered&amp;quot; cross-platform toolkits that are thin wrappers over single-platform toolkits (e.g., MFC on Windows and Motif on X11). Layered toolkits are usually slow, since every function call to the library results in many additional calls down through the different API layers. Layered toolkits are often restricted by the features and behavior of the underlying toolkits, leading to obscure bugs in applications.


Qt is professionally supported, and takes advantage of the available platforms: Microsoft Windows, X11, Mac OS X, and Embedded Linux. Using a single source tree, a Qt application can be compiled to an executable for each target platform. Although Qt is a cross-platform framework, customers have found it to be easier to learn and more productive than many platform-specific toolkits. Many customers use Qt for single-platform development, preferring Qt’s fully object-oriented approach.
Qt is professionally supported, and takes advantage of the available platforms: Microsoft Windows, X11, Mac OS X, and Embedded Linux. Using a single source tree, a Qt application can be compiled to an executable for each target platform. Although Qt is a cross-platform framework, customers have found it to be easier to learn and more productive than many platform-specific toolkits. Many customers use Qt for single-platform development, preferring Qt's fully object-oriented approach.


==X11==
== X11 ==


Qt for X11 uses Xlib to communicate with the X server directly. Qt does not use Xt (X Toolkit), Motif, Athena, or any other toolkit.
Qt for X11 uses Xlib to communicate with the X server directly. Qt does not use Xt (X Toolkit), Motif, Athena, or any other toolkit.


Qt supports the following versions of Unix: <span class="caps">AIX</span>, FreeBSD®, HP-UX, Linux, NetBSD, OpenBSD, and Solaris. See the Qt Development Frameworks Web site for an up-to-date list of supported compilers and operating system versions.
Qt supports the following versions of Unix: AIX (R), FreeBSD®, HP-UX, Linux, NetBSD, OpenBSD, and Solaris. See the Qt Development Frameworks Web site for an up-to-date list of supported compilers and operating system versions.


Qt applications automatically adapt to the user’s window manager or desktop environment, and have a native look and feel under Motif, <span class="caps">CDE</span>, <span class="caps">GNOME</span>, and <span class="caps">KDE</span>. This contrasts with most other Unix toolkits, which lock users into their own look and feel.
Qt applications automatically adapt to the user's window manager or desktop environment, and have a native look and feel under Motif, CDE, GNOME (TM), and KDE (TM). This contrasts with most other Unix toolkits, which lock users into their own look and feel.


Qt provides full Unicode support (see page). Qt applications automatically support both Unicode and non-Unicode fonts. Qt combines multiple X fonts to render multi-lingual text. Qt’s font handling is intelligent enough to search all the installed fonts for characters unavailable in the current font.
Qt provides full Unicode support (see page). Qt applications automatically support both Unicode and non-Unicode fonts. Qt combines multiple X fonts to render multi-lingual text. Qt's font handling is intelligent enough to search all the installed fonts for characters unavailable in the current font.


Qt takes advantage of X extensions where they are available. Qt supports the <span class="caps">RENDER</span> extension for anti-aliased and alpha-blended fonts and vector graphics. Qt provides on-the-spot editing for X Input Methods. Qt supports multiple screens both with traditional multi-head and with Xinerama.
Qt takes advantage of X extensions where they are available. Qt supports the RENDER extension for anti-aliased and alpha-blended fonts and vector graphics. Qt provides on-the-spot editing for X Input Methods. Qt supports multiple screens both with traditional multi-head and with Xinerama.


==Microsoft Windows==
== Microsoft Windows ==


Qt for Windows uses the Win32® <span class="caps">API</span> and <span class="caps">GDI</span> for low-level events and drawing. Qt does not use <span class="caps">MFC</span> or any other toolkit, but provides its own more powerful, customizable widgets that are rendered using a fast, yet accurate painting engine. (For non-specialized uses, Qt uses the native Windows file and print dialogs.)
Qt for Windows uses the Win32® API and GDI for low-level events and drawing. Qt does not use MFC or any other toolkit, but provides its own more powerful, customizable widgets that are rendered using a fast, yet accurate painting engine. (For non-specialized uses, Qt uses the native Windows file and print dialogs.)


Customers using Windows can create Qt applications using Microsoft Visual Studio that will run on Windows 98, NT4, ME, 2000, XP and Vista. Qt performs a run-time check for the Windows version, and uses the most advanced capabilities available. Qt developers are insulated from differences in the Windows <span class="caps">API</span>s.
Customers using Windows can create Qt applications using Microsoft Visual Studio that will run on Windows 98, NT4, ME, 2000, XP and Vista. Qt performs a run-time check for the Windows version, and uses the most advanced capabilities available. Qt developers are insulated from differences in the Windows APIs.


The Microsoft accessibility interfaces are supported by Qt. Unlike the common controls on Windows, Qt widgets can be extended without losing the accessibility information of the base widget. Custom widgets can also provide accessibility. Qt also supports multiple screens on Microsoft Windows.
The Microsoft accessibility interfaces are supported by Qt. Unlike the common controls on Windows, Qt widgets can be extended without losing the accessibility information of the base widget. Custom widgets can also provide accessibility. Qt also supports multiple screens on Microsoft Windows.


[[Image:architecture-diag.png]]
[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/architecture-diag.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/architecture-diag.png]]


''An overview of Qt’s architecture on supported desktop platforms.''
''An overview of Qt's architecture on supported desktop platforms.''


==Mac OS X==
== Mac OS X ==


Qt supports Mac OS X by using a combination of Cocoa® and Carbon® <span class="caps">API</span>s. On 64-bit hardware, Qt uses the Cocoa libraries to enable integration with Mac OS X native widgets and Cocoa views.
Qt supports Mac OS X by using a combination of Cocoa® and Carbon® APIs. On 64-bit hardware, Qt uses the Cocoa libraries to enable integration with Mac OS X native widgets and Cocoa views.


Qt for Mac OS X introduces layouts and straightforward internationalization support, standardized access to OpenGL, and powerful visual design with ''Qt Designer''. Qt handles files and asynchronous socket input/output in the event loop. Qt provides solid database support. Developers can create Mac OS X applications using a modern object-oriented <span class="caps">API</span> that includes comprehensive documentation and full source code.
Qt for Mac OS X introduces layouts and straightforward internationalization support, standardized access to OpenGL, and powerful visual design with ''Qt Designer''. Qt handles files and asynchronous socket input/output in the event loop. Qt provides solid database support. Developers can create Mac OS X applications using a modern object-oriented API that includes comprehensive documentation and full source code.


Developers can create applications on their favorite platform and broaden their market hugely by simply recompiling on the other supported platforms. Support for universal binaries on Mac OS X means that Qt applications can be created for Intel and PowerPC-based Macs. If desired, developers can take advantage of Qt’s integration with native components to add platform-specific features to their applications.
Developers can create applications on their favorite platform and broaden their market hugely by simply recompiling on the other supported platforms. Support for universal binaries on Mac OS X means that Qt applications can be created for Intel and PowerPC-based Macs. If desired, developers can take advantage of Qt's integration with native components to add platform-specific features to their applications.


===Online References===
=== Online References ===


[http://doc.qt.io/qt-4.8/supported-platforms.html Supported Platforms] ''[qt.io]''
&quot;Supported Platforms&amp;quot;:http://doc.qt.io/qt-4.8/supported-platforms.html


[http://doc.qt.io/qt-4.8/installation.html Installation] ''[qt.io]''
&quot;Installation&amp;quot;:http://doc.qt.io/qt-4.8/installation.html


[http://doc.qt.io/qt-4.8/deployment.html Deploying Qt Applications] ''[qt.io]''
&quot;Deploying Qt Applications&amp;quot;:http://doc.qt.io/qt-4.8/deployment.html


=Platform Specific Extensions and Qt Solutions=
= Platform Specific Extensions and Qt Solutions =


''In addition to being complete in itself, Qt provides some platform-specific extensions to assist developers in certain contexts. The ActiveQt extension allows developers to use ActiveX controls within their Qt applications, and also allows them to make their Qt applications into ActiveX servers. Other platform-specific extensions are made available through Qt Solutions.''
''In addition to being complete in itself, Qt provides some platform-specific extensions to assist developers in certain contexts. The ActiveQt extension allows developers to use ActiveX controls within their Qt applications, and also allows them to make their Qt applications into ActiveX servers. Other platform-specific extensions are made available through Qt Solutions.''


==ActiveX Interoperability==
== ActiveX Interoperability ==


ActiveX is built on Microsoft’s <span class="caps">COM</span> technology. It allows applications and libraries to use components provided by component servers, and to be component servers in their own right. Qt for Windows provides the ActiveQt module that allows developers to turn their applications into ActiveX servers, and to make use of the ActiveX controls provided by other applications.
ActiveX is built on Microsoft's COM technology. It allows applications and libraries to use components provided by component servers, and to be component servers in their own right. Qt for Windows provides the ActiveQt module that allows developers to turn their applications into ActiveX servers, and to make use of the ActiveX controls provided by other applications.


Integration with Microsoft’s .<span class="caps">NET</span> technology is also possible with ActiveQt. Applications can use ActiveQt’s <span class="caps">COM</span> support to automatically give .NET developers access to Qt widgets and data types.
Integration with Microsoft's .NET (TM) technology is also possible with ActiveQt. Applications can use ActiveQt's COM support to automatically give .NET developers access to Qt widgets and data types.


ActiveQt seamlessly integrates ActiveX into Qt: ActiveX properties, methods, and events become Qt properties, slots, and signals. This makes it straightforward for Qt developers to work with ActiveX using a familiar programming paradigm, and insulates them from all the different kinds of generated code that is normally part of an ActiveX implementation.
ActiveQt seamlessly integrates ActiveX into Qt: ActiveX properties, methods, and events become Qt properties, slots, and signals. This makes it straightforward for Qt developers to work with ActiveX using a familiar programming paradigm, and insulates them from all the different kinds of generated code that is normally part of an ActiveX implementation.


ActiveQt automatically handles the conversions between ActiveX and Qt data types. ActiveQt supports the <code>dynamicCall()</code> function to control an ActiveX component through the control’s '''IDispatch''' interface implementation.
ActiveQt automatically handles the conversions between ActiveX and Qt data types. ActiveQt supports the &lt;code&amp;gt;dynamicCall()&lt;/code&amp;gt; function to control an ActiveX component through the control's<br /> '''IDispatch''' interface implementation.


Turning a Qt application into an ActiveX server is simple. If we only need to export a single class, little more is required than the inclusion of a single header file. Once the class is compiled, its properties, slots, and signals become ActiveX properties, methods, and events to ActiveX clients. ActiveQt also provides facilities to determine if the application is being run in its own right or being used as an ActiveX control, so that developers can control which functionality is available in which context.
Turning a Qt application into an ActiveX server is simple. If we only need to export a single class, little more is required than the inclusion of a single header file. Once the class is compiled, its properties, slots, and signals become ActiveX properties, methods, and events to ActiveX clients. ActiveQt also provides facilities to determine if the application is being run in its own right or being used as an ActiveX control, so that developers can control which functionality is available in which context.


==Qt Solutions==
== Qt Solutions ==


In addition to all the classes supplied with Qt, Qt Development Frameworks also produces Qt Solutions, an optional service available to Qt licensees either at the time of purchase or as an add-on product. Qt Solutions offers a regularly updated set of components and widgets, many of which are available under the same dual licensing scheme as Qt. Almost all of the Solutions made available to Qt 3 developers are also available for Qt 4, and many new Solutions for Qt 4 have already been released.
In addition to all the classes supplied with Qt, Qt Development Frameworks also produces Qt Solutions, an optional service available to Qt licensees either at the time of purchase or as an add-on product. Qt Solutions offers a regularly updated set of components and widgets, many of which are available under the same dual licensing scheme as Qt. Almost all of the Solutions made available to Qt 3 developers are also available for Qt 4, and many new Solutions for Qt 4 have already been released.


===Online References===
=== Online References ===
 
[http://doc.qt.io/qt-4.8/activeqt.html Qt’s ActiveX Framework] ''[qt.io]''
 
[http://doc.qt.io/qt-4.8/intro-to-dbus.html D-Bus] ''[qt.io]''
 
http://qt.digia.com/products/appdev/add-on-products/qt-solutions ''[qt.digia.com]''


=The Qt Development Community=
&quot;Qt's ActiveX Framework (ActiveQt)&quot;:http://doc.qt.io/qt-4.8/activeqt.html


''Companies and independent developers from around the world are joining the Qt development community every day. They have recognized that Qt’s architecture lends itself to rapid application development. These developers, whether they are targeting one or many platforms, benefit from Qt’s consistent and straightforward <span class="caps">API</span>, powerful build system, and supporting tools such as Qt Designer.''
&quot;D-Bus&amp;quot;:http://doc.qt.io/qt-4.8/intro-to-dbus.html


Qt has an active and helpful user community who communicate using the <code>qt-interest</code> mailing list, the ''Qt Centre'' Web site at [http://www.qtcentre.org www.qtcentre.org] ''[qtcentre.org]'', and a number of other community Web sites and Weblogs. In addition, many Qt developers are active members of the [http://www.kde.org/ <span class="caps">KDE</span>] ''[kde.org]'' community. We publish [http://doc.qt.digia.com/qq/ Qt Quarterly] ''[doc.qt.digia.com]'', an online developers’ newsletter, for commercial customers and open source developers. A growing number of commercial and open source add-ons from third parties are also available; see the [http://qt.io Qt Project] ''[qt.io]'' site for the most up-to-date information.
&quot;http://qt.digia.com/products/appdev/add-on-products/qt-solutions&amp;quot;:http://qt.digia.com/products/appdev/add-on-products/qt-solutions


Qt’s extensive documentation is available online at http://doc.qt.io ''[qt.io]''. There are also a number of books in English, French, German, Russian, Chinese and Japanese, that present and explain Qt programming. A number of books about Qt are described on the [http://qt.io/books Qt Books] ''[qt.io]'' page.
= The Qt Development Community =


Companies participating in the Qt Project provide a range of training options for Qt and C++, including open enrollment courses for the general public and on-site courses for customers who have more specific training needs.
''Companies and independent developers from around the world are joining the Qt development community every day. They have recognized that Qt's architecture lends itself to rapid application development. These developers, whether they are targeting one or many platforms, benefit from Qt's consistent and straightforward API, powerful build system, and supporting tools such as Qt Designer.''


As well as providing a comprehensive framework for C++ developers, Qt can also be used with a variety of other programming languages. Qt itself includes the QtScript module, a JavaScript-oriented technology that enables developers to give users access to restricted parts of their applications for scripting purposes.
Qt has an active and helpful user community who communicate using the &lt;code&amp;gt;qt-interest&amp;lt;/code&amp;gt; mailing list, the ''Qt Centre'' Web site at &quot;www.qtcentre.org&amp;quot;:http://www.qtcentre.org, and a number of other community Web sites and Weblogs. In addition, many Qt developers are active members of the &quot;KDE&amp;quot;:http://www.kde.org/ community. We publish &quot;Qt Quarterly&amp;quot;:http://doc.qt.digia.com/qq/, an online developers' newsletter, for commercial customers and open source developers. A growing number of commercial and open source add-ons from third parties are also available; see the &quot;Qt Project&amp;quot;:http://qt.io site for the most up-to-date information.


Language bindings for Python, Ruby, Java, JavaScript, <span class="caps">BASIC</span>, Ada 2005, C#, Pascal, Lua, Perl and Scheme are also available from third parties; many of these solutions are produced and maintained by teams of open source developers.
Qt's extensive documentation is available online at &quot;http://doc.qt.io&amp;quot;:http://doc.qt.io. There are also a number of books in English, French, German, Russian, Chinese and Japanese, that present and explain Qt programming. A number of books about Qt are described on the &quot;Qt Books&amp;quot;:http://qt.io/books page.


Developers can evaluate Qt, with support, for 30 days on their preferred platform. For further information, visit http://qt.digia.com/products ''[qt.digia.com]''. Qt is also available under a <span class="caps">LGPL</span> license from https://qt.io/download ''[qt.io]''.
Companies participating in the Qt Project provide a range of training options for Qt and C+'', including open enrollment courses for the general public and on-site courses for customers who have more specific training needs.
<br />As well as providing a comprehensive framework for C''+ developers, Qt can also be used with a variety of other programming languages. Qt itself includes the QtScript module, a JavaScript-oriented technology that enables developers to give users access to restricted parts of their applications for scripting purposes.


===Online References===
Language bindings for Python, Ruby, Java, JavaScript, BASIC, Ada 2005, C#, Pascal, Lua, Perl and Scheme are also available from third parties; many of these solutions are produced and maintained by teams of open source developers.


[http://qt.io/videos#c-99 Videos: Qt Training Materials] ''[qt.io]''
Developers can evaluate Qt, with support, for 30 days on their preferred platform. For further information, visit &quot;http://qt.digia.com/products&amp;quot;:http://qt.digia.com/products. Qt is also available under a LGPL license from &quot;https://qt.io/download&amp;quot;:https://qt.io/download.


http://lists.qt.io/mailman/listinfo/interest ''[lists.qt.io]''
=== Online References ===


[http://doc.qt.digia.com/qq/ Qt Quarterly] ''[doc.qt.digia.com]''
&quot;Videos: Qt Training Materials&amp;quot;:http://qt.io/videos#c-99


This document is licensed under the [http://creativecommons.org/licenses/by-sa/2.5/ Creative Commons Attribution-Share Alike 2.5] ''[creativecommons.org]'' license.
&quot;http://lists.qt.io/mailman/listinfo/interest&amp;quot;:http://lists.qt.io/mailman/listinfo/interest


[[Image:share.png]] [[Image:remix.png]] [[Image:by.png]] [[Image:sa.png]]
&quot;Qt Quarterly&amp;quot;:http://doc.qt.digia.com/qq/


For more information, see http://creativecommons.org/licenses/by-sa/2.5/legalcode ''[creativecommons.org]'' for the full terms of the license.
This document is licensed under the &quot;Creative Commons Attribution-Share Alike 2.5&amp;quot;:http://creativecommons.org/licenses/by-sa/2.5/ license.


^1 <span class="caps">ISO</span> is a registered trademark of the International Organization for Standardization.
[[Image:http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/share.png|http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/share.png]] [[Image:http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/remix.png|http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/remix.png]] [[Image:http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/by.png|http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/by.png]] [[Image:http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/sa.png|http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/sa.png]]


===Categories:===
For more information, see &quot;http://creativecommons.org/licenses/by-sa/2.5/legalcode&amp;quot;:http://creativecommons.org/licenses/by-sa/2.5/legalcode for the full terms of the license.


* [[:Category:Learning|Learning]]
^1 ISO is a registered trademark of the International Organization for Standardization.
** [[:Category:Learning::Whitepapers|Whitepapers]]

Revision as of 14:21, 23 February 2015

English 한국어 "French&quot;:http://qt-devnet.developpez.com/tutoriels/qt/livre-blanc/

[toc align_right="yes&quot; depth="2&quot;]

Qt Whitepaper

http://qt.digia.com/Documents/Qt_master_logo_CMYK_noback.gif

This whitepaper describes the Qt C++ framework. Qt supports the development of cross-platform GUI applications with its "write once, compile anywhere&quot; approach. Using a single source tree and a simple recompilation, applications can be written for Windows, Mac OS X, Linux, Solaris, HP-UX, and many other versions of Unix with X11.

Qt applications can also be compiled to run on embedded Linux, Symbian and Windows CE platforms.

Qt has excellent cross-platform support for multimedia and 3D graphics, internationalization, SQL, XML and unit testing, as well as providing platform-specific extensions for specialized applications.

Qt applications can be built visually using Qt Designer, a flexible user interface builder with support for IDE integration.

The release of Qt 4.7 introduces the foundations of Qt Quick, a collection of technologies for rapid prototyping and creation of modern, intuitive user interfaces. These are covered briefly in the Qt Quick section later in this whitepaper, and are described in more detail in the Introduction to Qt Quick for C++ Developers whitepaper.

Introduction

Qt is the de facto standard C++ framework for high performance cross-platform software development. In addition to an extensive C++ class library, Qt includes tools to make writing applications fast and straightforward. Qt's cross-platform capabilities and internationalization support ensure that Qt applications reach the widest possible market.

The Qt C++ framework has been at the heart of commercial applications since 1995. Qt is used by companies and organizations as diverse as Adobe®, Boeing®, Google®, IBM (R), Motorola®, NASA, Skype®, and by numerous smaller companies and organizations. Qt 4 is designed to be easier to use than previous versions of Qt, while adding more powerful functionality. Qt's classes are fully featured and provide consistent interfaces to assist learning, reduce developer workload, and increase programmer productivity. Qt is, and always has been, fully object-oriented.

This whitepaper gives an overview of Qt's tools and functionality. Each section begins with a non-technical introduction before providing a more detailed description of relevant features. Links to online resources are also given for each subject area.

To evaluate Qt Commercial for 30 days, visit "http://qt.digia.com/en/downloads/&quot;:http://qt.digia.com/en/downloads/. Qt is also available under a LGPL license from "https://qt.io/download&quot;:https://qt.io/download.

Executive Summary

Qt includes a rich set of widgets ("controls&quot; in Windows terminology) that provide standard GUI functionality. Qt introduces an innovative alternative for inter-object communication, called "signals and slots&quot;, that replaces the old and unsafe callback technique used in many legacy frameworks. Qt also provides a conventional event model for handling mouse clicks, key presses, and other user input. Qt's cross-platform GUI applications can support all the user interface functionality required by modern applications, such as menus, context menus, drag and drop, and dockable toolbars. Desktop integration features provided by Qt can be used to extend applications into the surrounding desktop environment, taking advantage of some of the services provided on each platform.

Qt also includes Qt Designer, a tool for graphically designing user interfaces. Qt Designer supports Qt's powerful layout features in addition to absolute positioning. Qt Designer can be used purely for GUI design, or to create entire applications with its support for integration with popular integrated development environments (IDEs).

Qt has excellent support for multimedia and 3D graphics (page). Qt is the de facto standard GUI framework for platform-independent OpenGL® programming. Qt's painting system offers high quality rendering across all supported platforms. A sophisticated canvas framework enables developers to create interactive graphical applications that take advantage of Qt's advanced painting features.

Qt makes it possible to create platform-independent database applications using standard databases. Qt includes native drivers for Oracle®, Microsoft® SQL Server, Sybase® Adaptive Server, IBM DB2®, PostgreSQL™, MySQL®, Borland® Interbase, SQLite, and ODBC-compliant databases. Qt includes database-specific widgets, and any built-in or custom widget can be made data-aware.

Qt programs have native look and feel on all supported platforms using Qt's styles and themes support. From a single source tree, recompilation is all that is required to produce applications for Windows®, Mac OS X (R), Linux®, Solaris™, HP-UX™, and many other versions of Unix® with X11™. Qt's <code&gt;qmake&lt;/code&gt; build tool produces makefiles or <code&gt;.dsp&lt;/code&gt; files appropriate to the target platform.

Since Qt's architecture takes advantage of the underlying platform, many customers use Qt for single-platform development on Windows, Mac OS X, and Unix because they prefer Qt's approach. Qt includes support for important platform-specific features, such as ActiveX® on Windows, and Motif™ on Unix. See the section on sec:Qt's-Architecture for more information.

Qt uses Unicode™ throughout and has considerable support for internationalization. Qt includes Qt Linguist and other tools to support translators. Applications can easily use and mix text in Arabic, Chinese, English, Hebrew, Japanese, Russian, and other languages supported by Unicode.

Qt includes a variety of domain-specific classes. For example, Qt has an XML module that includes SAX and DOM classes for reading and manipulating data stored in XML-based formats. Objects can be stored in memory using Qt's STL-compatible collection classes, and handled using styles of iterators used in Java® and the C++ Standard Template Library (STL). Local and remote file handling using standard protocols are provided by Qt's input/output and networking classes.

Qt applications can have their functionality extended by plugins and dynamic libraries. Plugins provide additional codecs, database drivers, image formats, styles, and widgets. Plugins and libraries can be sold as products in their own right.

The QtScript module enables applications to be scripted with Qt Script, an ECMAScript-based language related to JavaScript. This technology allows developers to give users restricted access to parts of their applications for scripting purposes.

Qt is a mature C++ framework that is widely used around the world. In addition to Qt's many commercial uses, the Open Source edition of Qt is the foundation of KDE, the Linux desktop environment. Qt makes application development a pleasure, with its cross-platform build system, visual form design, and elegant API.

Online References

"Qt Videos: Qt in Use&quot;:http://qt.io/videos#c-142

Graphical User Interfaces

Qt provides a rich set of standard widgets that can be used to create graphical user interfaces for applications. Layout managers are used to arrange and resize widgets to suit the user's screen, language and fonts.

Widgets are visual elements that are combined to create user interfaces. Buttons, menus and scroll bars, message boxes and application windows are all examples of widgets.

Layout managers organize child widgets within their parent widget's area. They perform automatic positioning and resizing of child widgets, provide sensible minimum and default sizes for top-level widgets, and automatically reposition widgets when their contents change.

Signals and slots connect application components together so that they can communicate in a simple, type-safe way. This form of inter-object communication is enabled in all standard widgets and can be used by developers in their own custom widgets.

http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/widgets.png

A selection of widgets provided by Qt.

Widgets

The images above present a selection of widgets. These include standard text entry widgets, check boxes, radio buttons, sliders and push buttons, as well as more specialized widgets for date and time entry.

Labels, message boxes, tooltips and other textual widgets are not confined to using a single color, font and language. Qt's text-rendering widgets can display multi-language rich text using a subset of HTML.

Container widgets such as tab widgets and group boxes are also available, and can be used to group related user interface components. These widgets are managed specially in Qt Designer to help designers create new user interfaces. More complex widgets, such as scrolling views, are often used more by developers than by user interface designers because they are used to display specialized or dynamic content.

Developers can create their own widgets and dialogs by subclassing the base QWidget class or one of its subclasses. Specialized widgets like these can be completely customized to render their own content, respond to user input, and provide their own signals and slots.

Qt provides many other widgets than those shown here. Many of the available widgets are shown with links to their class documentation in Qt's online "Widget Gallery&quot;:http://doc.qt.io/qt-4.8/gallery.html.

Layouts

Layouts provide flexibility and responsiveness to user interfaces, enabling them to adapt when their styles, orientations or text fonts are updated.

Layouts help developers to support internationalization in their applications. With fixed sizes and positions, translated text is often truncated; with layouts, the child widgets are automatically resized. Additionally, widget placement can be reversed to provide a more natural appearance for users who work with right-to-left writing systems.

Layouts can also run from right-to-left and from bottom-to-top. Right-to-left layouts are convenient for internationalized applications supporting right-to-left writing systems such as Arabic and Hebrew. The built-in layouts are fully integrated with Qt's style system to provide a consistent look and feel on reversed displays.

Qt Designer is fully able to use layouts to position widgets.

Signals and Slots

"Signals and slots&quot;:http://doc.qt.io/qt-4.8/signalsandslots.html are used for communication between Qt objects. The signals and slots mechanism is a central feature of Qt and probably the part that differs most from the features provided by other frameworks. Signals and slots makes it easy to implement the "Observer pattern&quot;:http://en.wikipedia.org/wiki/Observer_pattern.

Widgets emit signals when events occur. For example, a button will emit a "clicked&quot; signal when it is clicked. A developer can choose to connect to a signal by creating a function (a "slot&quot;) and calling the <code&gt;connect()</code&gt; function to relate the signal to the slot. Qt's signals and slots mechanism does not require classes to have knowledge of each other, which makes it much easier to develop highly reusable classes. Since signals and slots are type-safe, type errors are reported as warnings and do not cause crashes to occur.

For example, if a Quit button's <code&gt;clicked()</code&gt; signal is connected to the application's <code&gt;quit()</code&gt; slot, a user's click on Quit makes the application terminate. In code, this is written as

connect(button, SIGNAL (clicked()), qApp, SLOT (quit()));<code>

Connections can be added or removed at any time during the execution of a Qt application, they can be set up so that they are executed when a signal is emitted or queued for later execution, and they can be made between objects in different threads.

The signals and slots mechanism is implemented in standard C+''. The implementation uses the C''+ preprocessor and &lt;code&amp;gt;moc&amp;lt;/code&amp;gt;, the Meta-Object Compiler, included with Qt. Code generation is performed automatically by sub:Qt's-Build-System. Developers never have to edit or even look at the generated code.

In addition to handling signals and slots, the Meta-Object Compiler supports Qt's translation mechanism, its property system, and its extended run-time type information. It also makes run-time introspection of C++ programs possible in a way that works on all supported platforms. The underlying system that provides these facilities is known as Qt's meta-object system &amp;amp;#40;see page.

=== Online References ===

&quot;Qt Examples&amp;quot;:http://doc.qt.io/qt-4.8/all-examples.html

&quot;Layout Management&amp;quot;:http://doc.qt.io/qt-4.8/layout.html

&quot;Object Model&amp;quot;:http://doc.qt.io/qt-4.8/object.html

&quot;Signals and Slots&amp;quot;:http://doc.qt.io/qt-4.8/signalsandslots.html

= Application Features =

''Building modern GUI applications with Qt is fast and simple, and can be achieved by hand coding or by using Qt Designer, Qt's visual design tool.''

Qt provides all the features necessary to create modern GUI applications with menus, toolbars and dock windows. Qt supports both SDI (single document interface&amp;amp;amp;#41; and MDI (multiple document interface). Qt also supports drag and drop and the clipboard.

A full set of standard dialogs are provided, including those for choosing files, folders, fonts, and colors. In practice, a one-line statement using one of Qt's static convenience functions is all that is necessary to present a standard dialog.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/assistant.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/assistant.png]]

''Qt Assistant uses many of the main window application features to display Qt's documentation.''

Qt uses actions to simplify user interface programming. For example, if a menu option, a toolbar button, and a keyboard accelerator all perform the same action, the action need only be coded once.

Qt can store application settings in a platform-independent way, using the system registry or text files, allowing items such as user preferences, most recently used files, window and toolbar positions and sizes to be recorded for later use.

Support for multithreading programming is provided by a collection of classes that represent common constructs, making it possible to write Qt applications that take advantage of threads to perform calculations, long duration tasks, or just to improve responsiveness.

Applications can also use Qt's desktop integration features to interact with services provided by the user's desktop environment.

== Main Window Features ==

The '''QMainWindow''' class provides a framework for typical application main windows. A main window contains a set of standard widgets. The top of the main window is occupied by a menu bar, beneath which toolbars are laid out in toolbar areas around the center of the window. The area of the main window below the bottom toolbar area is occupied by a status bar. Tooltips and &quot;What's this?&quot; help provide balloon help for the user interface elements.

=== QMenu ===

The QMenu widget presents menu items to the user in a vertical list. Menus can be standalone (e.g., a context pop-up menu), can appear in a menu bar, or can be a sub-menu of another pop-up menu. Menus can have tear-off handles.

Each menu item can have an icon, a checkbox, and an accelerator. Menu items usually correspond to actions (e.g., &quot;Save&amp;quot;) and cause their associated slots to be executed when selected by the user. Qt's layout managers take any menu bar into consideration. On Mac OS X, the menu bar appears at the top of the screen.

Qt's menus are very flexible and are part of an integrated ''action system'' (see sub:Actions ). Actions can be enabled or disabled, dynamically added to menus, and removed again later.

=== QToolBar ===

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/macintosh-unified-toolbar.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/macintosh-unified-toolbar.png]]

''Unified toolbar support on Mac OS X improves the look and feel of applications by blending adjacent toolbars and window title bars together.''

Toolbars contain collections of buttons and other widgets that the user can access to perform actions. They can be moved between the areas at the top, left, right, and bottom of the central area of a main window. Any toolbar can be dragged out of its toolbar area, and floated as an independent tool palette.

The '''QToolButton''' class implements a toolbar button with an icon, a styled frame, and an optional label. Toggle toolbar buttons turn features on and off. Other toolbar buttons execute commands. Different icons can be provided for the active, disabled, and enabled modes, and for the on and off states. If only one icon is provided, Qt automatically distinguishes the state using visual cues, for example, graying out disabled buttons. Toolbar buttons can also trigger pop-up menus.

Dock windows are windows that the user can move inside a toolbar area or from one toolbar area to another. The user can undock a dock window and make it float on top of the application, or minimize it. Animations are used to smoothly slide dock windows into and out of dock areas.

Dock areas can also be nested to allow dock windows to be stacked in multiple rows or columns, and dock windows can be stacked together in shared areas  when this occurs, the dock widgets are held in tabs.

Customization of dock windows is also possible. They can be displayed with vertical title bars, and given individually-styled title bars and window controls.

Some applications, including ''Qt Designer'' (see page) and ''Qt Linguist'' (page), use dock windows extensively. provides operators to save and restore the position of dock windows and toolbars, so that applications can easily restore the user's preferred working environment.

=== QStatusBar ===

The QStatusBar class provides a horizontal bar suitable for presenting status information, for example a can be hint:


statusBar()>showMessage("Ready&quot;);

<br />This snippet will show the message</s> &quot;Ready&amp;quot; on status bar. You can set property &lt;code&amp;gt;statusHint&amp;lt;/code&amp;gt; in any widget.

== Actions ==

Applications usually provide the user with several different ways to perform a particular action. For example, most applications have traditionally provided a &quot;Save&amp;quot; action available from the menu, from the toolbar (a toolbar button with an appropriate icon), and as an accelerator (). The '''QAction''' class encapsulates this concept. It allows programmers to define an action in one place.

As well as avoiding duplication of work, using a '''QAction''' ensures that the state of menu items stay in sync with the state of related toolbar buttons, and that interactive help is displayed when necessary. Disabling an action will disable any corresponding menu items and toolbar buttons. Similarly, if the user clicks a toggle button in a toolbar, the corresponding menu item will also be toggled.

== Dialogs and Wizards ==

Most GUI applications use dialog boxes to interact with the user for certain operations. Qt includes ready-made dialog classes with convenience functions for the most common tasks. Screenshots of some of Qt's standard dialogs are presented below. Qt also provides standard dialogs for color selection, printing, indicating progress and displaying messages.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/filedialog.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/filedialog.png]] [[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/fontdialog.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/fontdialog.png]]

''A '''QFileDialog''' and a '''QFontDialog''' shown in the Plastique style. On Windows and Mac OS X, native dialogs are used instead.''

Programmers can create their own dialogs by subclassing '''QDialog'''. ''Qt Designer'' also includes dialog templates to help developers get started with new designs.

Wizards are used to guide users through common tasks and processes, taking them step by step through the available options and providing help where necessary. Qt provides a flexible, yet intuitive API for building wizards with the appropriate native look and feel on each supported platform.

The '''QWizard''' class provides features for customizing the appearance of the wizard beyond the basic platform-specific look and feel. Instances of this class also control the order in which pages are presented to the user. '''QWizardPage''' is a standard widget that provides features to store and validate user input.

== Interactive Help ==

Applications often use various forms of interactive help to explain the purpose of user interface elements and assist users. Qt provides two mechanisms for giving brief help messages: tooltips for short context-sensitive help and &quot;What's this?&quot; pop-up help containing longer, more informative messages. Both of these are integrated with Qt's action system.

Developers can deploy ''Qt Assistant'' as the help browser for their own applications and documentation sets by using the classes in Qt's Help module. This module also provides an API that developers can use to access documentation for custom display purposes, perhaps using the tooltips and &quot;What's This?&quot; classes to show small pieces of relevant information to users.

== Settings ==

User settings and other application settings can easily be stored on disk using the '''QSettings''' class. On Windows, Mac OS X and Linux platforms, settings are stored in standard system locations; on other platforms, they are stored in text files.

A variety of Qt data types can be used seamlessly with '''QSettings''' and will be serialized for storage and later retrieval by applications. See sub:File-Handling for more information about serialization of Qt's data types.

== Multithreading and Concurrent Programming ==

Qt applications can use multiple threads: one thread to keep the user interface responsive, and one or many other threads to perform time-consuming activities such as reading large files and performing complex calculations. Qt provides classes to represent threads, mutexes, semaphores, thread-global storage, and locking primitives.

Facilities for concurrent programming are also provided, including implementations of the well-known map-reduce and filter-reduce algorithms. These are integrated with Qt's object model, using standard container classes to make it more convenient to use concurrent techniques in Qt applications.

Qt's meta-object system enables objects in different threads to communicate using signals and slots, making it possible for developers to create single-threaded applications that can later be adapted for multithreading without an extensive redesign.

== Desktop Integration ==

Applications can be extended to interact with services provided by the user's desktop environment by using Qt's desktop integration classes. These range from '''QSystemTrayIcon''', which is often used by long-running applications to provide a persistent indicator in the system tray, to '''QDesktopServices''', which allows resources such as &lt;code&amp;gt;mailto:&lt;/code&amp;gt; and &lt;code&amp;gt;http://&amp;lt;/code&amp;gt; URLs to be processed by the most appropriate applications on each platform.

=== Online References ===

&quot;The Qt 4 Main Window Classes&amp;quot;:http://doc.qt.io/qt-4.8/qt4-mainwindow.html

= Qt Designer =

''Qt Designer is a graphical user interface design tool for Qt applications. Applications can be written entirely as source code, or using Qt Designer to speed up development. A component-based architecture makes it possible for developers to extend Qt Designer with custom widgets and extensions, and even integrate it into integrated development environments.''

Designing a form with ''Qt Designer'' is a simple process. Developers drag widgets from a toolbox onto a form, and use standard editing tools to select, cut, paste, and resize them. Each widget's properties can then be changed using the property editor. The precise positions and sizes of the widgets do not matter. Developers select widgets and apply layouts to them. For example, some button widgets could be selected and laid out side by side by choosing the &quot;lay out horizontally&amp;quot; option. This approach makes design very fast, and the finished forms will scale properly to fit whatever window size the end-user prefers. See sub:Layouts for information about Qt's automatic layouts.

''Qt Designer'' eliminates the time-consuming &quot;compile, link, and run&amp;quot; cycle for user interface design. This makes it easy to correct or change designs. ''Qt Designer'''s preview options let developers see their forms in other styles; for example, a Mac OS X developer can preview a form in the Windows style. Forms can be previewed using device &quot;skins&amp;quot; to simulate the display constraints and appearance of the target device.

Commercial licensees on Windows can enjoy ''Qt Designer'''s user interface design facilities from within Microsoft Visual Studio®. Qt Development Frameworks also produces a Qt integration plugin for the cross-platform Eclipse IDE that embeds ''Qt Designer'' alongside other Qt technologies into the IDE framework.

== Working with Qt Designer ==

Developers can create both &quot;dialog&amp;quot; style applications and &quot;main window&amp;quot; style applications with menus, toolbars, balloon help, and other standard features. Several form templates are supplied, and developers can create their own templates to ensure consistency across an application or family of applications. Programmers can create their own custom widgets that can easily be integrated with ''Qt Designer''.

''Qt Designer'' supports a form-based approach to application development. A form is represented by a user interface (&lt;code&amp;gt;.ui&amp;lt;/code&amp;gt;) file, which can either be converted into C++ and compiled into an application, or processed at run-time to produce dynamically-generated user interfaces. Qt's build system &amp;amp;#40;see page&amp;amp;amp;#41; is able to automate the compile-time construction of user interfaces to make the design process easier.

The tools used to create and edit the source code for applications created with ''Qt Designer'' will depend on each developer's personal preferences; some will want to take advantage of the integration features provided with ''Qt Designer'' to develop from within Microsoft Visual Studio or the Eclipse environment.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/designer-46-overview.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/designer-46-overview.png]]

''An overview of Qt Designer's user interface.''

== Extending Qt Designer ==

The component-based architecture used as a foundation for ''Qt Designer'' was specifically designed to allow developers to extend its user interface and editing tools with custom components. In addition, the modular nature of the application makes it possible to make ''Qt Designer'''s user interface design features available from within integrated development environments such as Qt Creator, Microsoft Visual Studio and KDevelop.

In total, the QtDesigner module provides over 20 classes for working with &lt;code&amp;gt;.ui&amp;lt;/code&amp;gt; files and extending ''Qt Designer''. Many of these allow third parties to customize the user interface of the application itself.

Third party and custom widgets for in-house work are easily integrated into ''Qt Designer''. Adapting an existing widget for use within ''Qt Designer'' only requires a the widget to be compiled as a plugin, using an interface class to supply default widget properties and construct new instances of the widget. The plugin's interface is exported to ''Qt Designer'' using a macro similar to that described in sub:Plugins .

=== Online References ===

&quot;Qt Designer Manual&amp;quot;:http://doc.qt.io/qt-4.8/designer-manual.html

&quot;Qt Creator&amp;quot;:http://wiki.qt.io/Category:Tools::QtCreator

&quot;QtDesigner Module&amp;quot;:http://doc.qt.io/qt-4.8/qtdesigner.html

&quot;Qt Designer Examples&amp;quot;:http://doc.qt.io/qt-4.8/examples-designer.html

= Graphics and Multimedia =

''Qt provides excellent support for 2D and 3D graphics. Qt's 2D graphics classes support raster and vector graphics, can load and save a wide and extensible range of image formats, and can export text and graphics to Portable Document Format (PDF) files. Qt can draw transformed Unicode rich text, Scalable Vector Graphics (SVG) drawings, and provides a fully-featured canvas for demanding interactive applications. Qt also provides features for playing audio and video files and streams.''

Graphics are drawn using device-independent painter objects that allow the developer to reuse the same code to render graphics on different types of device, represented in Qt by paint devices (see sub:Painting on page). This approach ensures that a wide range of powerful painting operations are available for each of the devices supported by Qt, and also allows developers to choose the devices that are most suitable for their needs.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/demos-boxes.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/demos-boxes.png]]

''The Boxes demonstration presents a range of Qt's graphical features.''

Graphical applications that require an interactive canvas can take advantage of the Graphics View framework to manage and render scenes with large numbers of interactive items, using multiple views if necessary.

Qt's support for OpenGL and OpenGL ES helps developers to integrate 3D graphics into their applications, yet it also enables them to take advantage of modern graphics hardware to improve 2D rendering performance.

Device-independent color support enables colors to be specified by ARGB, AHSV, or ACMYK values, or by common names. The color channels used are 16 bits wide, and an optional level of opacity can be specified. Qt automatically allocates the requested color in the system's palette, or uses a similar color on color-limited displays.

== Painting ==

Qt provides a platform-independent API for painting onto widgets and other paint devices. It provides drawing primitives as well as advanced features such as transformations and clipping. All of Qt's built-in widgets paint themselves using '''QPainter''', and programmers use this class when implementing their own custom widgets.

=== QPainter ===

QPainter provides standard functions to draw points, lines, ellipses, arcs, B'ezier curves, and other primitives. More complex painting operations include support for polygons and vector paths, allowing detailed drawings to be prepared in advance and drawn using a single function call. Text can also be painted directly with a painter or incorporated in a path for later use.

Qt's painting system also provides a number of features to improve overall rendering quality, including alpha blending, Porter-Duff composition modes, anti-aliasing, and linear, radial and conical gradient fills.

'''Warning:''' When painting on a QWidget, QPainter can only be used inside a paintEvent() function or in a function called by paintEvent(); that is unless the Qt::WA_PaintOutsidePaintEvent widget attribute is set. On Mac OS X and Windows, you can only paint in a paintEvent() function regardless of this attribute's setting.


void paintEvent(QPaintEvent *)
{
QPainter doc(this);
QLineF line(10.0, 80.0, 90.0, 20.0);
doc.drawLine(line);
}

This snippet will draw a black line on a widget. &quot;There are many methods&amp;quot;:http://doc.qt.io/qt-4.8/qpainter.html to set brush, pen and aliasing.

== Images ==

Qt supports input, output, and manipulation of images in several formats, including BMP, GIF, JPEG, MNG, PNG, PNM, TIFF, XBM and XPM. Both classes can be used as paint devices and used in interactive graphical applications, or they can be used to preprocess images for later use in user interface components.

'''QImage''' is used for image manipulation, and can perform conversions between various color depths and pixel formats. Programmers can manipulate the pixel and palette data, apply transformations such as rotations and shears, and reduce the color depth with dithering if desired. Support for alpha channels enables applications to use transparency and alpha-blending for image composition and other purposes.

The range of graphics file formats that can be used with these classes can be extended through the use of an extensible plugin mechanism.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/graphicsview-map.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/graphicsview-map.png]]

''The Graphics View framework enables graphical applications to be created which combine high quality rendering with comprehensive features for user interaction.''

== Paint Devices and Printing ==

'''QPainter''' can operate on any paint device. The code required to paint on any supported device is the same, regardless of the device.

All widgets are paint devices. Qt uses a ''backing store'' to reduce flickering during the painting process. Translucent and shaped windows can be created on suitably configured systems.

OpenGL surfaces used with '''QGLWidget''' are also paint devices that convert standard '''QPainter''' calls to OpenGL calls, enabling two-dimensional graphics to be accelerated on devices with appropriately supported hardware.

Images can also be created by painting on device-independent '''QImage''' and display-optimized '''QPixmap''' objects. Standard image format files can be created by rendering to an image with the desired color depth and pixel format. Images can be created with support for varying levels of transparency and painted onto custom widgets to achieve certain effects.

Vector and meta-file formats are also supported by the paint system. '''QSvgGenerator''' creates Scalable Vector Graphics (SVG) drawings (see page) by translating painting commands to the corresponding structures in the SVG file format. '''QPicture''' is used to hold a sequence of painting commands that can be replayed when painting on another paint device or stored in a file.

Printing is performed by rendering to a '''QPrinter''' device that represents a physical printer. On Windows, the paint commands are sent to the Windows print engine, which uses the installed printer drivers. On Unix, PostScript® or Portable Document Format (PDF) data is sent to the print daemon  this is handled by the Common Unix Printing System &amp;#40;CUPS&amp;amp;#41; on modern systems.

Using Qt's generic painting API, applications can create PDF and PostScript files can be generated on all platforms, enabling applications to create high quality documents that can be viewed using suitable reader applications.

== Graphics View Framework ==

Qt introduces a powerful new framework for interactive graphical applications that is used to manage and display large numbers of items in a two-dimensional scene. Graphics View provides both an object-based API for adding new items to a scene and a traditional canvas-style API containing convenience functions for creating predefined items.

Once created, items can be placed with the required position, orientation, and scale in a scene. The display and item management functionality are implemented separately in the '''QGraphicsView''' and '''QGraphicsScene''' classes, enabling features such as multiple views onto the same scene and support for switchable renderers.

A selection of standard item types are provided, and these can be extended through subclassing to provide custom item types. Items can be grouped together to allow higher-level control over parts of a scene. Each scene, view, and the items themselves provide a comprehensive set of functions to allow coordinates to be transformed conveniently between coordinate systems. Both standard and custom items can be made selectable and movable, enabling a basic level of interactivity with a minimum of code.

Graphics View has been designed with animations in mind: items can be used to create animated objects that are transformed according to a series of transformations defined at certain points on a timeline.

Some of the standard items bring features found in other parts of Qt to the Graphics View framework, including rich text editing, Web browsing, display of SVG drawings and the use of shapes, paths and images. Items on a scene can also be rendered independently of any attached view, enabling scenes to be rendered to image files and printed to PDF files or printers.

A fully-featured event model enables events to be handled efficiently by dispatching them only to the items that require them. Since basic item handling is performed by the framework, items only need to respond to events if they need particular information about their environment.

Applications that need to mix classical user interface elements with interactive content can embed widgets directly into a scene using '''QGraphicsProxyWidget''', or create widget-like elements from scratch with '''QGraphicsWidget'''. As with conventional user interfaces, layout managers can be used to arrange widgets and items in a scene.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/svgviewer-example.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/svgviewer-example.png]]

''SVG drawings can be rendered onto any paint device supported by Qt.''

== Scalable Vector Graphics (SVG) ==

SVG is an XML-based file format and language for describing graphical applications that is commonly associated with two-dimensional Web-based graphics. SVG support in Qt is based on the SVG 1.1 standard, a World Wide Web Consortium (W3C®) Recommendation, and provides additional features to support the Tiny profiles of SVG 1.1 and 1.2.

Qt can render SVG drawings onto any paint device, including those for images and OpenGL widgets. This flexibility lets developers trade quality for speed as required. SVG drawings can also be used for icons in standard user interface controls, removing the need to generate bitmaps in a range of predefined sizes.

Developers can also generate SVG drawings by using '''QPainter''' functions to draw on a specialized SVG paint device, allowing graphics used in applications to be exported as SVG drawings with little additional effort.

== 3D Graphics ==

OpenGL is a standard API for rendering 3D graphics that can be used by Qt developers to include 3D graphics in their GUI applications. Qt's OpenGL module is available on Windows, X11, and Mac OS X, and uses each system's OpenGL library.

To use OpenGL in a Qt application, developers only need to subclass '''QGLWidget''' and draw onto it with standard OpenGL functions. Qt provides functions to convert color values to OpenGL's color format to help developers provide a consistent user interface for their applications.

Qt also enables OpenGL features and extensions to be used conveniently from within Qt applications. Convenience functions allow textures to be created from images, and support for pixel buffers and framebuffer objects are provided by appropriate classes. Support for features such as sample buffers can be enabled if they are available on the underlying platform.

2D applications can use '''QGLWidget''' subclasses to improve rendering performance on appropriate hardware. In this use case, standard '''QPainter''' operations are translated into OpenGL calls. This also makes it possible to overlay controls and decorations onto 3D scenes drawn using pure OpenGL. On embedded platforms, where hardware acceleration is often limited, this paint engine is restricted to using the functionality of OpenGL ES 2.0, ensuring that it works well on as many devices as possible.

On suitable hardware, support for anti-aliased rendering can be enabled to enhance both the rendering speed and quality of graphics produced using the OpenGL paint engine. On less-capable hardware, developers can give users the choice between quality and speed by exposing these rendering options to users at run-time.

== Multimedia ==

Qt uses the Phonon multimedia framework, an open source project originating from the KDE project, to provide media playback features that can be accessed using a consistent, cross-platform API. Qt ensures that applications on Linux/Unix, Windows and Mac OS X transparently use the appropriate multimedia framework for each platform  this means that applications can also take advantage of platform-specific support for audio and video codecs and formats.

Phonon's features can be integrated into other technologies provided by Qt. For example, movie widgets can be added to Web pages displayed using the WebKit browser engine and to scenes rendered using the Graphics View framework.

Additional classes for multimedia are included in the QtMultimedia module. These classes are focused on providing low-level access to audio and video data.

=== Online References ===

&quot;QPainter Class Reference&amp;quot;:http://doc.qt.io/qt-4.8/qpainter.html &quot;Graphics View Framework&amp;quot;:http://doc.qt.io/qt-4.8/graphicsview.html

&quot;OpenGL Examples&amp;quot;:http://doc.qt.io/qt-4.8/examples-opengl.html &quot;QtMultimedia Module&amp;quot;:http://doc.qt.io/qt-4.8/qtmultimedia.html

&quot;QtSvg Module&amp;quot;:http://doc.qt.io/qt-4.8/qtsvg.html &quot;Phonon Multimedia Framework&amp;quot;:http://doc.qt.io/qt-4.8/phonon-overview.html

= Item Views =

''Qt's item view widgets provide standard GUI controls for displaying and modifying large quantities of data. The underlying model/view framework isolates the way data is stored from the way it is presented to the user, enabling features like data sharing, sorting and filtering, multiple views, and multiple data representations to be used for the same data.''

When writing applications that process large quantities of data, developers typically rely on &quot;item view&amp;quot; widgets to display items of data quickly and efficiently. Standard item views found in modern GUI toolkits include list views containing simple lists of items, tree views with hierarchical lists of items, and table views which provide layout features similar to those found in spreadsheet applications.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/cleanlooks-treeview.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/cleanlooks-treeview.png]] [[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/plastique-listview.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/plastique-listview.png]] [[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/macintosh-tableview.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/macintosh-tableview.png]]

''Qt provides standard item views for trees, lists and tables of items.''

Qt's item view classes are available in two different forms: as classic item view widgets and as model/view components. Classic list, table and tree widgets are self-contained item views that manage item objects explicitly created by the developer.

'''QListView''', '''QTableView''' and '''QTreeView''' are the equivalent model/view components to the classic item views. These model/view components provide a cleaner, component-oriented way to handle data sets. Additionally, a set of standard models are provided to help developers organize their data.

== Standard Item Views ==

Standard implementations of list widgets, icon views, tree widgets, and tables are supplied with Qt. These support drag and drop operations within the same view and between different views. As with all Qt widgets, they are also fully integrated with Qt's resource system.

Item view classes are used to display data for various standard dialogs in Qt (Figure ) and are extensively used in ''Qt Designer'', ''Qt Assistant'', and ''Qt Linguist''.

Classic item views are typically used to display and manage a few hundred items of data, using an architecture that uses individual objects to encapsulate pieces of data. This approach should be familiar to existing Qt developers, and provides a convenient way to rapidly construct rich user interfaces for handling moderate amounts of data.

For consistency and reliability, the classic item views are built upon Qt's model/view framework, which provides a more scalable and customizable way to handle item view data.

== Qt's Model/View Framework ==

The model/view framework provided by Qt is a variation of the well-known ''Model-View-Controller'' pattern, adapted specially for Qt's item views. In this approach, models are used to supply data to other components, views display items of data to the user, and delegates handle aspects of the rendering and editing processes.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/modelview-delegates.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/modelview-delegates.png]]

''The component-oriented architecture of the model/view framework makes it easy to customize item views.''

Models are wrappers around sources of data that are written to conform to a standard interface provided by '''QAbstractItemModel'''. This interface enables widgets derived from '''QAbstractItemView''' to access data supplied via the model, irrespective of the nature of the original data source.

The separation between data and its presentation which this approach enables provides a number of improvements over classic item views:

* Since models provide a standard interface for accessing data, they can be designed and written separately from other components, and replaced if necessary.
* Data obtained from models can be shared between views. This enablesapplications to provide multiple views onto the same data set, andpotentially show different representations of data.
* Selections can be shared between views, or kept separate, dependingon the user's requirements and expectations.
* For standard list, tree, and table views, most of the rendering isperformed by delegates. This makes it easy to customize views formost purposes without having to write a lot of new code.
* By using ''proxy models'', data supplied by models can be transformed before it is supplied to views. This enablesapplications to provide sorting and filtering facilities that can be shared between multiple views.

The model/view system is also used by Qt's SQL models to make database integration simpler for non-database developers.

=== Online References ===

&quot;Model/View Programming&amp;quot;:http://doc.qt.io/qt-4.8/model-view-programming.html

&quot;Qt Examples&amp;quot;:http://doc.qt.io/qt-4.8/all-examples.html

= Text Handling =

''Qt provides a powerful text editor widget that allows the user to create and edit rich text documents, and can be used to prepare documents for printing. The underlying document structure used by the editor is fully accessible to developers, allowing both the structure and content of documents to be manipulated.''

Rich text documents typically contain text in a variety of fonts, colors, and sizes arranged in a series of paragraphs. Text can also be organized using lists and tables, and may be visually separated from the main body of a document by using frames. The appearance of each document element can be precisely adjusted using the many properties made available to developers through the rich text API.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/textedit-demo.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/textedit-demo.png]] [[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/textedit-OpenOffice.org.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/textedit-OpenOffice.org.png]]

''Qt's advanced rich text document features allow complex documents to be created and edited in '''QTextEdit''' (left). Documents can be exported in OpenDocument format for use in suitable document processors (right).''

== Rich Text Editing ==

Interactive rich text display and editing are handled in Qt by the '''QTextBrowser''' and '''QTextEdit''' widgets. These widgets fully support Unicode and are built on a structured document representation provided by '''QTextDocument''' that removes the need to use intermediate mark up languages to create rich text. '''QTextDocument''' also provides support for importing and exporting a subset of HTML 4.0, full undo/redo capabilities (including grouping of operations), and resource handling.

Qt provides an object-based API for documents that helps developers obtain a high-level overview of their structures. A cursor-based API is also provided to allow convenient exploration, processing and transformation of documents. In addition to the classes corresponding to structure and content, there are a number of classes which control the appearance of text and document elements. These allow the text styles for tables, lists, frames, and ordinary paragraphs to be customized to give documents the desired appearance.

Documents created programatically remain editable in '''QTextEdit''' widgets and maintain a full undo/redo history. Developers can augment the standard editing features available to let users add custom structures and content.

== Customization, Printing and Document Export ==

Qt's text handling features can also be used to provide specialized text formatting for custom widgets and rich text documents. These can be written using low-level classes such as '''QTextLayout''' to lay out the text line by line, and integrated into the extensible text layout system provided by '''QTextDocument''' for use with '''QTextEdit'''.

Syntax highlighting rules can also be applied to rich text documents with the '''QSyntaxHighlighter''' class. This allows a standard '''QTextEdit''' widget to be used as the basis for a code editor, or to provide highlighting facilities for document search tools.

Documents can also be formatted according to information obtained from a '''QPrintDialog''' into a series of pages suitable for printing with a '''QPrinter'''.

The '''QTextDocumentWriter''' class provides support for document export to HTML, plain text and OpenDocument Format (ODF) files. This class exposes its functionality via a generic API and is designed to be extended to support additional formats in future releases.

=== Online References ===

&quot;The Scribe Classes&amp;quot;:http://doc.qt.io/qt-4.8/qt4-scribe.html

&quot;Rich Text Processing&amp;quot;:http://doc.qt.io/qt-4.8/richtext.html

&quot;QTextDocumentWriter Class Reference&amp;quot;:http://doc.qt.io/qt-4.8/qtextdocumentwriter.html

= Web Integration with WebKit =

''Qt's integration with the WebKit browser engine enables developers to introduce Web functionality into their applications by using Qt-style APIs and paradigms to display and interact with Web content.''

Qt includes integrated support for WebKit, a fully-featured open source Web rendering engine with a focus on stability and performance. The version of WebKit supplied with Qt supports a number of Web standards, including HTML 4.01, XHTML 1.1, CSS 2.1 and JavaScript 1.5. More advanced features are also available  these are presented in the &quot;WebKit in Qt&amp;quot;:http://qt.digia.com/forms/whitepapers/reg-whitepaper-hybrid/ whitepaper.

WebKit's networking is transparently handled using Qt's networking classes, providing browser components with a fully-compliant HTTP 1.1 implementation support for Secure Sockets Layer (SSL) communication and proxy support.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/webkit-plus-graphics-view.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/webkit-plus-graphics-view.png]]

''Qt widgets can be embedded into Web pages displayed with Qt's WebKit integration; Web Pages can be displayed as items in the Graphics View framework.''

== Native Application Integration ==

Qt's support for WebKit goes beyond just rendering HTML by exposing features of WebKit to applications using Qt's paradigms. For example, support for Qt's signals and slots communication mechanism makes it easier for developers to connect Web components to widgets and other application objects.

Conversely, the integration between Qt and the browser engine enables native Qt controls to be included within Web pages, making it possible to combine Web content with highly-dynamic native user interfaces.

WebKit also enables Web applications to use native storage for persistent data, and this features is supported by Qt. Developers can enable native storage for applications that interoperate with remote services, and take advantage of configuration options to set an appropriate location and quota for it on the user's system.

== DOM Access API ==

The standard way to manipulate the structure of Web pages is via a Document Object Model (DOM) API. Qt's WebKit integration includes an implementation of the W3C selector API that provides a very simple way to access and manipulate page structures.

This API makes it intuitive to access the DOM by letting developers reuse their CSS selector knowledge, and results in little maintenance or footprint overhead.

== Netscape Plugin Support ==

Plugins conforming to the Netscape plugin API, a de-facto standard for third party browser components, can be embedded and displayed in Web pages rendered by Qt's WebKit integration. Configuration of this feature is performed via a Qt class that is also used to configure other kinds of plugins, such as widget plugins exposed by the application to the Web environment.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/webkit-netscape-plugin.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/webkit-netscape-plugin.png]]

''Third party browser plugins are supported by Qt and WebKit via the Netscape plugin API.''

=== Online References ===

&quot;WebKit in Qt&amp;quot;:http://doc.qt.io/qt-4.8/qtwebkit.html

&quot;Web Browser&amp;quot;:http://doc.qt.io/qt-4.8/demos-browser.html

= Databases =

''The Qt SQL module simplifies the creation of cross-platform GUI database applications. Programmers can easily execute SQL statements, use database models to supply information to item views for visualization and data entry purposes, and use widget mappers to relate database tables to specific widgets in form-based user interfaces.''

The Qt SQL module provides a cross-platform interface for accessing SQL databases, and includes native drivers for Oracle, Microsoft SQL Server, Sybase Adaptive Server, IBM DB2, PostgreSQL, MySQL, Borland Interbase, SQLite and ODBC. The drivers work on all platforms supported by Qt for which client libraries are available. Applications can access multiple databases using multiple drivers simultaneously. Distributions of Qt include the SQLite database, and the Qt SQL module is built with support for this database by default.

Developers can easily execute any SQL statements. Qt also provides a high-level C++ interface that can be used to generate the appropriate SQL statements automatically.

Qt provides a set of SQL models for use with the other model/view components. These enable view widgets to be automatically populated with the results of database queries, and simplify the process of editing for both users and non-database developers.

Using the facilities that the SQL module provides, it is straightforward to create database applications that use foreign key lookups and present master-detail relationships.

== Executing SQL Commands ==

The '''QSqlQuery''' class is used to directly execute any SQL statement and navigate the result sets produced by &lt;code&amp;gt;SELECT&amp;lt;/code&amp;gt; statements. The &lt;code&amp;gt;INSERT&amp;lt;/code&amp;gt;, &lt;code&amp;gt;UPDATE&amp;lt;/code&amp;gt;, and &lt;code&amp;gt;DELETE&amp;lt;/code&amp;gt; statements are equally simple to use.

Qt's SQL module also supports value binding and prepared queries. Value binding can be achieved using named binding and named placeholders, or using positional binding with named or positional placeholders. Qt's binding syntax works with all supported databases, either using the underlying database support or by emulation.

== SQL Models ==

Qt also provides a number of model classes for use with other components in the model/view framework. These allow the developer to set up SQL queries to automatically provide table views with items of data from a database.

Using these database models with other components in the model/view framework requires a minimum of work for developers. Setting up a query model is simply a matter of specifying a query and choosing which headers to examine, and setting up a table view to display the results of the query is similarly straightforward.

Models are provided for accessing SQL tables in different ways. These include a read-only data model for SQL result sets, an editable data model for a single database table, and a relational model that allows columns to be set as foreign keys into other database tables. The Qt Books demonstration shown in Figure uses a relational database model to find information about each of the books in a table.

The model/view framework contains a number of features that accommodate the requirements of database applications. These include support for transactions and the option to allow the contents of table to be edited on a per-row basis to avoid unnecessary round trips to a database.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/books-demo.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/books-demo.png]]

''The Qt Books demonstration shows the integration between Qt's SQL classes and the model/view framework.''

== Data-Aware Widgets ==

Qt provides facilities to allow data obtained from models, such as the SQL models described above, to be related to specific widgets in a window, allowing the user to see a cross-section of the data available from different locations in the underlying data store. This makes it easier to create data-entry applications with conventional form-based user interfaces.

The '''QDataWidgetMapper''' class is used to set up the mapping between a model and a selection of widgets. In the Books demonstration supplied with Qt (see above), a data mapper is constructed and assigned to a model, then each of the widgets used to edit fields in the database is mapped to a column.

The data mapper can be used directly to step through rows in a model, mapping the item in each column to a specific widget, and using it to display the data obtained. Navigation functions make it simple to connect easy-to-use navigation controls to the mapper.

Since the class also provides a similar API to the item view classes, different cross-sections of a model can be obtained by changing the mapper's configuration. The use of the model/view API also makes it possible for a data mapper to respond to changes to the underlying model. The Books demonstration updates the mapping whenever the user selects a different row in a table view; this behavior is set up with a simple signal-to-slot connection.

=== Online References ===

&quot;QtSql Module&amp;quot;:http://doc.qt.io/qt-4.8/qtsql.html

&quot;The Qt 4 Database GUI Layer&amp;quot;:http://doc.qt.io/qt-4.8/qt4-sql.html

&quot;SQL Examples&amp;quot;:http://doc.qt.io/qt-4.8/examples-sql.html

= Internationalization =

''Qt fully supports Unicode, the international standard character set. Programmers can freely mix Arabic, English, Hebrew, Japanese, Russian, and other languages supported by Unicode in their applications. Qt also includes tools to support application translation and localization.''

Qt supports the Unicode version 5.0 character encoding and uses the '''QString''' class to store Unicode strings, both for the API and internally.

An extensible set of text codecs provide support for different encodings and charsets, including Big5 and GBK for Chinese, EUC-JP, JIS, and Shift-JIS for Japanese, KOI8-R for Russian, and the ISO-8859 series of standard encodings^1. Qt uses text codecs for fonts, input-output, and input methods.

Built-in locale support enables number-to-string and string-to-number conversions to be adapted to suit the user's geographical location and language preferences.

Qt includes a set of tools to facilitate the translation process that support XML Localization Interchange File Format (XLIFF), GNU Gettext PO format and Qt's Translation Source (TS) files.

== Text Entry and Rendering ==

Far-Eastern writing systems require many more characters than are available on a keyboard. The conversion from a sequence of key presses to actual characters is performed at the window-system level by software called ''input methods''. Qt automatically supports the installed input methods on a user's system.

Qt provides a powerful text-rendering engine for all on-screen text, supporting advanced features such as special line breaking behavior, bidirectional writing, and diacritical marks. It renders most of the world's writing systems, including Arabic, Chinese, Cyrillic, English, Greek, Hebrew, Japanese, Korean, Latin, and Vietnamese. Qt will automatically combine the installed fonts to render multi-language text.

== Translating Applications ==

Qt provides tools and functions to help developers provide applications in their users' native languages. Qt itself contains about several hundred user-visible strings, for which Qt Development Frameworks provides French, German and Simplified Chinese translations.

To make strings translatable, developers simply wrap them in calls to the &lt;code&amp;gt;tr()&lt;/code&amp;gt; translation function, and can supply additional information to human translators with special C and C++ comments.

//: This name refers to a host name.

hostNameLabel->setText(tr("Name:"));

/*: This text refers to a C++ code example. */

QString example = tr("Example&quot;);

Along with the context, this comment information helps translators to accurately translate user-visible strings. Optional arguments can also be used to help with the translation of plural forms.

Qt provides tools to extract user-visible source texts from files in Qt projects, convert between common translation file formats, and generate compressed message files for use in applications. The process of extracting source texts and updating partially-complete translations is integrated into the build system for Qt applications, and can be modified to suit different translation workflows.

At run-time, applications use '''QTranslator''' objects to load translation files. Each file contains the translations for a particular language. The language can be chosen at run-time, in accordance with the locale or user preferences.

Translators can edit translation files conveniently using ''Qt Linguist'', a GUI application for performing translation work. The contexts are listed in the left-hand side of the application's window, and the list of source texts for the current context is displayed in the top-right area, along with translations and their current states (unfinished, obsolete, done). The user interface can be navigated via the keyboard; its dockable windows can be reorganized to suit the translators' preferences.

Applications often use the same phrases many times in different source texts. ''Qt Linguist'' automatically displays intelligent guesses based on previously translated strings and predefined translations; these often serve as a good starting point for new translations. Common translations can also be stored in phrasebooks to make the translation of future applications more efficient. ''Qt Linguist'' can optionally validate translations to ensure that accelerators and ending punctuation are translated correctly.

''Qt Linguist'''s comprehensive manual provides relevant information about the translation process for release managers, translators, and programmers.

[[Image:http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qt-linguist.png|http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qt-linguist.png]]

''Working on French and Simplified Chinese translations simultaneously with Qt Linguist.''

=== Online References ===

&quot;Qt Classes for Internationalization&amp;quot;:http://doc.qt.io/qt-4.8/i18n.html &quot;Qt Linguist Manual&amp;quot;:http://doc.qt.io/qt-4.8/linguist-manual.html

&quot;Unicode in Qt&amp;quot;:http://doc.qt.io/qt-4.8/unicode.html &quot;QTextCodec Class Reference&amp;quot;:http://doc.qt.io/qt-4.8/qtextcodec.html

= Qt Script =

''Qt Script is an interpreted ECMAScript-based language which can be used to script Qt applications. The QtScript module provides an API that makes it easy to expose parts of an application to the scripting environment, including support for signals-slot communication and other standard Qt features.''

Application scripting allows users to customize and extend the features of applications by accessing simple APIs for user-oriented scripting languages. Traditionally, Qt developers have used a variety of separate solutions to provide scripting support in their applications. The inclusion of Qt Script as a Qt module is intended to reduce the amount of effort required to implement scripting, while also making the process easier for developers who simply require scripting &quot;out of the box&amp;quot;.

== Scripting Architecture ==

The QtScript module provides an API based around the '''QScriptEngine''' and '''QScriptValue''' classes. These provide execution and data marshalling facilities.

Instances of '''QScriptEngine''' are responsible for executing Qt Script code within a scripting environment and provide facilities to expose instances of '''QObject''' subclasses to this environment. Additionally, '''QScriptEngine''' allows C++ data types to be converted to their Qt Script equivalents and inserted into the scripting environment. Qt Script data types are represented in C++ as '''QScriptValue''' instances which provide functions to convert data to C++ types.

Additionally, signals and slots can be used to communicate between Qt Script and applications. Qt Script objects can emit the signals of the objects they wrap, and any Qt Script function can be used as a slot. This provides the additional level of flexibility that script authors require and expect from a dynamic scripting language.

The simplest use of the QtScript module is to provide an interpreter for Qt Script that executes user-defined code.

QScriptEngine engine; QScriptValue result = engine.evaluate(userCode);

The '''QScriptEngine''' instance is also able to provide information about any syntax and run-time errors that occur.

In the above image, we can see the use of the QtScript module's features for integrating Qt Script into an application. A '''QObject'''-based wrapper for an image, providing a variety of functions and properties, is exposed to the scripting environment in the following way:

image = new ImageWrapper(this);

QScriptValue imageObject = engine.newQObject(image);

engine.globalObject().setProperty("image&quot;, imageObject);

Once defined in the environment, the user can manipulate the image using a simplified API that hides all the low-level details of managing the application's user interface.

http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qtscript-debugger.png

Debugging a function using the Qt Script debugger's user interface.

Debugging

Support for debugging of scripts is provided by the QtScriptTools module, which includes a set of integrated graphical components that developers can use when creating scriptable applications.

The QScriptEngineDebugger class has been designed to be simple to use. The separation between the implementation of the debugger and the script engine means that the process of attaching a debugger is simple and non-invasive; code that attaches the debugger to a script engine is self-contained and can be removed when no longer required.

The debugger provides a set of common debugging widgets that show source code, breakpoints, the contents of variables, and other useful information about the script that is being executed. These can be used together in a standard window (see Figure ) or as separate widgets.

In addition to these widgets, the debugger also provides a standard menu and toolbar that can be used separately to create a custom debugging interface. The toolbar contains a set of buttons that are linked to actions (see sub:Actions ) which can be triggered programmatically to control the execution of scripts.

If preferred, the debugger can be used without showing any of the user interface components; the developer has the option of keeping these hidden until an error occurs or a breakpoint is encountered.

A comprehensive user manual documents how to use the debugger's user interface, and contains information on the commands that can be entered at the debugging console.

Online References

"QtScript Module&quot;:http://doc.qt.io/qt-4.8/qtscript.html

"QtScriptTools Module&quot;:http://doc.qt.io/qt-4.8/qtscripttools.html

Styles and Themes

Qt automatically uses the native desktop style for an application's look and feel. Qt applications respect user preferences for colors, fonts, sounds, and other desktop settings. Qt programmers are free to use any of the supplied styles and can override any preferences. Programmers can modify existing styles or implement their own styles using Qt's powerful style engine.

A style implements the "look and feel&quot; of the user interface on a particular platform. A style is a QStyle subclass that implements basic drawing functions such as drawing frames, buttons, and images. Qt performs all the widget drawing itself for maximum speed and flexibility.

Built-in Styles

Qt provides the following built-in styles: CDE, Cleanlooks, GTK, Motif, Mac OS X, Plastique, Windows, Windows XP, and Windows Vista. By default, Qt uses the appropriate style for the user's platform and desktop environment. The style can also be chosen programmatically by the application developer, or by the user with the <code&gt;-style&lt;/code&gt; command line option.

http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qstyle-comboboxes.png

Combo boxes in the different native styles.

A style is complemented by the user's desktop settings, which include the user's preferences for colors, fonts, sounds, etc. Qt automatically adapts to the computer's active theme. For example, Qt supports scroll and fade transition effects for menus and tooltips.

The Windows and Mac OS X styles are built on top of native style managers, and are available only on their respective platforms. The other styles are emulated by Qt and are available everywhere.

The default styles on many modern X11 platforms are Plastique, a style inspired by the Plastik widget style for KDE, and GTK, which uses the GTK+ theme engine on GNOME desktops. An alternative style for GTK-based environments is Cleanlooks, a style designed to look like the Clearlooks theme for GNOME.

Qt's built-in widgets are style-aware. Custom widgets and dialogs are almost always combinations of built-in widgets and layouts, and automatically adapt to the style in use. On the rare occasions when it is necessary to write a custom widget from scratch, developers can use Qt's style API to draw basic user-interface elements rather than drawing raw graphics primitives directly.

Based on the translation file loaded, Qt applications automatically use right-to-left widget layouts rather than the default left-to-right scheme normally used. Additionally, when used in reversed mode, well-behaved styles render widgets with areas of light and shadow that are appropriate for the user's desktop environment.

Widget Style Sheets

Qt supports the use of widget style sheets with almost all standard widgets. These textual descriptions, written in a language similar to Cascading Style Sheets (CSS), are used to customize the appearance of widgets in much the same way that CSS descriptions are used to customize HTML rendering in WWW browsers. Each widget's style sheet is accessed via its <code&gt;styleSheet&lt;/code&gt; property, available in QWidget and its subclasses, and this enables customizations to be easily applied to style-aware widgets while an application is running. Since this property is also available for editing in Qt Designer, graphic designers can directly influence the look and feel of applications. For many common situations where customizations to standard widgets are required, the use of style sheets can eliminate the need for a custom style to be written.

http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/stylesheets-coffee.png http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/stylesheets-pagefold.png

The Style Sheet example allows interactive experiments with style sheets.

Custom Styles

Custom styles are used to provide a distinct look to an application or family of applications. Custom styles can be defined by subclassing QStyle or any of its subclasses. It is easy to make small modifications to existing styles by reimplementing one or two virtual functions from the appropriate base class.

The style API provides information about each of the constituent components used to draw widgets, making it possible for highly customized styles to be created and fine-tuned.

A style can also be compiled as a plugin. Plugins make it possible to preview a form using a custom style in Qt Designer without recompiling either Qt or Qt Designer itself. The style of an existing Qt application can be changed using a style plugin without recompiling the application. This enables applications like the Qt Styles example and the <code&gt;qtconfig&lt;/code&gt; tool to switch styles on-the-fly to provide previews for each of the available styles.

Online References

"Styles Example&quot;:http://doc.qt.io/qt-4.8/widgets-styles.html

"Qt Style Sheets&quot;:http://doc.qt.io/qt-4.8/stylesheet.html

Input/Output and Networking

Qt can load and save data in plain text, XML, and binary formats. Qt handles local files using its own classes, and remote files using the FTP and HTTP protocols. Inter-process communication and socket-based TCP and UDP networking are fully supported, and information about the network interfaces available can be easily obtained.

File Handling

At the heart of Qt's device handling infrastructure is QIODevice, a general base class for files, sockets and other devices, which can be subclassed to add support for custom devices. All devices are able to communicate using signals and slots, making it straightforward to integrate file and network communications into applications.

The QFile class supports large files, long file names, and internationalized file names. The QDir and QDirIterator classes are used to read and traverse directories, and can be used to manipulate path names, create directories, delete files, and perform other common operations. QFileInfo provides more detailed information about a file, such as its size, permissions and last modification time.

Qt includes classes similar to the standard <code&gt;iostream&lt;/code&gt; classes that operate on any device. Classes for text and raw data streams are used to stream text to and from devices, and these support the encodings provided by QTextCodec. Data streams can be used to serialize basic C++ types and many Qt types in a platform-independent binary format.

Transparent access to remote files is provided via a unified network access API, though specialized classes for HTTP and FTP protocols can also be used if required, building on Qt's networking classes (see page) . URLs can easily be parsed and reconstructed by using the QUrl class.

Some types of file can be read directly without requiring the use of a QFile object. For example, image files are usually read via the QImage class with its extensible plugin mechanism. Printing text and images is handled by QPrinter.

Qt can also be used to monitor files and directories for changes made by other applications and services. The QFileSystemWatcher class acts as a registry of file paths that need to be monitored, and emits a signal whenever a file or directory on any of these paths is changed.

XML

Qt's XML module provides a SAX parser and a DOM parser, both of which read well-formed XML and are non-validating. The SAX (Simple API for XML) implementation follows the design of the SAX2 Java implementation, with adapted naming conventions. The DOM (Document Object Model) Level 2 implementation follows the W3C recommendation and includes namespace support.

Qt's stream reading and writing classes present an alternative approach to reading and writing XML files in which tokens are "pulled&quot; from an input stream and "pushed&quot; to an output stream. The design of these classes makes it easy to write lightweight, high-level parsers for XML-based file formats.

Higher level XML manipulation, including support for XQuery 1.0 and XPath 2.0, is provided by an additional module. This separation between basic XML handling and more powerful querying facilities allows developers to decide the level of XML support used in applications. Partial support for XSLT 2.0 adds another processing option for developers familiar with common XML technologies.

Validation of XML documents is performed by classes representing XML schemas and validators for those schemas. These implement the W3C XML Schema specification as specified by version 1.0 of the standard.

Inter-Process Communication

Qt provides a process class that is used to start external programs and to communicate with them in a platform-independent way. Communication is achieved by writing to the external program's standard input and reading from its standard output and standard error streams. The QProcess class is derived from QIODevice, meaning that data can be streamed to and from it with text and data streams.

QProcess works asynchronously, reporting the availability of data by emitting signals. Qt applications can connect to the signals to retrieve the data for processing, and optionally respond by sending data back to the external program. Qt's process handling also supports a blocking mode of operation, and can redirect input and output from external programs to files.

Additionally, higher-level communication between applications, components and the operating system can be achieved on Unix platforms that support the D-Bus protocol. The QtDBus module allows applications to expose services by creating XML-based interface files. These are converted to C++ source code by a tool supplied with Qt.

Access to low-level shared resources, such as shared memory and system semaphores, is provided by dedicated classes. These provide the basis for building alternative communication mechanisms.

Networking

Qt provides a cross-platform interface for writing TCP/IP clients and servers, supporting IPv4 and IPv6. All of the networking classes provided are reentrant and can be used from any thread.

http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/ftp-example.png

The Qt FTP example uses Qt's networking features to provide simple FTP browsing capabilities.

The QTcpSocket class provides an asynchronous, buffered TCP connection. As with other QIODevice subclasses, text and data streams can be used to handle socket-level communications. Similarly, QUdpSocket handles UDP socket operations. Both classes support blocking and non-blocking modes of operation. All of Qt's networking classes are reentrant and can be used from any thread.

Custom TCP servers can be implemented by subclassing QTcpServer, which provides an asynchronous framework for handling incoming connections and serving clients. Servers can operate in blocking and non-blocking modes.

Support for proxy servers is available through the QNetworkProxy class, enabling both application-wide and per-socket proxying facilities. HTTP, FTP and SOCKS 5 proxy types are supported, and caching facilities can be employed to improve performance. Customization features enable an application-wide policy to be employed that can set up proxies based on the socket type, the protocol in use, and other criteria.

The QAbstractSocket class is a platform-independent wrapper for native socket APIs. It provides the underlying functionality for TCP, UDP and local domain sockets. Support for proxy servers is available through the QNetworkProxy class, enabling both application-wide and per-socket proxying facilities.

A management infrastructure for network operations is provided in the form of QNetworkAccessManager, which is used to dispatch requests over common protocols, such as HTTP and FTP, and handle replies. Specific classes for requests and replies make common communication easy, while allowing the developer to customize particular requests.

Information about a machine's network interfaces is provided by the QNetworkInterface class. This exposes details of each interface, their capabilities, the IP addresses assigned to them, and other interface-dependent information. For example, for Ethernet interfaces, the MAC address of the underlying hardware can be obtained, and the broadcast address and netmask can be obtained in addition to the IP address.

Encrypted Communications

Qt includes features for secure network communications through the use of encrypted TCP connections based on Secure Socket Layer (SSL) protocols, including SSLv3 and TLSv1.

QSslSocket provides an SSL encrypted socket that can be used for both clients and servers. Abstractions for other aspects of the encryption and authentication processes are addressed by classes for ciphers, keys, certificates.

Online References

"QIODevice Class Reference&quot;:http://doc.qt.io/qt-4.8/qiodevice.html

"QtXml Module&quot;:http://doc.qt.io/qt-4.8/qtxml.html

"QtNetwork Module&quot;:http://doc.qt.io/qt-4.8/qtnetwork.html

Collection Classes

Collection classes are used to store groups of items in memory. Qt provides a set of classes that are compatible with the Standard Template Library (STL), and that work regardless of whether the compiler supports STL or not. Java-style iterators are also provided for safety and convenience.

Applications often need to manage items in memory, such as groups of images, widgets, or custom objects. Many C++ compilers support the STL, which provides ready-made data structures for storing items. Qt provides lists, stacks, queues, and dictionaries with STL-syntax. Qt's collection classes even work with compilers that are not capable of supporting the STL.

Qt's rich set of portable collection classes ("containers&quot;) and associated iterators are heavily used inside Qt, and are provided as part of the Qt API. Qt's containers are optimized for speed and memory efficiency. Programmers can also use STL containers on the platforms that support them, at the cost of losing Qt's optimizations.

Unlike many template classes, which increase the size of executables dramatically when used, Qt's template collection classes are optimized for minimal code expansion.

Containers

Qt provides sequential container classes for lists, linked lists, vectors, stacks and queues, each with an interface very similar to the corresponding STL container, and each fully compatible with the STL algorithms. Qt provides some STL-equivalent algorithms for copying, finding and sorting items. On platforms with STL support, Qt provides automatic conversion operators between STL and Qt containers.

Additionally, Qt provides Java-style iterators for developers who are more familiar with Java containers than the STL.

Qt provides associative container classes for maps, hashes and sets. The "hash&quot; containers use a hash function to improve search performance. One-to-one and one-to-many variants of the map and hash containers are available.

Qt's sequential and associative collection classes can be used to store both value-based and pointer-based types, making them especially useful for handling QWidget and QObject pointers. When used to hold pointer-based items, convenience functions can be used to delete the contents of collections in one pass before the collection is destroyed.

Implicit Sharing

When used with Qt's value classes, the items held in these collection classes are implicitly shared ("copy on write&quot;). Copies of these classes share the same data in memory. The data sharing is handled automatically; if the application modifies the contents of one of the copied objects, a deep copy of the data is made so that the other objects are left unchanged. When an object is copied, only a pointer is passed and a reference count incremented, which is much faster than actually copying the data, and also saves memory.

Sharing is used wherever it makes sense: in Qt's value-based collection classes, and in other commonly-used classes. Programmers can safely and efficiently copy objects of these classes by value, avoiding the risks related to optimizing pointer-based code by hand. In particular, the implicitly shared QString and QRegExp classes makes string processing easy and fast.

Qt also provides low-level bit and byte array classes which are very efficient for handling basic data types.

Online References

"Container Classes&quot;:http://doc.qt.io/qt-4.8/containers.html

"Implicit Sharing&quot;:http://doc.qt.io/qt-4.8/implicit-sharing.html

Plugins and the Meta-Object System

Qt applications can access functions from dynamic libraries using a platform-independent API. Qt also supports plugins, allowing developers to create and distribute codecs, database drivers, image format converters, styles, and custom widgets as separate components.

Plugins and Libraries

Converting a Qt component into a plugin is achieved by subclassing the appropriate plugin base class, implementing a few simple functions, and adding a macro. Plugins written in this way can expose properties and interact with applications via the signals and slots mechanism.

Components supplied as plugins are detected and used by the application automatically. Many third parties provide Qt components in source form, as precompiled dynamic libraries, and as plugins.

The QLibrary class provides a cross-platform API for loading dynamic libraries, providing a type-safe way to call functions exported as symbols with C linkage.

The Meta-Object System

The meta-object system enhances Qt components with additional data at compile-time in order to provide extended run-time type information and other dynamic features. This approach makes it possible for Qt to provide features such as run-time object introspection, a translation mechanism for internationalization purposes, signals and slots, and a generic way to invoke functions and methods.

The use of a richly-typed object system makes it possible for applications to be scripted using Qt Script or any other programming language solution that is integrated with the meta-object system.

As mentioned above, these features can also be exposed by plugins to applications and vice versa.

Online References

"How to Create Qt Plugins&quot;:http://doc.qt.io/qt-4.8/plugins-howto.html

"The Meta-Object System&quot;:http://doc.qt.io/qt-4.8/metaobjects.html

Building Qt Applications

Qt developers can take advantage of a suite of tools to simplify the process of building applications on all supported platforms. Applications, libraries, and plugins are described by project files that are processed to produce suitable Makefiles for each platform.

Qt is designed to work with a range of development tools and environments, from simple command line tools to integration with popular integrated development environments (IDEs). Alternatively, Qt Creator (see page) is a lightweight, cross-platform IDE that is specifically tailored to development of Qt applications.

Qt's Build System

Projects are described by project files that contain terse, but readable descriptions of source and header files, Qt Designer forms, and other resources. These are processed by the <code&gt;qmake&lt;/code&gt; tool to produce suitable Makefiles for the project on each platform.

All of the Qt libraries, tools, and examples are described by project files. A simple example can be described in a few lines of declarations.

Support for conditional builds means that platform-specific code can be incorporated into projects, and will only be built for the appropriate platform.

When <code&gt;qmake&lt;/code&gt; is used to build a project, all the enhanced features of Qt are automatically handled by the other tools in the build suite: <code&gt;moc&lt;/code&gt; processes the header files to enable signals and slots, <code&gt;rcc&lt;/code&gt; compiles the specified resources, and <code&gt;uic&lt;/code&gt; is used to create code from user interface forms created with Qt Designer.

Precompiled header support, <code&gt;pkg-config&lt;/code&gt; integration, the ability to generate Visual Studio project files, and other advanced features allow developers to take advantage of platform-specific tools while retaining the use of a cross-platform build system for common project components.

Qt's Resource System

Qt provides a resource system that allows data files to be stored inside executables, so that any resources required by applications can be accessed at run-time. Qt's widgets support a naming scheme that allows developers to directly refer to these packaged resources.

The resources to be packaged with an application are listed in a Qt Resource Collection file, containing a list of files in the build directory along with the resource paths that are used in the application. These files are processed using <code&gt;rcc&lt;/code&gt; to create data that is compiled into the application. This approach ensures that certain critical resources are always available to applications, avoiding possible distribution and installation problems.

The resource system can also be extended at run-time with the QResource class, allowing additional paths to be searched for resources, and enabling additional resources to be loaded on demand, augmenting those built into the application.

http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/qt-creator-overview.png

An overview of Qt Creator.

Testing and Benchmarking Qt Applications

Support for unit testing is provided as a standard Qt module. Unit tests are written in C++ as QObject-based classes that contain test functions, and these are compiled into executables that can be run independently of any testing framework. Qt's unit testing library also provides extensions to allow graphical user interfaces to be tested.

Unit tests can also be set up to perform benchmarking operations with the use of a simple macro. Test cases can be configured to measure and report performance via the use of different backends, allowing performance data to be visualized using standard tools.

Qt Creator

Qt Creator is Qt Development Frameworks's lightweight IDE for C++ and Qt software development. Although it is designed to be easy to use, Qt Creator provides all the features developers have come to expect from IDEs, including syntax coloring and code completion, quick location of classes, functions and other C++ structures, and integrated debugging support.

Qt-specific features include signals and slots signature completion, integrated support for Qt Designer, and built-in Qt documentation. The "Qt Creator whitepaper&quot;:http://wiki.qt.io/QtCreatorWhitepaper contains a more detailed introduction to this product.

Online References

"qmake Manual&quot;:http://doc.qt.io/qt-4.8/qmake-manual.html

"QTestLib Manual&quot;:http://doc.qt.io/qt-4.8/qtestlib-manual.html

Qt's Architecture

Qt's functionality is built on the low-level APIs of the platforms it supports. This makes Qt flexible and efficient, and enables Qt applications to fit in with single-platform applications.

Qt is a cross-platform framework which uses native style APIs to accurately follow the human interface guidelines on each supported platform. All widgets are drawn by Qt, and programmers can extend or customize them by reimplementing virtual functions. Qt's widgets accurately emulate the look and feel of the supported platforms, as described in sec:Styles-and-Themes (see page). This technique also enables developers to derive their own custom styles to provide a distinct look and feel for their applications.

Qt uses the low-level APIs of the different platforms it supports. This differs from traditional "layered&quot; cross-platform toolkits that are thin wrappers over single-platform toolkits (e.g., MFC on Windows and Motif on X11). Layered toolkits are usually slow, since every function call to the library results in many additional calls down through the different API layers. Layered toolkits are often restricted by the features and behavior of the underlying toolkits, leading to obscure bugs in applications.

Qt is professionally supported, and takes advantage of the available platforms: Microsoft Windows, X11, Mac OS X, and Embedded Linux. Using a single source tree, a Qt application can be compiled to an executable for each target platform. Although Qt is a cross-platform framework, customers have found it to be easier to learn and more productive than many platform-specific toolkits. Many customers use Qt for single-platform development, preferring Qt's fully object-oriented approach.

X11

Qt for X11 uses Xlib to communicate with the X server directly. Qt does not use Xt (X Toolkit), Motif, Athena, or any other toolkit.

Qt supports the following versions of Unix: AIX (R), FreeBSD®, HP-UX, Linux, NetBSD, OpenBSD, and Solaris. See the Qt Development Frameworks Web site for an up-to-date list of supported compilers and operating system versions.

Qt applications automatically adapt to the user's window manager or desktop environment, and have a native look and feel under Motif, CDE, GNOME (TM), and KDE (TM). This contrasts with most other Unix toolkits, which lock users into their own look and feel.

Qt provides full Unicode support (see page). Qt applications automatically support both Unicode and non-Unicode fonts. Qt combines multiple X fonts to render multi-lingual text. Qt's font handling is intelligent enough to search all the installed fonts for characters unavailable in the current font.

Qt takes advantage of X extensions where they are available. Qt supports the RENDER extension for anti-aliased and alpha-blended fonts and vector graphics. Qt provides on-the-spot editing for X Input Methods. Qt supports multiple screens both with traditional multi-head and with Xinerama.

Microsoft Windows

Qt for Windows uses the Win32® API and GDI for low-level events and drawing. Qt does not use MFC or any other toolkit, but provides its own more powerful, customizable widgets that are rendered using a fast, yet accurate painting engine. (For non-specialized uses, Qt uses the native Windows file and print dialogs.)

Customers using Windows can create Qt applications using Microsoft Visual Studio that will run on Windows 98, NT4, ME, 2000, XP and Vista. Qt performs a run-time check for the Windows version, and uses the most advanced capabilities available. Qt developers are insulated from differences in the Windows APIs.

The Microsoft accessibility interfaces are supported by Qt. Unlike the common controls on Windows, Qt widgets can be extended without losing the accessibility information of the base widget. Custom widgets can also provide accessibility. Qt also supports multiple screens on Microsoft Windows.

http://doc.qt.digia.com/whitepapers/qt-whitepaper/wiki-images/architecture-diag.png

An overview of Qt's architecture on supported desktop platforms.

Mac OS X

Qt supports Mac OS X by using a combination of Cocoa® and Carbon® APIs. On 64-bit hardware, Qt uses the Cocoa libraries to enable integration with Mac OS X native widgets and Cocoa views.

Qt for Mac OS X introduces layouts and straightforward internationalization support, standardized access to OpenGL, and powerful visual design with Qt Designer. Qt handles files and asynchronous socket input/output in the event loop. Qt provides solid database support. Developers can create Mac OS X applications using a modern object-oriented API that includes comprehensive documentation and full source code.

Developers can create applications on their favorite platform and broaden their market hugely by simply recompiling on the other supported platforms. Support for universal binaries on Mac OS X means that Qt applications can be created for Intel and PowerPC-based Macs. If desired, developers can take advantage of Qt's integration with native components to add platform-specific features to their applications.

Online References

"Supported Platforms&quot;:http://doc.qt.io/qt-4.8/supported-platforms.html

"Installation&quot;:http://doc.qt.io/qt-4.8/installation.html

"Deploying Qt Applications&quot;:http://doc.qt.io/qt-4.8/deployment.html

Platform Specific Extensions and Qt Solutions

In addition to being complete in itself, Qt provides some platform-specific extensions to assist developers in certain contexts. The ActiveQt extension allows developers to use ActiveX controls within their Qt applications, and also allows them to make their Qt applications into ActiveX servers. Other platform-specific extensions are made available through Qt Solutions.

ActiveX Interoperability

ActiveX is built on Microsoft's COM technology. It allows applications and libraries to use components provided by component servers, and to be component servers in their own right. Qt for Windows provides the ActiveQt module that allows developers to turn their applications into ActiveX servers, and to make use of the ActiveX controls provided by other applications.

Integration with Microsoft's .NET (TM) technology is also possible with ActiveQt. Applications can use ActiveQt's COM support to automatically give .NET developers access to Qt widgets and data types.

ActiveQt seamlessly integrates ActiveX into Qt: ActiveX properties, methods, and events become Qt properties, slots, and signals. This makes it straightforward for Qt developers to work with ActiveX using a familiar programming paradigm, and insulates them from all the different kinds of generated code that is normally part of an ActiveX implementation.

ActiveQt automatically handles the conversions between ActiveX and Qt data types. ActiveQt supports the <code&gt;dynamicCall()</code&gt; function to control an ActiveX component through the control's
IDispatch interface implementation.

Turning a Qt application into an ActiveX server is simple. If we only need to export a single class, little more is required than the inclusion of a single header file. Once the class is compiled, its properties, slots, and signals become ActiveX properties, methods, and events to ActiveX clients. ActiveQt also provides facilities to determine if the application is being run in its own right or being used as an ActiveX control, so that developers can control which functionality is available in which context.

Qt Solutions

In addition to all the classes supplied with Qt, Qt Development Frameworks also produces Qt Solutions, an optional service available to Qt licensees either at the time of purchase or as an add-on product. Qt Solutions offers a regularly updated set of components and widgets, many of which are available under the same dual licensing scheme as Qt. Almost all of the Solutions made available to Qt 3 developers are also available for Qt 4, and many new Solutions for Qt 4 have already been released.

Online References

"Qt's ActiveX Framework (ActiveQt)":http://doc.qt.io/qt-4.8/activeqt.html

"D-Bus&quot;:http://doc.qt.io/qt-4.8/intro-to-dbus.html

"http://qt.digia.com/products/appdev/add-on-products/qt-solutions&quot;:http://qt.digia.com/products/appdev/add-on-products/qt-solutions

The Qt Development Community

Companies and independent developers from around the world are joining the Qt development community every day. They have recognized that Qt's architecture lends itself to rapid application development. These developers, whether they are targeting one or many platforms, benefit from Qt's consistent and straightforward API, powerful build system, and supporting tools such as Qt Designer.

Qt has an active and helpful user community who communicate using the <code&gt;qt-interest&lt;/code&gt; mailing list, the Qt Centre Web site at "www.qtcentre.org&quot;:http://www.qtcentre.org, and a number of other community Web sites and Weblogs. In addition, many Qt developers are active members of the "KDE&quot;:http://www.kde.org/ community. We publish "Qt Quarterly&quot;:http://doc.qt.digia.com/qq/, an online developers' newsletter, for commercial customers and open source developers. A growing number of commercial and open source add-ons from third parties are also available; see the "Qt Project&quot;:http://qt.io site for the most up-to-date information.

Qt's extensive documentation is available online at "http://doc.qt.io&quot;:http://doc.qt.io. There are also a number of books in English, French, German, Russian, Chinese and Japanese, that present and explain Qt programming. A number of books about Qt are described on the "Qt Books&quot;:http://qt.io/books page.

Companies participating in the Qt Project provide a range of training options for Qt and C+, including open enrollment courses for the general public and on-site courses for customers who have more specific training needs.
As well as providing a comprehensive framework for C+ developers, Qt can also be used with a variety of other programming languages. Qt itself includes the QtScript module, a JavaScript-oriented technology that enables developers to give users access to restricted parts of their applications for scripting purposes.

Language bindings for Python, Ruby, Java, JavaScript, BASIC, Ada 2005, C#, Pascal, Lua, Perl and Scheme are also available from third parties; many of these solutions are produced and maintained by teams of open source developers.

Developers can evaluate Qt, with support, for 30 days on their preferred platform. For further information, visit "http://qt.digia.com/products&quot;:http://qt.digia.com/products. Qt is also available under a LGPL license from "https://qt.io/download&quot;:https://qt.io/download.

Online References

"Videos: Qt Training Materials&quot;:http://qt.io/videos#c-99

"http://lists.qt.io/mailman/listinfo/interest&quot;:http://lists.qt.io/mailman/listinfo/interest

"Qt Quarterly&quot;:http://doc.qt.digia.com/qq/

This document is licensed under the "Creative Commons Attribution-Share Alike 2.5&quot;:http://creativecommons.org/licenses/by-sa/2.5/ license.

http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/share.png http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/remix.png http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/by.png http://doc.qt.nokia.com/whitepapers/qt-whitepaper/wiki-images/sa.png

For more information, see "http://creativecommons.org/licenses/by-sa/2.5/legalcode&quot;:http://creativecommons.org/licenses/by-sa/2.5/legalcode for the full terms of the license.

^1 ISO is a registered trademark of the International Organization for Standardization.