Source

Target

Commits (17)
Showing with 368 additions and 410 deletions
Qt 5.1 introduces many new features and improvements as well as bugfixes
over the 5.0.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
http://qt-project.org/doc/qt-5.1
The Qt version 5.1 series is binary compatible with the 5.0.x series.
Applications compiled for 5.0 will continue to run with 5.1.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
http://bugreports.qt-project.org/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* General *
****************************************************************************
- Documentation: Fixed several missing information or incorrect information.
......@@ -110,18 +110,17 @@ item views. QSqlTableModel has read/write access to a single table, whereas
QSqlRelationalTableModel has read/write access to the main table (not to the
table with the foreign key).
The following pages contain information about incorporating SQL into
applications:
\list
\li \l {Qt SQL}
\li \l {Qt SQL C++ Classes}
\li \l {Connecting to Databases}
\li \l {SQL Database Drivers}
\li \l {Creating Data-Aware Forms}
\li \l {Using the SQL Model Classes}
\li \l {Presenting Data in a Table View}
\li \l {SQL Programming}
\li \l {Executing SQL Statements}
\li \l {Data Types for Qt-supported Database Systems}
\li \l {Qt Quick Local Storage QML Types}
\list
\li \l{Database Classes}
\li \l{Executing SQL Statements}
\li \l{Using the SQL Model Classes}
\li \l{Presenting Data in a Table View}
\li \l{Creating Data-Aware Forms}
\endlist
\endlist
\section1 XML Support in Qt
......
......@@ -99,7 +99,7 @@
\li \l{Qt Graphical Effects}{QtGraphicalEffects}
\row
\li \l{Qt Script}{QtScript}
\li QtQuick1 (formerly QtDeclarative)
\li \l{Qt Quick 1}{QtDeclarative}
\li \l{Qt Image Formats}{QtImageFormats}
\endtable
......
......@@ -33,11 +33,12 @@
\c {CMake} is a tool that helps simplify the build process for
development projects across different platforms. \c{CMake}
automates the generation of buildsystems such as Makefiles.
automates the generation of buildsystems such as Makefiles and Visual Studio project
files.
\c{CMake} is a 3rd party tool with its own \l{CMake Documentation}{documentation}.
The rest of this manual details the specifics of how to use Qt 5 with \c{CMake}.
The minimum version required to use Qt5 is \c{CMake} 2.8.3, but 2.8.9 is recommended.
The minimum version required to use Qt5 is \c{CMake} 2.8.3, but 2.8.11 is recommended.
\section1 Getting Started
......@@ -45,38 +46,33 @@
and header files shipped with Qt. These libraries and header files can then be used
to build libraries and applications based on Qt.
The recommended way to use Qt libraries and headers with \c{CMake} 2.8.9 is to use
the \c{qt5_use_modules} macro.
The recommended way to use Qt libraries and headers with \c{CMake} 2.8.11 is to use
the \c{target_link_libraries} command. In \c{CMake} 2.8.11 and later versions, this
command automatically adds appropriate include directories, compile definitions, the
position-independent-code flag, and links to the qtmain.lib library on Windows.
To build a helloworld executable, typical usage would be:
To build a helloworld GUI executable, typical usage would be:
\snippet doc/src/snippets/cmake/CMakeLists.pro 0
Note that it is necessary to use \c{find_package} to find a Qt module before using the macro.
See the documentation for the
\l{CMake find_package Documentation}
command for the full options it supports.
Note that setting the minimum required CMake version to 2.8.11 is required for
automatic linking to the qtmain.lib library on Windows.
In order for \c{find_package} to be successful, Qt 5 must be found below the CMAKE_PREFIX_PATH,
or the Qt5<Module>_DIR must be set in the \c{CMake} cache to the location of the
Qt5WidgetsConfig.cmake file. The easiest way to use \c{CMake} is to set the CMAKE_PREFIX_PATH
environment variable to the install prefix of Qt 5.
The \c{qt5_use_modules} macro encapsulates all of the variable usage required to use a Qt module.
It automatically finds the modules given to it on the command line if they have not already been found.
\snippet doc/src/snippets/cmake/CMakeLists.pro 1
The CMAKE_AUTOMOC setting runs moc automatically when required. For more on this feature see
the \l{CMake AUTOMOC documentation}
\section2 Imported targets
Imported targets are created for each Qt module. That means that the Qt5<Module>_LIBRARIES contains
a name of an imported target, rather than a path to a library. The actual path to the library can be
obtained using the \l{CMake LOCATION Documentation}{LOCATION property}:
Imported targets are created for each Qt module. Imported target names should be preferred instead of
using a variable like Qt5<Module>_LIBRARIES in CMake commands such as \c{target_link_libraries}.
The actual path to the library can be obtained using the \l{CMake LOCATION Documentation}{LOCATION property}:
\snippet doc/src/snippets/cmake/CMakeLists.pro 2
\snippet doc/src/snippets/cmake/CMakeLists.pro 1
Note however that it is rare to require the full location to the library in \c{CMake} code. Most
\c{CMake} APIs are aware of imported targets and can automatically use them instead of the full path.
......@@ -93,6 +89,21 @@
If your project has custom CMake build configurations, it may be necessary to set a mapping from your
custom configuration to either the debug or release Qt configuration.
\snippet doc/src/snippets/cmake/CMakeLists.pro 2
\section2 Using Qt 5 with \c{CMake} older than 2.8.11
The recommended way to use Qt libraries and headers with \c{CMake} prior to 2.8.11 is to use
the \c{qt5_use_modules} macro.
Note that it is necessary to use \c{find_package} to find a Qt module before using the macro.
See the documentation for the
\l{CMake find_package Documentation}
command for the full options it supports.
The \c{qt5_use_modules} macro encapsulates all of the variable usage required to use a Qt module.
It automatically finds the modules given to it on the command line if they have not already been found.
\snippet doc/src/snippets/cmake/CMakeLists.pro 3
\section2 Using Qt 5 with \c{CMake} older than 2.8.9
......@@ -112,7 +123,8 @@
If not using the \c{qt5_use_modules} macro, and if using CMake 2.8.9 or later, the
\l{CMake POSITION_INDEPENDENT_CODE Documentation}{POSITION_INDEPENDENT_CODE property} can be set on
targets using Qt instead, or it can be set globally for all targets:
targets using Qt instead, or it can be set globally for all targets. Note that this is not necessary
with CMake 2.8.11:
\snippet doc/src/snippets/cmake/CMakeLists.pro 5
......@@ -127,11 +139,13 @@
\section2 Module variables
The result of a \c{find_package} call is that some variables will be populated with
The result of a \c{find_package} call is that imported targets will be created for
use with \c{target_link_libraries}, some variables will be populated with
information required to configure the build, and macros will be made available
for use. All of the package-specific variables have a consistent name with a prefix
of the name of the package. For example, \c{find_package}(Qt5Widgets) will make the
following variables available if successfully found:
for use. The name of the imported target for each module matches the name of the module with a
prefix of 'Qt5::', for example Qt5::Widgets. All of the package-specific variables have a
consistent name with a prefix of the name of the package. For example,
\c{find_package}(Qt5Widgets) will make the following variables available if successfully found:
\list
\li Qt5Widgets_VERSION_STRING
......
......@@ -28,6 +28,7 @@
/*!
\page qtexamplesandtutorials.html
\title Qt Examples And Tutorials
\brief Explains step by step basic Qt programming
\section1 Tutorials
......
......@@ -666,7 +666,7 @@ in the \l{Qt for Windows CE Requirements} document.
Qt requires Xcode to be installed on the system. You can get it from:
\l{https://developer.apple.com/xcode/}
\l{http://developer.apple.com/xcode/}
The command line tools are also needed, they can be installed within XCode:
......
......@@ -86,9 +86,9 @@ tools, for example:
The development tools are located in the directory
\e{<install_dir>}/\e{<version>}/\e{<compiler>}/bin. For Windows, the MinGW
toolchain is placed in \e{<install_dir>}\Tools. You can run them from Qt Creator
or from the command line. You can also launch some of them as standalone
applications.
toolchain is placed in \e{<install_dir>}\\Tools. You can run
them from Qt Creator or from the command line. You can also launch some of
them as standalone applications.
\section1 Running Example Applications
......
......@@ -163,11 +163,11 @@ need to be direct.
\section1 Printing
Qt supports printing both directly to actual printers, locally or on the
network, as well as producing PDF or PostScript output. How to do printing with
network, as well as producing PDF output. How to do printing with
Qt is described in detail on the \l {Qt Print Support} page.
To be able to access the Qt printing classes from your application or library, see
the \l {Qt Print Support module} page.
the \l {Qt Print Support} module page.
......
......@@ -369,7 +369,7 @@
See \c qtbase/src/3rdparty/sha1/sha1.cpp for more information about the terms and
conditions under which the code is supplied.
\section1 SQLite (\c sqlite) version 3.7.16.2
\section1 SQLite (\c sqlite) version 3.7.17.0
\e{SQLite is a small C library that implements a
self-contained, embeddable, zero-configuration SQL database engine.}
......
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page android_runtime_licensing_notes.html
\title Android GNU C++ Run-time Licensing
\ingroup licensing
\brief Provides additional information about the licensing of run-time dependencies of Qt for Android
The Android platform does not provide a full implementation of the C++ run-time. Instead,
apps that depend on features such as STL, exceptions, or RTTI, must include an additional
native run-time library that provides the features they need.
Qt will by default use the GNU libstdc++ library which is distributed as part of the Google Android NDK.
Qt Creator will copy this library into the .APK for any Qt-based Android app. The library will then be
loaded by the app on start-up to meet the run-time requirements of Qt.
The GNU C++ run-time is licensed under the
\l{http://gcc.gnu.org/onlinedocs/libstdc++/manual/appendix_gpl.html}{GNU General Public License version 3} with
an exception which grants permission for run-time linking and usage of the library by an application which
would otherwise violate the terms of the main license. For more information about this exception, see
\l{http://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html}{the official license page}.
\section1 Information About License From GCC Headers
This file is part of the GNU ISO C++ Library. This library is free
software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later
version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>.
\section1 The GCC Run-time Library Exception
GCC RUNTIME LIBRARY EXCEPTION
Version 3.1, 31 March 2009
Copyright (C) 2009 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
This GCC Runtime Library Exception ("Exception") is an additional
permission under section 7 of the GNU General Public License, version
3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
bears a notice placed by the copyright holder of the file stating that
the file is governed by GPLv3 along with this Exception.
When you use GCC to compile a program, GCC may combine portions of
certain GCC header files and runtime libraries with the compiled
program. The purpose of this Exception is to allow compilation of
non-GPL (including proprietary) programs to use, in this way, the
header files and runtime libraries covered by this Exception.
0. Definitions.
A file is an "Independent Module" if it either requires the Runtime
Library for execution after a Compilation Process, or makes use of an
interface provided by the Runtime Library, but is not otherwise based
on the Runtime Library.
"GCC" means a version of the GNU Compiler Collection, with or without
modifications, governed by version 3 (or a specified later version) of
the GNU General Public License (GPL) with the option of using any
subsequent versions published by the FSF.
"GPL-compatible Software" is software whose conditions of propagation,
modification and use would permit combination with GCC in accord with
the license of GCC.
"Target Code" refers to output from any compiler for a real or virtual
target processor architecture, in executable form or suitable for
input to an assembler, loader, linker and/or execution
phase. Notwithstanding that, Target Code does not include data in any
format that is used as a compiler intermediate representation, or used
for producing a compiler intermediate representation.
The "Compilation Process" transforms code entirely represented in
non-intermediate languages designed for human-written code, and/or in
Java Virtual Machine byte code, into Target Code. Thus, for example,
use of source code generators and preprocessors need not be considered
part of the Compilation Process, since the Compilation Process can be
understood as starting with the output of the generators or
preprocessors.
A Compilation Process is "Eligible" if it is done using GCC, alone or
with other GPL-compatible software, or if it is done without using any
work based on GCC. For example, using non-GPL-compatible Software to
optimize any GCC intermediate representations would not qualify as an
Eligible Compilation Process.
1. Grant of Additional Permission.
You have permission to propagate a work of Target Code formed by
combining the Runtime Library with Independent Modules, even if such
propagation would otherwise violate the terms of GPLv3, provided that
all Target Code was generated by Eligible Compilation Processes. You
may then convey such a combination under terms of your choice,
consistent with the licensing of the Independent Modules.
2. No Weakening of GCC Copyleft.
The availability of this Exception does not imply any general
presumption that third-party software is unaffected by the copyleft
requirements of the license of GCC.
......@@ -27,215 +27,11 @@
/*!
\group modules
\title All Modules
\startpage index.html Qt Reference Documentation
\nextpage QtCore
\title All C++ APIs per Module
\brief A list of C++ modules
\ingroup classlists
\brief Qt 5 consists of essential modules, add-on modules, and tools.
\section1 Qt Essentials
Qt essentials define the foundation of Qt on all platforms. They are
available on all supported development platforms and on the tested target
platforms. They will remain source and binary compatible during Qt 5.
Essential modules are general and useful for a majority of Qt applications.
A module that is used for a special purpose is considered an add-on module
even if it is available on all supported platforms.
The following table lists the Qt essentials:
\table 80%
\header
\li Module
\li Description
\row
\li \l{Qt Core}
\li Core non-graphical classes used by other modules.
\row
\li \l{Qt GUI}
\li Base classes for graphical user interface (GUI) components.
Includes OpenGL.
\row
\li \l{Qt Multimedia}
\li Classes for audio, video, radio and camera functionality.
\row
\li \l{Qt Multimedia Widgets}
\li Widget-based classes for implementing multimedia functionality.
\row
\li \l{Qt Network}
\li Classes to make network programming easier and more portable.
\row
\li \l{Qt QML}
\li Classes for QML and JavaScript languages.
\row
\li \l{Qt Quick}
\li A declarative framework for building highly dynamic applications
with custom user interfaces.
\row
\li \l{Qt Quick Controls}
\li Reusable Qt Quick based UI controls to create classic desktop-style
user interfaces
\row
\li \l{Qt SQL}
\li Classes for database integration using SQL.
\row
\li \l{Qt Test}
\li Classes for unit testing Qt applications and libraries.
\row
\li \l{Qt WebKit}
\li Classes for a WebKit2 based implementation and a new QML API.
See also Qt WebKit Widgets in the add-on modules.
\row
\li \l{Qt WebKit Widgets}
\li WebKit1 and QWidget-based classes from Qt 4.
\row
\li \l{Qt Widgets}
\li Classes to extend Qt GUI with C++ widgets.
\endtable
If you use \l qmake to build your projects, the QtCore and QtGui
modules are included by default. To link only against QtCore, add
the following line to your \c .pro file:
\snippet doc/src/snippets/code/doc_src_modules.pro 0
On Windows, if you do not use \l qmake
or other build tools such as CMake, you also need to link against
the \c qtmain library.
\section1 Qt Add-Ons
Qt add-on modules bring additional value for specific purposes. These
modules may only be available on some development platform for some target
platforms. Some of them are included in the Qt releases on particular
platforms. Each add-on module specifies its compatibility promise
separately.
The following table lists the Qt add-ons:
\table 80%
\header
\li Module
\li Development Platforms
\li Target Platforms
\li Description
\row
\li \l{Active Qt}
\li Windows
\li
\li Classes for applications which use ActiveX and COM
\row
\li \l{Qt Concurrent}
\li
\li
\li Classes for writing multi-threaded programs without using low-level
threading primitives.
\row
\li \l{Qt D-Bus}
\li Unix
\li
\li Classes for inter-process communication over the D-Bus protocol.
\row
\li \l{Qt Graphical Effects}
\li All
\li
\li Graphical effects for use with Qt Quick 2.
\row
\li \l{Qt Image Formats}
\li All
\li
\li Plugins for additional image formats: TIFF, MNG, TGA, WBMP.
\row
\li \l{Qt OpenGL}
\li
\li
\li OpenGL support classes.
\note Provided to ease porting from Qt 4.x. Please use the QOpenGL
classes in QtGui for new code.
\row
\li \l{Qt Print Support}
\li All
\li
\li Classes to make printing easier and more portable.
\row
\li \l{Qt Quick 1 Reference Documentation}{Qt Declarative}
\li All
\li
\li Qt Declarative is provided for \l{Qt 4.8 Reference Documentation}{Qt 4}
compatibility. The documentation is available through the Qt 4.8
\l{Qt Quick 1 Reference Documentation}{Qt Quick} documentation.
\row
\li \l{Qt Script}
\li All
\li
\li Classes for making Qt applications scriptable. Provided for Qt 4.x
compatibility. Please use the QJS* classes in the QtQml module for
new code.
\row
\li \l{Qt Script Tools}
\li All
\li
\li Additional components for applications that use Qt Script.
\row
\li \l{Qt Sensors}
\li All
\li \l{Android}, \l{BlackBerry}, \l{iOS}, and Mer.
\li Provides access to sensor hardware and motion gesture recognition.
\row
\li \l{Qt Serial Port}
\li All
\li \l{Support for Windows}{Windows}, \l{Support for Linux/X11}{Linux}, and \l{Support for Mac OS X}{Mac OS X}.
\li Provides access to hardware and virtual serial ports.
\row
\li \l{Qt SVG}
\li All
\li
\li Classes for displaying the contents of SVG files.
\row
\li \l{Qt X11 Extras}
\li All
\li \l{Support for Linux/X11}{Linux/X11}
\li Provides specific APIs for X11.
\row
\li \l{Qt XML}
\li
\li
\li C++ implementations of SAX and DOM.
\note Deprecated, please use QXmlStreamReader and QXmlStreamWriter
for new functionality.
\row
\li \l{Qt XML Patterns}
\li
\li
\li Support for XPath, XQuery, XSLT and XML schema validation.
\endtable
\section1 Qt Tools
Tools that are officially a part of Qt. The official tools run on all the
supported development platforms.
The following table lists the Qt tools:
\table 80%
\header
\li Tool
\li Description
\row
\li \l{Qt Designer}
\li Classes for extending \QD.
\row
\li \l{Qt Help}
\li Classes for online help.
\row
\li \l{Qt UI Tools}
\li Classes for UI tools.
\endtable
\sa {Class and Function Documentation}
This page lists the C++ APIs in Qt. The \l{All Modules} page contains a list
of all Qt modules.
*/
......@@ -247,7 +43,7 @@
qtmain is a helper library that enables the developer to write a
cross-platform main() function on Windows.
If you do not use \l qmake or other build tools such as CMake, then you
If you do not use \l qmake or other build tools such as \l{CMake Manual}{CMake}, then you
need to link against the \c qtmain library.
\section1 License Information
......
......@@ -69,6 +69,10 @@ After the SDK is updated, install the Qt 5.1 binaries using the
to develop for Android. For more information, see
\l{Qt Creator: Connecting Android Devices}.
\note You must manually choose at least one of the two Qt libraries for Android
(x86 and ARMv7) from the \gui{Qt 5.1.0} component tree within the \gui{Select
Components} page of \l{Qt Installation Program}{Qt installation program}.
\section1 Porting an Existing Qt Application
Most Qt applications should be portable to Android with ease, unless they
......@@ -145,5 +149,6 @@ AVDs found.
\list
\li \l{Platform and Compiler Notes - Android}{Platform Notes}
\li \l{Qt Creator: Deploying Applications to Android Devices}
\li \l{Android GNU C++ run-time licensing}
\endlist
*/
......@@ -178,7 +178,7 @@
The items in the Application Menu will be merged correctly for
your localized application, but they will not show up translated
until you
\l{https://developer.apple.com/library/mac/#documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW13}
\l{http://developer.apple.com/library/mac/#documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW13}
{add a localized resource folder} to the application bundle.
The main thing you need to do is create a file called
locversion.plist. Here is an example for Norwegian:
......
......@@ -331,4 +331,12 @@
}
\endcode
\section2 D-Bus
Mac OS X does not ship with a D-Bus daemon, because the operating system has
its own IPC mechanisms; therefore Qt binary packages don't usually include
the \l{Qt D-Bus} module. However you can install \c dbus via Homebrew, Fink or
MacPorts; then when you build Qt it will be detected, and the Qt D-Bus module
will be built.
*/
......@@ -62,7 +62,7 @@
\section1 Aqua
This is a critical piece of Mac OS X (documentation can be found at
\l{https://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html#//apple_ref/doc/uid/20000957}).
\l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html#//apple_ref/doc/uid/20000957}).
It is a huge topic, but the most important guidelines for GUI
design are probably these:
......
......@@ -51,7 +51,7 @@ The following list summarizes the changes in Qt 5:
\li Qt Widgets - These are now part of a separate module,
\l{Qt Widgets}{QtWidgets}. They were part of \l{QtGui} earlier.
\li Qt Quick - The older Qt Quick version (1.0) is now part of a separate
\l{https://qt-project.org/doc/qt-4.8/qtdeclarative.html}{Qt Declarative}
\l{http://qt-project.org/doc/qt-4.8/qtdeclarative.html}{Qt Declarative}
add-on module for compatibility purposes. We recommend using the new Qt
Quick (2.0) from now on to avoid binary breaks in the future.
\li Qt3Support - This module is removed in Qt 5, so you must move away from
......
......@@ -51,6 +51,14 @@ The QML language and engine infrastructure is provided by the \l {Qt QML} module
For in-depth information about the QML language, please see the
\l{Qt QML} module documentation.
The following pages contain more information about QML:
\list
\li \l{First Steps with QML} - begin using QML with these examples
\li \l{The QML Reference} - reference about the QML constructs and features
\li \l{qml-codingconventions.html}{QML Coding Conventions}
\li \l{qtquick-glossary.html}{Glossary of Terms}
\endlist
\section2 What is Qt Quick?
Qt Quick is the standard library of types and functionality for QML. It
......@@ -62,25 +70,6 @@ The \c QtQuick QML library is provided by the \l{Qt Quick} module.
For in-depth information about the various QML types and other functionality
provided by Qt Quick, please see the \l{Qt Quick} module documentation.
\section1 Quick Start
\list
\li \l{qtquick-quickstart-basics.html}{QML Basics}
\list
\li \l{qtquick-quickstart-basics.html#creating-a-qml-document}{Creating a QML Document}
\li \l{qtquick-quickstart-basics.html#loading-and-displaying-the-qml-document}{Loading and Displaying the QML Document}
\endlist
\li \l{qtquick-quickstart-essentials.html}{QML Essentials}
\list
\li \l{qtquick-quickstart-essentials.html#handling-user-input}{Handling User Input}
\li \l{qtquick-quickstart-essentials.html#property-bindings}{Property Bindings}
\li \l{qtquick-quickstart-essentials.html#animations}{Animations}
\li \l{qtquick-quickstart-essentials.html#defining-custom-qml-types-for-re-use}{Defining Custom QML Types for Re-use}
\li \l{qml-codingconventions.html}{QML Coding Conventions}
\li \l{qtquick-glossary.html}{Glossary of Terms}
\endlist
\endlist
\section1 QML User Interfaces
For creating or customizing graphical user interfaces, Qt Quick adds visual
......
......@@ -25,17 +25,103 @@
**
****************************************************************************/
/*!
\page qtquick-quickstart-essentials.html
\title Quick Start Guide - QML Essentials
\brief Essential QML application development examples
\page qmlfirststeps.html
\title First Steps with QML
\brief Basic QML application development examples
\section1 Creating a QML Document
A QML document defines a hierarchy of objects with a highly-readable,
structured layout. Every QML document consists of two parts: an imports
section and an object declaration section. The types and functionality most
common to user interfaces are provided in the \c{QtQuick}
import.
\section2 Importing and Using the QtQuick Module
To use the \l{Qt Quick} module, a QML document needs to
import it. The import syntax looks like this:
\code
import QtQuick 2.0
\endcode
The types and functionality that \l{Qt Quick} provides can now
be used in the QML document!
\section2 Defining an Object Hierarchy
The object declaration in a QML document defines what will be displayed in the
visual scene. \l{Qt Quick} provides the basic building blocks
for all user interfaces, such as the objects for displaying images and text and
for handling user input.
A simple object declaration might be a colored rectangle with some text centered
in it:
\qml
Rectangle {
width: 200
height: 100
color: "red"
Text {
anchors.centerIn: parent
text: "Hello, World!"
}
}
\endqml
This defines an object hierarchy with a root \l Rectangle object
which has a child \l Text object. The \c parent of the \l Text object is
automatically set to the \l Rectangle, and similarly, the \l Text object is
added to the \c children property of the \l Rectangle object, by QML.
\section2 Putting it All Together
The \l Rectangle and \l Text types used in the above example are both provided
by the \c{QtQuick} import. Putting the import and object declaration
together, we get a complete QML document:
\qml
import QtQuick 2.0
Rectangle {
width: 200
height: 100
color: "red"
Text {
anchors.centerIn: parent
text: "Hello, World!"
}
}
\endqml
If we save that document as "HelloWorld.qml", we can load and display it.
\section1 Loading and Displaying the QML Document
To display the graphical scene defined by the QML document, it may be loaded
with the \l{Prototyping with qmlscene}{qmlscene} tool. The
\l{Prototyping with qmlscene}{qmlscene} tool should be installed into the
Qt installation directory. Assuming that the Qt binaries are installed into
or are available in the system executable path, you can display the QML
document with the following command:
\code
qmlscene HelloWorld.qml
\endcode
You should see the text "Hello, World!" in the center of a red rectangle.
\section1 Handling User Input
One of the great advantages of using QML to define a user interface is that it
allows the user interface designer to define how the application should react
to events with simple JavaScript expressions. In QML, we refer to those events
as \l{Signal and Handler Event System}{signals} and such signals can be handled
with \l{qml-signals-and-handlers}{signal handlers}.
to events with simple JavaScript expressions. In QML, we refer to those events
as \l{Signal and Handler Event System}{signals} and these signals are handled by
\l{qml-signals-and-handlers}{signal handlers}.
For example, consider the following example:
\qml
......@@ -60,7 +146,7 @@ Rectangle {
This example can be saved as "ClickableHelloWorld.qml" and run with qmlscene.
Whenever the user clicks anywhere in the window, the rectangle will change
from red to blue. Note that the \l MouseArea type also emits the clicked
from red to blue. Note that the \l MouseArea type also emits the clicked
signal for touch events, so this code will also work on a mobile device.
Keyboard user input can be similarly handled with a simple expression:
......@@ -94,11 +180,11 @@ is pressed.
\section1 Property Bindings
Objects and their properties form the basis of a graphical interface defined
in a QML document. The QML language allows properties to be bound to each
in a QML document. The QML language allows properties to be bound to each
other in various ways, enabling highly dynamic user interfaces.
In the following example, the geometry of each child \l Rectangle is bound to
that of the parent \l Rectangle. If the geometry of the parent \l Rectangle
that of the parent \l Rectangle. If the geometry of the parent \l Rectangle
were to change, the geometry of each child \l Rectangle would automatically
update due to the property bindings.
......@@ -124,9 +210,9 @@ Rectangle {
\section1 Animations
Properties can also be dynamically updated via animations. The \c QtQuick
Properties can also be dynamically updated via animations. The \c QtQuick
import provides various animation types which can be used to animate changes
to a property's value. In the following example, a property is animated which
to a property's value. In the following example, a property is animated which
then gets displayed in a \l Text area:
\qml
......@@ -155,7 +241,7 @@ The value being displayed will vary from 0 to 150 periodically.
\section1 Defining Custom QML Types for Re-use
One of the most important concepts in QML is that of type re-use. An
One of the most important concepts in QML is that of type re-use. An
application will probably have multiple visual types which are all similar
(for example, multiple push buttons), and QML allows these sort of things to
be defined as re-usable, custom types, to minimize code duplication and
......@@ -175,10 +261,19 @@ That type may now be re-used multiple times in the application, as follows:
\endtable
In this way, modular user interface types can be built up and re-used within
In this way, modular user interface types are assembled and reused within
an application.
See \l {QML Object Attributes}
for more details on how to develop your own reusable components.
\section1 Where to Go from Here
Now that you have seen QML in action, you are ready to take your next step.
The follow page will lead you in your journey with QML.
\list
\li \l{QML Application Developer Resources}
\endlist
*/
......@@ -52,9 +52,9 @@ There are very few changes in the QML language that affect the porting of existi
The \c QtQuick module has been updated to version 2.0. All QML applications should update their import
statements to use the new version:
\qml
\code
import QtQuick 2.0
\endqml
\endcode
\section2 Property and Method Changes
......@@ -241,17 +241,17 @@ For the purposes of porting older applications, the \c {QtDeclarative} module is
QDeclarativeView or QDeclarativeItem and the Graphics View integration) can use this module. Note
that new applications should use the new \l {Qt QML} and \l {Qt Quick} modules instead.
To use the \c {Qt Quick 1} module, add "quick1" to your qmake \c .pro file:
To use the \c {Qt Quick 1} module, add "declarative" to your qmake \c .pro file:
\code
QT += quick1
QT += declarative
\endcode
Required header files can be included from the Qt Quick 1 module:
Required header files can be included as follows:
\code
#include <QtQuick1/QDeclarativeView>
#include <QtQuick1/QDeclarativeItem>
#include <QtDeclarative/QDeclarativeView>
#include <QtDeclarative/QDeclarativeItem>
\endcode
*/
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page qtquick-quickstart-basics.html
\title Quick Start Guide - QML Basics
\brief Basic QML application development examples
\section1 Creating a QML Document
A QML document defines a hierarchy of objects with a highly-readable,
structured layout. Every QML document consists of two parts: an imports
section and an object declaration section. The types and functionality most
common to user interfaces are provided in the \c{QtQuick}
import.
\section2 Importing and Using the QtQuick Module
To use the \l{Qt Quick} module, a QML document needs to
import it. The import syntax looks like this:
\qml
import QtQuick 2.0
\endqml
The types and functionality that \l{Qt Quick} provides can now
be used in the QML document!
\section2 Defining an Object Hierarchy
The object declaration in a QML document defines what will be displayed in the
visual scene. \l{Qt Quick} provides the basic building blocks
for all user interfaces, including objects to display images and text, and to
handle user input.
A simple object declaration might be a colored rectangle with some text centered
in it:
\qml
Rectangle {
width: 200
height: 100
color: "red"
Text {
anchors.centerIn: parent
text: "Hello, World!"
}
}
\endqml
This defines an object hierarchy with a root \l Rectangle object
which has a child \l Text object. The \c parent of the \l Text object is
automatically set to the \l Rectangle, and similarly, the \l Text object is
added to the \c children property of the \l Rectangle object, by QML.
\section2 Putting it Together
The \l Rectangle and \l Text types used in the above example are both provided
by the \c{QtQuick} import. Putting the import and object declaration
together, we get a complete QML document:
\qml
import QtQuick 2.0
Rectangle {
width: 200
height: 100
color: "red"
Text {
anchors.centerIn: parent
text: "Hello, World!"
}
}
\endqml
If we save that document as "HelloWorld.qml" we can load and display it.
\section1 Loading and Displaying the QML Document
To display the graphical scene defined by the QML document, it may be loaded
with the \l{Prototyping with qmlscene}{qmlscene} tool. The
\l{Prototyping with qmlscene}{qmlscene} tool should be installed into the
Qt installation directory. Assuming that the Qt binaries are installed into
or are available in the system executable path, you can display the QML
document with the following command:
\code
qmlscene HelloWorld.qml
\endcode
You should see the text "Hello, World!" in the center of a red rectangle.
*/