diff options
Diffstat (limited to 'doc/src')
8 files changed, 246 insertions, 60 deletions
diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index d11825e..3659caa 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -368,6 +368,10 @@ instead to create the signal handler: \o \snippet doc/src/snippets/declarative/qtbinding/signals-cpp/MyItem.qml 0 \endtable +C++ signals can use enum values as parameters provided that the enum is declared in the +class that is emitting the signal, and that the enum is registered using Q_ENUMS. +See \l {Using enumerations of a custom type} below for details. + \section2 Modifying properties @@ -503,6 +507,21 @@ the \l {Extending QML Functionalities using C++} reference documentation for more information. +\section2 Using enumeration values as signal parameters + +C++ signals may pass enumeration values as signal parameters to QML, providing that the enumeration +and the signal are declared within the same class, or that the enumeration value is one of those declared +in the \l {Qt}{Qt Namespace}. + +Additionally, if a C++ signal with an enum parameter should be connectable to a QML function using the +\l {Connecting signals to methods and other signals}{connect()} function, the enum type must be +registered using qRegisterMetaType(). + +For QML signals, enum values may be used as signal parameters using the \c int type: + +\snippet doc/src/snippets/declarative/qtbinding/enums/standalone.qml 1 + + \section2 Automatic type conversion from strings As a convenience, some basic types can be specified in QML using format strings to make it easier to diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc index 58b51e5..2345990 100644 --- a/doc/src/frameworks-technologies/model-view-programming.qdoc +++ b/doc/src/frameworks-technologies/model-view-programming.qdoc @@ -1934,6 +1934,13 @@ \l{QSortFilterProxyModel::lessThan()}{lessThan()} function to perform custom comparisons. + \section3 Custom data models + + QIdentityProxyModel instances do not sort or filter the structure of the source model, + but provide a base class for creating a data proxy. This could be useful on top of a + QFileSystemModel for example to provide different colours for the BackgroundRole for + different types of files. + \section1 Model subclassing reference Model subclasses need to provide implementations of many of the virtual functions diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index 113ad86..24b297f 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -630,7 +630,7 @@ we need to do special bookkeeping in Qt to handle this correctly, which unfortunately make mixing in native panels hard. The best way at the moment to do this, is to follow the pattern below, where we post the call to the - function with native code rather than calling it directly. Then we now that + function with native code rather than calling it directly. Then we know that Qt has cleanly updated any pending event loop recursions before the native panel is shown: @@ -708,28 +708,8 @@ \section1 Supported Devices - Qt is designed to work on any device which runs one of the following - versions of Symbian: - - \table - \header \o Symbian Version - \row \o S60 3.1 - \row \o S60 3.2 - \row \o S60 5.0 (Symbian ^1) - \endtable - - Qt has received \l{Tier 1 Platforms}{Tier 1} testing on the following phone models: - - \table - \header \o Phone - \row \o Nokia 5800 - \row \o Nokia E71 - \row \o Nokia E72 - \row \o Nokia N78 - \row \o Nokia N95 - \row \o Nokia N97 - \row \o Samsung i8910 - \endtable + See the list of supported devices at + http://wiki.forum.nokia.com/index.php/Nokia_Smart_Installer_for_Symbian#Supported_Devices \section1 Supported Functionality @@ -742,8 +722,6 @@ \o Planned for future release. \row \o QtDBus \o No current plans to support this feature. - \row \o QtOpenGL ES - \o Planned for future release. \row \o Printing support \o No current plans to support this feature. \row \o Qt3Support @@ -837,6 +815,12 @@ plugin. If the Helix plugin fails to load, the MMF plugin, if present on the device, will be loaded instead. + \section1 QtOpenGL Support + + Qt 4.7 introduces the QtOpenGL module to Symbian^3. QtOpenGL is supported on + devices which support OpenGL ES 2.0. Symbian platforms prior to Symbian^3 + are not supported. + \section1 UI Performance in devices prior to Symbian^3 Qt uses the QPainter class to perform low-level painting on widgets and diff --git a/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp b/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp index cf40f9a..5919c01 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp @@ -86,38 +86,3 @@ beginMoveRows(parent, 2, 2, parent, 0); //! [9] beginMoveRows(parent, 2, 2, parent, 4); //! [9] - - -//! [10] -class CustomDataProxy : public QSortFilterProxyModel -{ - Q_OBJECT -public: - CustomDataProxy(QObject *parent) - : QSortFilterProxyModel(parent) - { - } - - ... - - QVariant data(const QModelIndex &index, int role) - { - if (role != Qt::BackgroundRole) - return QSortFilterProxyModel::data(index, role); - - if (m_customData.contains(index.row())) - return m_customData.value(index.row()); - return QSortFilterProxyModel::data(index, role); - } - -private slots: - void resetInternalData() - { - m_customData.clear(); - } - -private: - QHash<int, QVariant> m_customData; -}; -//! [10] - diff --git a/doc/src/snippets/code/src_gui_itemviews_qidentityproxymodel.cpp b/doc/src/snippets/code/src_gui_itemviews_qidentityproxymodel.cpp new file mode 100644 index 0000000..6bf6c89 --- /dev/null +++ b/doc/src/snippets/code/src_gui_itemviews_qidentityproxymodel.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com> +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +class DateFormatProxyModel : public QIdentityProxyModel +{ + // ... + + void setDateFormatString(const QString &formatString) + { + m_formatString = formatString; + } + + QVariant data(const QModelIndex &index, int role) + { + if (role != Qt::DisplayRole) + return QIdentityProxyModel::data(index, role); + + const QDateTime dateTime = sourceModel()->data(SourceClass::DateRole).toDateTime(); + + return dateTime.toString(m_formatString); + } + +private: + QString m_formatString; +}; +//! [0] diff --git a/doc/src/snippets/code/src_network_access_qhttpmultipart.cpp b/doc/src/snippets/code/src_network_access_qhttpmultipart.cpp new file mode 100644 index 0000000..9ad2222 --- /dev/null +++ b/doc/src/snippets/code/src_network_access_qhttpmultipart.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType); + +QHttpPart textPart; +textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"text\"")); +textPart.setBody("my text"); + +QHttpPart imagePart; +imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg")); +imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"image\"")); +QFile *file = new QFile("image.jpg"); +file->open(QIODevice::ReadOnly); +imagePart.setBodyDevice(file); +file->setParent(multiPart); // we cannot delete the file now, so delete it with the multiPart + +multiPart->append(textPart); +multiPart->append(imagePart); + +QUrl url("http://my.server.tld"); +QNetworkRequest request(url); + +QNetworkAccessManager manager; +QNetworkReply *reply = manager.post(request, multiPart); +multiPart->setParent(reply); // delete the multiPart with the reply +// here connect signals etc. +//! [0] diff --git a/doc/src/snippets/code/src_network_access_qhttppart.cpp b/doc/src/snippets/code/src_network_access_qhttppart.cpp new file mode 100644 index 0000000..0e2dbea --- /dev/null +++ b/doc/src/snippets/code/src_network_access_qhttppart.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +Content-Type: text/plain +Content-Disposition: form-data; name="text" + +here goes the body +//! [0] + +//! [1] +QHttpPart textPart; +textPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("text/plain")); +textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"text\"")); +textPart.setBody("here goes the body"); +//! [1] + +//! [2] +QHttpPart imagePart; +imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg")); +imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"image\"")); +imagePart.setRawHeader("Content-ID", "my@content.id"); // add any headers you like via setRawHeader() +QFile *file = new QFile("image.jpg"); +file->open(QIODevice::ReadOnly); +imagePart.setBodyDevice(file); +//! [2] + diff --git a/doc/src/snippets/declarative/qtbinding/enums/standalone.qml b/doc/src/snippets/declarative/qtbinding/enums/standalone.qml index 5721870..74e2c9c 100644 --- a/doc/src/snippets/declarative/qtbinding/enums/standalone.qml +++ b/doc/src/snippets/declarative/qtbinding/enums/standalone.qml @@ -38,6 +38,9 @@ ** ****************************************************************************/ import MyLibrary 1.0 +import QtQuick 1.0 + +Item { //![0] ImageViewer { @@ -47,3 +50,15 @@ ImageViewer { } } //![0] + +//![1] +ImageViewer { + signal someOtherSignal(int statusValue) + + Component.onCompleted: { + someOtherSignal(ImageViewer.Loading) + } +} +//![1] + +} |