From 0948de26bca9a68a354b436895bdf9e2db9c4288 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Tue, 8 Jun 2010 04:40:42 +1000 Subject: initial connman bearer backend. still needs work, debugging, additional threading support, and probably refactoring. This includes a connman dbus service wrapper that has more functionality than is needed by the bearer backend but still missing some 'set' functionality for a complete connman wrapper. Developed with wifi/desktop on 'lucid' kubuntu, using the connman available at http://ppa.launchpad.net/indicator-network-developers/ppa/ubuntu --- src/plugins/bearer/bearer.pro | 3 +- src/plugins/bearer/connman/connman.pro | 19 + src/plugins/bearer/connman/main.cpp | 93 ++ src/plugins/bearer/connman/qconnmanengine.cpp | 651 ++++++++++++ src/plugins/bearer/connman/qconnmanengine.h | 144 +++ .../bearer/connman/qconnmanservice_linux.cpp | 1038 ++++++++++++++++++++ .../bearer/connman/qconnmanservice_linux_p.h | 377 +++++++ 7 files changed, 2324 insertions(+), 1 deletion(-) create mode 100644 src/plugins/bearer/connman/connman.pro create mode 100644 src/plugins/bearer/connman/main.cpp create mode 100644 src/plugins/bearer/connman/qconnmanengine.cpp create mode 100644 src/plugins/bearer/connman/qconnmanengine.h create mode 100644 src/plugins/bearer/connman/qconnmanservice_linux.cpp create mode 100644 src/plugins/bearer/connman/qconnmanservice_linux_p.h diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index f95e8af..6d8f7f2 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -4,7 +4,8 @@ contains(QT_CONFIG, dbus) { contains(QT_CONFIG, icd) { SUBDIRS += icd } else { - SUBDIRS += networkmanager generic + SUBDIRS += generic + !mac:SUBDIRS += connman networkmanager } } diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro new file mode 100644 index 0000000..4be752b --- /dev/null +++ b/src/plugins/bearer/connman/connman.pro @@ -0,0 +1,19 @@ +TARGET = qconnmanbearer +include(../../qpluginbase.pri) + +QT = core network dbus + +HEADERS += qconnmanservice_linux_p.h \ + qconnmanengine.h \ + ../qnetworksession_impl.h \ + ../qbearerengine_impl.h + +SOURCES += main.cpp \ + qconnmanservice_linux.cpp \ + qconnmanengine.cpp \ + ../qnetworksession_impl.cpp + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer +target.path += $$[QT_INSTALL_PLUGINS]/bearer +INSTALLS += target + diff --git a/src/plugins/bearer/connman/main.cpp b/src/plugins/bearer/connman/main.cpp new file mode 100644 index 0000000..d483cf0 --- /dev/null +++ b/src/plugins/bearer/connman/main.cpp @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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$ +** +****************************************************************************/ +#include "qconnmanengine.h" + +#include + +#include + +#ifndef QT_NO_BEARERMANAGEMENT +#ifndef QT_NO_DBUS + +QT_BEGIN_NAMESPACE + +class QConnmanEnginePlugin : public QBearerEnginePlugin +{ +public: + QConnmanEnginePlugin(); + ~QConnmanEnginePlugin(); + + QStringList keys() const; + QBearerEngine *create(const QString &key) const; +}; + +QConnmanEnginePlugin::QConnmanEnginePlugin() +{ +} + +QConnmanEnginePlugin::~QConnmanEnginePlugin() +{ +} + +QStringList QConnmanEnginePlugin::keys() const +{ + return QStringList() << QLatin1String("connman"); +} + +QBearerEngine *QConnmanEnginePlugin::create(const QString &key) const +{ + if (key == QLatin1String("connman")) { + QConnmanEngine *engine = new QConnmanEngine; + if (engine->connmanAvailable()) + return engine; + else + delete engine; + } + return 0; +} + +Q_EXPORT_STATIC_PLUGIN(QConnmanEnginePlugin) +Q_EXPORT_PLUGIN2(qconnmanbearer, QConnmanEnginePlugin) + +QT_END_NAMESPACE + +#endif +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp new file mode 100644 index 0000000..e4cab92 --- /dev/null +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -0,0 +1,651 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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$ +** +****************************************************************************/ + +#include "qconnmanengine.h" +#include "qconnmanservice_linux_p.h" +#include "../qnetworksession_impl.h" + +#include + +#include + +#include + +#include +#include +//#include +#include +#include +#include + +#ifndef QT_NO_BEARERMANAGEMENT +#ifndef QT_NO_DBUS + +QT_BEGIN_NAMESPACE + +QConnmanEngine::QConnmanEngine(QObject *parent) +: QBearerEngineImpl(parent), + connmanManager(new QConnmanManagerInterface(this)) +{ +// qWarning() << Q_FUNC_INFO; +} + +QConnmanEngine::~QConnmanEngine() +{ +} + +bool QConnmanEngine::connmanAvailable() const +{ + QMutexLocker locker(&mutex); + return connmanManager->isValid(); +} + +void QConnmanEngine::initialize() +{ + connect(connmanManager,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(propertyChangedContext(QString,QString,QDBusVariant))); + + foreach(const QString techPath, connmanManager->getTechnologies()) { + QConnmanTechnologyInterface *tech; + tech = new QConnmanTechnologyInterface(techPath, this); + + connect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); + + foreach(const QString devicePath,tech->getDevices()) { + QConnmanDeviceInterface *dev; + dev = new QConnmanDeviceInterface(devicePath); + connect(dev,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(devicePropertyChangedContext(QString,QString,QDBusVariant))); + deviceMap.insert(techPath,QStringList() << devicePath); + } + } + // Get current list of access points. + getConfigurations(); +} + +QList QConnmanEngine::getConfigurations() +{ + QMutexLocker locker(&mutex); + foundConfigurations.clear(); + getNetworkListing(); + return foundConfigurations; +} + +void QConnmanEngine::getNetworkListing() +{ + QMutexLocker locker(&mutex); + + QMapIterator i(deviceMap); + while(i.hasNext()) { + i.next(); + QConnmanDeviceInterface dev(i.value().at(0)); + if(dev.isValid()) { + foreach(const QString network,dev.getNetworks()) { + addNetworkConfiguration(network); + } + } + } +} + +void QConnmanEngine::doRequestUpdate() +{ + getConfigurations(); + emit updateCompleted(); +} + +QString QConnmanEngine::getInterfaceFromId(const QString &id) +{ + QMutexLocker locker(&mutex); + + QString servicePath = serviceFromId(id); + QString netPath = getNetworkForService(servicePath); + + QMapIterator i(deviceMap); + while(i.hasNext()) { + i.next(); + if(i.value().count() > 0) { + QConnmanDeviceInterface dev(i.value().at(0)); + foreach(const QString network, dev.getNetworks()) { + if(network == netPath) { + return dev.getInterface(); + } + } + } + } + return QString(); +} + +bool QConnmanEngine::hasIdentifier(const QString &id) +{ + QMutexLocker locker(&mutex); + return accessPointConfigurations.contains(id); +} + +QString QConnmanEngine::bearerName(const QString &id) +{ + QMutexLocker locker(&mutex); + QConnmanServiceInterface serv(serviceFromId(id)); + QString connectionType = serv.getType(); + + if (connectionType == "ethernet") + return QLatin1String("Ethernet"); + else if (connectionType == "wifi") + return QLatin1String("WLAN"); + else if (connectionType == "cellular") { + QString mode = serv.getMode(); + if(mode == "gprs" || mode == "edge") { + return QLatin1String("2G"); + } else if(mode == "umts") { + return QLatin1String("WCDMA"); + } + } + else if (connectionType == "wimax") + return QLatin1String("WIMAX"); + + return QString(); +} + +void QConnmanEngine::connectToId(const QString &id) +{ + QMutexLocker locker(&mutex); + QConnmanServiceInterface serv(serviceFromId(id)); + if(!serv.isValid()) { + emit connectionError(id, InterfaceLookupError); + } else { + serv.connect(); + } +} + +void QConnmanEngine::disconnectFromId(const QString &id) +{ + QMutexLocker locker(&mutex); + QConnmanServiceInterface serv(serviceFromId(id)); + if(!serv.isValid()) { + emit connectionError(id, DisconnectionError); + } else { + serv.disconnect(); + } +} + +void QConnmanEngine::requestUpdate() +{ + QMutexLocker locker(&mutex); + QTimer::singleShot(0, this, SLOT(doRequestUpdate())); +} + +QString QConnmanEngine::serviceFromId(const QString &id) +{ + QMutexLocker locker(&mutex); + foreach(QString service, connmanManager->getServices()) { + if (id == QString::number(qHash(service))) + return service; + } + + return QString(); +} + +QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id) +{ + QMutexLocker locker(&mutex); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + if (!ptr) + return QNetworkSession::Invalid; + + if (!ptr->isValid) { + return QNetworkSession::Invalid; + } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return QNetworkSession::Connected; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + return QNetworkSession::Disconnected; + } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + return QNetworkSession::NotAvailable; + } else if ((ptr->state & QNetworkConfiguration::Undefined) == + QNetworkConfiguration::Undefined) { + return QNetworkSession::NotAvailable; + } + + return QNetworkSession::Invalid; +} + +quint64 QConnmanEngine::bytesWritten(const QString &id) +{//TODO use connman counter API + QMutexLocker locker(&mutex); + quint64 result = 0; + QString devFile = getInterfaceFromId(id); + QFile tx("/sys/class/net/"+devFile+"/statistics/tx_bytes"); + if(tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&tx); + in >> result; + tx.close(); + } + return result; +} + +quint64 QConnmanEngine::bytesReceived(const QString &id) +{//TODO use connman counter API + QMutexLocker locker(&mutex); + quint64 result = 0; + QString devFile = getInterfaceFromId(id); + QFile rx("/sys/class/net/"+devFile+"/statistics/rx_bytes"); + if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&rx); + in >> result; + rx.close(); + } + return result; +} + +quint64 QConnmanEngine::startTime(const QString &/*id*/) +{ + // TODO + QMutexLocker locker(&mutex); + if (activeTime.isNull()) { + return 0; + } + return activeTime.secsTo(QDateTime::currentDateTime()); +} + +QNetworkConfigurationManager::Capabilities QConnmanEngine::capabilities() const +{ + return QNetworkConfigurationManager::ForcedRoaming | + QNetworkConfigurationManager::DataStatistics | + QNetworkConfigurationManager::CanStartAndStopInterfaces; +} + +QNetworkSessionPrivate *QConnmanEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + +QNetworkConfigurationPrivatePointer QConnmanEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + + +QString QConnmanEngine::getServiceForNetwork(const QString &netPath) +{ + QMutexLocker locker(&mutex); + QConnmanNetworkInterface network(netPath, this); + foreach(QString service,connmanManager->getServices()) { + QConnmanServiceInterface serv(service,this); + if(serv.getName() == network.getName() + && network.getSignalStrength() == serv.getSignalStrength()) { + return service; + } + } + return QString(); +} + +QString QConnmanEngine::getNetworkForService(const QString &servPath) +{ + QMutexLocker locker(&mutex); + QMap map; + + QMapIterator i(deviceMap); + while(i.hasNext()) { + i.next(); + if(i.value().count() > 0) { + QConnmanDeviceInterface device(i.value().at(0)); + QMap netMapStrength; + + foreach(const QString netPath, knownNetworks[device.getType()]) { + QConnmanNetworkInterface network1(netPath, this); + QString netname = network1.getName(); + qint32 sigStrength = network1.getSignalStrength(); + + if(netMapStrength.contains(netname) + && netMapStrength.value(netname) < sigStrength) { + netMapStrength.remove(netname); + map.remove(netname); + } + netMapStrength.insert(netname, sigStrength); + map.insert(netname,netPath); + } + } + } + + QConnmanServiceInterface *serv; + serv = new QConnmanServiceInterface(servPath); + if(map.contains(serv->getName())) { + return map.value(serv->getName()); + } + return QString(); +} + +void QConnmanEngine::propertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) +{ +// qDebug() << __FUNCTION__ << path << item; + QMutexLocker locker(&mutex); + + if(item == "Technologies") { + QDBusArgument arg = qvariant_cast(value.variant()); + QStringList newlist = qdbus_cast(arg); + if(newlist.count() > 0) { + QMap oldtech = technologies; + + foreach(const QString listPath, newlist) { + if(!oldtech.contains(listPath)) { + QConnmanTechnologyInterface *tech; + tech = new QConnmanTechnologyInterface(listPath,this); + connect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); + technologies.insert(listPath, tech); + } + } + + foreach(const QString old, oldtech.keys()) { + if(!newlist.contains(old)) { + QConnmanTechnologyInterface *tech = oldtech.value(old); + disconnect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); + + technologies.remove(old); + getNetworkListing(); + } + } + } + } +} + +void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) +{ +// qDebug() << __FUNCTION__ << path << item; + QMutexLocker locker(&mutex); + if(item == "State") { + configurationChange(QString::number(qHash(path))); + if(value.variant().toString() == "failure") { + QConnmanServiceInterface serv(path); + qDebug() <<__FUNCTION__ <<"Error" << serv.getError(); + emit connectionError(QString::number(qHash(path)), ConnectError); + } + } +} + +void QConnmanEngine::networkPropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &/*value*/) +{ +// qDebug() << __FUNCTION__ << path << item; + QMutexLocker locker(&mutex); +} + +void QConnmanEngine::devicePropertyChangedContext(const QString &path,const QString &item,const QDBusVariant &value) +{ +// qDebug() << __FUNCTION__ << path << item << value.variant(); + QMutexLocker locker(&mutex); + if(item == "Networks") { + QDBusArgument arg = qvariant_cast(value.variant()); + QStringList remainingNetworks = qdbus_cast(arg); + + QConnmanDeviceInterface dev(path); + QStringList oldnetworks = knownNetworks[dev.getType()]; + if(remainingNetworks.count() != oldnetworks.count()) { + + foreach(const QString netPath, remainingNetworks) { + if(!oldnetworks.contains(netPath)) { + addNetworkConfiguration(netPath); + } + } + + foreach(const QString netPath, oldnetworks) { + QString servicePath = getServiceForNetwork(netPath); + if(!remainingNetworks.contains(netPath)) { + if(servicePath.isEmpty()) { + removeConfiguration(netPath); + } else { + if(!remainingNetworks.contains(servicePath)) { + removeConfiguration(QString::number(qHash(servicePath))); + } + } + } + } + } + } +} + +void QConnmanEngine::technologyPropertyChangedContext(const QString & path, const QString &item, const QDBusVariant &value) +{ +// qWarning() << __FUNCTION__ << path << item << value.variant(); +// if(item == "Devices") { +// QDBusArgument arg = qvariant_cast(value.variant()); +// QStringList list = qdbus_cast(arg); +// } + if(item == "State") { + if(value.variant().toString() == "enabled") { + } + if(value.variant().toString() == "offline") { + deviceMap.remove(path); + } + if(value.variant().toString() == "available") { + QConnmanTechnologyInterface tech(connmanManager->getPathForTechnology(path)); + foreach(const QString devPath, tech.getDevices()) { + QConnmanDeviceInterface *dev; + dev = new QConnmanDeviceInterface(devPath,this); + connect(dev,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(devicePropertyChangedContext(QString,QString,QDBusVariant))); + + deviceMap.insert(path,QStringList() << devPath); + } + } + } +} + +void QConnmanEngine::configurationChange(const QString &id) +{ + QMutexLocker locker(&mutex); + bool changed = false; + + if (accessPointConfigurations.contains(id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + QString servicePath = serviceFromId(id); + QConnmanServiceInterface *serv; + serv = new QConnmanServiceInterface(servicePath); + QString networkName = serv->getName(); + QNetworkConfiguration::StateFlags curState = getStateForService(servicePath); + + ptr->mutex.lock(); + + if (!ptr->isValid) { + ptr->isValid = true; + changed = true; + } + + if (ptr->name != networkName) { + ptr->name = networkName; + changed = true; + } + + if (ptr->state != curState) { + ptr->state = curState; + changed = true; + } + + ptr->mutex.unlock(); + + if (changed) { + locker.unlock(); + emit configurationChanged(ptr); + locker.relock(); + } + + } + locker.unlock(); + emit updateCompleted(); +} + +QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QString &service) +{ + qWarning() << __FUNCTION__; + QMutexLocker locker(&mutex); + QConnmanServiceInterface serv(service); + QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined; + if(serv.isFavorite()) { + flag = ( flag | QNetworkConfiguration::Discovered); + } else { + flag = QNetworkConfiguration::Undefined; + } + + if(serv.getState() == "ready" || serv.getState() == "online") { + flag = ( flag | QNetworkConfiguration::Active); + } + + return flag; +} + +QString QConnmanEngine::typeToBearer(const QString &type) +{ + QMutexLocker locker(&mutex); + if(type == "wifi") + return "WLAN"; + if(type == "ethernet") + return "Ethernet"; + if(type == "bluetooth") + return "Bluetooth"; + if(type == "cellular") { + return "Cellular"; + // not handled: CDMA2000 HSPA + } + if(type == "wimax") + return "WiMax"; +// if(type == "gps") +// if(type == "vpn") + + return "Unknown"; +} + +void QConnmanEngine::removeConfiguration(const QString &netpath) +{ + QMutexLocker locker(&mutex); + const QString id = QString::number(qHash(netpath)); + if (accessPointConfigurations.contains(id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id); + QConnmanDeviceInterface device(netpath.section("/",0,5),this); + locker.unlock(); + knownNetworks[device.getType()].removeAll(netpath); + emit configurationRemoved(ptr); + locker.relock(); + } +} + +void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) +{ +// qWarning() << __FUNCTION__ << networkPath; + QMutexLocker locker(&mutex); + + QConnmanNetworkInterface *network; + network = new QConnmanNetworkInterface(networkPath, this); + QString servicePath = getServiceForNetwork(networkPath); + QConnmanServiceInterface *serv; + + QString id; + if(servicePath.isEmpty()) { + id = QString::number(qHash(networkPath)); + } else { + id = QString::number(qHash(servicePath)); + } + if (!accessPointConfigurations.contains(id)) { + connect(network,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(networkPropertyChangedContext(QString,QString, QDBusVariant))); + + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + + QString networkName = network->getName(); + + if(networkName.isEmpty()) + networkName = "Hidden Network"; + + QString bearerName; + + QConnmanDeviceInterface device(networkPath.section("/",0,5),this); + if(servicePath.isEmpty()) { + bearerName = typeToBearer(device.getType()); + } else { + serv = new QConnmanServiceInterface(servicePath,this); + bearerName = typeToBearer(serv->getType()); + connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); + } + knownNetworks[device.getType()]<< networkPath; + + if(bearerName == "Cellular") { + QString mode = serv->getMode(); + if(mode == "gprs" || mode == "edge") { + bearerName = "2G"; + } else if(mode == "umts") { + bearerName = "WCDMA"; + } + networkName = serv->getAPN(); + } + + cpPriv->name = networkName; + cpPriv->isValid = true; + cpPriv->id = id; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->bearer = bearerName; + + if(network->getWifiSecurity() == "none") { + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + } else { + cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + } + + if(servicePath.isEmpty()) + cpPriv->state = QNetworkConfiguration::Undefined; + else + cpPriv->state = getStateForService(servicePath); + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(ptr->id, ptr); + foundConfigurations.append(cpPriv); + locker.unlock(); + emit configurationAdded(ptr); + locker.relock(); + } +} + +QT_END_NAMESPACE + +#endif // QT_NO_DBUS +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h new file mode 100644 index 0000000..849d8c9 --- /dev/null +++ b/src/plugins/bearer/connman/qconnmanengine.h @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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$ +** +****************************************************************************/ + +#ifndef QCONNMANENGINE_P_H +#define QCONNMANENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include "../qbearerengine_impl.h" + +#include "qconnmanservice_linux_p.h" + +#include +#include + +#ifndef QT_NO_BEARERMANAGEMENT +#ifndef QT_NO_DBUS + +QT_BEGIN_NAMESPACE + +class QConnmanEngine : public QBearerEngineImpl +{ + Q_OBJECT + +public: + QConnmanEngine(QObject *parent = 0); + ~QConnmanEngine(); + + bool connmanAvailable() const; + + virtual QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + virtual QString bearerName(const QString &id); + + virtual void connectToId(const QString &id); + virtual void disconnectFromId(const QString &id); + + Q_INVOKABLE void initialize(); + Q_INVOKABLE void requestUpdate(); + + QNetworkSession::State sessionStateForId(const QString &id); + QNetworkSessionPrivate *createSessionBackend(); + + virtual quint64 bytesWritten(const QString &id); + virtual quint64 bytesReceived(const QString &id); + virtual quint64 startTime(const QString &id); + + + virtual QNetworkConfigurationManager::Capabilities capabilities() const; + virtual QNetworkConfigurationPrivatePointer defaultConfiguration(); + + void configurationChange(const QString &id); + QList getConfigurations(); + + +private Q_SLOTS: + + void doRequestUpdate(); + void servicePropertyChangedContext(const QString &,const QString &,const QDBusVariant &); + void networkPropertyChangedContext(const QString &,const QString &,const QDBusVariant &); + void devicePropertyChangedContext(const QString &,const QString &,const QDBusVariant &); + void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); + void technologyPropertyChangedContext(const QString &,const QString &, const QDBusVariant &); + +private: + QConnmanManagerInterface *connmanManager; + + QList foundConfigurations; + void getNetworkListing(); + + QString getServiceForNetwork(const QString &network); + QString getNetworkForService(const QString &network); + + QString serviceFromId(const QString &id); + QString networkFromId(const QString &id); + + QNetworkConfiguration::StateFlags getStateForService(const QString &service); + QString typeToBearer(const QString &type); + + void removeConfiguration(const QString &path); + void addNetworkConfiguration(const QString &worknetPath); + QDateTime activeTime; + + + QMap technologies; + QMap knownNetworks; + QMap deviceMap; +}; + +QT_END_NAMESPACE + +#endif // QT_NO_DBUS +#endif // QT_NO_BEARERMANAGEMENT + +#endif + diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp new file mode 100644 index 0000000..ca76ffd --- /dev/null +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -0,0 +1,1038 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "qconnmanservice_linux_p.h" + + +QT_BEGIN_NAMESPACE +static QDBusConnection dbusConnection = QDBusConnection::systemBus(); + + +QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent) + : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), + QLatin1String(CONNMAN_MANAGER_PATH), + CONNMAN_MANAGER_INTERFACE, + QDBusConnection::systemBus(), parent) +{ +} + +QConnmanManagerInterface::~QConnmanManagerInterface() +{ +} + +void QConnmanManagerInterface::connectNotify(const char *signal) +{ +if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { + if(!connection().connect(QLatin1String(CONNMAN_SERVICE), + QLatin1String(CONNMAN_MANAGER_PATH), + QLatin1String(CONNMAN_MANAGER_INTERFACE), + QLatin1String("PropertyChanged"), + this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) { + qWarning() << "PropertyCHanged not connected"; + } + } + + if (QLatin1String(signal) == SIGNAL(stateChanged(QString))) { + if (!connection().connect(QLatin1String(CONNMAN_SERVICE), + QLatin1String(CONNMAN_MANAGER_PATH), + QLatin1String(CONNMAN_MANAGER_INTERFACE), + QLatin1String("StateChanged"), + this,SIGNAL(stateChanged(const QString&)))) { + qWarning() << "StateChanged not connected"; + + } + } + if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) { + QConnmanDBusHelper *helper; + helper = new QConnmanDBusHelper(this); + + dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QLatin1String(CONNMAN_MANAGER_PATH), + QLatin1String(CONNMAN_MANAGER_INTERFACE), + QLatin1String("PropertyChanged"), + helper,SLOT(propertyChanged(QString,QDBusVariant))); + + + QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + } +} + +void QConnmanManagerInterface::disconnectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) { + + } +} + +QVariant QConnmanManagerInterface::getProperty(const QString &property) +{ + QVariant var; + QVariantMap map = getProperties(); + if (map.contains(property)) { + var = map.value(property); + } else { + qDebug() << "does not contain" << property; + } + return var; +} + +QVariantMap QConnmanManagerInterface::getProperties() +{ + QDBusReply reply = this->call(QLatin1String("GetProperties")); + return reply.value(); +} + +QString QConnmanManagerInterface::getState() +{ + QDBusReply reply = this->call("GetState"); + return reply.value(); +} + +bool QConnmanManagerInterface::setProperty(const QString &name, const QDBusVariant &value) +{ + Q_UNUSED(name); + Q_UNUSED(value); + return false; +} + +QDBusObjectPath QConnmanManagerInterface::createProfile(const QString &/*name*/) +{ + return QDBusObjectPath(); +} + +bool QConnmanManagerInterface::removeProfile(QDBusObjectPath /*path*/) +{ + return false; +} + +bool QConnmanManagerInterface::requestScan(const QString &type) +{ + QDBusReply reply = this->call(QLatin1String("RequestScan"), QVariant::fromValue(type)); + + bool ok = true; + if(reply.error().type() == QDBusError::InvalidArgs) { + qWarning() << reply.error().message(); + ok = false; + } + return ok; +} + +bool QConnmanManagerInterface::enableTechnology(const QString &type) +{ + QDBusReply > reply = this->call(QLatin1String("EnableTechnology"), QVariant::fromValue(type)); + bool ok = true; + if(reply.error().type() == QDBusError::InvalidArgs) { + qWarning() << reply.error().message(); + ok = false; + } + return ok; +} + +bool QConnmanManagerInterface::disableTechnology(const QString &type) +{ + QDBusReply > reply = this->call(QLatin1String("DisableTechnology"), QVariant::fromValue(type)); + bool ok = true; + if(reply.error().type() == QDBusError::InvalidArgs) { + qWarning() << reply.error().message(); + ok = false; + } + return ok; +} + +QDBusObjectPath QConnmanManagerInterface::connectService(QVariantMap &map) +{ + QDBusReply reply = this->call(QLatin1String("ConnectService"), QVariant::fromValue(map)); + if(!reply.isValid()) { + qDebug() << reply.error().message(); + + } + return reply; +} + +void QConnmanManagerInterface::registerAgent(QDBusObjectPath &/*path*/) +{ +} + +void QConnmanManagerInterface::unregisterAgent(QDBusObjectPath /*path*/) +{ +} + +void QConnmanManagerInterface::registerCounter(QDBusObjectPath /*path*/, quint32 /*interval*/) +{ +} + +void QConnmanManagerInterface::unregisterCounter(QDBusObjectPath /*path*/) +{ +} + +QString QConnmanManagerInterface::requestSession(const QString &bearerName) +{ + QDBusReply > reply = this->call(QLatin1String("RequestSession"), QVariant::fromValue(bearerName)); + return QString(); +} + +void QConnmanManagerInterface::releaseSession() +{ + QDBusReply > reply = this->call(QLatin1String("ReleaseSession")); +} + + +QDBusObjectPath QConnmanManagerInterface::lookupService(const QString &service) +{ + QDBusReply reply = this->call(QLatin1String("LookupService"), QVariant::fromValue(service)); + if(!reply.isValid()) { + qDebug() << reply.error().message(); + } + return reply; +} + +// properties + +QStringList QConnmanManagerInterface::getAvailableTechnologies() +{ + QVariant var = getProperty("AvailableTechnologies"); + return qdbus_cast(var); +} + +QStringList QConnmanManagerInterface::getEnabledTechnologies() +{ + QVariant var = getProperty("EnabledTechnologies"); + return qdbus_cast(var); +} + +QStringList QConnmanManagerInterface::getConnectedTechnologies() +{ + QVariant var = getProperty("ConnectedTechnologies"); + return qdbus_cast(var); +} + +QString QConnmanManagerInterface::getDefaultTechnology() +{ + QVariant var = getProperty("DefaultTechnology"); + return qdbus_cast(var); +} + +bool QConnmanManagerInterface::getOfflineMode() +{ + QVariant var = getProperty("OfflineMode"); + return qdbus_cast(var); +} + +QString QConnmanManagerInterface::getActiveProfile() +{ + QVariant var = getProperty("ActiveProfile"); + return qdbus_cast(var); +} + +QStringList QConnmanManagerInterface::getProfiles() +{ + QVariant var = getProperty("Profiles"); + return qdbus_cast(var); +} + +QStringList QConnmanManagerInterface::getTechnologies() +{ + QVariant var = getProperty("Technologies"); + return qdbus_cast(var); +} + +QStringList QConnmanManagerInterface::getServices() +{ + QVariant var = getProperty("Services"); + return qdbus_cast(var); +} + +QString QConnmanManagerInterface::getPathForTechnology(const QString &name) +{ + foreach(const QString path, getTechnologies()) { + if(path.contains(name)) { + return path; + } + } + return ""; +} + +QConnmanNetworkInterface::QConnmanNetworkInterface(const QString &dbusPathName, QObject *parent) + : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), + dbusPathName, + CONNMAN_NETWORK_INTERFACE, + QDBusConnection::systemBus(), parent) +{ +} + +QConnmanNetworkInterface::~QConnmanNetworkInterface() +{ +} + +void QConnmanNetworkInterface::connectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { + if(!connection().connect(QLatin1String(CONNMAN_SERVICE), + this->path(), + QLatin1String(CONNMAN_NETWORK_INTERFACE), + QLatin1String("PropertyChanged"), + this,SIGNAL(propertyChanged(QString,QDBusVariant))) ) { + qWarning() << "network properties not connected"; + } + } + if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) { + QConnmanDBusHelper *helper; + helper = new QConnmanDBusHelper(this); + + dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + this->path(), + QLatin1String(CONNMAN_NETWORK_INTERFACE), + QLatin1String("PropertyChanged"), + helper,SLOT(propertyChanged(QString,QDBusVariant))); + + QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + } +} + +void QConnmanNetworkInterface::disconnectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { + + } +} + +QVariantMap QConnmanNetworkInterface::getProperties() +{ + QDBusReply reply = this->call(QLatin1String("GetProperties")); + return reply.value(); +} + +QVariant QConnmanNetworkInterface::getProperty(const QString &property) +{ + QVariant var; + QVariantMap map = getProperties(); + if (map.contains(property)) { + var = map.value(property); + } + return var; +} + +//properties + +QString QConnmanNetworkInterface::getAddress() +{ + QVariant var = getProperty("Address"); + return qdbus_cast(var); +} + +QString QConnmanNetworkInterface::getName() +{ + QVariant var = getProperty("Name"); + return qdbus_cast(var); +} + +bool QConnmanNetworkInterface::isConnected() +{ + QVariant var = getProperty("Connected"); + return qdbus_cast(var); +} + +quint8 QConnmanNetworkInterface::getSignalStrength() +{ + QVariant var = getProperty("Strength"); + return qdbus_cast(var); +} + +QString QConnmanNetworkInterface::getDevice() +{ + QVariant var = getProperty("Device"); + return qdbus_cast(var); +} + +QString QConnmanNetworkInterface::getWifiSsid() +{ + QVariant var = getProperty("WiFi.SSID"); + return qdbus_cast(var); +} + +QString QConnmanNetworkInterface::getWifiMode() +{ + QVariant var = getProperty("WiFi.Mode"); + return qdbus_cast(var); +} + +QString QConnmanNetworkInterface::getWifiSecurity() +{ + QVariant var = getProperty("WiFi.Security"); + return qdbus_cast(var); +} + +QString QConnmanNetworkInterface::getWifiPassphrase() +{ + QVariant var = getProperty("WiFi.Passphrase"); + return qdbus_cast(var); +} + + +////////////////////////// + +QConnmanProfileInterface::QConnmanProfileInterface(const QString &dbusPathName,QObject *parent) + : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), + dbusPathName, + CONNMAN_PROFILE_INTERFACE, + QDBusConnection::systemBus(), parent) +{ +} + +QConnmanProfileInterface::~QConnmanProfileInterface() +{ +} + +void QConnmanProfileInterface::connectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { + dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + this->path(), + QLatin1String(CONNMAN_PROFILE_INTERFACE), + QLatin1String("PropertyChanged"), + this,SIGNAL(propertyChanged(QString,QDBusVariant))); + } +} + +void QConnmanProfileInterface::disconnectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString, QVariant))) { + + } +} + +QVariantMap QConnmanProfileInterface::getProperties() +{ + QDBusReply reply = this->call(QLatin1String("GetProperties")); + return reply.value(); +} + +QVariant QConnmanProfileInterface::getProperty(const QString &property) +{ + QVariant var; + QVariantMap map = getProperties(); + if (map.contains(property)) { + var = map.value(property); + } else { + qDebug() <<__FUNCTION__<< "Could not find" << property; + } + return var; +} + +// properties +QString QConnmanProfileInterface::getName() +{ + + QVariant var = getProperty("Name"); + return qdbus_cast(var); +} + +bool QConnmanProfileInterface::isOfflineMode() +{ + QVariant var = getProperty("OfflineMode"); + return qdbus_cast(var); +} + +QStringList QConnmanProfileInterface::getServices() +{ + QVariant var = getProperty("Services"); + return qdbus_cast(var); +} + +/////////////////////////// +QConnmanServiceInterface::QConnmanServiceInterface(const QString &dbusPathName,QObject *parent) + : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), + dbusPathName, + CONNMAN_SERVICE_INTERFACE, + QDBusConnection::systemBus(), parent) +{ +} + +QConnmanServiceInterface::~QConnmanServiceInterface() +{ +} + +void QConnmanServiceInterface::connectNotify(const char *signal) +{ +// qWarning() << __FUNCTION__ << signal << this->path(); + + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { + dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + this->path(), + QLatin1String(CONNMAN_SERVICE_INTERFACE), + QLatin1String("PropertyChanged"), + this,SIGNAL(propertyChanged(QString,QDBusVariant))); + } + if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) { + QConnmanDBusHelper *helper; + helper = new QConnmanDBusHelper(this); + + dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + this->path(), + QLatin1String(CONNMAN_SERVICE_INTERFACE), + QLatin1String("PropertyChanged"), + helper,SLOT(propertyChanged(QString,QDBusVariant))); + + QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + } +} + +void QConnmanServiceInterface::disconnectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) { + + } +} + +QVariantMap QConnmanServiceInterface::getProperties() +{ + QDBusReply reply = this->call(QLatin1String("GetProperties")); + return reply.value(); +} + +QVariant QConnmanServiceInterface::getProperty(const QString &property) +{ + QVariant var; + QVariantMap map = getProperties(); + if (map.contains(property)) { + var = map.value(property); + } else { +// qDebug() <<__FUNCTION__<< "Could not find" << property; + } + return var; +} + +// clearProperty +void QConnmanServiceInterface::connect() +{ + QDBusReply reply = this->call(QLatin1String("Connect")); +} + +void QConnmanServiceInterface::disconnect() +{ + QDBusReply reply = this->call(QLatin1String("Disconnect")); +} + +void QConnmanServiceInterface::remove() +{ + QDBusReply reply = this->call(QLatin1String("Remove")); +} + +// void moveBefore(QDBusObjectPath &service); +// void moveAfter(QDBusObjectPath &service); + +// properties +QString QConnmanServiceInterface::getState() +{ + QVariant var = getProperty("State"); + return qdbus_cast(var); +} + +QString QConnmanServiceInterface::getError() +{ + QVariant var = getProperty("Error"); + return qdbus_cast(var); +} + +QString QConnmanServiceInterface::getName() +{ + QVariant var = getProperty("Name"); + return qdbus_cast(var); +} + +QString QConnmanServiceInterface::getType() +{ + QVariant var = getProperty("Type"); + return qdbus_cast(var); +} + +QString QConnmanServiceInterface::getMode() +{ + QVariant var = getProperty("Mode"); + return qdbus_cast(var); +} + +QString QConnmanServiceInterface::getSecurity() +{ + QVariant var = getProperty("Security"); + return qdbus_cast(var); +} + +QString QConnmanServiceInterface::getPassphrase() +{ + QVariant var = getProperty("Passphrase"); + return qdbus_cast(var); +} + +bool QConnmanServiceInterface::isPassphraseRequired() +{ + QVariant var = getProperty("PassphraseRequired"); + return qdbus_cast(var); +} + +quint8 QConnmanServiceInterface::getSignalStrength() +{ + QVariant var = getProperty("Strength"); + return qdbus_cast(var); +} + +bool QConnmanServiceInterface::isFavorite() +{ + QVariant var = getProperty("Favorite"); + return qdbus_cast(var); +} + +bool QConnmanServiceInterface::isImmutable() +{ + QVariant var = getProperty("Immutable"); + return qdbus_cast(var); +} + +bool QConnmanServiceInterface::isAutoConnect() +{ + QVariant var = getProperty("AutoConnect"); + return qdbus_cast(var); +} + +bool QConnmanServiceInterface::isSetupRequired() +{ + QVariant var = getProperty("SetupRequired"); + return qdbus_cast(var); +} + +QString QConnmanServiceInterface::getAPN() +{ + QVariant var = getProperty("APN"); + return qdbus_cast(var); +} + +QString QConnmanServiceInterface::getMCC() +{ + QVariant var = getProperty("MCC"); + return qdbus_cast(var); +} + +QString QConnmanServiceInterface::getMNC() +{ + QVariant var = getProperty("MNC"); + return qdbus_cast(var); +} + +bool QConnmanServiceInterface::isRoaming() +{ + QVariant var = getProperty("Roaming"); + return qdbus_cast(var); +} + +QStringList QConnmanServiceInterface::getNameservers() +{ + QVariant var = getProperty("NameServers"); + return qdbus_cast(var); +} + +QStringList QConnmanServiceInterface::getDomains() +{ + QVariant var = getProperty("Domains"); + return qdbus_cast(var); +} + +QVariantMap QConnmanServiceInterface::getIPv4() +{ + QVariant var = getProperty("IPv4"); + return qdbus_cast(var); +} + +QVariantMap QConnmanServiceInterface::getIPv4Configuration() +{ + QVariant var = getProperty("IPv4.Configuration"); + return qdbus_cast(var); +} + +QVariantMap QConnmanServiceInterface::getProxy() +{ + QVariant var = getProperty("Proxy"); + return qdbus_cast(var); +} + +QVariantMap QConnmanServiceInterface::getEthernet() +{ + QVariant var = getProperty("Ethernet"); + return qdbus_cast(var); +} + +bool QConnmanServiceInterface::isOfflineMode() +{ + QVariant var = getProperty("OfflineMode"); + return qdbus_cast(var); +} + +QStringList QConnmanServiceInterface::getServices() +{ + QVariant var = getProperty("Services"); + return qdbus_cast(var); +} + + +////////////////////////// +QConnmanTechnologyInterface::QConnmanTechnologyInterface(const QString &dbusPathName,QObject *parent) + : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), + dbusPathName, + CONNMAN_TECHNOLOGY_INTERFACE, + QDBusConnection::systemBus(), parent) +{ +} + +QConnmanTechnologyInterface::~QConnmanTechnologyInterface() +{ +} + +void QConnmanTechnologyInterface::connectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { + dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + this->path(), + QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE), + QLatin1String("PropertyChanged"), + this,SIGNAL(propertyChanged(QString,QDBusVariant))); + } + if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) { + QConnmanDBusHelper *helper; + helper = new QConnmanDBusHelper(this); + + dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + this->path(), + QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE), + QLatin1String("PropertyChanged"), + helper,SLOT(propertyChanged(QString,QDBusVariant))); + + QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + } +} + +void QConnmanTechnologyInterface::disconnectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) { + + } +} + +QVariantMap QConnmanTechnologyInterface::getProperties() +{ + QDBusReply reply = this->call(QLatin1String("GetProperties")); + return reply.value(); +} + +QVariant QConnmanTechnologyInterface::getProperty(const QString &property) +{ + QVariant var; + QVariantMap map = getProperties(); + if (map.contains(property)) { + var = map.value(property); + } + return var; +} + +// properties +QString QConnmanTechnologyInterface::getState() +{ + QVariant var = getProperty("State"); + return qdbus_cast(var); +} + +QString QConnmanTechnologyInterface::getName() +{ + QVariant var = getProperty("Name"); + return qdbus_cast(var); +} + +QString QConnmanTechnologyInterface::getType() +{ + QVariant var = getProperty("Type"); + return qdbus_cast(var); +} + + +QStringList QConnmanTechnologyInterface::getDevices() +{ + QVariant var = getProperty("Devices"); + return qdbus_cast(var); +} + + +////////////////////////////////// +QConnmanAgentInterface::QConnmanAgentInterface(const QString &dbusPathName, QObject *parent) + : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), + dbusPathName, + CONNMAN_AGENT_INTERFACE, + QDBusConnection::systemBus(), parent) +{ +} + +QConnmanAgentInterface::~QConnmanAgentInterface() +{ +} + +void QConnmanAgentInterface::connectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { +// dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), +// this->path(), +// QLatin1String(CONNMAN_NETWORK_INTERFACE), +// QLatin1String("PropertyChanged"), +// this,SIGNAL(propertyChanged(const QString &, QVariant &))); + } +} + +void QConnmanAgentInterface::disconnectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString, QDBusVariant))) { + + } +} + + +void QConnmanAgentInterface::release() +{ +} + +void QConnmanAgentInterface::reportError(QDBusObjectPath &/*path*/, const QString &/*error*/) +{ +} + +//dict QConnmanAgentInterface::requestInput(QDBusObjectPath &path, dict fields) +//{ +//} + +void QConnmanAgentInterface::cancel() +{ +} + + +///////////////////////////////////////// + +QConnmanDeviceInterface::QConnmanDeviceInterface(const QString &dbusPathName,QObject *parent) + : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), + dbusPathName, + CONNMAN_DEVICE_INTERFACE, + QDBusConnection::systemBus(), parent) +{ +} + +QConnmanDeviceInterface::~QConnmanDeviceInterface() +{ +} + +void QConnmanDeviceInterface::connectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { + dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + this->path(), + QLatin1String(CONNMAN_DEVICE_INTERFACE), + QLatin1String("PropertyChanged"), + this,SIGNAL(propertyChanged(QString,QDBusVariant))); + + } + if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) { + QConnmanDBusHelper *helper; + helper = new QConnmanDBusHelper(this); + + dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + this->path(), + QLatin1String(CONNMAN_DEVICE_INTERFACE), + QLatin1String("PropertyChanged"), + helper,SLOT(propertyChanged(QString,QDBusVariant))); + + QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + } +} + +void QConnmanDeviceInterface::disconnectNotify(const char *signal) +{ + if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) { + + } +} + +QVariantMap QConnmanDeviceInterface::getProperties() +{ + QDBusReply reply = this->call(QLatin1String("GetProperties")); + return reply.value(); +} + +bool QConnmanDeviceInterface::setProperty(const QString &name, const QDBusVariant &value) +{ + +// QList args; + qWarning() << __FUNCTION__ << name << value.variant(); +// args << qVariantFromValue(name); +// args << qVariantFromValue(value); + + QDBusMessage reply = this->call(QLatin1String("SetProperty"),name, qVariantFromValue(value)); +qWarning() << reply.errorMessage(); + + return true; +} + +void QConnmanDeviceInterface::scan() +{ + QDBusReply reply = this->call(QLatin1String("ProposeScan")); + if(!reply.isValid()) { + qDebug() << reply.error().message(); + } +} + +QVariant QConnmanDeviceInterface::getProperty(const QString &property) +{ + QVariant var; + QVariantMap map = getProperties(); + if (map.contains(property)) { + var = map.value(property); + } + return var; +} + +//properties +QString QConnmanDeviceInterface::getAddress() +{ + QVariant var = getProperty("Address"); + return qdbus_cast(var); +} + +QString QConnmanDeviceInterface::getName() +{ + QVariant var = getProperty("Name"); + return qdbus_cast(var); +} + +QString QConnmanDeviceInterface::getType() +{ + QVariant var = getProperty("Type"); + return qdbus_cast(var); +} + +QString QConnmanDeviceInterface::getInterface() +{ + QVariant var = getProperty("Interface"); + return qdbus_cast(var); +} + +bool QConnmanDeviceInterface::isPowered() +{ + QVariant var = getProperty("Powered"); + return qdbus_cast(var); +} + +quint16 QConnmanDeviceInterface::getScanInterval() +{ + QVariant var = getProperty("ScanInterval"); + return qdbus_cast(var); +} + +bool QConnmanDeviceInterface::setScanInterval(const QString & interval) +{ +// QList args; +// args << qVariantFromValue(name) +// << value.variant(); + +// QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,QLatin1String("SetProperty"),args); + + return setProperty("ScanInterval", QDBusVariant(interval)); +} + +bool QConnmanDeviceInterface::isScanning() +{ + QVariant var = getProperty("Scanning"); + return qdbus_cast(var); +} + +QStringList QConnmanDeviceInterface::getNetworks() +{ + QVariant var = getProperty("Networks"); + return qdbus_cast(var); +} + +bool QConnmanDeviceInterface::setEnabled(bool powered) +{ + QList args; + args << qVariantFromValue(QString("Powered")) + << qVariantFromValue(QDBusVariant(powered)); + + QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,QLatin1String("SetProperty"),args); + qWarning() << reply.errorMessage() << reply.errorName(); + return true; +} + +QConnmanDBusHelper::QConnmanDBusHelper(QObject * parent) + : QObject(parent) +{ +} + +QConnmanDBusHelper::~QConnmanDBusHelper() +{ +} + +void QConnmanDBusHelper::propertyChanged(const QString &item, const QDBusVariant &var) +{ + QDBusMessage msg = this->message(); +// qWarning() << sender(); + // qWarning() << msg.interface() << msg.path() << item << var.variant() <<"\n"; + Q_EMIT propertyChangedContext(msg.path() ,item, var); +} + +///////////////// +QT_END_NAMESPACE diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h new file mode 100644 index 0000000..9475296 --- /dev/null +++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h @@ -0,0 +1,377 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins 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$ +** +****************************************************************************/ + +#ifndef QCONNMANSERVICE_H +#define QCONNMANSERVICE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifndef __CONNMAN_DBUS_H + +#define CONNMAN_SERVICE "org.moblin.connman" +#define CONNMAN_PATH "/org/moblin/connman" + +#define CONNMAN_DEBUG_INTERFACE CONNMAN_SERVICE ".Debug" +#define CONNMAN_ERROR_INTERFACE CONNMAN_SERVICE ".Error" +#define CONNMAN_AGENT_INTERFACE CONNMAN_SERVICE ".Agent" +#define CONNMAN_COUNTER_INTERFACE CONNMAN_SERVICE ".Counter" + +#define CONNMAN_MANAGER_INTERFACE CONNMAN_SERVICE ".Manager" +#define CONNMAN_MANAGER_PATH "/" + +#define CONNMAN_TASK_INTERFACE CONNMAN_SERVICE ".Task" +#define CONNMAN_PROFILE_INTERFACE CONNMAN_SERVICE ".Profile" +#define CONNMAN_SERVICE_INTERFACE CONNMAN_SERVICE ".Service" +#define CONNMAN_DEVICE_INTERFACE CONNMAN_SERVICE ".Device" +#define CONNMAN_NETWORK_INTERFACE CONNMAN_SERVICE ".Network" +#define CONNMAN_PROVIDER_INTERFACE CONNMAN_SERVICE ".Provider" +#define CONNMAN_TECHNOLOGY_INTERFACE CONNMAN_SERVICE ".Technology" +#endif + +QT_BEGIN_NAMESPACE + +QT_END_NAMESPACE + + +QT_BEGIN_NAMESPACE + +class QConnmanManagerInterface : public QDBusAbstractInterface +{ + Q_OBJECT + +public: + + QConnmanManagerInterface( QObject *parent = 0); + ~QConnmanManagerInterface(); + + QDBusObjectPath path() const; + + QVariantMap getProperties(); + bool setProperty(const QString &name, const QDBusVariant &value); + QDBusObjectPath createProfile(const QString &name); + bool removeProfile(QDBusObjectPath path); + bool requestScan(const QString &type); + bool enableTechnology(const QString &type); + bool disableTechnology(const QString &type); + QDBusObjectPath connectService(QVariantMap &map); + void registerAgent(QDBusObjectPath &path); + void unregisterAgent(QDBusObjectPath path); + void registerCounter(QDBusObjectPath path, quint32 interval); + void unregisterCounter(QDBusObjectPath path); + + QString requestSession(const QString &bearerName); + void releaseSession(); + + // properties + QString getState(); + QStringList getAvailableTechnologies(); + QStringList getEnabledTechnologies(); + QStringList getConnectedTechnologies(); + QString getDefaultTechnology(); + bool getOfflineMode(); + QString getActiveProfile(); + QStringList getProfiles(); + QStringList getTechnologies(); + QStringList getServices(); + QDBusObjectPath lookupService(const QString &); + + QString getPathForTechnology(const QString &tech); + + +Q_SIGNALS: + void propertyChanged(const QString &, const QDBusVariant &value); + void stateChanged(const QString &); + void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); + +protected: + void connectNotify(const char *signal); + void disconnectNotify(const char *signal); + QVariant getProperty(const QString &); +}; + + +class QConnmanNetworkInterface : public QDBusAbstractInterface +{ + Q_OBJECT + +public: + + QConnmanNetworkInterface(const QString &dbusPathName, QObject *parent = 0); + ~QConnmanNetworkInterface(); + + QVariantMap getProperties(); + + //properties + QString getAddress(); + QString getName(); + bool isConnected(); + quint8 getSignalStrength(); + QString getDevice(); + QString getWifiSsid(); + QString getWifiMode(); + QString getWifiSecurity(); + QString getWifiPassphrase(); + +Q_SIGNALS: + void propertyChanged(const QString &, const QDBusVariant &value); + void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); +protected: + void connectNotify(const char *signal); + void disconnectNotify(const char *signal); + QVariant getProperty(const QString &); +}; + +class QConnmanProfileInterfacePrivate; +class QConnmanProfileInterface : public QDBusAbstractInterface +{ + Q_OBJECT + +public: + + QConnmanProfileInterface(const QString &dbusPathName,QObject *parent = 0); + ~QConnmanProfileInterface(); + + QVariantMap getProperties(); +// properties + QString getName(); + bool isOfflineMode(); + QStringList getServices(); + +Q_SIGNALS: + void propertyChanged(const QString &, const QDBusVariant &value); +private: + QConnmanProfileInterfacePrivate *d; + +protected: + void connectNotify(const char *signal); + void disconnectNotify(const char *signal); + QVariant getProperty(const QString &); +}; + +class QConnmanServiceInterface : public QDBusAbstractInterface +{ + Q_OBJECT + +public: + + QConnmanServiceInterface(const QString &dbusPathName,QObject *parent = 0); + ~QConnmanServiceInterface(); + + QVariantMap getProperties(); + // clearProperty + void connect(); + void disconnect(); + void remove(); + // void moveBefore(QDBusObjectPath &service); + // void moveAfter(QDBusObjectPath &service); + +// properties + QString getState(); + QString getError(); + QString getName(); + QString getType(); + QString getMode(); + QString getSecurity(); + QString getPassphrase(); + bool isPassphraseRequired(); + quint8 getSignalStrength(); + bool isFavorite(); + bool isImmutable(); + bool isAutoConnect(); + bool isSetupRequired(); + QString getAPN(); + QString getMCC(); + QString getMNC(); + bool isRoaming(); + QStringList getNameservers(); + QStringList getDomains(); + QVariantMap getIPv4(); + QVariantMap getIPv4Configuration(); + QVariantMap getProxy(); + QVariantMap getEthernet(); + + bool isOfflineMode(); + QStringList getServices(); + +Q_SIGNALS: + void propertyChanged(const QString &, const QDBusVariant &value); + void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); + +protected: + void connectNotify(const char *signal); + void disconnectNotify(const char *signal); + QVariant getProperty(const QString &); +}; + +class QConnmanTechnologyInterface : public QDBusAbstractInterface +{ + Q_OBJECT + +public: + + QConnmanTechnologyInterface(const QString &dbusPathName,QObject *parent = 0); + ~QConnmanTechnologyInterface(); + + QVariantMap getProperties(); +// properties + QString getState(); + QString getName(); + QString getType(); + + QStringList getDevices(); + +Q_SIGNALS: + void propertyChanged(const QString &, const QDBusVariant &value); + void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); +protected: + void connectNotify(const char *signal); + void disconnectNotify(const char *signal); + QVariant getProperty(const QString &); + +}; + +class QConnmanAgentInterface : public QDBusAbstractInterface +{ + Q_OBJECT + +public: + + QConnmanAgentInterface(const QString &dbusPathName,QObject *parent = 0); + ~QConnmanAgentInterface(); + + void release(); + void reportError(QDBusObjectPath &path, const QString &error); +// dict requestInput(QDBusObjectPath &path, dict fields); + void cancel(); +protected: + void connectNotify(const char *signal); + void disconnectNotify(const char *signal); +}; + +//class QConnmanCounterInterfacePrivate; +//class QConnmanCounterInterface : public QDBusAbstractInterface +//{ +// Q_OBJECT +// +//public: +// +// QConnmanCounterInterface(QObject *parent = 0); +// ~QConnmanCounterInterface(); +// +// void release(); +//private: +// QConnmanCounterInterfacePrivate *d; +//}; + +class QConnmanDeviceInterface : public QDBusAbstractInterface +{ + Q_OBJECT + +public: + + QConnmanDeviceInterface(const QString &dbusPathName,QObject *parent = 0); + ~QConnmanDeviceInterface(); + + QVariantMap getProperties(); + void scan(); + +//properties + QString getAddress(); + QString getName(); + QString getType(); + QString getInterface(); + bool isPowered(); + quint16 getScanInterval(); + bool setScanInterval(const QString &interval); + + bool isScanning(); + QStringList getNetworks(); + bool setEnabled(bool powered); + bool setProperty(const QString &name, const QDBusVariant &value); + +Q_SIGNALS: + void propertyChanged(const QString &, const QDBusVariant &value); + void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); +protected: + void connectNotify(const char *signal); + void disconnectNotify(const char *signal); + QVariant getProperty(const QString &); + +}; + +class QConnmanDBusHelper: public QObject, protected QDBusContext + { + Q_OBJECT + public: + QConnmanDBusHelper(QObject *parent = 0); + ~QConnmanDBusHelper(); + + public slots: + void propertyChanged(const QString &, const QDBusVariant &); + +Q_SIGNALS: + void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); +}; + +QT_END_NAMESPACE + +#endif //QCONNMANSERVICE_H -- cgit v0.12 From 54e3221555997d26d59b880e3e153f1fc979505d Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Fri, 18 Jun 2010 13:01:18 +0200 Subject: Fix QWizard icon and metrics on Windows 7 and Vista This patch takes care of missing icon on Windows Vista+7. It also updates the metrics to look more native in both versions. Task-number: QTBUG-9873, QTBUG-11974, QTBUG-6120 Reviewed-by: prasanth --- src/gui/dialogs/qwizard_win.cpp | 42 +++++++++++++++++++++++++++-------------- src/gui/dialogs/qwizard_win_p.h | 21 +++++++++++++++------ 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp index e406cba..ad8801a 100644 --- a/src/gui/dialogs/qwizard_win.cpp +++ b/src/gui/dialogs/qwizard_win.cpp @@ -180,7 +180,8 @@ QVistaBackButton::QVistaBackButton(QWidget *widget) QSize QVistaBackButton::sizeHint() const { ensurePolished(); - int width = 32, height = 32; + int size = int(QStyleHelper::dpiScaled(32)); + int width = size, height = size; /* HANDLE theme = pOpenThemeData(0, L"Navigation"); SIZE size; @@ -213,8 +214,8 @@ void QVistaBackButton::paintEvent(QPaintEvent *) HANDLE theme = pOpenThemeData(0, L"Navigation"); //RECT rect; RECT clipRect; - int xoffset = QWidget::mapToParent(r.topLeft()).x(); - int yoffset = QWidget::mapToParent(r.topLeft()).y(); + int xoffset = QWidget::mapToParent(r.topLeft()).x() - 1; + int yoffset = QWidget::mapToParent(r.topLeft()).y() - 1; clipRect.top = r.top() + yoffset; clipRect.bottom = r.bottom() + yoffset; @@ -245,6 +246,11 @@ QVistaHelper::QVistaHelper(QWizard *wizard) is_vista = resolveSymbols(); if (is_vista) backButton_ = new QVistaBackButton(wizard); + + // Handle diff between Windows 7 and Vista + iconSpacing = QStyleHelper::dpiScaled(7); + textSpacing = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? + iconSpacing : QStyleHelper::dpiScaled(20); } QVistaHelper::~QVistaHelper() @@ -308,18 +314,15 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type) void QVistaHelper::drawTitleBar(QPainter *painter) { - if (vistaState() == VistaAero) - drawBlackRect( - QRect(0, 0, wizard->width(), titleBarSize() + topOffset()), - painter->paintEngine()->getDC()); + HDC hdc = painter->paintEngine()->getDC(); + if (vistaState() == VistaAero) + drawBlackRect(QRect(0, 0, wizard->width(), + titleBarSize() + topOffset()), hdc); Q_ASSERT(backButton_); const int btnTop = backButton_->mapToParent(QPoint()).y(); const int btnHeight = backButton_->size().height(); - const int verticalCenter = (btnTop + btnHeight / 2); - - wizard->windowIcon().paint( - painter, QRect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize())); + const int verticalCenter = (btnTop + btnHeight / 2) - 1; const QString text = wizard->window()->windowTitle(); const QFont font = QApplication::font("QWorkspaceTitleBar"); @@ -327,14 +330,25 @@ void QVistaHelper::drawTitleBar(QPainter *painter) const QRect brect = fontMetrics.boundingRect(text); int textHeight = brect.height(); int textWidth = brect.width(); + int glowOffset = 0; + if (vistaState() == VistaAero) { textHeight += 2 * glowSize(); textWidth += 2 * glowSize(); + glowOffset = glowSize(); } + drawTitleText( painter, text, - QRect(titleOffset(), verticalCenter - textHeight / 2, textWidth, textHeight), - painter->paintEngine()->getDC()); + QRect(titleOffset() - glowOffset, verticalCenter - textHeight / 2, textWidth, textHeight), + hdc); + + if (!wizard->windowIcon().isNull()) { + QRect rect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize()); + HICON hIcon = wizard->windowIcon().pixmap(iconSize()).toWinHICON(); + DrawIconEx(hdc, rect.left(), rect.top(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT); + DestroyIcon(hIcon); + } } void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible) @@ -734,7 +748,7 @@ bool QVistaHelper::resolveSymbols() int QVistaHelper::titleOffset() { - int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + padding(); + int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + textSpacing; return leftMargin() + iconOffset; } diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/gui/dialogs/qwizard_win_p.h index 5f3b6c2..caf018d 100644 --- a/src/gui/dialogs/qwizard_win_p.h +++ b/src/gui/dialogs/qwizard_win_p.h @@ -61,6 +61,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -100,9 +101,14 @@ public: enum VistaState { VistaAero, VistaBasic, Classic, Dirty }; static VistaState vistaState(); static int titleBarSize() { return frameSize() + captionSize(); } - static int topPadding() { return 8; } - static int topOffset() { return titleBarSize() + (vistaState() == VistaAero ? 13 : 3); } - + static int topPadding() { // padding under text + return int(QStyleHelper::dpiScaled( + QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6)); + } + static int topOffset() { + static int aeroOffset = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? + QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13); + return (titleBarSize() + (vistaState() == VistaAero ? aeroOffset : 3)); } private: static HFONT getCaptionFont(HANDLE hTheme); bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc); @@ -111,11 +117,10 @@ private: static int frameSize() { return GetSystemMetrics(SM_CYSIZEFRAME); } static int captionSize() { return GetSystemMetrics(SM_CYCAPTION); } - static int backButtonSize() { return 31; } // ### should be queried from back button itself + static int backButtonSize() { return int(QStyleHelper::dpiScaled(30)); } static int iconSize() { return 16; } // Standard Aero - static int padding() { return 7; } // Standard Aero - static int leftMargin() { return backButtonSize() + padding(); } static int glowSize() { return 10; } + int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; } int titleOffset(); bool resolveSymbols(); @@ -139,6 +144,10 @@ private: QRect rtTitle; QWizard *wizard; QVistaBackButton *backButton_; + + int titleBarOffset; // Extra spacing above the text + int iconSpacing; // Space between button and icon + int textSpacing; // Space between icon and text }; -- cgit v0.12 From 066fe8ab70508af6310c49e6eb9cdd74962b6401 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Tue, 22 Jun 2010 04:14:21 +1000 Subject: fix ghost ap issue, and dont block on connect --- src/plugins/bearer/connman/qconnmanengine.cpp | 276 ++++++++++++++++++-------- src/plugins/bearer/connman/qconnmanengine.h | 41 +++- 2 files changed, 235 insertions(+), 82 deletions(-) diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index e4cab92..c1df710 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -51,7 +51,6 @@ #include #include -//#include #include #include #include @@ -65,7 +64,6 @@ QConnmanEngine::QConnmanEngine(QObject *parent) : QBearerEngineImpl(parent), connmanManager(new QConnmanManagerInterface(this)) { -// qWarning() << Q_FUNC_INFO; } QConnmanEngine::~QConnmanEngine() @@ -98,6 +96,7 @@ void QConnmanEngine::initialize() deviceMap.insert(techPath,QStringList() << devicePath); } } + // Get current list of access points. getConfigurations(); } @@ -113,7 +112,6 @@ QList QConnmanEngine::getConfigurations() void QConnmanEngine::getNetworkListing() { QMutexLocker locker(&mutex); - QMapIterator i(deviceMap); while(i.hasNext()) { i.next(); @@ -126,6 +124,8 @@ void QConnmanEngine::getNetworkListing() } } + + void QConnmanEngine::doRequestUpdate() { getConfigurations(); @@ -141,16 +141,16 @@ QString QConnmanEngine::getInterfaceFromId(const QString &id) QMapIterator i(deviceMap); while(i.hasNext()) { - i.next(); - if(i.value().count() > 0) { - QConnmanDeviceInterface dev(i.value().at(0)); - foreach(const QString network, dev.getNetworks()) { - if(network == netPath) { - return dev.getInterface(); - } - } - } - } + i.next(); + if(i.value().count() > 0) { + QConnmanDeviceInterface dev(i.value().at(0)); + foreach(const QString network, dev.getNetworks()) { + if(network == netPath) { + return dev.getInterface(); + } + } + } + } return QString(); } @@ -187,12 +187,13 @@ QString QConnmanEngine::bearerName(const QString &id) void QConnmanEngine::connectToId(const QString &id) { QMutexLocker locker(&mutex); - QConnmanServiceInterface serv(serviceFromId(id)); - if(!serv.isValid()) { - emit connectionError(id, InterfaceLookupError); - } else { - serv.connect(); - } + QConnmanConnectThread *thread; + thread = new QConnmanConnectThread(this); + thread->setServicePath(serviceFromId(id)); + thread->setIdentifier(id); + connect(thread,SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), + this,SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError))); + thread->start(); } void QConnmanEngine::disconnectFromId(const QString &id) @@ -234,9 +235,24 @@ QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id) if (!ptr->isValid) { return QNetworkSession::Invalid; - } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + + } + QString service = serviceFromId(id); + QConnmanServiceInterface serv(service); + QString servState = serv.getState(); + + if(servState == "idle" || servState == "failure") { + return QNetworkSession::Disconnected; + } + + if(servState == "association" || servState == "configuration" || servState == "login") { + return QNetworkSession::Connecting; + } + if(servState == "ready" || servState == "online") { return QNetworkSession::Connected; - } else if ((ptr->state & QNetworkConfiguration::Discovered) == + } + + if ((ptr->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { return QNetworkSession::Disconnected; } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { @@ -324,14 +340,14 @@ QString QConnmanEngine::getNetworkForService(const QString &servPath) QMutexLocker locker(&mutex); QMap map; - QMapIterator i(deviceMap); - while(i.hasNext()) { - i.next(); - if(i.value().count() > 0) { - QConnmanDeviceInterface device(i.value().at(0)); - QMap netMapStrength; + QMapIterator i(deviceMap); + while(i.hasNext()) { + i.next(); + if(i.value().count() > 0) { + QConnmanDeviceInterface device(i.value().at(0)); + QMap netMapStrength; + foreach(const QString netPath, knownNetworks[device.getType()]) { - foreach(const QString netPath, knownNetworks[device.getType()]) { QConnmanNetworkInterface network1(netPath, this); QString netname = network1.getName(); qint32 sigStrength = network1.getSignalStrength(); @@ -355,10 +371,19 @@ QString QConnmanEngine::getNetworkForService(const QString &servPath) return QString(); } -void QConnmanEngine::propertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) +void QConnmanEngine::propertyChangedContext(const QString &/*path*/,const QString &item, const QDBusVariant &value) { -// qDebug() << __FUNCTION__ << path << item; QMutexLocker locker(&mutex); + if(item == "Services") { + QDBusArgument arg = qvariant_cast(value.variant()); + QStringList list = qdbus_cast(arg); + + if(list.count() > accessPointConfigurations.count()) { + foreach(const QString service, list) { + addServiceConfiguration(service); + } + } + } if(item == "Technologies") { QDBusArgument arg = qvariant_cast(value.variant()); @@ -392,52 +417,47 @@ void QConnmanEngine::propertyChangedContext(const QString &path,const QString &i void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) { -// qDebug() << __FUNCTION__ << path << item; +// qWarning() << __FUNCTION__ << path << item << value.variant(); QMutexLocker locker(&mutex); - if(item == "State") { + if(item == "State") { configurationChange(QString::number(qHash(path))); if(value.variant().toString() == "failure") { QConnmanServiceInterface serv(path); - qDebug() <<__FUNCTION__ <<"Error" << serv.getError(); - emit connectionError(QString::number(qHash(path)), ConnectError); + emit connectionError(QString::number(qHash(path)), ConnectError); } } } -void QConnmanEngine::networkPropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &/*value*/) +void QConnmanEngine::networkPropertyChangedContext(const QString &/*path*/,const QString &/*item*/, const QDBusVariant &/*value*/) { -// qDebug() << __FUNCTION__ << path << item; QMutexLocker locker(&mutex); } -void QConnmanEngine::devicePropertyChangedContext(const QString &path,const QString &item,const QDBusVariant &value) +void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const QString &item,const QDBusVariant &value) { -// qDebug() << __FUNCTION__ << path << item << value.variant(); QMutexLocker locker(&mutex); if(item == "Networks") { QDBusArgument arg = qvariant_cast(value.variant()); - QStringList remainingNetworks = qdbus_cast(arg); - - QConnmanDeviceInterface dev(path); - QStringList oldnetworks = knownNetworks[dev.getType()]; - if(remainingNetworks.count() != oldnetworks.count()) { + QStringList remainingNetworks = qdbus_cast(arg); + QConnmanDeviceInterface device(devpath); + QStringList oldnetworks = knownNetworks[device.getType()]; + if(remainingNetworks.count() > oldnetworks.count()) { foreach(const QString netPath, remainingNetworks) { if(!oldnetworks.contains(netPath)) { addNetworkConfiguration(netPath); } } - + } else { foreach(const QString netPath, oldnetworks) { QString servicePath = getServiceForNetwork(netPath); if(!remainingNetworks.contains(netPath)) { if(servicePath.isEmpty()) { - removeConfiguration(netPath); + removeConfiguration(QString::number(qHash(netPath))); } else { - if(!remainingNetworks.contains(servicePath)) { - removeConfiguration(QString::number(qHash(servicePath))); - } + removeConfiguration(QString::number(qHash(servicePath))); } + knownNetworks[device.getType()].removeAll(netPath); } } } @@ -446,17 +466,11 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &path,const QStr void QConnmanEngine::technologyPropertyChangedContext(const QString & path, const QString &item, const QDBusVariant &value) { -// qWarning() << __FUNCTION__ << path << item << value.variant(); -// if(item == "Devices") { -// QDBusArgument arg = qvariant_cast(value.variant()); -// QStringList list = qdbus_cast(arg); -// } + if(item == "Devices") { + QDBusArgument arg = qvariant_cast(value.variant()); + QStringList list = qdbus_cast(arg); + } if(item == "State") { - if(value.variant().toString() == "enabled") { - } - if(value.variant().toString() == "offline") { - deviceMap.remove(path); - } if(value.variant().toString() == "available") { QConnmanTechnologyInterface tech(connmanManager->getPathForTechnology(path)); foreach(const QString devPath, tech.getDevices()) { @@ -464,51 +478,49 @@ void QConnmanEngine::technologyPropertyChangedContext(const QString & path, cons dev = new QConnmanDeviceInterface(devPath,this); connect(dev,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(devicePropertyChangedContext(QString,QString,QDBusVariant))); - deviceMap.insert(path,QStringList() << devPath); } } + if(value.variant().toString() == "offline") { + deviceMap.remove(path); + } } } void QConnmanEngine::configurationChange(const QString &id) { QMutexLocker locker(&mutex); - bool changed = false; if (accessPointConfigurations.contains(id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); QString servicePath = serviceFromId(id); QConnmanServiceInterface *serv; serv = new QConnmanServiceInterface(servicePath); QString networkName = serv->getName(); + QNetworkConfiguration::StateFlags curState = getStateForService(servicePath); ptr->mutex.lock(); if (!ptr->isValid) { ptr->isValid = true; - changed = true; } if (ptr->name != networkName) { ptr->name = networkName; - changed = true; } if (ptr->state != curState) { ptr->state = curState; - changed = true; } ptr->mutex.unlock(); - if (changed) { - locker.unlock(); - emit configurationChanged(ptr); - locker.relock(); - } + locker.unlock(); + emit configurationChanged(ptr); + locker.relock(); } locker.unlock(); @@ -517,7 +529,6 @@ void QConnmanEngine::configurationChange(const QString &id) QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QString &service) { - qWarning() << __FUNCTION__; QMutexLocker locker(&mutex); QConnmanServiceInterface serv(service); QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined; @@ -555,23 +566,76 @@ QString QConnmanEngine::typeToBearer(const QString &type) return "Unknown"; } -void QConnmanEngine::removeConfiguration(const QString &netpath) +void QConnmanEngine::removeConfiguration(const QString &id) { QMutexLocker locker(&mutex); - const QString id = QString::number(qHash(netpath)); + if (accessPointConfigurations.contains(id)) { QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id); - QConnmanDeviceInterface device(netpath.section("/",0,5),this); locker.unlock(); - knownNetworks[device.getType()].removeAll(netpath); emit configurationRemoved(ptr); locker.relock(); } } +void QConnmanEngine::addServiceConfiguration(const QString &servicePath) +{ + + QMutexLocker locker(&mutex); + QConnmanServiceInterface *serv; + serv = new QConnmanServiceInterface(servicePath); + const QString netPath = getNetworkForService(servicePath); + + QConnmanNetworkInterface *network; + network = new QConnmanNetworkInterface(netPath, this); + + const QString id = QString::number(qHash(servicePath)); + + if (!accessPointConfigurations.contains(id)) { + QConnmanDeviceInterface device(netPath.section("/",0,5),this); + knownNetworks[device.getType()]<< netPath; +// knownNetworks << servicePath; + connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); + + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + + QString networkName = serv->getName(); + + if(serv->getType() == "Cellular") { + networkName = serv->getAPN(); + } + + cpPriv->name = networkName; + cpPriv->isValid = true; + cpPriv->id = id; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->bearer = bearerName(id); + + if(serv->getSecurity() == "none") { + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + } else { + cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + } + + connect(network,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(networkPropertyChangedContext(QString,QString, QDBusVariant))); + + cpPriv->state = getStateForService(servicePath); + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(ptr->id, ptr); + foundConfigurations.append(cpPriv); + + locker.unlock(); + emit configurationAdded(ptr); + locker.relock(); + emit updateCompleted(); + } +} + void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) { -// qWarning() << __FUNCTION__ << networkPath; QMutexLocker locker(&mutex); QConnmanNetworkInterface *network; @@ -580,11 +644,18 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) QConnmanServiceInterface *serv; QString id; + QConnmanDeviceInterface device(networkPath.section("/",0,5),this); + if(servicePath.isEmpty()) { id = QString::number(qHash(networkPath)); } else { id = QString::number(qHash(servicePath)); + serv = new QConnmanServiceInterface(servicePath,this); + connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); } + knownNetworks[device.getType()]<< networkPath; + if (!accessPointConfigurations.contains(id)) { connect(network,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(networkPropertyChangedContext(QString,QString, QDBusVariant))); @@ -598,16 +669,13 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) QString bearerName; - QConnmanDeviceInterface device(networkPath.section("/",0,5),this); if(servicePath.isEmpty()) { + QString devicePath = networkPath.section("/",0,5); + QConnmanDeviceInterface device(devicePath,this); bearerName = typeToBearer(device.getType()); } else { - serv = new QConnmanServiceInterface(servicePath,this); bearerName = typeToBearer(serv->getType()); - connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); } - knownNetworks[device.getType()]<< networkPath; if(bearerName == "Cellular") { QString mode = serv->getMode(); @@ -642,7 +710,57 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) locker.unlock(); emit configurationAdded(ptr); locker.relock(); + emit updateCompleted(); + } +} + +bool QConnmanEngine::requiresPolling() const +{ + return false; +} + + +QConnmanConnectThread::QConnmanConnectThread(QObject *parent) + :QThread(parent), + servicePath(), identifier() +{ +} + +QConnmanConnectThread::~QConnmanConnectThread() +{ +} + +void QConnmanConnectThread::stop() +{ + if(currentThread() != this) { + QMetaObject::invokeMethod(this, "quit", + Qt::QueuedConnection); + } else { + quit(); } + wait(); +} + +void QConnmanConnectThread::run() +{ + QConnmanServiceInterface serv(servicePath); + if(!serv.isValid()) { + emit connectionError(identifier, QBearerEngineImpl::InterfaceLookupError); + } else { + serv.connect(); + } +} + +void QConnmanConnectThread::setServicePath(const QString &path) +{ + QMutexLocker locker(&mutex); + servicePath = path; +} + +void QConnmanConnectThread::setIdentifier(const QString &id) +{ + QMutexLocker locker(&mutex); + identifier = id; } QT_END_NAMESPACE diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h index 849d8c9..b5f1488 100644 --- a/src/plugins/bearer/connman/qconnmanengine.h +++ b/src/plugins/bearer/connman/qconnmanengine.h @@ -59,12 +59,14 @@ #include #include +#include #ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_DBUS QT_BEGIN_NAMESPACE +class QConnmanConnectThread; class QConnmanEngine : public QBearerEngineImpl { Q_OBJECT @@ -114,6 +116,7 @@ private: QConnmanManagerInterface *connmanManager; QList foundConfigurations; + void getNetworkListing(); QString getServiceForNetwork(const QString &network); @@ -125,14 +128,46 @@ private: QNetworkConfiguration::StateFlags getStateForService(const QString &service); QString typeToBearer(const QString &type); - void removeConfiguration(const QString &path); + void removeConfiguration(const QString &servicePath); + void addServiceConfiguration(const QString &servicePath); void addNetworkConfiguration(const QString &worknetPath); QDateTime activeTime; QMap technologies; - QMap knownNetworks; - QMap deviceMap; + // QStringList knownNetworks; + + QMap knownNetworks; + QMap deviceMap; + +protected: + bool requiresPolling() const; + QConnmanConnectThread *connThread; +}; + +class QConnmanConnectThread : public QThread +{ + Q_OBJECT + +public: + QConnmanConnectThread(QObject *parent = 0); + ~QConnmanConnectThread(); + bool keepRunning; + void stop(); + void setServicePath(const QString &path); + void setIdentifier(const QString &id); + +Q_SIGNALS: + void connectionError(const QString &id, QBearerEngineImpl::ConnectionError error); + +protected: + void run(); + QString servicePath; + QString identifier; + +private: + QMutex mutex; + }; QT_END_NAMESPACE -- cgit v0.12 From 5aa3b45acf810f444487d0904a9c84be8687623d Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Thu, 24 Jun 2010 12:23:34 +1000 Subject: Added surround sound support to win32 low-level audio backend. Task-number:QTBUG-11586 Reviewed-by:Andrew den Exter --- src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp | 5 +++ src/multimedia/audio/qaudiooutput_win32_p.cpp | 54 +++++++++++++++++++---- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index 465bc98..4e6b2df 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -374,6 +374,11 @@ void QAudioDeviceInfoInternal::updateLists() #endif channelz.append(1); channelz.append(2); + if (mode == QAudio::AudioOutput) { + channelz.append(4); + channelz.append(6); + channelz.append(8); + } byteOrderz.append(QAudioFormat::LittleEndian); diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index 533583a..513c16c 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -52,6 +52,10 @@ #include "qaudiooutput_win32_p.h" +#include + +#define _KSDATAFORMAT_SUBTYPE_PCM (GUID) {0x00000001,0x0000,0x0010,{0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71}} + //#define DEBUG_AUDIO 1 QT_BEGIN_NAMESPACE @@ -258,15 +262,47 @@ bool QAudioOutputPrivate::open() } } - if(waveOutOpen(&hWaveOut, devId, &wfx, - (DWORD_PTR)&waveOutProc, - (DWORD_PTR) this, - CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { - errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; - emit stateChanged(deviceState); - qWarning("QAudioOutput: open error"); - return false; + if ( settings.channels() <= 2) { + if(waveOutOpen(&hWaveOut, devId, &wfx, + (DWORD_PTR)&waveOutProc, + (DWORD_PTR) this, + CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { + errorState = QAudio::OpenError; + deviceState = QAudio::StoppedState; + emit stateChanged(deviceState); + qWarning("QAudioOutput: open error"); + return false; + } + } else { + WAVEFORMATEXTENSIBLE wfex; + wfex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + wfex.Format.nChannels = settings.channels(); + wfex.Format.wBitsPerSample = settings.sampleSize(); + wfex.Format.nSamplesPerSec = settings.frequency(); + wfex.Format.nBlockAlign = wfex.Format.nChannels*wfex.Format.wBitsPerSample/8; + wfex.Format.nAvgBytesPerSec=wfex.Format.nSamplesPerSec*wfex.Format.nBlockAlign; + wfex.Samples.wValidBitsPerSample=wfex.Format.wBitsPerSample; + wfex.SubFormat=_KSDATAFORMAT_SUBTYPE_PCM; + wfex.Format.cbSize=22; + + wfex.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; + if (settings.channels() >= 4) + wfex.dwChannelMask |= SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT; + if (settings.channels() >= 6) + wfex.dwChannelMask |= SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY; + if (settings.channels() == 8) + wfex.dwChannelMask |= SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT; + + if(waveOutOpen(&hWaveOut, devId, &wfex.Format, + (DWORD_PTR)&waveOutProc, + (DWORD_PTR) this, + CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { + errorState = QAudio::OpenError; + deviceState = QAudio::StoppedState; + emit stateChanged(deviceState); + qWarning("QAudioOutput: open error"); + return false; + } } totalTimeValue = 0; -- cgit v0.12 From c2cc288a3acb9493a13449fd36fcc9ebce40807b Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Thu, 24 Jun 2010 13:18:37 +1000 Subject: Added surround sound support to alsa low-level audio backend. Task-number:QTBUG-11586 Reviewed-by:Derick Hawcroft --- src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp | 46 ++++++++++++++++++++++++ src/multimedia/audio/qaudiodeviceinfo_alsa_p.h | 5 +++ 2 files changed, 51 insertions(+) diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index 36270a7..f663dd2 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -62,6 +62,8 @@ QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode device = QLatin1String(dev); this->mode = mode; + + checkSurround(); } QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() @@ -389,6 +391,9 @@ void QAudioDeviceInfoInternal::updateLists() } channelz.append(1); channelz.append(2); + if (surround40) channelz.append(4); + if (surround51) channelz.append(6); + if (surround71) channelz.append(8); sizez.append(8); sizez.append(16); sizez.append(32); @@ -483,4 +488,45 @@ QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() return devices.first(); } +void QAudioDeviceInfoInternal::checkSurround() +{ + QList devices; + surround40 = false; + surround51 = false; + surround71 = false; + + void **hints, **n; + char *name, *descr, *io; + + if(snd_device_name_hint(-1, "pcm", &hints) < 0) + return; + + n = hints; + + while (*n != NULL) { + name = snd_device_name_get_hint(*n, "NAME"); + descr = snd_device_name_get_hint(*n, "DESC"); + io = snd_device_name_get_hint(*n, "IOID"); + if((name != NULL) && (descr != NULL)) { + QString deviceName = QLatin1String(name); + if (mode == QAudio::AudioOutput) { + if(deviceName.contains(QLatin1String("surround40"))) + surround40 = true; + if(deviceName.contains(QLatin1String("surround51"))) + surround51 = true; + if(deviceName.contains(QLatin1String("surround71"))) + surround71 = true; + } + } + if(name != NULL) + free(name); + if(descr != NULL) + free(descr); + if(io != NULL) + free(io); + ++n; + } + snd_device_name_free_hint(hints); +} + QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h index 6f9a459..8525980 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h @@ -98,6 +98,11 @@ private: bool open(); void close(); + void checkSurround(); + bool surround40; + bool surround51; + bool surround71; + QString device; QAudio::Mode mode; QAudioFormat nearest; -- cgit v0.12 From 19ef773e1308b2bdce8ec2efd700d5754c01f6d3 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Thu, 24 Jun 2010 14:19:26 +1000 Subject: Fixed compile error introduced by win32 surround sound support change. Reviewed-by:Andrew den Exter --- src/multimedia/audio/qaudiooutput_win32_p.cpp | 43 ++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index 513c16c..56de4ee 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -52,7 +52,48 @@ #include "qaudiooutput_win32_p.h" -#include +#ifndef SPEAKER_FRONT_LEFT + #define SPEAKER_FRONT_LEFT 0x00000001 + #define SPEAKER_FRONT_RIGHT 0x00000002 + #define SPEAKER_FRONT_CENTER 0x00000004 + #define SPEAKER_LOW_FREQUENCY 0x00000008 + #define SPEAKER_BACK_LEFT 0x00000010 + #define SPEAKER_BACK_RIGHT 0x00000020 + #define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040 + #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080 + #define SPEAKER_BACK_CENTER 0x00000100 + #define SPEAKER_SIDE_LEFT 0x00000200 + #define SPEAKER_SIDE_RIGHT 0x00000400 + #define SPEAKER_TOP_CENTER 0x00000800 + #define SPEAKER_TOP_FRONT_LEFT 0x00001000 + #define SPEAKER_TOP_FRONT_CENTER 0x00002000 + #define SPEAKER_TOP_FRONT_RIGHT 0x00004000 + #define SPEAKER_TOP_BACK_LEFT 0x00008000 + #define SPEAKER_TOP_BACK_CENTER 0x00010000 + #define SPEAKER_TOP_BACK_RIGHT 0x00020000 + #define SPEAKER_RESERVED 0x7FFC0000 + #define SPEAKER_ALL 0x80000000 +#endif + +#ifndef _WAVEFORMATEXTENSIBLE_ + + #define _WAVEFORMATEXTENSIBLE_ + typedef struct + { + WAVEFORMATEX Format; // Base WAVEFORMATEX data + union + { + WORD wValidBitsPerSample; // Valid bits in each sample container + WORD wSamplesPerBlock; // Samples per block of audio data; valid + // if wBitsPerSample=0 (but rarely used). + WORD wReserved; // Zero if neither case above applies. + } Samples; + DWORD dwChannelMask; // Positions of the audio channels + GUID SubFormat; // Format identifier GUID + } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE, *LPPWAVEFORMATEXTENSIBLE; + typedef const WAVEFORMATEXTENSIBLE* LPCWAVEFORMATEXTENSIBLE; + +#endif #define _KSDATAFORMAT_SUBTYPE_PCM (GUID) {0x00000001,0x0000,0x0010,{0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71}} -- cgit v0.12 From a67e9a9a0d0e335db2f7b7232c6c7ec42750533c Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Fri, 25 Jun 2010 08:41:04 +1000 Subject: Fixed compile error in multimedia module WAVE_FORMAT_EXTENSIBLE not in v6.0 ms SDK only in v6.1's Reviewed-by:TrustMe --- src/multimedia/audio/qaudiooutput_win32_p.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index 56de4ee..d0f1791 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -95,6 +95,10 @@ #endif +#if !defined(WAVE_FORMAT_EXTENSIBLE) +#define WAVE_FORMAT_EXTENSIBLE 0xFFFE +#endif + #define _KSDATAFORMAT_SUBTYPE_PCM (GUID) {0x00000001,0x0000,0x0010,{0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71}} //#define DEBUG_AUDIO 1 -- cgit v0.12 From 473eb62791f2e489aacd4be88df101ce26fe92ea Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Fri, 25 Jun 2010 10:47:40 +1000 Subject: Fix compile err with win2005 compiler for multimedia lib. Reviewed-by:TrustMe --- src/multimedia/audio/qaudiooutput_win32_p.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index d0f1791..f26198f 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -99,7 +99,8 @@ #define WAVE_FORMAT_EXTENSIBLE 0xFFFE #endif -#define _KSDATAFORMAT_SUBTYPE_PCM (GUID) {0x00000001,0x0000,0x0010,{0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71}} +DEFINE_GUID(_KSDATAFORMAT_SUBTYPE_PCM, +0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); //#define DEBUG_AUDIO 1 -- cgit v0.12 From 0ad9edf26daf78d697cd9e83c639c65879461b0f Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Fri, 25 Jun 2010 12:40:38 +1000 Subject: Fix compile error on win32 with multimedia lib. Reviewed-by:TrustMe --- src/multimedia/audio/qaudiooutput_win32_p.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index f26198f..075d100 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -99,9 +99,6 @@ #define WAVE_FORMAT_EXTENSIBLE 0xFFFE #endif -DEFINE_GUID(_KSDATAFORMAT_SUBTYPE_PCM, -0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); - //#define DEBUG_AUDIO 1 QT_BEGIN_NAMESPACE @@ -328,6 +325,8 @@ bool QAudioOutputPrivate::open() wfex.Format.nBlockAlign = wfex.Format.nChannels*wfex.Format.wBitsPerSample/8; wfex.Format.nAvgBytesPerSec=wfex.Format.nSamplesPerSec*wfex.Format.nBlockAlign; wfex.Samples.wValidBitsPerSample=wfex.Format.wBitsPerSample; + static const GUID _KSDATAFORMAT_SUBTYPE_PCM = { + 0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; wfex.SubFormat=_KSDATAFORMAT_SUBTYPE_PCM; wfex.Format.cbSize=22; -- cgit v0.12 From c049aff3ce283b9ba9a17a63aedaa70efb51ad09 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 25 Jun 2010 10:32:47 +0200 Subject: Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to 4b88f595ab62b7c5f703a286c4f5f13f8784a936 * Fix crash/regression in thai line word breaking when libthai is installed: Commit 4b88f595ab62b7c5f703a286c4f5f13f8784a936 upstream ensures the zero termination of the string passed to libthai. --- src/3rdparty/harfbuzz/src/harfbuzz-thai.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c index fc2bdbf..e153ba9 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c @@ -53,6 +53,8 @@ static void to_tis620(const HB_UChar16 *string, hb_uint32 len, const char *cstr) else result[i] = '?'; } + + result[len] = 0; } static void thaiWordBreaks(const HB_UChar16 *string, hb_uint32 len, HB_CharAttributes *attributes) @@ -70,8 +72,8 @@ static void thaiWordBreaks(const HB_UChar16 *string, hb_uint32 len, HB_CharAttri if (!th_brk) return; - if (len > 128) - cstr = (char *)malloc(len*sizeof(char)); + if (len >= 128) + cstr = (char *)malloc(len*sizeof(char) + 1); to_tis620(string, len, cstr); @@ -96,7 +98,7 @@ static void thaiWordBreaks(const HB_UChar16 *string, hb_uint32 len, HB_CharAttri if (break_positions != brp) free(break_positions); - if (len > 128) + if (len >= 128) free(cstr); } -- cgit v0.12 From 63e3ded08cc619993598462ca0f839b2239dd2c5 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 27 Jun 2010 00:00:16 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( fc13f9b396e1448cd71266f56ba7a93de5cf6ed9 ) Changes in WebKit/qt since the last update: * Benjamin's update/fixes to the backport of https://bugs.webkit.org/show_bug.cgi?id=33150 --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/page/FrameView.cpp | 30 ++++++++++++++-------- src/3rdparty/webkit/WebCore/page/FrameView.h | 6 +++-- .../webkit/WebCore/platform/ScrollView.cpp | 7 +++-- src/3rdparty/webkit/WebCore/platform/ScrollView.h | 5 +++- .../webkit/WebCore/rendering/RenderLayer.cpp | 24 +++++++++++++++++ .../webkit/WebCore/rendering/RenderLayer.h | 2 ++ .../WebKit/qt/tests/qwebview/tst_qwebview.cpp | 26 ++++++++++++++++++- 8 files changed, 84 insertions(+), 18 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 1b8e789..354e21d 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - be1a105be93d7fcbe36d93d0827dc6e98b55de0c + fc13f9b396e1448cd71266f56ba7a93de5cf6ed9 diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.cpp b/src/3rdparty/webkit/WebCore/page/FrameView.cpp index cc7d171..1ea166f 100644 --- a/src/3rdparty/webkit/WebCore/page/FrameView.cpp +++ b/src/3rdparty/webkit/WebCore/page/FrameView.cpp @@ -780,7 +780,7 @@ void FrameView::removeFixedObject() setCanBlitOnScroll(!useSlowRepaints()); } -void FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) +bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) { const size_t fixedObjectThreshold = 5; @@ -790,7 +790,7 @@ void FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect if (!positionedObjects || positionedObjects->isEmpty()) { hostWindow()->scroll(scrollDelta, rectToScroll, clipRect); - return; + return true; } // Get the rects of the fixed objects visible in the rectToScroll @@ -801,9 +801,9 @@ void FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect RenderBox* renderBox = *it; if (renderBox->style()->position() != FixedPosition) continue; - IntRect topLevelRect; - IntRect updateRect = renderBox->paintingRootRect(topLevelRect); - updateRect.move(-scrollX(), -scrollY()); + IntRect updateRect = renderBox->layer()->repaintRectIncludingDescendants(); + updateRect = contentsToWindow(updateRect); + updateRect.intersect(rectToScroll); if (!updateRect.isEmpty()) { if (subRectToUpdate.size() >= fixedObjectThreshold) { @@ -819,7 +819,7 @@ void FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect // 1) scroll hostWindow()->scroll(scrollDelta, rectToScroll, clipRect); - // 2) update the area of fixed objets that has been invalidated + // 2) update the area of fixed objects that has been invalidated size_t fixObjectsCount = subRectToUpdate.size(); for (size_t i = 0; i < fixObjectsCount; ++i) { IntRect updateRect = subRectToUpdate[i]; @@ -829,12 +829,11 @@ void FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect updateRect.intersect(rectToScroll); hostWindow()->repaint(updateRect, true, false, true); } - } else { - // the number of fixed objects exceed the threshold, so we repaint everything. - IntRect updateRect = clipRect; - updateRect.intersect(rectToScroll); - hostWindow()->repaint(updateRect, true, false, true); + return true; } + + // the number of fixed objects exceed the threshold, we cannot use the fast path + return false; } void FrameView::setIsOverlapped(bool isOverlapped) @@ -964,6 +963,15 @@ void FrameView::scrollPositionChanged() { frame()->eventHandler()->sendScrollEvent(); + // For fixed position elements, update widget positions and compositing layers after scrolling, + // but only if we're not inside of layout. + if (!m_nestedLayoutCount && hasFixedObjects()) { + if (RenderView* root = m_frame->contentRenderer()) { + root->updateWidgetPositions(); + root->layer()->updateRepaintRectsAfterScroll(); + } + } + #if USE(ACCELERATED_COMPOSITING) // We need to update layer positions after scrolling to account for position:fixed layers. Document* document = m_frame->document(); diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.h b/src/3rdparty/webkit/WebCore/page/FrameView.h index ed1e6c6..6350a2a 100644 --- a/src/3rdparty/webkit/WebCore/page/FrameView.h +++ b/src/3rdparty/webkit/WebCore/page/FrameView.h @@ -131,7 +131,7 @@ public: virtual void scrollRectIntoViewRecursively(const IntRect&); virtual void setScrollPosition(const IntPoint&); - void scrollPositionChanged(); + virtual void scrollPositionChanged(); String mediaType() const; void setMediaType(const String&); @@ -200,7 +200,7 @@ public: void invalidateScrollCorner(); protected: - virtual void scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); + virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); private: FrameView(Frame*); @@ -214,6 +214,8 @@ private: bool useSlowRepaints() const; bool useSlowRepaintsIfNotOverlapped() const; + bool hasFixedObjects() const { return m_fixedObjectCount > 0; } + void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode); void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow); diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp index 9e15c43..518c454 100644 --- a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp +++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp @@ -259,6 +259,7 @@ void ScrollView::valueChanged(Scrollbar* scrollbar) if (scrollbarsSuppressed()) return; + scrollPositionChanged(); scrollContents(scrollDelta); } @@ -509,7 +510,8 @@ void ScrollView::scrollContents(const IntSize& scrollDelta) if (canBlitOnScroll()) { // The main frame can just blit the WebView window // FIXME: Find a way to blit subframes without blitting overlapping content - scrollContentsFastPath(-scrollDelta, scrollViewRect, clipRect); + if (!scrollContentsFastPath(-scrollDelta, scrollViewRect, clipRect)) + hostWindow()->repaint(updateRect, true, false, true); } else { // We need to go ahead and repaint the entire backing store. Do it now before moving the // windowed plugins. @@ -524,9 +526,10 @@ void ScrollView::scrollContents(const IntSize& scrollDelta) hostWindow()->paint(); } -void ScrollView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) +bool ScrollView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) { hostWindow()->scroll(scrollDelta, rectToScroll, clipRect); + return true; } IntPoint ScrollView::windowToContents(const IntPoint& windowPoint) const diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.h b/src/3rdparty/webkit/WebCore/platform/ScrollView.h index 7060d07..0e40334 100644 --- a/src/3rdparty/webkit/WebCore/platform/ScrollView.h +++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.h @@ -246,7 +246,7 @@ protected: virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect); // Scroll the content by blitting the pixels - virtual void scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); + virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); private: RefPtr m_horizontalScrollbar; @@ -281,6 +281,9 @@ private: // Called to update the scrollbars to accurately reflect the state of the view. void updateScrollbars(const IntSize& desiredOffset); + // Called when the scroll position within this view changes. FrameView overrides this to generate repaint invalidations. + virtual void scrollPositionChanged() {} + void platformInit(); void platformDestroy(); void platformAddChild(Widget*); diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp index fea61c9..6c73114 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.cpp @@ -331,6 +331,14 @@ void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags) m_marquee->updateMarqueePosition(); } +IntRect RenderLayer::repaintRectIncludingDescendants() const +{ + IntRect repaintRect = m_repaintRect; + for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) + repaintRect.unite(child->repaintRectIncludingDescendants()); + return repaintRect; +} + void RenderLayer::computeRepaintRects() { RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint(); @@ -338,6 +346,22 @@ void RenderLayer::computeRepaintRects() m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer); } +void RenderLayer::updateRepaintRectsAfterScroll(bool fixed) +{ + if (fixed || renderer()->style()->position() == FixedPosition) { + computeRepaintRects(); + fixed = true; + } else if (renderer()->hasTransform()) { + // Transforms act as fixed position containers, so nothing inside a + // transformed element can be fixed relative to the viewport if the + // transformed element is not fixed itself or child of a fixed element. + return; + } + + for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) + child->updateRepaintRectsAfterScroll(fixed); +} + void RenderLayer::updateTransform() { // hasTransform() on the renderer is also true when there is transform-style: preserve-3d or perspective set, diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h index a274638..ac51d9d 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderLayer.h @@ -384,7 +384,9 @@ public: // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint. IntRect repaintRect() const { return m_repaintRect; } + IntRect repaintRectIncludingDescendants() const; void computeRepaintRects(); + void updateRepaintRectsAfterScroll(bool fixed = false); void setNeedsFullRepaint(bool f = true) { m_needsFullRepaint = f; } int staticX() const { return m_staticX; } diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp index d466ab5..5e8e8a9 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -29,7 +29,31 @@ #include #include #include - +#include +#include + +/** + * Starts an event loop that runs until the given signal is received. + Optionally the event loop + * can return earlier on a timeout. + * + * \return \p true if the requested signal was received + * \p false on timeout + */ +static bool waitForSignal(QObject* obj, const char* signal, int timeout = 0) +{ + QEventLoop loop; + QObject::connect(obj, signal, &loop, SLOT(quit())); + QTimer timer; + QSignalSpy timeoutSpy(&timer, SIGNAL(timeout())); + if (timeout > 0) { + QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + timer.setSingleShot(true); + timer.start(timeout); + } + loop.exec(); + return timeoutSpy.isEmpty(); +} class tst_QWebView : public QObject { Q_OBJECT -- cgit v0.12 From 361f409d513b7360b1a6f919799cc1948835aef3 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Mon, 28 Jun 2010 09:30:53 +1000 Subject: fix actions regarding removal of connman. make tests pass on desktop --- src/plugins/bearer/connman/qconnmanengine.cpp | 162 ++++++++++++++------------ src/plugins/bearer/connman/qconnmanengine.h | 10 +- 2 files changed, 91 insertions(+), 81 deletions(-) diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index c1df710..bdff815 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -91,9 +91,14 @@ void QConnmanEngine::initialize() foreach(const QString devicePath,tech->getDevices()) { QConnmanDeviceInterface *dev; dev = new QConnmanDeviceInterface(devicePath); - connect(dev,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(devicePropertyChangedContext(QString,QString,QDBusVariant))); - deviceMap.insert(techPath,QStringList() << devicePath); + if(!deviceMap.value(techPath).contains(devicePath)) { + connect(dev,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(devicePropertyChangedContext(QString,QString,QDBusVariant))); + deviceMap.insert(techPath,QStringList() << devicePath); + foreach(const QString network,dev->getNetworks()) { + serviceNetworks.insert(getServiceForNetwork(network),network); + } + } } } @@ -104,9 +109,28 @@ void QConnmanEngine::initialize() QList QConnmanEngine::getConfigurations() { QMutexLocker locker(&mutex); - foundConfigurations.clear(); + // foundConfigurations.clear(); getNetworkListing(); - return foundConfigurations; + QList fetchedConfigurations; + QNetworkConfigurationPrivate* cpPriv = 0; + + for (int i = 0; i < foundConfigurations.count(); ++i) { + QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; + cpPriv = foundConfigurations.at(i); + + config->name = cpPriv->name; + config->isValid = cpPriv->isValid; + config->id = cpPriv->id; + config->state = cpPriv->state; + config->type = cpPriv->type; + config->roamingSupported = cpPriv->roamingSupported; + config->purpose = cpPriv->purpose; + config->bearer = cpPriv->bearer; + + fetchedConfigurations.append(config); + } + return fetchedConfigurations; +// return foundConfigurations; } void QConnmanEngine::getNetworkListing() @@ -128,6 +152,7 @@ void QConnmanEngine::getNetworkListing() void QConnmanEngine::doRequestUpdate() { + connmanManager->requestScan(""); getConfigurations(); emit updateCompleted(); } @@ -135,23 +160,7 @@ void QConnmanEngine::doRequestUpdate() QString QConnmanEngine::getInterfaceFromId(const QString &id) { QMutexLocker locker(&mutex); - - QString servicePath = serviceFromId(id); - QString netPath = getNetworkForService(servicePath); - - QMapIterator i(deviceMap); - while(i.hasNext()) { - i.next(); - if(i.value().count() > 0) { - QConnmanDeviceInterface dev(i.value().at(0)); - foreach(const QString network, dev.getNetworks()) { - if(network == netPath) { - return dev.getInterface(); - } - } - } - } - return QString(); + return configInterfaces.value(id); } bool QConnmanEngine::hasIdentifier(const QString &id) @@ -216,7 +225,7 @@ void QConnmanEngine::requestUpdate() QString QConnmanEngine::serviceFromId(const QString &id) { QMutexLocker locker(&mutex); - foreach(QString service, connmanManager->getServices()) { + foreach(const QString service, serviceNetworks.keys()) { if (id == QString::number(qHash(service))) return service; } @@ -241,7 +250,7 @@ QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id) QConnmanServiceInterface serv(service); QString servState = serv.getState(); - if(servState == "idle" || servState == "failure") { + if(serv.isFavorite() && servState == "idle" || servState == "failure") { return QNetworkSession::Disconnected; } @@ -335,43 +344,8 @@ QString QConnmanEngine::getServiceForNetwork(const QString &netPath) return QString(); } -QString QConnmanEngine::getNetworkForService(const QString &servPath) -{ - QMutexLocker locker(&mutex); - QMap map; - - QMapIterator i(deviceMap); - while(i.hasNext()) { - i.next(); - if(i.value().count() > 0) { - QConnmanDeviceInterface device(i.value().at(0)); - QMap netMapStrength; - foreach(const QString netPath, knownNetworks[device.getType()]) { - - QConnmanNetworkInterface network1(netPath, this); - QString netname = network1.getName(); - qint32 sigStrength = network1.getSignalStrength(); - - if(netMapStrength.contains(netname) - && netMapStrength.value(netname) < sigStrength) { - netMapStrength.remove(netname); - map.remove(netname); - } - netMapStrength.insert(netname, sigStrength); - map.insert(netname,netPath); - } - } - } - QConnmanServiceInterface *serv; - serv = new QConnmanServiceInterface(servPath); - if(map.contains(serv->getName())) { - return map.value(serv->getName()); - } - return QString(); -} - -void QConnmanEngine::propertyChangedContext(const QString &/*path*/,const QString &item, const QDBusVariant &value) +void QConnmanEngine::propertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) { QMutexLocker locker(&mutex); if(item == "Services") { @@ -413,14 +387,17 @@ void QConnmanEngine::propertyChangedContext(const QString &/*path*/,const QStrin } } } + if(item == "State") { +// qDebug() << value.variant(); + } } void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) { -// qWarning() << __FUNCTION__ << path << item << value.variant(); QMutexLocker locker(&mutex); if(item == "State") { configurationChange(QString::number(qHash(path))); + if(value.variant().toString() == "failure") { QConnmanServiceInterface serv(path); emit connectionError(QString::number(qHash(path)), ConnectError); @@ -439,8 +416,17 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const Q if(item == "Networks") { QDBusArgument arg = qvariant_cast(value.variant()); QStringList remainingNetworks = qdbus_cast(arg); - QConnmanDeviceInterface device(devpath); - QStringList oldnetworks = knownNetworks[device.getType()]; + QString devicetype; + QMapIterator i(deviceMap); + while(i.hasNext()) { + i.next(); + if(i.value().contains(devpath)) { + devicetype = i.key(); + } + } + + + QStringList oldnetworks = knownNetworks[devicetype]; if(remainingNetworks.count() > oldnetworks.count()) { foreach(const QString netPath, remainingNetworks) { @@ -450,14 +436,14 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const Q } } else { foreach(const QString netPath, oldnetworks) { - QString servicePath = getServiceForNetwork(netPath); + QString servicePath = serviceNetworks.key(netPath); if(!remainingNetworks.contains(netPath)) { if(servicePath.isEmpty()) { removeConfiguration(QString::number(qHash(netPath))); } else { removeConfiguration(QString::number(qHash(servicePath))); } - knownNetworks[device.getType()].removeAll(netPath); + knownNetworks[devicetype].removeAll(netPath); } } } @@ -471,14 +457,18 @@ void QConnmanEngine::technologyPropertyChangedContext(const QString & path, cons QStringList list = qdbus_cast(arg); } if(item == "State") { + if(value.variant().toString() == "available") { QConnmanTechnologyInterface tech(connmanManager->getPathForTechnology(path)); foreach(const QString devPath, tech.getDevices()) { - QConnmanDeviceInterface *dev; - dev = new QConnmanDeviceInterface(devPath,this); - connect(dev,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(devicePropertyChangedContext(QString,QString,QDBusVariant))); - deviceMap.insert(path,QStringList() << devPath); + + if(!deviceMap.value(path).contains(devPath)) { + QConnmanDeviceInterface *dev; + dev = new QConnmanDeviceInterface(devPath,this); + connect(dev,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(devicePropertyChangedContext(QString,QString,QDBusVariant))); + deviceMap.insert(path,QStringList() << devPath); + } } } if(value.variant().toString() == "offline") { @@ -571,6 +561,20 @@ void QConnmanEngine::removeConfiguration(const QString &id) QMutexLocker locker(&mutex); if (accessPointConfigurations.contains(id)) { + + QString service = serviceFromId(id); + QConnmanServiceInterface serv(service); + + disconnect(&serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); + + QString netPath = serviceNetworks.value(service); + serviceNetworks.remove(service); + + QConnmanServiceInterface network(netPath); + disconnect(&network,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(networkPropertyChangedContext(QString,QString, QDBusVariant))); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id); locker.unlock(); emit configurationRemoved(ptr); @@ -584,20 +588,21 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath) QMutexLocker locker(&mutex); QConnmanServiceInterface *serv; serv = new QConnmanServiceInterface(servicePath); - const QString netPath = getNetworkForService(servicePath); + const QString netPath = serviceNetworks.value(servicePath); QConnmanNetworkInterface *network; network = new QConnmanNetworkInterface(netPath, this); + serviceNetworks.insert(servicePath,netPath); + const QString id = QString::number(qHash(servicePath)); if (!accessPointConfigurations.contains(id)) { + QConnmanDeviceInterface device(netPath.section("/",0,5),this); knownNetworks[device.getType()]<< netPath; -// knownNetworks << servicePath; connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); QString networkName = serv->getName(); @@ -626,6 +631,8 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath) QNetworkConfigurationPrivatePointer ptr(cpPriv); accessPointConfigurations.insert(ptr->id, ptr); foundConfigurations.append(cpPriv); + configInterfaces[cpPriv->id] = device.getInterface(); + locker.unlock(); emit configurationAdded(ptr); @@ -650,11 +657,12 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) id = QString::number(qHash(networkPath)); } else { id = QString::number(qHash(servicePath)); - serv = new QConnmanServiceInterface(servicePath,this); - connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); + serv = new QConnmanServiceInterface(servicePath,this); + connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); } knownNetworks[device.getType()]<< networkPath; + serviceNetworks.insert(servicePath,networkPath); if (!accessPointConfigurations.contains(id)) { connect(network,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), @@ -707,6 +715,8 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) QNetworkConfigurationPrivatePointer ptr(cpPriv); accessPointConfigurations.insert(ptr->id, ptr); foundConfigurations.append(cpPriv); + configInterfaces[cpPriv->id] = device.getInterface(); + locker.unlock(); emit configurationAdded(ptr); locker.relock(); diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h index b5f1488..0f6dc1c 100644 --- a/src/plugins/bearer/connman/qconnmanengine.h +++ b/src/plugins/bearer/connman/qconnmanengine.h @@ -120,7 +120,6 @@ private: void getNetworkListing(); QString getServiceForNetwork(const QString &network); - QString getNetworkForService(const QString &network); QString serviceFromId(const QString &id); QString networkFromId(const QString &id); @@ -134,11 +133,12 @@ private: QDateTime activeTime; - QMap technologies; - // QStringList knownNetworks; + QMap technologies; // techpath, tech interface + QMap configInterfaces; // id, interface name + QMap knownNetworks; //device path, net paths list + QMap deviceMap; //tech path, device path + QMap serviceNetworks; //service, network - QMap knownNetworks; - QMap deviceMap; protected: bool requiresPolling() const; -- cgit v0.12 From e620e6626454f0ee10655033841baa6e3b2f4990 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Tue, 29 Jun 2010 12:54:11 +1000 Subject: QAudioInput push mode does not work Task-number:QTBUG-11755 Reviewed-by:Derick Hawcroft --- src/multimedia/audio/qaudioinput_alsa_p.cpp | 54 +++++++++++++++++++++-------- src/multimedia/audio/qaudioinput_alsa_p.h | 1 + 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index c9a8b71..58669b3 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -120,7 +120,7 @@ int QAudioInputPrivate::xrun_recovery(int err) if(err < 0) reset = true; else { - bytesAvailable = bytesReady(); + bytesAvailable = checkBytesReady(); if (bytesAvailable <= 0) reset = true; } @@ -408,7 +408,7 @@ bool QAudioInputPrivate::open() snd_pcm_start(handle); // Step 5: Setup timer - bytesAvailable = bytesReady(); + bytesAvailable = checkBytesReady(); if(pullMode) connect(audioSource,SIGNAL(readyRead()),this,SLOT(userFeed())); @@ -437,19 +437,29 @@ void QAudioInputPrivate::close() } } -int QAudioInputPrivate::bytesReady() const +int QAudioInputPrivate::checkBytesReady() { if(resuming) - return period_size; - - if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) - return 0; - int frames = snd_pcm_avail_update(handle); - if (frames < 0) return frames; - if((int)frames > (int)buffer_frames) - frames = buffer_frames; + bytesAvailable = period_size; + else if(deviceState != QAudio::ActiveState + && deviceState != QAudio::IdleState) + bytesAvailable = 0; + else { + int frames = snd_pcm_avail_update(handle); + if (frames < 0) { + bytesAvailable = frames; + } else { + if((int)frames > (int)buffer_frames) + frames = buffer_frames; + bytesAvailable = snd_pcm_frames_to_bytes(handle, frames); + } + } + return bytesAvailable; +} - return snd_pcm_frames_to_bytes(handle, frames); +int QAudioInputPrivate::bytesReady() const +{ + return qMax(bytesAvailable, 0); } qint64 QAudioInputPrivate::read(char* data, qint64 len) @@ -460,12 +470,12 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) if ( !handle ) return 0; - bytesAvailable = bytesReady(); + bytesAvailable = checkBytesReady(); if (bytesAvailable < 0) { // bytesAvailable as negative is error code, try to recover from it. xrun_recovery(bytesAvailable); - bytesAvailable = bytesReady(); + bytesAvailable = checkBytesReady(); if (bytesAvailable < 0) { // recovery failed must stop and set error. close(); @@ -639,11 +649,25 @@ bool QAudioInputPrivate::deviceReady() InputPrivate* a = qobject_cast(audioSource); a->trigger(); } - bytesAvailable = bytesReady(); + bytesAvailable = checkBytesReady(); if(deviceState != QAudio::ActiveState) return true; + if (bytesAvailable < 0) { + // bytesAvailable as negative is error code, try to recover from it. + xrun_recovery(bytesAvailable); + bytesAvailable = checkBytesReady(); + if (bytesAvailable < 0) { + // recovery failed must stop and set error. + close(); + errorState = QAudio::IOError; + deviceState = QAudio::StoppedState; + emit stateChanged(deviceState); + return 0; + } + } + if(intervalTime && (timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) { emit notify(); elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime; diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h index 92cef83..191235e 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/multimedia/audio/qaudioinput_alsa_p.h @@ -109,6 +109,7 @@ private slots: bool deviceReady(); private: + int checkBytesReady(); int xrun_recovery(int err); int setFormat(); bool open(); -- cgit v0.12 From d198186cdb18bbb9428ca51e8771cc4fd9563452 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 29 Jun 2010 10:24:44 +0200 Subject: Layout direction change by key should change alignment of QLineEdit When QLineControl was split out of QLineEdit, a regression was introduced. When the layout direction was altered by a key press, the layout direction of the QLineControl would be set, but not the QLineEdit. This would in turn mean that QLineEdit would use the wrong layout direction for its visual alignment. Patch is a small hack to read back the layout direction from the control after it has been set. Task-number: QTBUG-11204 Reviewed-by: Trond --- src/gui/widgets/qlineedit.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index f041a36..6e8daee 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1665,8 +1665,11 @@ void QLineEdit::keyPressEvent(QKeyEvent *event) } #endif d->control->processKeyEvent(event); - if (event->isAccepted()) + if (event->isAccepted()) { + if (layoutDirection() != d->control->layoutDirection()) + setLayoutDirection(d->control->layoutDirection()); d->control->setCursorBlinkPeriod(0); + } } /*! -- cgit v0.12 From 5a6d8c40791da2e8751965d05ae2d5ef69bed301 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Wed, 30 Jun 2010 12:20:14 +1000 Subject: make sure ap's are removed when the device is removed --- src/plugins/bearer/connman/qconnmanengine.cpp | 24 ++++++++---- .../bearer/connman/qconnmanservice_linux.cpp | 44 +++++++++++++++++++--- .../bearer/connman/qconnmanservice_linux_p.h | 34 +++++++++-------- 3 files changed, 74 insertions(+), 28 deletions(-) diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index bdff815..8775623 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -250,7 +250,7 @@ QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id) QConnmanServiceInterface serv(service); QString servState = serv.getState(); - if(serv.isFavorite() && servState == "idle" || servState == "failure") { + if(serv.isFavorite() && (servState == "idle" || servState == "failure")) { return QNetworkSession::Disconnected; } @@ -285,6 +285,7 @@ quint64 QConnmanEngine::bytesWritten(const QString &id) in >> result; tx.close(); } + return result; } @@ -347,6 +348,9 @@ QString QConnmanEngine::getServiceForNetwork(const QString &netPath) void QConnmanEngine::propertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) { + Q_UNUSED(path); +// qDebug() << __FUNCTION__ << path << item << value.variant(); + QMutexLocker locker(&mutex); if(item == "Services") { QDBusArgument arg = qvariant_cast(value.variant()); @@ -421,11 +425,10 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const Q while(i.hasNext()) { i.next(); if(i.value().contains(devpath)) { - devicetype = i.key(); + devicetype = i.key().section("/",-1); } } - QStringList oldnetworks = knownNetworks[devicetype]; if(remainingNetworks.count() > oldnetworks.count()) { @@ -593,14 +596,16 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath) QConnmanNetworkInterface *network; network = new QConnmanNetworkInterface(netPath, this); - serviceNetworks.insert(servicePath,netPath); const QString id = QString::number(qHash(servicePath)); if (!accessPointConfigurations.contains(id)) { - QConnmanDeviceInterface device(netPath.section("/",0,5),this); - knownNetworks[device.getType()]<< netPath; + + serviceNetworks.insert(servicePath,netPath); + + knownNetworks[device.getType()].append(netPath); + connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); @@ -661,10 +666,13 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); } - knownNetworks[device.getType()]<< networkPath; - serviceNetworks.insert(servicePath,networkPath); if (!accessPointConfigurations.contains(id)) { + + knownNetworks[device.getType()].append(networkPath); + + serviceNetworks.insert(servicePath,networkPath); + connect(network,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(networkPropertyChangedContext(QString,QString, QDBusVariant))); diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index ca76ffd..b20e7c1 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -208,17 +208,29 @@ void QConnmanManagerInterface::unregisterAgent(QDBusObjectPath /*path*/) { } -void QConnmanManagerInterface::registerCounter(QDBusObjectPath /*path*/, quint32 /*interval*/) -{ +void QConnmanManagerInterface::registerCounter(const QString &path, quint32 interval) +{ QDBusReply > reply = this->call(QLatin1String("RegisterCounter"), + QVariant::fromValue(path), + QVariant::fromValue(interval)); + bool ok = true; + if(reply.error().type() == QDBusError::InvalidArgs) { + qWarning() << reply.error().message(); + } } -void QConnmanManagerInterface::unregisterCounter(QDBusObjectPath /*path*/) -{ +void QConnmanManagerInterface::unregisterCounter(const QString &path) +{ QDBusReply > reply = this->call(QLatin1String("UnregisterCounter"), + QVariant::fromValue(path)); + bool ok = true; + if(reply.error().type() == QDBusError::InvalidArgs) { + qWarning() << reply.error().message(); + } } QString QConnmanManagerInterface::requestSession(const QString &bearerName) { - QDBusReply > reply = this->call(QLatin1String("RequestSession"), QVariant::fromValue(bearerName)); + QDBusReply > reply = this->call(QLatin1String("RequestSession"), + QVariant::fromValue(bearerName)); return QString(); } @@ -863,7 +875,29 @@ void QConnmanAgentInterface::cancel() ///////////////////////////////////////// +QConnmanCounterInterface::QConnmanCounterInterface(const QString &dbusPathName,QObject *parent) + : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), + dbusPathName, + CONNMAN_COUNTER_INTERFACE, + QDBusConnection::systemBus(), parent) +{ +} + +QConnmanCounterInterface::~QConnmanCounterInterface() +{ +} + +quint32 QConnmanCounterInterface::getReceivedByteCount() +{ +return 0; +} + +quint32 QConnmanCounterInterface::getTransmittedByteCount() +{ +return 0; +} +///////////////////////////////////////// QConnmanDeviceInterface::QConnmanDeviceInterface(const QString &dbusPathName,QObject *parent) : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), dbusPathName, diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h index 9475296..35e3f3d 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h +++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h @@ -115,8 +115,8 @@ public: QDBusObjectPath connectService(QVariantMap &map); void registerAgent(QDBusObjectPath &path); void unregisterAgent(QDBusObjectPath path); - void registerCounter(QDBusObjectPath path, quint32 interval); - void unregisterCounter(QDBusObjectPath path); + void registerCounter(const QString &path, quint32 interval); + void unregisterCounter(const QString &path); QString requestSession(const QString &bearerName); void releaseSession(); @@ -307,20 +307,24 @@ protected: void disconnectNotify(const char *signal); }; -//class QConnmanCounterInterfacePrivate; -//class QConnmanCounterInterface : public QDBusAbstractInterface -//{ -// Q_OBJECT -// -//public: -// -// QConnmanCounterInterface(QObject *parent = 0); -// ~QConnmanCounterInterface(); -// +class QConnmanCounterInterfacePrivate; +class QConnmanCounterInterface : public QDBusAbstractInterface +{ + Q_OBJECT + +public: + + QConnmanCounterInterface(const QString &dbusPathName, QObject *parent = 0); + ~QConnmanCounterInterface(); + // void release(); -//private: -// QConnmanCounterInterfacePrivate *d; -//}; + QString getInterface(); + quint32 getReceivedByteCount(); + quint32 getTransmittedByteCount(); + +private: + QConnmanCounterInterfacePrivate *d; +}; class QConnmanDeviceInterface : public QDBusAbstractInterface { -- cgit v0.12 From b0bbabe728fedb8531fc2837403856bd5ed44e1b Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 30 Jun 2010 14:31:49 +0200 Subject: Avoid blurry text with OpenVG on Symbian Qt's graphics system uses qreal as measurement unit. The established paint engines (such as "raster") implicitly round textitem coordinates for technical reasons, e.g. for optimized blitting. Some Qt based Ui libraries (such as QWidgets) can in some cases cause textitems to be drawn on non-integer coordinates. In particular, this happens when centering text. Since these libraries have been developed against the established paint engines with implicit rounding, these non-integer coordinates were never an issue. The new OpenVG paintengine took these coordinates seriously without rounding them. On some OpenVG implementations (e.g. that of some Symbian phones), this led to blurry text rendering. This patch adds coordinate rounding for unscaled, unrotated textitems to the OpenVG paintengine. So that it does the same as the raster paint engine. Task-number: QT-3071 Reviewed-By: Jason Barron --- src/openvg/qpaintengine_vg.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index cfc481e..515197a 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3424,7 +3424,13 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) // Set the transformation to use for drawing the current glyphs. QTransform glyphTransform(d->pathTransform); - glyphTransform.translate(p.x(), p.y()); + if (d->transform.type() <= QTransform::TxTranslate) { + // Prevent blurriness of unscaled, unrotated text by using integer coordinates. + // Using ceil(x-0.5) instead of qRound() or int-cast, behave like other paint engines. + glyphTransform.translate(ceil(p.x() - 0.5), ceil(p.y() - 0.5)); + } else { + glyphTransform.translate(p.x(), p.y()); + } #if defined(QVG_NO_IMAGE_GLYPHS) glyphTransform.scale(glyphCache->scaleX, glyphCache->scaleY); #endif -- cgit v0.12 From 76274d40569f45cec50ad5df8646e09e40117007 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 1 Jul 2010 10:12:58 +0100 Subject: Fix QXmlQuery autotest on Symbian Deployment of the test files to ../xmlpatterns resolves to c:/private/xmlpatterns, which is an illegal location to deploy to on symbian. Changed the deployment and test to put the xmlpatterns directory inside the app's private directory on symbian Regression tested on windows build. Reviewed-by: mread --- tests/auto/qxmlquery/qxmlquery.pro | 7 ++++++- tests/auto/qxmlquery/tst_qxmlquery.cpp | 25 ++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/tests/auto/qxmlquery/qxmlquery.pro b/tests/auto/qxmlquery/qxmlquery.pro index cfab564..c9429ed 100644 --- a/tests/auto/qxmlquery/qxmlquery.pro +++ b/tests/auto/qxmlquery/qxmlquery.pro @@ -23,7 +23,12 @@ wince*|symbian*: { addFiles.path = . patternistFiles.sources = ../xmlpatterns/queries - patternistFiles.path = ../xmlpatterns + symbian: { + #../xmlpatterns resolves to an illegal path for deployment + patternistFiles.path = xmlpatterns + } else { + patternistFiles.path = ../xmlpatterns + } DEPLOYMENT += addFiles patternistFiles } diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index be0d708..9a3d65d 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -67,6 +67,9 @@ #if defined(Q_OS_SYMBIAN) #define SRCDIR "" +#define XMLPATTERNSDIR "xmlpatterns" +#else +#define XMLPATTERNSDIR SRCDIR "../xmlpatterns" #endif /*! @@ -264,7 +267,7 @@ void tst_QXmlQuery::checkBaseURI(const QUrl &baseURI, const QString &candidate) QVERIFY(QDir(baseURI.toLocalFile()).relativeFilePath(QFileInfo(candidate).canonicalFilePath()).startsWith("../")); } -const char *const tst_QXmlQuery::queriesDirectory = SRCDIR "../xmlpatterns/queries/"; +const char *const tst_QXmlQuery::queriesDirectory = XMLPATTERNSDIR "/queries/"; QStringList tst_QXmlQuery::queries() { @@ -857,7 +860,7 @@ void tst_QXmlQuery::bindVariableXSLTSuccess() const stylesheet.bindVariable(QLatin1String("paramSelectWithTypeIntBoundWithBindVariableRequired"), QVariant(QLatin1String("param5"))); - stylesheet.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/parameters.xsl")))); + stylesheet.setQuery(QUrl(inputFile(QLatin1String(XMLPATTERNSDIR "/stylesheets/parameters.xsl")))); QVERIFY(stylesheet.isValid()); @@ -1798,11 +1801,11 @@ void tst_QXmlQuery::setFocusQUrl() const { QXmlQuery query(QXmlQuery::XSLT20); - const TestURIResolver resolver(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); + const TestURIResolver resolver(QUrl(inputFile(QLatin1String(XMLPATTERNSDIR "/stylesheets/documentElement.xml")))); query.setUriResolver(&resolver); QVERIFY(query.setFocus(QUrl(QLatin1String("arbitraryURI")))); - query.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/copyWholeDocument.xsl")))); + query.setQuery(QUrl(inputFile(QLatin1String(XMLPATTERNSDIR "/stylesheets/copyWholeDocument.xsl")))); QVERIFY(query.isValid()); QBuffer result; @@ -2997,7 +3000,7 @@ void tst_QXmlQuery::setInitialTemplateNameQXmlName() const QCOMPARE(query.initialTemplateName(), name); - query.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/namedTemplate.xsl")))); + query.setQuery(QUrl(inputFile(QLatin1String(XMLPATTERNSDIR "/stylesheets/namedTemplate.xsl")))); QVERIFY(query.isValid()); QBuffer result; @@ -3059,7 +3062,7 @@ void tst_QXmlQuery::setNetworkAccessManager() const /* Ensure fn:doc() picks up the right QNetworkAccessManager. */ { NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")), - QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/simpleDocument.xml")))); + QUrl(inputFile(QLatin1String(XMLPATTERNSDIR "/queries/simpleDocument.xml")))); QXmlQuery query; query.setNetworkAccessManager(&networkOverrider); @@ -3075,7 +3078,7 @@ void tst_QXmlQuery::setNetworkAccessManager() const /* Ensure setQuery() is using the right network manager. */ { NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")), - QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/concat.xq")))); + QUrl(inputFile(QLatin1String(XMLPATTERNSDIR "/queries/concat.xq")))); QXmlQuery query; query.setNetworkAccessManager(&networkOverrider); @@ -3133,9 +3136,9 @@ void tst_QXmlQuery::multipleDocsAndFocus() const /* We use string concatenation, since variable bindings might disturb what * we're testing. */ query.setQuery(QLatin1String("string(doc('") + - inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/simpleDocument.xml")) + + inputFile(QLatin1String(XMLPATTERNSDIR "/queries/simpleDocument.xml")) + QLatin1String("'))")); - query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); + query.setFocus(QUrl(inputFile(QLatin1String(XMLPATTERNSDIR "/stylesheets/documentElement.xml")))); query.setQuery(QLatin1String("string(.)")); QStringList result; @@ -3159,11 +3162,11 @@ void tst_QXmlQuery::multipleEvaluationsWithDifferentFocus() const QXmlQuery query; QStringList result; - query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); + query.setFocus(QUrl(inputFile(QLatin1String(XMLPATTERNSDIR "/stylesheets/documentElement.xml")))); query.setQuery(QLatin1String("string(.)")); QVERIFY(query.evaluateTo(&result)); - query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); + query.setFocus(QUrl(inputFile(QLatin1String(XMLPATTERNSDIR "/stylesheets/documentElement.xml")))); QVERIFY(query.evaluateTo(&result)); } -- cgit v0.12 From 47589ccc85c4aa2f40d7ceb5f0363b76b782198a Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 1 Jul 2010 10:17:57 +0100 Subject: Fix RVCT compile error in QGraphicsSceneIndex autotest The test code used the 'using' keyword to try and change access control of a base class method from protected to public. With the RVCT 2.2 compiler, 'using' imports the function(s) from the base class, but they retain their existing access control. Used an inline public function to call the base class as a workaround Reviewed-by: mread --- tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 6396e44..dba8a64 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -224,7 +224,18 @@ void tst_QGraphicsSceneIndex::connectedToSceneRectChanged() { class MyScene : public QGraphicsScene - { public: using QGraphicsScene::receivers; }; + { + public: +#ifdef Q_CC_RVCT + //using keyword doesn't change visibility to public in RVCT2.2 compiler + inline int receivers(const char* signal) const + { + return QGraphicsScene::receivers(signal); + } +#else + using QGraphicsScene::receivers; +#endif + }; MyScene scene; // Uses QGraphicsSceneBspTreeIndex by default. QCOMPARE(scene.receivers(SIGNAL(sceneRectChanged(const QRectF&))), 1); -- cgit v0.12 From cb3309b28b9d81af33b0ef92f2ae727d0d91b939 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 20 Apr 2010 15:42:16 +0200 Subject: Fix compile error in QFileDialog autotest Reviewed-by: Trust Me --- tests/auto/qfiledialog/tst_qfiledialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 9adb4fc..38a1ee7 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -548,7 +548,7 @@ void tst_QFiledialog::completer() // ### FIXME: This will fail on Symbian on some tests and some environments until the file engine and QFileSystemModel // are fixed to properly capitalize paths, so that some folders are not duplicated in QFileSystemModel. #if defined(Q_OS_SYMBIAN) - QSKIP("This will fail on Symbian on some tests and some environments until the file engine and QFileSystemModel are fixed to properly capitalize paths") + QSKIP("This will fail on Symbian on some tests and some environments until the file engine and QFileSystemModel are fixed to properly capitalize paths", SkipAll); #endif QTRY_COMPARE(cModel->rowCount(), expected); } QT_CATCH(...) { -- cgit v0.12 From 3475453895ff5fb393d375202581e3236c0340e8 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 1 Jul 2010 15:32:20 +0200 Subject: Using the remaining valid data to construct the QTime object when msec parsing failed. It's relevant with QTBUG-11623, but not a fix for it. Reviewed-by: Aleksandar Sasha Babic --- src/corelib/tools/qdatetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index c1027ed..347de0c 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -1914,7 +1914,7 @@ QTime QTime::fromString(const QString& s, Qt::DateFormat f) const QString msec_s(QLatin1String("0.") + s.mid(9, 4)); const float msec(msec_s.toFloat(&ok)); if (!ok) - return QTime(); + return QTime(hour, minute, second, 0); return QTime(hour, minute, second, qMin(qRound(msec * 1000.0), 999)); } } -- cgit v0.12 From 6d5e561be6f013f7cb5c77e15ee6b7640cad7563 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Fri, 2 Jul 2010 10:12:47 +1000 Subject: Segmentation Fault in QAudioOutputPrivate::freeBlocks() caused by wrong pointer increment Task-number:QTBUG-11883 Reviewed-by:Andrew den Exter --- src/multimedia/audio/qaudioinput_win32_p.cpp | 2 +- src/multimedia/audio/qaudiooutput_win32_p.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 8240047..3f6e778 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -148,7 +148,7 @@ void QAudioInputPrivate::freeBlocks(WAVEHDR* blockArray) for(int i = 0; i < count; i++) { waveInUnprepareHeader(hWaveIn,blocks, sizeof(WAVEHDR)); - blocks+=sizeof(WAVEHDR); + blocks++; } HeapFree(GetProcessHeap(), 0, blockArray); } diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index 075d100..09771b3 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -193,7 +193,7 @@ void QAudioOutputPrivate::freeBlocks(WAVEHDR* blockArray) for(int i = 0; i < count; i++) { waveOutUnprepareHeader(hWaveOut,blocks, sizeof(WAVEHDR)); - blocks+=sizeof(WAVEHDR); + blocks++; } HeapFree(GetProcessHeap(), 0, blockArray); } -- cgit v0.12 From f5c5e20ab20f016c07351330d03432e4912f20b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 28 Jun 2010 15:56:33 +0200 Subject: Fixed missing clip when computing the graphics item effect source rect. If item clips children to shape we should take that into account when computing the source rect, to avoid creating unnecessary large source pixmaps which might have a significant performance impact. Task-number: QT-3551 Reviewed-by: Gunnar Reviewed-by: Trond --- src/gui/graphicsview/qgraphicsitem.cpp | 27 +++++++++++++++++++--- src/gui/graphicsview/qgraphicsitem_p.h | 14 +++++++---- .../tst_qgraphicseffectsource.cpp | 15 ++++++++++++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 074e571..88e9952 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1205,8 +1205,14 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q Returns the bounding rect of this item's children (excluding itself). */ -void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rect) +void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rect, bool doClip) { + Q_Q(QGraphicsItem); + + QRectF childrenRect; + QRectF *result = rect; + rect = &childrenRect; + for (int i = 0; i < children.size(); ++i) { QGraphicsItem *child = children.at(i); QGraphicsItemPrivate *childd = child->d_ptr.data(); @@ -1228,6 +1234,15 @@ void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rec childd->childrenBoundingRectHelper(x, rect); } } + + if (doClip && (flags & QGraphicsItem::ItemClipsChildrenToShape)){ + if (x) + *rect &= x->mapRect(q->boundingRect()); + else + *rect &= q->boundingRect(); + } + + *result |= *rect; } void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, @@ -10816,8 +10831,14 @@ QRectF QGraphicsItemEffectSourcePrivate::boundingRect(Qt::CoordinateSystem syste } QRectF rect = item->boundingRect(); - if (!item->d_ptr->children.isEmpty()) - rect |= item->childrenBoundingRect(); + if (!item->d_ptr->children.isEmpty()) { + if (dirtyChildrenBoundingRect) { + childrenBoundingRect = QRectF(); + item->d_ptr->childrenBoundingRectHelper(0, &childrenBoundingRect, true); + dirtyChildrenBoundingRect = false; + } + rect |= childrenBoundingRect; + } if (deviceCoordinates) { Q_ASSERT(info->painter); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index e737773..ead240b 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -239,7 +239,7 @@ public: void removeChild(QGraphicsItem *child); void setParentItemHelper(QGraphicsItem *parent, const QVariant *newParentVariant, const QVariant *thisPointerVariant); - void childrenBoundingRectHelper(QTransform *x, QRectF *rect); + void childrenBoundingRectHelper(QTransform *x, QRectF *rect, bool doClip = true); void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, const QRegion &exposedRegion, bool allItems = false) const; QRectF effectiveBoundingRect() const; @@ -580,7 +580,7 @@ class QGraphicsItemEffectSourcePrivate : public QGraphicsEffectSourcePrivate { public: QGraphicsItemEffectSourcePrivate(QGraphicsItem *i) - : QGraphicsEffectSourcePrivate(), item(i), info(0) + : QGraphicsEffectSourcePrivate(), dirtyChildrenBoundingRect(true), item(i), info(0) {} inline void detach() @@ -631,6 +631,9 @@ public: QGraphicsEffect::PixmapPadMode mode) const; QRect paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded = 0) const; + mutable bool dirtyChildrenBoundingRect; + mutable QRectF childrenBoundingRect; + QGraphicsItem *item; QGraphicsItemPaintInfo *info; QTransform lastEffectTransform; @@ -788,9 +791,12 @@ inline void QGraphicsItemPrivate::markParentDirty(bool updateBoundingRect) #ifndef QT_NO_GRAPHICSEFFECT if (parentp->graphicsEffect) { if (updateBoundingRect) { + QGraphicsItemEffectSourcePrivate *sourcep = + static_cast(parentp->graphicsEffect->d_func() + ->source->d_func()); + parentp->dirtyChildrenBoundingRect = 1; parentp->notifyInvalidated = 1; - static_cast(parentp->graphicsEffect->d_func() - ->source->d_func())->invalidateCache(); + sourcep->invalidateCache(); } if (parentp->graphicsEffect->isEnabled()) { parentp->dirty = 1; diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index 49f110e..49a76fa 100644 --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -161,6 +161,7 @@ private slots: void draw(); void update(); void boundingRect(); + void clippedBoundingRect(); void deviceRect(); void pixmap(); @@ -282,6 +283,20 @@ void tst_QGraphicsEffectSource::boundingRect() QTRY_COMPARE(effect->source()->boundingRect(), itemBoundingRect); } +void tst_QGraphicsEffectSource::clippedBoundingRect() +{ + QRectF itemBoundingRect = item->boundingRect(); + item->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + + QGraphicsRectItem *child = new QGraphicsRectItem(-1000, -1000, 2000, 2000); + child->setBrush(Qt::red); + child->setParentItem(item); + + effect->storeDeviceDependentStuff = true; + effect->source()->update(); + QTRY_COMPARE(effect->source()->boundingRect(Qt::LogicalCoordinates), itemBoundingRect); +} + void tst_QGraphicsEffectSource::deviceRect() { effect->storeDeviceDependentStuff = true; -- cgit v0.12 From ce4ed8fa50a72927d68c4c68c04a28d783546c07 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 2 Jul 2010 16:55:00 +0200 Subject: Removed missing symbols from DEF files. RevBy: Jason Barron --- src/s60installs/bwins/QtGuiu.def | 2 +- src/s60installs/eabi/QtGuiu.def | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 3368e4c..cde0b60 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -2645,7 +2645,7 @@ EXPORTS ?childItems@QGraphicsItem@@QBE?AV?$QList@PAVQGraphicsItem@@@@XZ @ 2644 NONAME ; class QList QGraphicsItem::childItems(void) const ?children@QGraphicsItem@@QBE?AV?$QList@PAVQGraphicsItem@@@@XZ @ 2645 NONAME ; class QList QGraphicsItem::children(void) const ?childrenBoundingRect@QGraphicsItem@@QBE?AVQRectF@@XZ @ 2646 NONAME ; class QRectF QGraphicsItem::childrenBoundingRect(void) const - ?childrenBoundingRectHelper@QGraphicsItemPrivate@@QAEXPAVQTransform@@PAVQRectF@@@Z @ 2647 NONAME ; void QGraphicsItemPrivate::childrenBoundingRectHelper(class QTransform *, class QRectF *) + ?childrenBoundingRectHelper@QGraphicsItemPrivate@@QAEXPAVQTransform@@PAVQRectF@@@Z @ 2647 NONAME ABSENT ; void QGraphicsItemPrivate::childrenBoundingRectHelper(class QTransform *, class QRectF *) ?childrenCheckState@QTreeWidgetItem@@ABE?AVQVariant@@H@Z @ 2648 NONAME ; class QVariant QTreeWidgetItem::childrenCheckState(int) const ?childrenClippedToShape@QGraphicsItemPrivate@@QBE_NXZ @ 2649 NONAME ; bool QGraphicsItemPrivate::childrenClippedToShape(void) const ?childrenCollapsible@QSplitter@@QBE_NXZ @ 2650 NONAME ; bool QSplitter::childrenCollapsible(void) const diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index cfe2630..4c57c03 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -4675,7 +4675,7 @@ EXPORTS _ZN20QGraphicsItemPrivate20removeExtraItemCacheEv @ 4674 NONAME _ZN20QGraphicsItemPrivate23appendGraphicsTransformEP18QGraphicsTransform @ 4675 NONAME _ZN20QGraphicsItemPrivate25movableAncestorIsSelectedEPK13QGraphicsItem @ 4676 NONAME - _ZN20QGraphicsItemPrivate26childrenBoundingRectHelperEP10QTransformP6QRectF @ 4677 NONAME + _ZN20QGraphicsItemPrivate26childrenBoundingRectHelperEP10QTransformP6QRectF @ 4677 NONAME ABSENT _ZN20QGraphicsItemPrivate26invalidateDepthRecursivelyEv @ 4678 NONAME _ZN20QGraphicsItemPrivate28ensureSequentialSiblingIndexEv @ 4679 NONAME _ZN20QGraphicsItemPrivate29ensureSceneTransformRecursiveEPP13QGraphicsItem @ 4680 NONAME -- cgit v0.12 From 46ff093e22f95aa5e634e7edc6484ee717054625 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 5 Jul 2010 14:46:09 +1000 Subject: Include qmath.h to get the definition of ceil() Reviewed-by: Julian de Bhal --- src/openvg/qpaintengine_vg.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 515197a..7a050f6 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include #include -- cgit v0.12 From 752d46c90ee0fc5f06f01feedd8e0659178b15d4 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 5 Jul 2010 15:35:51 +0200 Subject: Support time zone designator in QDateTime::fromString() based on ISO 8601-2004 standard. Task-number: QTBUG-11623 Reviewed-by: Denis Dzyubenko Reviewed-by: David Boddie --- doc/src/external-resources.qdoc | 5 +++++ src/corelib/global/qnamespace.qdoc | 5 +++-- src/corelib/tools/qdatetime.cpp | 27 ++++++++++++++++++++++++++- tests/auto/qdatetime/tst_qdatetime.cpp | 6 ++++++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 3ca50b4..b4324af 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -422,3 +422,8 @@ \externalpage http://www.w3.org/XML/Schema \title XML Schema */ + +/*! + \externalpage http://www.iso.org/iso/date_and_time_format + \title ISO 8601 +*/ diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index a756565..15c4efc 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -577,8 +577,9 @@ be short, localized names. This is basically equivalent to using the date format string, "ddd MMM d yyyy". See QDate::toString() for more information. - \value ISODate ISO 8601 extended format: either \c{YYYY-MM-DD} for dates or - \c{YYYY-MM-DDTHH:MM:SS} for combined dates and times. + \value ISODate \l{ISO 8601} extended format: either \c{YYYY-MM-DD} for dates or + \c{YYYY-MM-DDTHH:MM:SS}, \c{YYYY-MM-DDTHH:MM:SSTZD} (e.g., 1997-07-16T19:20:30+01:00) + for combined dates and times. \value SystemLocaleShortDate The \l{QLocale::ShortFormat}{short format} used by the \l{QLocale::system()}{operating system}. diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 347de0c..c6ab4e4 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3044,12 +3044,37 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f) if (tmp.size() == 10) return QDateTime(date); + tmp = tmp.mid(11); + // Recognize UTC specifications if (tmp.endsWith(QLatin1Char('Z'))) { ts = Qt::UTC; tmp.chop(1); } - return QDateTime(date, QTime::fromString(tmp.mid(11), Qt::ISODate), ts); + + // Recognize timezone specifications + QRegExp rx(QLatin1String("[+-]")); + if (tmp.contains(rx)) { + int idx = tmp.indexOf(rx); + QString tmp2 = tmp.mid(idx); + tmp = tmp.left(idx); + bool ok = true; + int ntzhour = 1; + int ntzminute = 3; + if ( tmp2.indexOf(QLatin1Char(':')) == 3 ) + ntzminute = 4; + const int tzhour(tmp2.mid(ntzhour, 2).toInt(&ok)); + const int tzminute(tmp2.mid(ntzminute, 2).toInt(&ok)); + QTime tzt(tzhour, tzminute); + int utcOffset = (tzt.hour() * 60 + tzt.minute()) * 60; + if ( utcOffset != 0 ) { + ts = Qt::OffsetFromUTC; + QDateTime dt(date, QTime::fromString(tmp, Qt::ISODate), ts); + dt.setUtcOffset( utcOffset * (tmp2.startsWith(QLatin1Char('-')) ? -1 : 1) ); + return dt; + } + } + return QDateTime(date, QTime::fromString(tmp, Qt::ISODate), ts); } case Qt::SystemLocaleDate: case Qt::SystemLocaleShortDate: diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index 86a4c80..d23133d 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -1286,6 +1286,12 @@ void tst_QDateTime::fromString() dt = QDateTime::fromString("2002-10-01", Qt::ISODate); QCOMPARE(dt, QDateTime(QDate(2002, 10, 1), QTime(0, 0, 0, 0))); + dt = QDateTime::fromString("1987-02-13T13:24:51+01:00", Qt::ISODate); + QCOMPARE(dt, QDateTime(QDate(1987, 2, 13), QTime(12, 24, 51), Qt::UTC)); + + dt = QDateTime::fromString("1987-02-13T13:24:51-01:00", Qt::ISODate); + QCOMPARE(dt, QDateTime(QDate(1987, 2, 13), QTime(14, 24, 51), Qt::UTC)); + dt = QDateTime::fromString("Thu Jan 1 00:12:34 1970 GMT"); QCOMPARE(dt.toUTC(), QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC)); -- cgit v0.12 From 8ef60f0791c1fb7fa649214238db6db3e2d975c6 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 5 Jul 2010 16:42:44 +0200 Subject: Revert "Support time zone designator in QDateTime::fromString() based on ISO 8601-2004 standard." This reverts commit 752d46c90ee0fc5f06f01feedd8e0659178b15d4. --- doc/src/external-resources.qdoc | 5 ----- src/corelib/global/qnamespace.qdoc | 5 ++--- src/corelib/tools/qdatetime.cpp | 27 +-------------------------- tests/auto/qdatetime/tst_qdatetime.cpp | 6 ------ 4 files changed, 3 insertions(+), 40 deletions(-) diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index b4324af..3ca50b4 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -422,8 +422,3 @@ \externalpage http://www.w3.org/XML/Schema \title XML Schema */ - -/*! - \externalpage http://www.iso.org/iso/date_and_time_format - \title ISO 8601 -*/ diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 15c4efc..a756565 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -577,9 +577,8 @@ be short, localized names. This is basically equivalent to using the date format string, "ddd MMM d yyyy". See QDate::toString() for more information. - \value ISODate \l{ISO 8601} extended format: either \c{YYYY-MM-DD} for dates or - \c{YYYY-MM-DDTHH:MM:SS}, \c{YYYY-MM-DDTHH:MM:SSTZD} (e.g., 1997-07-16T19:20:30+01:00) - for combined dates and times. + \value ISODate ISO 8601 extended format: either \c{YYYY-MM-DD} for dates or + \c{YYYY-MM-DDTHH:MM:SS} for combined dates and times. \value SystemLocaleShortDate The \l{QLocale::ShortFormat}{short format} used by the \l{QLocale::system()}{operating system}. diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index c6ab4e4..347de0c 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3044,37 +3044,12 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f) if (tmp.size() == 10) return QDateTime(date); - tmp = tmp.mid(11); - // Recognize UTC specifications if (tmp.endsWith(QLatin1Char('Z'))) { ts = Qt::UTC; tmp.chop(1); } - - // Recognize timezone specifications - QRegExp rx(QLatin1String("[+-]")); - if (tmp.contains(rx)) { - int idx = tmp.indexOf(rx); - QString tmp2 = tmp.mid(idx); - tmp = tmp.left(idx); - bool ok = true; - int ntzhour = 1; - int ntzminute = 3; - if ( tmp2.indexOf(QLatin1Char(':')) == 3 ) - ntzminute = 4; - const int tzhour(tmp2.mid(ntzhour, 2).toInt(&ok)); - const int tzminute(tmp2.mid(ntzminute, 2).toInt(&ok)); - QTime tzt(tzhour, tzminute); - int utcOffset = (tzt.hour() * 60 + tzt.minute()) * 60; - if ( utcOffset != 0 ) { - ts = Qt::OffsetFromUTC; - QDateTime dt(date, QTime::fromString(tmp, Qt::ISODate), ts); - dt.setUtcOffset( utcOffset * (tmp2.startsWith(QLatin1Char('-')) ? -1 : 1) ); - return dt; - } - } - return QDateTime(date, QTime::fromString(tmp, Qt::ISODate), ts); + return QDateTime(date, QTime::fromString(tmp.mid(11), Qt::ISODate), ts); } case Qt::SystemLocaleDate: case Qt::SystemLocaleShortDate: diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index d23133d..86a4c80 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -1286,12 +1286,6 @@ void tst_QDateTime::fromString() dt = QDateTime::fromString("2002-10-01", Qt::ISODate); QCOMPARE(dt, QDateTime(QDate(2002, 10, 1), QTime(0, 0, 0, 0))); - dt = QDateTime::fromString("1987-02-13T13:24:51+01:00", Qt::ISODate); - QCOMPARE(dt, QDateTime(QDate(1987, 2, 13), QTime(12, 24, 51), Qt::UTC)); - - dt = QDateTime::fromString("1987-02-13T13:24:51-01:00", Qt::ISODate); - QCOMPARE(dt, QDateTime(QDate(1987, 2, 13), QTime(14, 24, 51), Qt::UTC)); - dt = QDateTime::fromString("Thu Jan 1 00:12:34 1970 GMT"); QCOMPARE(dt.toUTC(), QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC)); -- cgit v0.12 From 919dc2dca2ceff3848f6c91819845819f91fb68e Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 5 Jul 2010 07:22:42 -0700 Subject: Spectrum build: fixed DLL rpath Rather than explicitly modifying LD_LIBRARY_PATH using a shell script when the application is launched, the relative path from the application binary to the FFT library is encoded in the application using an --rpath flag. Task-number: QTBUG-11756 Reviewed-by: Andy Shaw --- demos/spectrum/app/app.pro | 13 +++-------- demos/spectrum/app/spectrum.sh | 50 ------------------------------------------ 2 files changed, 3 insertions(+), 60 deletions(-) delete mode 100644 demos/spectrum/app/spectrum.sh diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro index 22ee3b1..5410b2b 100644 --- a/demos/spectrum/app/app.pro +++ b/demos/spectrum/app/app.pro @@ -3,7 +3,6 @@ include(../spectrum.pri) TEMPLATE = app TARGET = spectrum -unix: !macx: !symbian: TARGET = spectrum.bin QT += multimedia @@ -112,15 +111,9 @@ symbian { # Specify directory in which to create spectrum application DESTDIR = ../bin - unix: !symbian { - # On unices other than Mac OSX, we copy a shell script into the bin directory. - # This script takes care of correctly setting the LD_LIBRARY_PATH so that - # the dynamic library can be located. - copy_launch_script.target = copy_launch_script - copy_launch_script.commands = \ - install -m 0555 $$QT_SOURCE_TREE/demos/spectrum/app/spectrum.sh ../bin/spectrum - QMAKE_EXTRA_TARGETS += copy_launch_script - POST_TARGETDEPS += copy_launch_script + unix: { + # Provide relative path from application to fftreal library + QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN } } } diff --git a/demos/spectrum/app/spectrum.sh b/demos/spectrum/app/spectrum.sh deleted file mode 100644 index 2a230ed..0000000 --- a/demos/spectrum/app/spectrum.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -############################################################################# -## -## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -## All rights reserved. -## Contact: Nokia Corporation (qt-info@nokia.com) -## -## This file is part of the examples 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$ -## -############################################################################# - - -# Shell script for launching spectrum application on Unix systems other than Mac OSX - -bindir=`dirname "$0"` -LD_LIBRARY_PATH="${bindir}:${LD_LIBRARY_PATH}" -export LD_LIBRARY_PATH -exec "${bindir}/spectrum.bin" ${1+"$@"} - -- cgit v0.12 From e7f6c2d9625bda1d063b9ec3acd7eb5f79f30ba7 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 5 Jul 2010 11:39:37 +0100 Subject: Spectrum demo: fixed installation All binaries must be written into $$QT_BUILD_DIR/demos/spectrum in order for them to be correctly installed. Task-number: QTBUG-11572 Task-number: QTBUG-11756 Reviewed-by: Andy Shaw --- demos/spectrum/3rdparty/fftreal/fftreal.pro | 14 ++++++++------ demos/spectrum/app/app.pro | 5 ++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/demos/spectrum/3rdparty/fftreal/fftreal.pro b/demos/spectrum/3rdparty/fftreal/fftreal.pro index 6801b42..c9da205 100644 --- a/demos/spectrum/3rdparty/fftreal/fftreal.pro +++ b/demos/spectrum/3rdparty/fftreal/fftreal.pro @@ -1,3 +1,5 @@ +include(../../spectrum.pri) + TEMPLATE = lib TARGET = fftreal @@ -31,13 +33,13 @@ symbian { # Provide unique ID for the generated binary, required by Symbian OS TARGET.UID3 = 0xA000E403 TARGET.CAPABILITY = UserEnvironment +} + +macx { + CONFIG += lib_bundle } else { - macx { - CONFIG += lib_bundle - } else { - DESTDIR = ../../bin - } -} + !symbian: DESTDIR = ../.. +} # Install diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro index 5410b2b..6c74b27 100644 --- a/demos/spectrum/app/app.pro +++ b/demos/spectrum/app/app.pro @@ -62,8 +62,7 @@ symbian { LIBS += -F$${fftreal_dir} LIBS += -framework fftreal } else { - # Link to dynamic library which is written to ../bin - LIBS += -L../bin + LIBS += -L.. LIBS += -lfftreal } } @@ -109,7 +108,7 @@ symbian { } } else { # Specify directory in which to create spectrum application - DESTDIR = ../bin + DESTDIR = .. unix: { # Provide relative path from application to fftreal library -- cgit v0.12 From 2de46daf6568c85d976a1e784c0bafbea89adb3a Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Wed, 7 Jul 2010 15:21:48 +1000 Subject: Don't try and use QFactoryLoader when relevant features are turned off. Task-number: QTBUG-11900 Reviewed-by: Andrew den Exter --- src/multimedia/audio/qaudiodevicefactory.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp index 4f45110..523075c 100644 --- a/src/multimedia/audio/qaudiodevicefactory.cpp +++ b/src/multimedia/audio/qaudiodevicefactory.cpp @@ -67,8 +67,11 @@ QT_BEGIN_NAMESPACE + +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QAudioEngineFactoryInterface_iid, QLatin1String("/audio"), Qt::CaseInsensitive)) +#endif class QNullDeviceInfo : public QAbstractAudioDeviceInfo @@ -137,6 +140,7 @@ QList QAudioDeviceFactory::availableDevices(QAudio::Mode mode) devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode); #endif #endif +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QFactoryLoader* l = loader(); foreach (QString const& key, l->keys()) { @@ -148,12 +152,13 @@ QList QAudioDeviceFactory::availableDevices(QAudio::Mode mode) delete plugin; } - +#endif return devices; } QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() { +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(QLatin1String("default"))); if (plugin) { @@ -161,6 +166,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() if (list.size() > 0) return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput); } +#endif #ifndef QT_NO_AUDIO_BACKEND #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput); @@ -171,6 +177,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() { +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(QLatin1String("default"))); if (plugin) { @@ -178,6 +185,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() if (list.size() > 0) return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput); } +#endif #ifndef QT_NO_AUDIO_BACKEND #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput); @@ -196,12 +204,13 @@ QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &re return new QAudioDeviceInfoInternal(handle, mode); #endif #endif +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(realm)); if (plugin) rc = plugin->createDeviceInfo(handle, mode); - +#endif return rc == 0 ? new QNullDeviceInfo() : rc; } @@ -225,12 +234,13 @@ QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo con return new QAudioInputPrivate(deviceInfo.handle(), format); #endif #endif +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(deviceInfo.realm())); if (plugin) return plugin->createInput(deviceInfo.handle(), format); - +#endif return new QNullInputDevice(); } @@ -244,12 +254,13 @@ QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo c return new QAudioOutputPrivate(deviceInfo.handle(), format); #endif #endif +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(deviceInfo.realm())); if (plugin) return plugin->createOutput(deviceInfo.handle(), format); - +#endif return new QNullOutputDevice(); } -- cgit v0.12 From f14b644004498dc6fb1a9437b81e3164e89bfdb5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 7 Jul 2010 09:51:34 +0200 Subject: qdoc: Fixed the case where the property and type names are the same. Also simplified some code. Task-number: QTBUG-6340 --- tools/qdoc3/codemarker.cpp | 8 ++++++++ tools/qdoc3/codemarker.h | 9 +++++---- tools/qdoc3/cppcodemarker.cpp | 15 +++++++++------ tools/qdoc3/cppcodemarker.h | 7 ++++--- tools/qdoc3/htmlgenerator.cpp | 8 +++++--- tools/qdoc3/htmlgenerator.h | 7 ++++--- tools/qdoc3/javacodemarker.cpp | 6 ++++-- tools/qdoc3/javacodemarker.h | 5 ++++- tools/qdoc3/plaincodemarker.cpp | 7 ------- tools/qdoc3/plaincodemarker.h | 1 - tools/qdoc3/qscodemarker.cpp | 7 ------- tools/qdoc3/qscodemarker.h | 1 - tools/qdoc3/tree.cpp | 10 ++++++---- tools/qdoc3/tree.h | 20 ++++++++++++-------- 14 files changed, 61 insertions(+), 50 deletions(-) diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index 33ceaf5..7130d61 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -630,4 +630,12 @@ QList
CodeMarker::qmlSections(const QmlClassNode* , SynopsisStyle ) } #endif +const Node* CodeMarker::resolveTarget(const QString& , + const Tree* , + const Node* , + const Node* ) +{ + return 0; +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index aab8a9c..53ad4a8 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -155,10 +155,11 @@ class CodeMarker virtual QList
qmlSections(const QmlClassNode* qmlClassNode, SynopsisStyle style); #endif - virtual const Node *resolveTarget(const QString& target, - const Tree *tree, - const Node *relative) = 0; - virtual QStringList macRefsForNode(const Node *node); + virtual const Node* resolveTarget(const QString& target, + const Tree* tree, + const Node* relative, + const Node* self = 0); + virtual QStringList macRefsForNode(const Node* node); static void initialize(const Config& config); static void terminate(); diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index c4ee054..562e92b 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -825,9 +825,10 @@ QList
CppCodeMarker::sections(const InnerNode *inner, return sections; } -const Node *CppCodeMarker::resolveTarget(const QString &target, - const Tree *tree, - const Node *relative) +const Node *CppCodeMarker::resolveTarget(const QString& target, + const Tree* tree, + const Node* relative, + const Node* self) { if (target.endsWith("()")) { const FunctionNode *func; @@ -869,11 +870,13 @@ const Node *CppCodeMarker::resolveTarget(const QString &target, else { QStringList path = target.split("::"); const Node *node; + int flags = Tree::SearchBaseClasses | + Tree::SearchEnumValues | + Tree::NonFunction; if ((node = tree->findNode(path, relative, - Tree::SearchBaseClasses | - Tree::SearchEnumValues | - Tree::NonFunction))) + flags, + self))) return node; } return 0; diff --git a/tools/qdoc3/cppcodemarker.h b/tools/qdoc3/cppcodemarker.h index 2dcf400..eca3936 100644 --- a/tools/qdoc3/cppcodemarker.h +++ b/tools/qdoc3/cppcodemarker.h @@ -81,9 +81,10 @@ class CppCodeMarker : public CodeMarker Status status); QList
qmlSections(const QmlClassNode* qmlClassNode, SynopsisStyle style); - const Node *resolveTarget(const QString& target, - const Tree *tree, - const Node *relative); + const Node* resolveTarget(const QString& target, + const Tree* tree, + const Node* relative, + const Node* self = 0); private: QString addMarkUp(const QString& protectedCode, diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 89b1e98..4461b48 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -2676,7 +2676,7 @@ void HtmlGenerator::generateQmlItem(const Node *node, } } } - out() << highlightedCode(marked, marker, relative); + out() << highlightedCode(marked, marker, relative, false, node); debugging_on = false; } #endif @@ -2988,7 +2988,8 @@ void HtmlGenerator::generateSynopsis(const Node *node, QString HtmlGenerator::highlightedCode(const QString& markedCode, CodeMarker* marker, const Node* relative, - bool alignNames) + bool alignNames, + const Node* self) { QString src = markedCode; QString html; @@ -3067,8 +3068,9 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, bool handled = false; if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) { par1 = QStringRef(); - const Node* n = marker->resolveTarget(arg.toString(), myTree, relative); + const Node* n = marker->resolveTarget(arg.toString(), myTree, relative, self); if (HtmlGenerator::debugging_on) { + qDebug() << "arg.toString()" << arg.toString(); if (n) { qDebug() << " " << n->name() << n->type() << n->subType(); qDebug() << " " << relative->name() << relative->type() << relative->subType(); diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 80341de..a2fadf6 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -210,9 +210,10 @@ class HtmlGenerator : public PageGenerator const Node *relative, CodeMarker *marker); QString highlightedCode(const QString& markedCode, - CodeMarker *marker, - const Node *relative, - bool alignNames = false); + CodeMarker* marker, + const Node* relative, + bool alignNames = false, + const Node* self = 0); void generateFullName(const Node *apparentNode, const Node *relative, diff --git a/tools/qdoc3/javacodemarker.cpp b/tools/qdoc3/javacodemarker.cpp index 1918cd8..c9a8f60 100644 --- a/tools/qdoc3/javacodemarker.cpp +++ b/tools/qdoc3/javacodemarker.cpp @@ -155,8 +155,10 @@ QList
JavaCodeMarker::sections(const InnerNode * /* inner */, SynopsisS return QList
(); } -const Node *JavaCodeMarker::resolveTarget(const QString &target, const Tree *tree, - const Node *relative) +const Node *JavaCodeMarker::resolveTarget(const QString &target, + const Tree *tree, + const Node *relative, + const Node* /* self */) { if (target.endsWith("()")) { const FunctionNode *func; diff --git a/tools/qdoc3/javacodemarker.h b/tools/qdoc3/javacodemarker.h index a2d04dd..c2aabc0 100644 --- a/tools/qdoc3/javacodemarker.h +++ b/tools/qdoc3/javacodemarker.h @@ -72,7 +72,10 @@ public: QList
sections(const InnerNode *innerNode, SynopsisStyle style, Status status); QString functionBeginRegExp( const QString& funcName ); QString functionEndRegExp( const QString& funcName ); - const Node *resolveTarget( const QString& target, const Tree *tree, const Node *relative ); + const Node* resolveTarget( const QString& target, + const Tree* tree, + const Node* relative, + const Node* self = 0 ); }; QT_END_NAMESPACE diff --git a/tools/qdoc3/plaincodemarker.cpp b/tools/qdoc3/plaincodemarker.cpp index 4abfd2b..d825c13 100644 --- a/tools/qdoc3/plaincodemarker.cpp +++ b/tools/qdoc3/plaincodemarker.cpp @@ -129,11 +129,4 @@ QList
PlainCodeMarker::sections(const InnerNode * /* innerNode */, return QList
(); } -const Node *PlainCodeMarker::resolveTarget( const QString& /* target */, - const Tree * /* tree */, - const Node * /* relative */ ) -{ - return 0; -} - QT_END_NAMESPACE diff --git a/tools/qdoc3/plaincodemarker.h b/tools/qdoc3/plaincodemarker.h index e9cc40d..7afb88e 100644 --- a/tools/qdoc3/plaincodemarker.h +++ b/tools/qdoc3/plaincodemarker.h @@ -71,7 +71,6 @@ public: QString functionBeginRegExp( const QString& funcName ); QString functionEndRegExp( const QString& funcName ); QList
sections(const InnerNode *innerNode, SynopsisStyle style, Status status); - const Node *resolveTarget(const QString &target, const Tree *tree, const Node *relative); }; QT_END_NAMESPACE diff --git a/tools/qdoc3/qscodemarker.cpp b/tools/qdoc3/qscodemarker.cpp index d4b8e80..2ee5d99 100644 --- a/tools/qdoc3/qscodemarker.cpp +++ b/tools/qdoc3/qscodemarker.cpp @@ -375,11 +375,4 @@ QList
QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle sty return sections; } -const Node *QsCodeMarker::resolveTarget( const QString& /* target */, - const Tree * /* tree */, - const Node * /* relative */ ) -{ - return 0; -} - QT_END_NAMESPACE diff --git a/tools/qdoc3/qscodemarker.h b/tools/qdoc3/qscodemarker.h index 1590009..c6a177f 100644 --- a/tools/qdoc3/qscodemarker.h +++ b/tools/qdoc3/qscodemarker.h @@ -72,7 +72,6 @@ public: QList
sections(const InnerNode *innerNode, SynopsisStyle style, Status status); QString functionBeginRegExp( const QString& funcName ); QString functionEndRegExp( const QString& funcName ); - const Node *resolveTarget( const QString& target, const Tree *tree, const Node *relative ); }; QT_END_NAMESPACE diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 70b998f..022e1c2 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -125,18 +125,20 @@ Tree::~Tree() /*! */ -Node *Tree::findNode(const QStringList &path, Node *relative, int findFlags) +Node *Tree::findNode(const QStringList &path, Node *relative, int findFlags, const Node* self) { return const_cast(const_cast(this)->findNode(path, relative, - findFlags)); + findFlags, + self)); } /*! */ const Node* Tree::findNode(const QStringList &path, const Node* start, - int findFlags) const + int findFlags, + const Node* self) const { const Node* current = start; if (!current) @@ -172,7 +174,7 @@ const Node* Tree::findNode(const QStringList &path, if (node && i == path.size() && (!(findFlags & NonFunction) || node->type() != Node::Function || ((FunctionNode *)node)->metaness() == FunctionNode::MacroWithoutParams)) - if ((node != start) && (node->subType() != Node::QmlPropertyGroup)) + if ((node != self) && (node->subType() != Node::QmlPropertyGroup)) return node; current = current->parent(); } while (current); diff --git a/tools/qdoc3/tree.h b/tools/qdoc3/tree.h index 0865847..b34c3a8 100644 --- a/tools/qdoc3/tree.h +++ b/tools/qdoc3/tree.h @@ -65,10 +65,13 @@ class Tree Tree(); ~Tree(); - Node *findNode(const QStringList &path, Node *relative=0, int findFlags=0); - Node *findNode(const QStringList &path, + Node* findNode(const QStringList &path, + Node* relative=0, + int findFlags=0, + const Node* self=0); + Node* findNode(const QStringList &path, Node::Type type, - Node *relative = 0, + Node* relative = 0, int findFlags = 0); FunctionNode *findFunctionNode(const QStringList &path, Node *relative = 0, @@ -98,12 +101,13 @@ class Tree NamespaceNode *root() { return &roo; } QString version() const { return vers; } - const Node *findNode(const QStringList &path, - const Node *relative = 0, - int findFlags = 0) const; - const Node *findNode(const QStringList &path, + const Node* findNode(const QStringList &path, + const Node* relative = 0, + int findFlags = 0, + const Node* self=0) const; + const Node* findNode(const QStringList &path, Node::Type type, const - Node *relative = 0, + Node* relative = 0, int findFlags = 0) const; const FunctionNode *findFunctionNode(const QStringList &path, const Node *relative = 0, -- cgit v0.12 From 401a6552f2601e5ca5b2e00a274baa6dcd83c96e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 7 Jul 2010 10:27:38 +0200 Subject: I18n: Complete German translation for 4.7.0 --- translations/qt_de.ts | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/translations/qt_de.ts b/translations/qt_de.ts index 7d32ead..74bd048 100644 --- a/translations/qt_de.ts +++ b/translations/qt_de.ts @@ -2024,6 +2024,11 @@ nach Signalnamen dürfen nicht mit einem Großbuchstaben beginnen + + Illegal signal name + Ungültiger Name für Signal + + Duplicate method name Mehrfaches Auftreten eines Methodennamens @@ -2034,6 +2039,11 @@ nach Methodennamen dürfen nicht mit einem Großbuchstaben beginnen + + Illegal method name + Ungültiger Name für Methode + + Property value set multiple times Mehrfache Zuweisung eines Wertes an eine Eigenschaft @@ -7713,21 +7723,53 @@ Bitte wählen Sie einen anderen Dateinamen. Kontext4 - + Call + Button to start a call (note: a separate button is used to end the call) Anruf - + Hangup + Button to end a call (note: a separate button is used to start the call) Auflegen + + Toggle Call/Hangup + Button that will hang up if we're in call, or make a call if we're not. + Anrufen/Aufhängen + + Flip Umdrehen + + Voice Dial + Button to trigger voice dialling + Sprachwahl + + + + Last Number Redial + Button to redial the last number called + Wahlwiederholung + + + + Camera Shutter + Button to trigger the camera shutter (take a picture) + Auslöser + + + + Camera Focus + Button to focus the camera + Scharfstellen + + Kanji Kanji -- cgit v0.12 From 1350f26569a4ab802ba93dc23e5dcb964a0cd3a5 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 7 Jul 2010 10:24:53 +0200 Subject: Add missing API shims There were still a couple of functions that didn't have them. This could cause said functions to crash if multiple script engines were being used. Reviewed-by: Jedrzej Nowacki --- src/script/api/qscriptvalue.cpp | 6 ++++++ tests/auto/qscriptengine/tst_qscriptengine.cpp | 29 ++++++++++++++++++++++++++ tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 4 ++++ 3 files changed, 39 insertions(+) diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 451d1b0..f6390bb 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1268,6 +1268,7 @@ QDateTime QScriptValue::toDateTime() const Q_D(const QScriptValue); if (!d || !d->engine) return QDateTime(); + QScript::APIShim shim(d->engine); return QScriptEnginePrivate::toDateTime(d->engine->currentFrame, d->jscValue); } @@ -1284,6 +1285,7 @@ QRegExp QScriptValue::toRegExp() const Q_D(const QScriptValue); if (!d || !d->engine) return QRegExp(); + QScript::APIShim shim(d->engine); return QScriptEnginePrivate::toRegExp(d->engine->currentFrame, d->jscValue); } #endif // QT_NO_REGEXP @@ -1303,6 +1305,7 @@ QObject *QScriptValue::toQObject() const Q_D(const QScriptValue); if (!d || !d->engine) return 0; + QScript::APIShim shim(d->engine); return QScriptEnginePrivate::toQObject(d->engine->currentFrame, d->jscValue); } @@ -1317,6 +1320,7 @@ const QMetaObject *QScriptValue::toQMetaObject() const Q_D(const QScriptValue); if (!d || !d->engine) return 0; + QScript::APIShim shim(d->engine); return QScriptEnginePrivate::toQMetaObject(d->engine->currentFrame, d->jscValue); } @@ -1407,6 +1411,7 @@ QScriptValue QScriptValue::property(quint32 arrayIndex, Q_D(const QScriptValue); if (!d || !d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); return d->engine->scriptValueFromJSCValue(d->property(arrayIndex, mode)); } @@ -1434,6 +1439,7 @@ void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value, "cannot set value created in a different engine"); return; } + QScript::APIShim shim(d->engine); JSC::JSValue jsValue = d->engine->scriptValueToJSCValue(value); d->setProperty(arrayIndex, jsValue, flags); } diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 6885adf..7a732cc 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -4265,6 +4265,35 @@ void tst_QScriptEngine::reentrancy() QScriptEngine eng; QCOMPARE(eng.evaluate("Array()").toString(), QString()); } + + { + QScriptEngine eng1; + QScriptEngine eng2; + { + QScriptValue d1 = eng1.newDate(0); + QScriptValue d2 = eng2.newDate(0); + QCOMPARE(d1.toDateTime(), d2.toDateTime()); + QCOMPARE(d2.toDateTime(), d1.toDateTime()); + } + { + QScriptValue r1 = eng1.newRegExp("foo", "gim"); + QScriptValue r2 = eng2.newRegExp("foo", "gim"); + QCOMPARE(r1.toRegExp(), r2.toRegExp()); + QCOMPARE(r2.toRegExp(), r1.toRegExp()); + } + { + QScriptValue o1 = eng1.newQObject(this); + QScriptValue o2 = eng2.newQObject(this); + QCOMPARE(o1.toQObject(), o2.toQObject()); + QCOMPARE(o2.toQObject(), o1.toQObject()); + } + { + QScriptValue mo1 = eng1.newQMetaObject(&staticMetaObject); + QScriptValue mo2 = eng2.newQMetaObject(&staticMetaObject); + QCOMPARE(mo1.toQMetaObject(), mo2.toQMetaObject()); + QCOMPARE(mo2.toQMetaObject(), mo1.toQMetaObject()); + } + } } void tst_QScriptEngine:: incDecNonObjectProperty() diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 8aa4e711..83a3388 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -2123,6 +2123,10 @@ void tst_QScriptValue::getSetProperty() QVERIFY(object.property(foo).strictlyEquals(num)); QVERIFY(object.property("foo").strictlyEquals(num)); QVERIFY(object.propertyFlags(foo) == 0); + + // Setting index property on non-Array + object.setProperty(13, num); + QVERIFY(object.property(13).equals(num)); } void tst_QScriptValue::arrayElementGetterSetter() -- cgit v0.12 From 0ad74254d0810459bc08fdf9c0898a0d73f596b0 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 7 Jul 2010 10:50:58 +0200 Subject: qdoc: Removed a lot of dead code to minimize confusion. --- tools/qdoc3/htmlgenerator.cpp | 229 +----------------------------------------- tools/qdoc3/htmlgenerator.h | 6 -- 2 files changed, 1 insertion(+), 234 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 4461b48..b7ab4d6 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -346,17 +346,6 @@ QString HtmlGenerator::format() */ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) { -#if 0 - // Copy the stylesheets from the directory containing the qdocconf file. - // ### This should be changed to use a special directory in doc/src. - QStringList::ConstIterator styleIter = stylesheets.begin(); - QDir configPath = QDir::current(); - while (styleIter != stylesheets.end()) { - QString filePath = configPath.absoluteFilePath(*styleIter); - Config::copyFile(Location(), filePath, filePath, outputDir()); - ++styleIter; - } -#endif myTree = tree; nonCompatClasses.clear(); mainClasses.clear(); @@ -371,9 +360,6 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) findAllFunctions(tree->root()); findAllLegaleseTexts(tree->root()); findAllNamespaces(tree->root()); -#ifdef ZZZ_QDOC_QML - findAllQmlClasses(tree->root()); -#endif findAllSince(tree->root()); PageGenerator::generateTree(tree, marker); @@ -1259,30 +1245,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" << Atom(Atom::LineBreak); -#if 0 - // No longer used because the modeule name is a breadcrumb. - QString fixedModule = inner->moduleName(); - if (fixedModule == "Qt3SupportLight") - fixedModule = "Qt3Support"; - if (!fixedModule.isEmpty()) - subtitleText << "[" << Atom(Atom::AutoLink, fixedModule) << " module]"; - - if (fixedModule.isEmpty()) { - QMultiMap publicGroups = myTree->publicGroups(); - QList groupNames = publicGroups.values(inner->name()); - if (!groupNames.isEmpty()) { - qSort(groupNames.begin(), groupNames.end()); - subtitleText << "["; - for (int j=0; jsections(inner, CodeMarker::Summary, CodeMarker::Okay); generateTableOfContents(inner,marker,§ions); @@ -1853,7 +1815,7 @@ void HtmlGenerator::generateHeader(const QString& title, generateBreadCrumbs(title,node,marker); out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); -#if 0 // Removed for new docf format. MWS +#if 0 // Removed for new doc format. MWS if (node && !node->links().empty()) out() << "

\n" << navigationLinks << "

\n"; #endif @@ -2665,19 +2627,7 @@ void HtmlGenerator::generateQmlItem(const Node *node, marked.replace("<@type>", ""); marked.replace("", ""); } - if (node->type() == Node::QmlProperty) { - const QmlPropertyNode* qpn = static_cast(node); - if (!summary && qpn->name() == "color" && qpn->dataType() == "color") { - if (relative && relative->name() == "GradientStop") { - qDebug() << "color : color"; - debugging_on = true; - qDebug() << " " << relative->name() << relative->type() << relative->subType(); - qDebug() << marked; - } - } - } out() << highlightedCode(marked, marker, relative, false, node); - debugging_on = false; } #endif @@ -3069,13 +3019,6 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) { par1 = QStringRef(); const Node* n = marker->resolveTarget(arg.toString(), myTree, relative, self); - if (HtmlGenerator::debugging_on) { - qDebug() << "arg.toString()" << arg.toString(); - if (n) { - qDebug() << " " << n->name() << n->type() << n->subType(); - qDebug() << " " << relative->name() << relative->type() << relative->subType(); - } - } addLink(linkForNode(n,relative), arg, &html); handled = true; } @@ -3681,13 +3624,6 @@ void HtmlGenerator::findAllSince(const InnerNode *node) } } -#if 0 - const QRegExp versionSeparator("[\\-\\.]"); - const int minorIndex = version.indexOf(versionSeparator); - const int patchIndex = version.indexOf(versionSeparator, minorIndex+1); - version = version.left(patchIndex); -#endif - void HtmlGenerator::findAllFunctions(const InnerNode *node) { NodeList::ConstIterator c = node->childNodes().begin(); @@ -3751,29 +3687,6 @@ void HtmlGenerator::findAllNamespaces(const InnerNode *node) } } -#ifdef ZZZ_QDOC_QML -/*! - This function finds all the qml element nodes and - stores them in a map for later use. - */ -void HtmlGenerator::findAllQmlClasses(const InnerNode *node) -{ - NodeList::const_iterator c = node->childNodes().constBegin(); - while (c != node->childNodes().constEnd()) { - if ((*c)->type() == Node::Fake) { - const FakeNode* fakeNode = static_cast(*c); - if (fakeNode->subType() == Node::QmlClass) { - const QmlClassNode* qmlNode = - static_cast(fakeNode); - const Node* n = qmlNode->classNode(); - } - qmlClasses.insert(fakeNode->name(),*c); - } - ++c; - } -} -#endif - int HtmlGenerator::hOffset(const Node *node) { switch (node->type()) { @@ -3782,12 +3695,6 @@ int HtmlGenerator::hOffset(const Node *node) return 2; case Node::Fake: return 1; -#if 0 - if (node->doc().briefText().isEmpty()) - return 1; - else - return 2; -#endif case Node::Enum: case Node::Typedef: case Node::Function: @@ -4461,138 +4368,4 @@ void HtmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marke #endif -#if 0 // fossil removed for new doc format MWS 19/04/2010 - out() << "\n"; - out() << QString("\n").arg(naturalLanguage); - - QString shortVersion; - if ((project != "Qtopia") && (project != "Qt Extended")) { - shortVersion = project + " " + shortVersion + ": "; - if (node && !node->doc().location().isEmpty()) - out() << "\n"; - - shortVersion = myTree->version(); - if (shortVersion.count(QChar('.')) == 2) - shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); - if (!shortVersion.isEmpty()) { - if (project == "QSA") - shortVersion = "QSA " + shortVersion + ": "; - else - shortVersion = "Qt " + shortVersion + ": "; - } - } - - out() << "\n" - " " << shortVersion << protectEnc(title) << "\n"; - out() << QString("").arg(outputEncoding); - - if (!style.isEmpty()) - out() << " \n"; - - const QMap &metaMap = node->doc().metaTagMap(); - if (!metaMap.isEmpty()) { - QMapIterator i(metaMap); - while (i.hasNext()) { - i.next(); - out() << " \n"; - } - } - - navigationLinks.clear(); - - if (node && !node->links().empty()) { - QPair linkPair; - QPair anchorPair; - const Node *linkNode; - - if (node->links().contains(Node::PreviousLink)) { - linkPair = node->links()[Node::PreviousLink]; - linkNode = findNodeForTarget(linkPair.first, node, marker); - if (!linkNode || linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - - out() << " \n"; - - navigationLinks += "[Previous: "; - if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty()) - navigationLinks += protectEnc(anchorPair.second); - else - navigationLinks += protectEnc(linkPair.second); - navigationLinks += "]\n"; - } - if (node->links().contains(Node::ContentsLink)) { - linkPair = node->links()[Node::ContentsLink]; - linkNode = findNodeForTarget(linkPair.first, node, marker); - if (!linkNode || linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - - out() << " \n"; - - navigationLinks += "["; - if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty()) - navigationLinks += protectEnc(anchorPair.second); - else - navigationLinks += protectEnc(linkPair.second); - navigationLinks += "]\n"; - } - if (node->links().contains(Node::NextLink)) { - linkPair = node->links()[Node::NextLink]; - linkNode = findNodeForTarget(linkPair.first, node, marker); - if (!linkNode || linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - - out() << " \n"; - - navigationLinks += "[Next: "; - if (linkPair.first == linkPair.second && !anchorPair.second.isEmpty()) - navigationLinks += protectEnc(anchorPair.second); - else - navigationLinks += protectEnc(linkPair.second); - navigationLinks += "]\n"; - } - if (node->links().contains(Node::IndexLink)) { - linkPair = node->links()[Node::IndexLink]; - linkNode = findNodeForTarget(linkPair.first, node, marker); - if (!linkNode || linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - out() << " \n"; - } - if (node->links().contains(Node::StartLink)) { - linkPair = node->links()[Node::StartLink]; - linkNode = findNodeForTarget(linkPair.first, node, marker); - if (!linkNode || linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - out() << " \n"; - } - } - - foreach (const QString &stylesheet, stylesheets) { - out() << " \n"; - } - - foreach (const QString &customHeadElement, customHeadElements) { - out() << " " << customHeadElement << "\n"; - } - - out() << "\n" - #endif - QT_END_NAMESPACE diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index a2fadf6..9c5be15 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -237,9 +237,6 @@ class HtmlGenerator : public PageGenerator void findAllFunctions(const InnerNode *node); void findAllLegaleseTexts(const InnerNode *node); void findAllNamespaces(const InnerNode *node); -#ifdef ZZZ_QDOC_QML - void findAllQmlClasses(const InnerNode *node); -#endif void findAllSince(const InnerNode *node); static int hOffset(const Node *node); static bool isThreeColumnEnumValueTable(const Atom *atom); @@ -317,9 +314,6 @@ class HtmlGenerator : public PageGenerator NodeMap obsoleteClasses; NodeMap namespaceIndex; NodeMap serviceClasses; -#ifdef QDOC_QML - NodeMap qmlClasses; -#endif QMap funcIndex; QMap legaleseTexts; NewSinceMaps newSinceMaps; -- cgit v0.12 From b139e7e96e5c47b412c4f0bbc4ae11d5cca99e61 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 6 Jul 2010 19:39:52 +0200 Subject: run dep commands in build dir the file names are given relative to the build directory, so the command needs to be run in it as well. this is a more expected (and simpler) fix than the alternative, which would be giving file names relative to the source directory. reasons not to fix: - due to some other bug, the problem really affects only builds where the build dir is not at the same level as the source dir - otherwise, absolute paths would be passed anyway - it has some breakage potential for the cases where the commands actually expect being run in the source dir - it can be worked around by manually injecting the cd statement into the command reasons why i still fixed it: - it doesn't affect in-source builds, and it seems that most complex build systems (which would define custom compilers with depend_command) don't support shadow builds anyway - people who needed things to work probably already used $$OUT_PWD somehow (either a "cd" at the start, or prepending it to each path), so this change will be practically a no-op - "it's just dependencies, and these are known to be broken in qmake anyway" Reviewed-by: joerg Task-number: QTBUG-1918 --- qmake/generators/makefile.cpp | 8 ++++++-- tests/auto/qmake/testdata/simple_app/build/README | 1 + tests/auto/qmake/testdata/simple_app/simple_app.pro | 1 + tests/auto/qmake/testdata/simple_app/test.qrc | 5 +++++ tests/auto/qmake/tst_qmake.cpp | 16 ++++++++++++++++ 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/auto/qmake/testdata/simple_app/build/README create mode 100644 tests/auto/qmake/testdata/simple_app/test.qrc diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index d6b3e09..45a96f5 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1756,6 +1756,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } QStringList tmp_dep = project->values((*it) + ".depends"); QString tmp_dep_cmd; + QString dep_cd_cmd; if(!project->isEmpty((*it) + ".depend_command")) { int argv0 = -1; QStringList cmdline = project->values((*it) + ".depend_command"); @@ -1774,6 +1775,9 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) cmdline[argv0] = escapeFilePath(cmdline.at(argv0)); } } + dep_cd_cmd = QLatin1String("cd ") + + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + + QLatin1String(" && "); } QStringList &vars = project->values((*it) + ".variables"); if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) @@ -1875,7 +1879,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) char buff[256]; QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, (*input), tmp_out); - dep_cmd = fixEnvVariables(dep_cmd); + dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -1973,7 +1977,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) if(!tmp_dep_cmd.isEmpty() && doDepends()) { char buff[256]; QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, (*input), out); - dep_cmd = fixEnvVariables(dep_cmd); + dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { diff --git a/tests/auto/qmake/testdata/simple_app/build/README b/tests/auto/qmake/testdata/simple_app/build/README new file mode 100644 index 0000000..acfd9d9 --- /dev/null +++ b/tests/auto/qmake/testdata/simple_app/build/README @@ -0,0 +1 @@ +Here to ensure build/ exists, used by the simple_app_shadowbuild2 test. diff --git a/tests/auto/qmake/testdata/simple_app/simple_app.pro b/tests/auto/qmake/testdata/simple_app/simple_app.pro index f496d5b..a8c4ad6 100644 --- a/tests/auto/qmake/testdata/simple_app/simple_app.pro +++ b/tests/auto/qmake/testdata/simple_app/simple_app.pro @@ -3,6 +3,7 @@ CONFIG += qt warn_on HEADERS = test_file.h SOURCES = test_file.cpp \ main.cpp +RESOURCES = test.qrc TARGET = simple_app DESTDIR = ./ diff --git a/tests/auto/qmake/testdata/simple_app/test.qrc b/tests/auto/qmake/testdata/simple_app/test.qrc new file mode 100644 index 0000000..decde3d --- /dev/null +++ b/tests/auto/qmake/testdata/simple_app/test.qrc @@ -0,0 +1,5 @@ + + + test.qrc + + diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/qmake/tst_qmake.cpp index 03054e7..5efe714 100644 --- a/tests/auto/qmake/tst_qmake.cpp +++ b/tests/auto/qmake/tst_qmake.cpp @@ -65,6 +65,7 @@ public slots: private slots: void simple_app(); void simple_app_shadowbuild(); + void simple_app_shadowbuild2(); void simple_lib(); void simple_dll(); void subdirs(); @@ -163,6 +164,21 @@ void tst_qmake::simple_app_shadowbuild() QVERIFY( test_compiler.removeMakefile( buildDir ) ); } +void tst_qmake::simple_app_shadowbuild2() +{ + QString workDir = base_path + "/testdata/simple_app"; + QString buildDir = base_path + "/testdata/simple_app/build"; + + QVERIFY( test_compiler.qmake( workDir, "simple_app", buildDir )); + QVERIFY( test_compiler.make( buildDir )); + QVERIFY( test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" )); + QVERIFY( test_compiler.makeClean( buildDir )); + QVERIFY( test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" )); // Should still exist after a make clean + QVERIFY( test_compiler.makeDistClean( buildDir )); + QVERIFY( !test_compiler.exists( buildDir, "simple_app", Exe, "1.0.0" )); // Should not exist after a make distclean + QVERIFY( test_compiler.removeMakefile( buildDir ) ); +} + void tst_qmake::simple_dll() { QString workDir = base_path + "/testdata/simple_dll"; -- cgit v0.12 From 42fe2bfb65c85fc630efe32aa1d62d66f2caab2a Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Wed, 7 Jul 2010 12:05:35 +0200 Subject: Fixed whitespace formatting Merge-request: 715 Reviewed-by: Oswald Buddenhagen --- src/plugins/sqldrivers/db2/db2.pro | 2 +- src/plugins/sqldrivers/ibase/ibase.pro | 2 +- src/plugins/sqldrivers/mysql/mysql.pro | 2 +- src/plugins/sqldrivers/oci/oci.pro | 2 +- src/plugins/sqldrivers/odbc/odbc.pro | 2 +- src/plugins/sqldrivers/psql/psql.pro | 2 +- src/plugins/sqldrivers/sqlite/sqlite.pro | 2 +- src/plugins/sqldrivers/sqlite2/sqlite2.pro | 2 +- src/plugins/sqldrivers/tds/tds.pro | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro index 5223beb..25ca499 100644 --- a/src/plugins/sqldrivers/db2/db2.pro +++ b/src/plugins/sqldrivers/db2/db2.pro @@ -1,4 +1,4 @@ -TARGET = qsqldb2 +TARGET = qsqldb2 HEADERS = ../../../sql/drivers/db2/qsql_db2.h SOURCES = main.cpp \ diff --git a/src/plugins/sqldrivers/ibase/ibase.pro b/src/plugins/sqldrivers/ibase/ibase.pro index ec2bc7b..bb73adb 100644 --- a/src/plugins/sqldrivers/ibase/ibase.pro +++ b/src/plugins/sqldrivers/ibase/ibase.pro @@ -1,4 +1,4 @@ -TARGET = qsqlibase +TARGET = qsqlibase HEADERS = ../../../sql/drivers/ibase/qsql_ibase.h SOURCES = main.cpp \ diff --git a/src/plugins/sqldrivers/mysql/mysql.pro b/src/plugins/sqldrivers/mysql/mysql.pro index 9f5c619..b808c8e 100644 --- a/src/plugins/sqldrivers/mysql/mysql.pro +++ b/src/plugins/sqldrivers/mysql/mysql.pro @@ -1,4 +1,4 @@ -TARGET = qsqlmysql +TARGET = qsqlmysql HEADERS = ../../../sql/drivers/mysql/qsql_mysql.h SOURCES = main.cpp \ diff --git a/src/plugins/sqldrivers/oci/oci.pro b/src/plugins/sqldrivers/oci/oci.pro index 3bf70a1..d75827e 100644 --- a/src/plugins/sqldrivers/oci/oci.pro +++ b/src/plugins/sqldrivers/oci/oci.pro @@ -1,4 +1,4 @@ -TARGET = qsqloci +TARGET = qsqloci HEADERS = ../../../sql/drivers/oci/qsql_oci.h SOURCES = main.cpp \ diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro index 2bf85f1..70070db 100644 --- a/src/plugins/sqldrivers/odbc/odbc.pro +++ b/src/plugins/sqldrivers/odbc/odbc.pro @@ -1,4 +1,4 @@ -TARGET = qsqlodbc +TARGET = qsqlodbc HEADERS = ../../../sql/drivers/odbc/qsql_odbc.h SOURCES = main.cpp \ diff --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro index 80a5348..9586695 100644 --- a/src/plugins/sqldrivers/psql/psql.pro +++ b/src/plugins/sqldrivers/psql/psql.pro @@ -1,4 +1,4 @@ -TARGET = qsqlpsql +TARGET = qsqlpsql HEADERS = ../../../sql/drivers/psql/qsql_psql.h SOURCES = main.cpp \ diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro index fb31233..75f04b9 100644 --- a/src/plugins/sqldrivers/sqlite/sqlite.pro +++ b/src/plugins/sqldrivers/sqlite/sqlite.pro @@ -1,4 +1,4 @@ -TARGET = qsqlite +TARGET = qsqlite HEADERS = ../../../sql/drivers/sqlite/qsql_sqlite.h SOURCES = smain.cpp \ diff --git a/src/plugins/sqldrivers/sqlite2/sqlite2.pro b/src/plugins/sqldrivers/sqlite2/sqlite2.pro index 88db22a..0f6c19a 100644 --- a/src/plugins/sqldrivers/sqlite2/sqlite2.pro +++ b/src/plugins/sqldrivers/sqlite2/sqlite2.pro @@ -1,4 +1,4 @@ -TARGET = qsqlite2 +TARGET = qsqlite2 HEADERS = ../../../sql/drivers/sqlite2/qsql_sqlite2.h SOURCES = smain.cpp \ diff --git a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro index 08a166b..ba40be5 100644 --- a/src/plugins/sqldrivers/tds/tds.pro +++ b/src/plugins/sqldrivers/tds/tds.pro @@ -1,4 +1,4 @@ -TARGET = qsqltds +TARGET = qsqltds HEADERS = ../../../sql/drivers/tds/qsql_tds.h -- cgit v0.12 From d7557de99b38031906c17c54496cb76a13dec5f7 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Wed, 7 Jul 2010 12:05:36 +0200 Subject: Consolidate sql driver configuration redundancy Previously sql driver recipes each appeared in both the plugin pro file and src/sql/drivers/drivers.pri for building into QtSql. Split driver recipes into shared pri files. Also split bundled 3rd party sqlite code recipe into a shared pri. Merge-request: 715 Reviewed-by: Oswald Buddenhagen --- src/3rdparty/sqlite.pri | 4 + src/plugins/sqldrivers/db2/db2.pro | 8 +- src/plugins/sqldrivers/ibase/ibase.pro | 12 +-- src/plugins/sqldrivers/mysql/mysql.pro | 21 +---- src/plugins/sqldrivers/oci/oci.pro | 11 +-- src/plugins/sqldrivers/odbc/odbc.pro | 17 +--- src/plugins/sqldrivers/psql/psql.pro | 16 +--- src/plugins/sqldrivers/sqlite/sqlite.pro | 15 +--- src/plugins/sqldrivers/sqlite2/sqlite2.pro | 7 +- src/plugins/sqldrivers/tds/tds.pro | 13 +-- src/sql/drivers/db2/qsql_db2.pri | 8 ++ src/sql/drivers/drivers.pri | 130 +++-------------------------- src/sql/drivers/ibase/qsql_ibase.pri | 11 +++ src/sql/drivers/mysql/qsql_mysql.pri | 16 ++++ src/sql/drivers/oci/qsql_oci.pri | 9 ++ src/sql/drivers/odbc/qsql_odbc.pri | 13 +++ src/sql/drivers/psql/qsql_psql.pri | 13 +++ src/sql/drivers/sqlite/qsql_sqlite.pri | 9 ++ src/sql/drivers/sqlite2/qsql_sqlite2.pri | 4 + src/sql/drivers/tds/qsql_tds.pri | 10 +++ 20 files changed, 126 insertions(+), 221 deletions(-) create mode 100644 src/3rdparty/sqlite.pri create mode 100644 src/sql/drivers/db2/qsql_db2.pri create mode 100644 src/sql/drivers/ibase/qsql_ibase.pri create mode 100644 src/sql/drivers/mysql/qsql_mysql.pri create mode 100644 src/sql/drivers/oci/qsql_oci.pri create mode 100644 src/sql/drivers/odbc/qsql_odbc.pri create mode 100644 src/sql/drivers/psql/qsql_psql.pri create mode 100644 src/sql/drivers/sqlite/qsql_sqlite.pri create mode 100644 src/sql/drivers/sqlite2/qsql_sqlite2.pri create mode 100644 src/sql/drivers/tds/qsql_tds.pri diff --git a/src/3rdparty/sqlite.pri b/src/3rdparty/sqlite.pri new file mode 100644 index 0000000..575412d --- /dev/null +++ b/src/3rdparty/sqlite.pri @@ -0,0 +1,4 @@ +CONFIG(release, debug|release):DEFINES *= NDEBUG +DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE +INCLUDEPATH += $$PWD/sqlite +SOURCES += $$PWD/sqlite/sqlite3.c diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro index 25ca499..e053f37 100644 --- a/src/plugins/sqldrivers/db2/db2.pro +++ b/src/plugins/sqldrivers/db2/db2.pro @@ -1,10 +1,6 @@ TARGET = qsqldb2 -HEADERS = ../../../sql/drivers/db2/qsql_db2.h -SOURCES = main.cpp \ - ../../../sql/drivers/db2/qsql_db2.cpp - -unix:!contains( LIBS, .*db2.* ):LIBS *= -ldb2 -win32:!contains( LIBS, .*db2.* ):LIBS *= -ldb2cli +SOURCES = main.cpp +include(../../../sql/drivers/db2/qsql_db2.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/ibase/ibase.pro b/src/plugins/sqldrivers/ibase/ibase.pro index bb73adb..7870ec8 100644 --- a/src/plugins/sqldrivers/ibase/ibase.pro +++ b/src/plugins/sqldrivers/ibase/ibase.pro @@ -1,14 +1,6 @@ TARGET = qsqlibase -HEADERS = ../../../sql/drivers/ibase/qsql_ibase.h -SOURCES = main.cpp \ - ../../../sql/drivers/ibase/qsql_ibase.cpp - -unix:!contains( LIBS, .*gds.* ):!contains( LIBS, .*libfb.* ):LIBS *= -lgds - -win32:!contains( LIBS, .*gds.* ):!contains( LIBS, .*fbclient.* ) { - !win32-borland:LIBS *= -lgds32_ms - win32-borland:LIBS += gds32.lib -} +SOURCES = main.cpp +include(../../../sql/drivers/ibase/qsql_ibase.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/mysql/mysql.pro b/src/plugins/sqldrivers/mysql/mysql.pro index b808c8e..b6d42ff 100644 --- a/src/plugins/sqldrivers/mysql/mysql.pro +++ b/src/plugins/sqldrivers/mysql/mysql.pro @@ -1,23 +1,6 @@ TARGET = qsqlmysql -HEADERS = ../../../sql/drivers/mysql/qsql_mysql.h -SOURCES = main.cpp \ - ../../../sql/drivers/mysql/qsql_mysql.cpp - -unix: { - isEmpty(QT_LFLAGS_MYSQL) { - !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) { - use_libmysqlclient_r:LIBS *= -lmysqlclient_r - else:LIBS *= -lmysqlclient - } - } else { - LIBS *= $$QT_LFLAGS_MYSQL - QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL - } -} - -win32:!contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*) { - LIBS *= -llibmysql -} +SOURCES = main.cpp +include(../../../sql/drivers/mysql/qsql_mysql.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/oci/oci.pro b/src/plugins/sqldrivers/oci/oci.pro index d75827e..d7dcce9 100644 --- a/src/plugins/sqldrivers/oci/oci.pro +++ b/src/plugins/sqldrivers/oci/oci.pro @@ -1,13 +1,6 @@ TARGET = qsqloci -HEADERS = ../../../sql/drivers/oci/qsql_oci.h -SOURCES = main.cpp \ - ../../../sql/drivers/oci/qsql_oci.cpp - -win32:LIBS *= -loci - -unix:!contains( LIBS, .*clnts.* ):LIBS *= -lclntsh - -macx:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ +SOURCES = main.cpp +include(../../../sql/drivers/oci/qsql_oci.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro index 70070db..677eb6e 100644 --- a/src/plugins/sqldrivers/odbc/odbc.pro +++ b/src/plugins/sqldrivers/odbc/odbc.pro @@ -1,19 +1,6 @@ TARGET = qsqlodbc -HEADERS = ../../../sql/drivers/odbc/qsql_odbc.h -SOURCES = main.cpp \ - ../../../sql/drivers/odbc/qsql_odbc.cpp - -unix { - !contains( LIBS, .*odbc.* ) { - LIBS *= $$QT_LFLAGS_ODBC - } - DEFINES += UNICODE -} - -win32 { - !win32-borland:LIBS *= -lodbc32 - win32-borland:LIBS *= $(BCB)/lib/PSDK/odbc32.lib -} +SOURCES = main.cpp +include(../../../sql/drivers/odbc/qsql_odbc.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro index 9586695..8276c0a 100644 --- a/src/plugins/sqldrivers/psql/psql.pro +++ b/src/plugins/sqldrivers/psql/psql.pro @@ -1,18 +1,6 @@ TARGET = qsqlpsql -HEADERS = ../../../sql/drivers/psql/qsql_psql.h -SOURCES = main.cpp \ - ../../../sql/drivers/psql/qsql_psql.cpp - -unix|win32-g++*: { - !isEmpty(QT_LFLAGS_PSQL) { - !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz - !static:LIBS *= $$QT_LFLAGS_PSQL - QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL - } - !contains(LIBS, .*pq.*):LIBS *= -lpq -} - -win32:!win32-g++*:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32 +SOURCES = main.cpp +include(../../../sql/drivers/psql/qsql_psql.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro index 75f04b9..f4c1671 100644 --- a/src/plugins/sqldrivers/sqlite/sqlite.pro +++ b/src/plugins/sqldrivers/sqlite/sqlite.pro @@ -1,18 +1,7 @@ TARGET = qsqlite -HEADERS = ../../../sql/drivers/sqlite/qsql_sqlite.h -SOURCES = smain.cpp \ - ../../../sql/drivers/sqlite/qsql_sqlite.cpp - -!system-sqlite:!contains( LIBS, .*sqlite.* ) { - CONFIG(release, debug|release):DEFINES *= NDEBUG - DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE - INCLUDEPATH += ../../../3rdparty/sqlite - SOURCES += ../../../3rdparty/sqlite/sqlite3.c -} else { - LIBS *= $$QT_LFLAGS_SQLITE - QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE -} +SOURCES = smain.cpp +include(../../../sql/drivers/sqlite/qsql_sqlite.pri) wince*: DEFINES += HAVE_LOCALTIME_S=0 diff --git a/src/plugins/sqldrivers/sqlite2/sqlite2.pro b/src/plugins/sqldrivers/sqlite2/sqlite2.pro index 0f6c19a..e6197b9 100644 --- a/src/plugins/sqldrivers/sqlite2/sqlite2.pro +++ b/src/plugins/sqldrivers/sqlite2/sqlite2.pro @@ -1,9 +1,6 @@ TARGET = qsqlite2 -HEADERS = ../../../sql/drivers/sqlite2/qsql_sqlite2.h -SOURCES = smain.cpp \ - ../../../sql/drivers/sqlite2/qsql_sqlite2.cpp - -!contains(LIBS, .*sqlite.*):LIBS *= -lsqlite +SOURCES = smain.cpp +include(../../../sql/drivers/sqlite2/qsql_sqlite2.pri) include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro index ba40be5..b8e8ded 100644 --- a/src/plugins/sqldrivers/tds/tds.pro +++ b/src/plugins/sqldrivers/tds/tds.pro @@ -1,15 +1,6 @@ TARGET = qsqltds -HEADERS = ../../../sql/drivers/tds/qsql_tds.h - -SOURCES = main.cpp \ - ../../../sql/drivers/tds/qsql_tds.cpp - -unix:!contains( LIBS, .*sybdb.* ):LIBS *= -lsybdb - -win32 { - !win32-borland:LIBS *= -lNTWDBLIB - win32-borland:LIBS *= $(BCB)/lib/PSDK/NTWDBLIB.LIB -} +SOURCES = main.cpp +include(../../../sql/drivers/tds/qsql_tds.pri) include(../qsqldriverbase.pri) diff --git a/src/sql/drivers/db2/qsql_db2.pri b/src/sql/drivers/db2/qsql_db2.pri new file mode 100644 index 0000000..e53a8a0 --- /dev/null +++ b/src/sql/drivers/db2/qsql_db2.pri @@ -0,0 +1,8 @@ +HEADERS += $$PWD/qsql_db2.h +SOURCES += $$PWD/qsql_db2.cpp + +unix { + !contains(LIBS, .*db2.*):LIBS *= -ldb2 +} else:!win32-borland { + !contains(LIBS, .*db2.*):LIBS *= -ldb2cli +} diff --git a/src/sql/drivers/drivers.pri b/src/sql/drivers/drivers.pri index 05e7265..3af5525 100644 --- a/src/sql/drivers/drivers.pri +++ b/src/sql/drivers/drivers.pri @@ -1,119 +1,11 @@ -contains(sql-drivers, all ) { - sql-driver += psql mysql odbc oci tds db2 sqlite ibase -} - -contains(sql-drivers, psql) { - HEADERS += drivers/psql/qsql_psql.h - SOURCES += drivers/psql/qsql_psql.cpp - - unix|win32-g++* { - !static:!isEmpty(QT_LFLAGS_PSQL) { - !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz - !static:LIBS *= $$QT_LFLAGS_PSQL - QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL - } - !contains(LIBS, .*pq.*):LIBS *= -lpq - } else:win32:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32 -} - -contains(sql-drivers, mysql) { - HEADERS += drivers/mysql/qsql_mysql.h - SOURCES += drivers/mysql/qsql_mysql.cpp - - unix { - isEmpty(QT_LFLAGS_MYSQL) { - !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) { - use_libmysqlclient_r:LIBS *= -lmysqlclient_r - else:LIBS *= -lmysqlclient - } - } else { - LIBS *= $$QT_LFLAGS_MYSQL - QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL - } - } - - win32:!contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*) { - !win32-g++*:LIBS *= -llibmysql - else:LIBS *= -lmysql - } -} - -contains(sql-drivers, odbc) { - HEADERS += drivers/odbc/qsql_odbc.h - SOURCES += drivers/odbc/qsql_odbc.cpp - - mac:!contains( LIBS, .*odbc.* ):LIBS *= -liodbc - unix:!contains( LIBS, .*odbc.* ):LIBS *= -lodbc - unix:DEFINES += UNICODE - - win32 { - !win32-borland:LIBS *= -lodbc32 - else:LIBS *= $(BCB)/lib/PSDK/odbc32.lib - } -} - -contains(sql-drivers, oci) { - HEADERS += drivers/oci/qsql_oci.h - SOURCES += drivers/oci/qsql_oci.cpp - - unix:!contains( LIBS, .*clnts.* ):LIBS += -lclntsh - - win32:LIBS += -loci -} - -contains(sql-drivers, tds) { - HEADERS += drivers/tds/qsql_tds.h - SOURCES += drivers/tds/qsql_tds.cpp - - unix:LIBS += -L$SYBASE/lib -lsybdb - - win32 { - !win32-borland:LIBS += -lNTWDBLIB - else:LIBS += $(BCB)/lib/PSDK/NTWDBLIB.LIB - } -} - -contains(sql-drivers, db2) { - HEADERS += drivers/db2/qsql_db2.h - SOURCES += drivers/db2/qsql_db2.cpp - - unix:LIBS += -ldb2 - - win32 { - !win32-borland:LIBS += -ldb2cli -# else:LIBS += $(BCB)/lib/PSDK/db2cli.lib - } -} - -contains(sql-drivers, ibase) { - HEADERS += drivers/ibase/qsql_ibase.h - SOURCES += drivers/ibase/qsql_ibase.cpp - - unix:LIBS *= -lgds - - win32 { - !win32-borland:LIBS *= -lgds32_ms - else:LIBS += gds32.lib - } -} - -contains(sql-drivers, sqlite2) { - HEADERS += drivers/sqlite2/qsql_sqlite2.h - SOURCES += drivers/sqlite2/qsql_sqlite2.cpp - !contains(LIBS, .*sqlite.*):LIBS *= -lsqlite -} - -contains(sql-drivers, sqlite) { - !system-sqlite:!contains( LIBS, .*sqlite3.* ) { - CONFIG(release, debug|release):DEFINES *= NDEBUG - DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE - INCLUDEPATH += ../3rdparty/sqlite - SOURCES += ../3rdparty/sqlite/sqlite3.c - } else { - LIBS *= $$QT_LFLAGS_SQLITE - QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE - } - - HEADERS += drivers/sqlite/qsql_sqlite.h - SOURCES += drivers/sqlite/qsql_sqlite.cpp -} +contains(sql-drivers, all):sql-driver += psql mysql odbc oci tds db2 sqlite ibase + +contains(sql-drivers, psql):include($$PWD/sqlite/qsql_psql.pri) +contains(sql-drivers, mysql):include($$PWD/mysql/qsql_mysql.pri) +contains(sql-drivers, odbc):include($$PWD/odbc/qsql_odbc.pri) +contains(sql-drivers, oci):include($$PWD/oci/qsql_oci.pri) +contains(sql-drivers, tds):include($$PWD/tds/qsql_tds.pri) +contains(sql-drivers, db2):include($$PWD/db2/qsql_db2.pri) +contains(sql-drivers, ibase):include($$PWD/db2/qsql_ibase.pri) +contains(sql-drivers, sqlite2):include($$PWD/sqlite2/qsql_sqlite2.pri) +contains(sql-drivers, sqlite):include($$PWD/sqlite/qsql_sqlite.pri) diff --git a/src/sql/drivers/ibase/qsql_ibase.pri b/src/sql/drivers/ibase/qsql_ibase.pri new file mode 100644 index 0000000..ebcd18a --- /dev/null +++ b/src/sql/drivers/ibase/qsql_ibase.pri @@ -0,0 +1,11 @@ +HEADERS += $$PWD/qsql_ibase.h +SOURCES += $$PWD/qsql_ibase.cpp + +unix { + !contains(LIBS, .*gds.*):!contains(LIBS, .*libfb.*):LIBS *= -lgds +} else { + !contains(LIBS, .*gds.*):!contains(LIBS, .*fbclient.*) { + win32-borland:LIBS += gds32.lib + else:LIBS *= -lgds32_ms + } +} diff --git a/src/sql/drivers/mysql/qsql_mysql.pri b/src/sql/drivers/mysql/qsql_mysql.pri new file mode 100644 index 0000000..801b891 --- /dev/null +++ b/src/sql/drivers/mysql/qsql_mysql.pri @@ -0,0 +1,16 @@ +HEADERS += $$PWD/qsql_mysql.h +SOURCES += $$PWD/qsql_mysql.cpp + +unix { + isEmpty(QT_LFLAGS_MYSQL) { + !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) { + use_libmysqlclient_r:LIBS *= -lmysqlclient_r + else:LIBS *= -lmysqlclient + } + } else { + LIBS *= $$QT_LFLAGS_MYSQL + QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL + } +} else { + !contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*):LIBS *= -llibmysql +} diff --git a/src/sql/drivers/oci/qsql_oci.pri b/src/sql/drivers/oci/qsql_oci.pri new file mode 100644 index 0000000..6859156 --- /dev/null +++ b/src/sql/drivers/oci/qsql_oci.pri @@ -0,0 +1,9 @@ +HEADERS += $$PWD/qsql_oci.h +SOURCES += $$PWD/qsql_oci.cpp + +unix { + !contains(LIBS, .*clnts.*):LIBS *= -lclntsh +} else { + LIBS *= -loci +} +macx:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ diff --git a/src/sql/drivers/odbc/qsql_odbc.pri b/src/sql/drivers/odbc/qsql_odbc.pri new file mode 100644 index 0000000..c4c92be --- /dev/null +++ b/src/sql/drivers/odbc/qsql_odbc.pri @@ -0,0 +1,13 @@ +HEADERS += $$PWD/qsql_odbc.h +SOURCES += $$PWD/qsql_odbc.cpp + +mac { + !contains(LIBS, .*odbc.*):LIBS *= -liodbc +} else:unix { + DEFINES += UNICODE + !contains(LIBS, .*odbc.*):LIBS *= $$QT_LFLAGS_ODBC +} else:win32-borland { + LIBS *= $(BCB)/lib/PSDK/odbc32.lib +} else { + LIBS *= -lodbc32 +} diff --git a/src/sql/drivers/psql/qsql_psql.pri b/src/sql/drivers/psql/qsql_psql.pri new file mode 100644 index 0000000..c282d57 --- /dev/null +++ b/src/sql/drivers/psql/qsql_psql.pri @@ -0,0 +1,13 @@ +HEADERS += $$PWD/qsql_psql.h +SOURCES += $$PWD/qsql_psql.cpp + +unix|win32-g++* { + !static:!isEmpty(QT_LFLAGS_PSQL) { + !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz + LIBS *= $$QT_LFLAGS_PSQL + QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL + } + !contains(LIBS, .*pq.*):LIBS *= -lpq +} else { + !contains(LIBS, .*pq.*):LIBS *= -llibpq -lws2_32 -ladvapi32 +} diff --git a/src/sql/drivers/sqlite/qsql_sqlite.pri b/src/sql/drivers/sqlite/qsql_sqlite.pri new file mode 100644 index 0000000..7ad5936 --- /dev/null +++ b/src/sql/drivers/sqlite/qsql_sqlite.pri @@ -0,0 +1,9 @@ +HEADERS += $$PWD/qsql_sqlite.h +SOURCES += $$PWD/qsql_sqlite.cpp + +!system-sqlite:!contains(LIBS, .*sqlite3.*) { + include($$PWD/../../../3rdparty/sqlite.pri) +} else { + LIBS *= $$QT_LFLAGS_SQLITE + QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE +} diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.pri b/src/sql/drivers/sqlite2/qsql_sqlite2.pri new file mode 100644 index 0000000..9f0e807 --- /dev/null +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.pri @@ -0,0 +1,4 @@ +HEADERS += $PWD/qsql_sqlite2.h +SOURCES += $PWD/qsql_sqlite2.cpp + +!contains(LIBS, .*sqlite.*):LIBS *= -lsqlite diff --git a/src/sql/drivers/tds/qsql_tds.pri b/src/sql/drivers/tds/qsql_tds.pri new file mode 100644 index 0000000..e2662ca --- /dev/null +++ b/src/sql/drivers/tds/qsql_tds.pri @@ -0,0 +1,10 @@ +HEADERS += $$PWD/qsql_tds.h +SOURCES += $$PWD/qsql_tds.cpp + +unix { + !contains(LIBS, .*sybdb.*):LIBS *= -lsybdb +} else:win32-borland { + LIBS *= $(BCB)/lib/PSDK/NTWDBLIB.LIB +} else { + LIBS *= -lNTWDBLIB +} -- cgit v0.12 From 484c05ef374ef1c1043836b074693838d6b30adb Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Wed, 7 Jul 2010 12:05:37 +0200 Subject: Simplify *= to += after contains() test Merge-request: 715 Reviewed-by: Oswald Buddenhagen --- src/sql/drivers/db2/qsql_db2.pri | 4 ++-- src/sql/drivers/ibase/qsql_ibase.pri | 4 ++-- src/sql/drivers/mysql/qsql_mysql.pri | 6 +++--- src/sql/drivers/oci/qsql_oci.pri | 2 +- src/sql/drivers/odbc/qsql_odbc.pri | 4 ++-- src/sql/drivers/psql/qsql_psql.pri | 4 ++-- src/sql/drivers/sqlite2/qsql_sqlite2.pri | 2 +- src/sql/drivers/tds/qsql_tds.pri | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/sql/drivers/db2/qsql_db2.pri b/src/sql/drivers/db2/qsql_db2.pri index e53a8a0..16557f0 100644 --- a/src/sql/drivers/db2/qsql_db2.pri +++ b/src/sql/drivers/db2/qsql_db2.pri @@ -2,7 +2,7 @@ HEADERS += $$PWD/qsql_db2.h SOURCES += $$PWD/qsql_db2.cpp unix { - !contains(LIBS, .*db2.*):LIBS *= -ldb2 + !contains(LIBS, .*db2.*):LIBS += -ldb2 } else:!win32-borland { - !contains(LIBS, .*db2.*):LIBS *= -ldb2cli + !contains(LIBS, .*db2.*):LIBS += -ldb2cli } diff --git a/src/sql/drivers/ibase/qsql_ibase.pri b/src/sql/drivers/ibase/qsql_ibase.pri index ebcd18a..33fbb0d 100644 --- a/src/sql/drivers/ibase/qsql_ibase.pri +++ b/src/sql/drivers/ibase/qsql_ibase.pri @@ -2,10 +2,10 @@ HEADERS += $$PWD/qsql_ibase.h SOURCES += $$PWD/qsql_ibase.cpp unix { - !contains(LIBS, .*gds.*):!contains(LIBS, .*libfb.*):LIBS *= -lgds + !contains(LIBS, .*gds.*):!contains(LIBS, .*libfb.*):LIBS += -lgds } else { !contains(LIBS, .*gds.*):!contains(LIBS, .*fbclient.*) { win32-borland:LIBS += gds32.lib - else:LIBS *= -lgds32_ms + else:LIBS += -lgds32_ms } } diff --git a/src/sql/drivers/mysql/qsql_mysql.pri b/src/sql/drivers/mysql/qsql_mysql.pri index 801b891..1b9c3dd 100644 --- a/src/sql/drivers/mysql/qsql_mysql.pri +++ b/src/sql/drivers/mysql/qsql_mysql.pri @@ -4,13 +4,13 @@ SOURCES += $$PWD/qsql_mysql.cpp unix { isEmpty(QT_LFLAGS_MYSQL) { !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) { - use_libmysqlclient_r:LIBS *= -lmysqlclient_r - else:LIBS *= -lmysqlclient + use_libmysqlclient_r:LIBS += -lmysqlclient_r + else:LIBS += -lmysqlclient } } else { LIBS *= $$QT_LFLAGS_MYSQL QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL } } else { - !contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*):LIBS *= -llibmysql + !contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*):LIBS += -llibmysql } diff --git a/src/sql/drivers/oci/qsql_oci.pri b/src/sql/drivers/oci/qsql_oci.pri index 6859156..60ccc4c 100644 --- a/src/sql/drivers/oci/qsql_oci.pri +++ b/src/sql/drivers/oci/qsql_oci.pri @@ -2,7 +2,7 @@ HEADERS += $$PWD/qsql_oci.h SOURCES += $$PWD/qsql_oci.cpp unix { - !contains(LIBS, .*clnts.*):LIBS *= -lclntsh + !contains(LIBS, .*clnts.*):LIBS += -lclntsh } else { LIBS *= -loci } diff --git a/src/sql/drivers/odbc/qsql_odbc.pri b/src/sql/drivers/odbc/qsql_odbc.pri index c4c92be..8394012 100644 --- a/src/sql/drivers/odbc/qsql_odbc.pri +++ b/src/sql/drivers/odbc/qsql_odbc.pri @@ -2,10 +2,10 @@ HEADERS += $$PWD/qsql_odbc.h SOURCES += $$PWD/qsql_odbc.cpp mac { - !contains(LIBS, .*odbc.*):LIBS *= -liodbc + !contains(LIBS, .*odbc.*):LIBS += -liodbc } else:unix { DEFINES += UNICODE - !contains(LIBS, .*odbc.*):LIBS *= $$QT_LFLAGS_ODBC + !contains(LIBS, .*odbc.*):LIBS += $$QT_LFLAGS_ODBC } else:win32-borland { LIBS *= $(BCB)/lib/PSDK/odbc32.lib } else { diff --git a/src/sql/drivers/psql/qsql_psql.pri b/src/sql/drivers/psql/qsql_psql.pri index c282d57..97db4be 100644 --- a/src/sql/drivers/psql/qsql_psql.pri +++ b/src/sql/drivers/psql/qsql_psql.pri @@ -7,7 +7,7 @@ unix|win32-g++* { LIBS *= $$QT_LFLAGS_PSQL QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL } - !contains(LIBS, .*pq.*):LIBS *= -lpq + !contains(LIBS, .*pq.*):LIBS += -lpq } else { - !contains(LIBS, .*pq.*):LIBS *= -llibpq -lws2_32 -ladvapi32 + !contains(LIBS, .*pq.*):LIBS += -llibpq -lws2_32 -ladvapi32 } diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.pri b/src/sql/drivers/sqlite2/qsql_sqlite2.pri index 9f0e807..76fe255 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.pri +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.pri @@ -1,4 +1,4 @@ HEADERS += $PWD/qsql_sqlite2.h SOURCES += $PWD/qsql_sqlite2.cpp -!contains(LIBS, .*sqlite.*):LIBS *= -lsqlite +!contains(LIBS, .*sqlite.*):LIBS += -lsqlite diff --git a/src/sql/drivers/tds/qsql_tds.pri b/src/sql/drivers/tds/qsql_tds.pri index e2662ca..c552ead 100644 --- a/src/sql/drivers/tds/qsql_tds.pri +++ b/src/sql/drivers/tds/qsql_tds.pri @@ -2,7 +2,7 @@ HEADERS += $$PWD/qsql_tds.h SOURCES += $$PWD/qsql_tds.cpp unix { - !contains(LIBS, .*sybdb.*):LIBS *= -lsybdb + !contains(LIBS, .*sybdb.*):LIBS += -lsybdb } else:win32-borland { LIBS *= $(BCB)/lib/PSDK/NTWDBLIB.LIB } else { -- cgit v0.12 From 0c71b098965ce4779a7da785249497c15b9d1d14 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 8 Jun 2010 11:30:05 +0100 Subject: Prevent crash when video is played without a VideoWidget The Phonon API allows video to be played via a Phonon::MediaObject, even if no Phonon::VideoWidget has been connected to it. This patch prevents the Phonon MMF backend crashing in this scenario due to dereferencing a null pointer. Reviewed-by: Thierry Bastian --- src/3rdparty/phonon/mmf/abstractvideoplayer.cpp | 10 ++++++++-- src/3rdparty/phonon/mmf/videoplayer_dsa.cpp | 7 ++++++- src/3rdparty/phonon/mmf/videoplayer_surface.cpp | 5 ++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp index 2e0ab1c..ecfce9e 100644 --- a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp @@ -211,7 +211,8 @@ void MMF::AbstractVideoPlayer::aspectRatioChanged() TRACE_CONTEXT(AbstractVideoPlayer::aspectRatioChanged, EVideoInternal); TRACE_ENTRY("state %d aspectRatio %d", state()); - updateScaleFactors(m_videoOutput->videoWindowSize()); + if (m_videoOutput) + updateScaleFactors(m_videoOutput->videoWindowSize()); TRACE_EXIT_0(); } @@ -221,7 +222,8 @@ void MMF::AbstractVideoPlayer::scaleModeChanged() TRACE_CONTEXT(AbstractVideoPlayer::scaleModeChanged, EVideoInternal); TRACE_ENTRY("state %d", state()); - updateScaleFactors(m_videoOutput->videoWindowSize()); + if (m_videoOutput) + updateScaleFactors(m_videoOutput->videoWindowSize()); TRACE_EXIT_0(); } @@ -357,6 +359,8 @@ void MMF::AbstractVideoPlayer::videoOutputChanged() void MMF::AbstractVideoPlayer::initVideoOutput() { + Q_ASSERT(m_videoOutput); + bool connected = connect( m_videoOutput, SIGNAL(videoWindowChanged()), this, SLOT(videoWindowChanged()) @@ -400,6 +404,8 @@ QSize scaleToAspect(const QSize &srcRect, int aspectWidth, int aspectHeight) void MMF::AbstractVideoPlayer::updateScaleFactors(const QSize &windowSize, bool apply) { + Q_ASSERT(m_videoOutput); + if (m_videoFrameSize.isValid()) { QRect videoRect; diff --git a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp index 1925471..f0255b1 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp @@ -61,6 +61,8 @@ DsaVideoPlayer::~DsaVideoPlayer() void MMF::DsaVideoPlayer::videoWindowScreenRectChanged() { + Q_ASSERT(m_videoOutput); + QRect windowRect = static_cast(m_videoOutput)->videoWindowScreenRect(); // Clip to physical window size @@ -130,6 +132,8 @@ void MMF::DsaVideoPlayer::createPlayer() void MMF::DsaVideoPlayer::initVideoOutput() { + Q_ASSERT(m_videoOutput); + bool connected = connect( m_videoOutput, SIGNAL(videoWindowScreenRectChanged()), this, SLOT(videoWindowScreenRectChanged()) @@ -156,7 +160,8 @@ void MMF::DsaVideoPlayer::initVideoOutput() void MMF::DsaVideoPlayer::prepareCompleted() { - videoWindowScreenRectChanged(); + if (m_videoOutput) + videoWindowScreenRectChanged(); } void MMF::DsaVideoPlayer::handleVideoWindowChanged() diff --git a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp index fda7342..5d8db26 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp @@ -59,7 +59,8 @@ SurfaceVideoPlayer::~SurfaceVideoPlayer() void MMF::SurfaceVideoPlayer::videoWindowSizeChanged() { - updateScaleFactors(m_videoOutput->videoWindowSize()); + if (m_videoOutput) + updateScaleFactors(m_videoOutput->videoWindowSize()); } @@ -80,6 +81,8 @@ void MMF::SurfaceVideoPlayer::createPlayer() void MMF::SurfaceVideoPlayer::initVideoOutput() { + Q_ASSERT(m_videoOutput); + bool connected = connect( m_videoOutput, SIGNAL(videoWindowSizeChanged()), this, SLOT(videoWindowSizeChanged()) -- cgit v0.12 From 80af9a7b09b531a849b863695b244dd1df7dfb1d Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 8 Jun 2010 14:56:31 +0100 Subject: Enable bufferStatus signal during video clip loading on NGA platforms CVideoPlayerUtility::RegisterForVideoLoadingNotification() was only called in the DSA, not the NGA, variant of the Phonon MMF backend. Task-number: QTBUG-11378 Reviewed-by: Thierry Bastian --- src/3rdparty/phonon/mmf/abstractvideoplayer.cpp | 2 ++ src/3rdparty/phonon/mmf/videoplayer_dsa.cpp | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp index ecfce9e..c45ed98 100644 --- a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp @@ -66,6 +66,8 @@ void MMF::AbstractVideoPlayer::construct() createPlayer(); + m_player->RegisterForVideoLoadingNotification(*this); + TRACE_EXIT_0(); } diff --git a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp index f0255b1..deb9774 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_dsa.cpp @@ -126,8 +126,6 @@ void MMF::DsaVideoPlayer::createPlayer() // CVideoPlayerUtility::NewL starts DSA m_dsaActive = true; - - m_player->RegisterForVideoLoadingNotification(*this); } void MMF::DsaVideoPlayer::initVideoOutput() -- cgit v0.12 From 50fbb9d19b3f524361c146de8ff0fb2fe6abacc9 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 8 Jun 2010 14:37:21 +0100 Subject: Close media clip before creating new player object Failure to Close() an existing MMF player utility object before creating a new one - which happens in the MMF backend's implementation of Phonon::MediaObject::setCurrentSource() - causes intialization of the newly-created utility to fail later on. Task-number: QTBUG-11377 Reviewed-by: Thierry Bastian --- src/3rdparty/phonon/mmf/abstractmediaplayer.h | 1 - src/3rdparty/phonon/mmf/abstractplayer.h | 1 + src/3rdparty/phonon/mmf/dummyplayer.cpp | 4 ++++ src/3rdparty/phonon/mmf/dummyplayer.h | 1 + src/3rdparty/phonon/mmf/mediaobject.cpp | 3 +++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index 23a8233..7d28caf 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -71,7 +71,6 @@ protected: virtual int openFile(RFile& file) = 0; virtual int openUrl(const QString& url) = 0; virtual int bufferStatus() const = 0; - virtual void close() = 0; void updateMetaData(); virtual int numberOfMetaDataEntries() const = 0; diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index ab892f5..30d5243 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -55,6 +55,7 @@ public: AbstractPlayer(const AbstractPlayer *player); virtual void open(const Phonon::MediaSource&, RFile&) = 0; + virtual void close() = 0; // MediaObjectInterface (implemented) qint32 tickInterval() const; diff --git a/src/3rdparty/phonon/mmf/dummyplayer.cpp b/src/3rdparty/phonon/mmf/dummyplayer.cpp index 6970088..d39ef76 100644 --- a/src/3rdparty/phonon/mmf/dummyplayer.cpp +++ b/src/3rdparty/phonon/mmf/dummyplayer.cpp @@ -97,6 +97,10 @@ void MMF::DummyPlayer::open(const Phonon::MediaSource &, RFile &) } +void MMF::DummyPlayer::close() +{ + +} //----------------------------------------------------------------------------- // AbstractPlayer diff --git a/src/3rdparty/phonon/mmf/dummyplayer.h b/src/3rdparty/phonon/mmf/dummyplayer.h index 6841b5d..9d45696 100644 --- a/src/3rdparty/phonon/mmf/dummyplayer.h +++ b/src/3rdparty/phonon/mmf/dummyplayer.h @@ -58,6 +58,7 @@ public: // AbstractPlayer virtual void open(const Phonon::MediaSource&, RFile&); + virtual void close(); virtual void doSetTickInterval(qint32 interval); }; } diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index e1b921b..d264377 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -281,6 +281,9 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) break; } + if (oldPlayer) + oldPlayer->close(); + AbstractPlayer* newPlayer = 0; // Construct newPlayer using oldPlayer (if not 0) in order to copy -- cgit v0.12 From 896de79554060aadf4963d8285ef3f5d8740428b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 7 Jul 2010 14:21:55 +0200 Subject: qdoc: Fixed a few links to QtObject (QML:QtObject) --- doc/src/declarative/elements.qdoc | 2 +- src/declarative/qml/qdeclarativeengine.cpp | 6 +++--- tools/qdoc3/cppcodeparser.cpp | 15 ++------------- tools/qdoc3/htmlgenerator.cpp | 5 ++++- tools/qdoc3/tree.cpp | 6 ++++-- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 48eb09f..349a8ed 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -114,7 +114,7 @@ The following table lists the QML elements provided by the \l {QtDeclarative}{Qt \row \o \l {Connections} \o Explicitly connects signals and signal handlers \row \o \l {Component} \o Encapsulate QML items as a component \row \o \l {Timer} \o Provides timed triggers -\row \o \l {QtObject} \o Basic element containing only the objectName property +\row \o \l {QML:QtObject} {QtObject} \o Basic element containing only the objectName property \row \o \l {WorkerScript} \o Enables the use of threads in QML \row \o \l {Loader} \o Controls the loading of items or components \row \o \l {Repeater} \o Uses a model to create multiples of components diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 8b15ae9..036c854 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -125,7 +125,7 @@ QT_BEGIN_NAMESPACE QObject. See the QObject documentation for further details. */ /*! - \qmlproperty string QtObject::objectName + \qmlproperty string QML:QtObject::objectName This property allows you to give a name to this specific object instance. See \l{scripting.html#accessing-child-qobjects}{Accessing Child QObjects} @@ -236,8 +236,8 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) } /*! -\qmlmethod url Qt::resolvedUrl(url) -Returns \c url resolved relative to the URL of the caller. + \qmlmethod url Qt::resolvedUrl(url) + Returns \c url resolved relative to the URL of the caller. */ QUrl QDeclarativeScriptEngine::resolvedUrl(QScriptContext *context, const QUrl& url) { diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index e4870e3..d5108fd 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -728,23 +728,12 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, if (n) classNode = static_cast(n); } - if (names[0].startsWith("Q")) + if (names[0].startsWith("Qt")) return new QmlClassNode(tre->root(), QLatin1String("QML:")+names[0], classNode); else return new QmlClassNode(tre->root(), names[0], classNode); } else if (command == COMMAND_QMLBASICTYPE) { -#if 0 - QStringList parts = arg.split(" "); - qDebug() << command << parts; - if (parts.size() > 1) { - FakeNode* pageNode = static_cast(tre->root()->findNode(parts[1], Node::Fake)); - if (pageNode) { - qDebug() << "FOUND"; - return new QmlBasicTypeNode(pageNode, parts[0]); - } - } -#endif return new QmlBasicTypeNode(tre->root(), arg); } else if ((command == COMMAND_QMLSIGNAL) || @@ -755,7 +744,7 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, QString type; QmlClassNode* qmlClass = 0; if (splitQmlMethodArg(doc,arg,type,element)) { - if (element.startsWith(QLatin1String("Q"))) + if (element.startsWith(QLatin1String("Qt"))) element = QLatin1String("QML:") + element; Node* n = tre->findNode(QStringList(element),Node::Fake); if (n && n->subType() == Node::QmlClass) { diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index b7ab4d6..441cfc6 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4197,7 +4197,10 @@ void HtmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK); - text << Atom(Atom::String, qcn->name()); + QString name = qcn->name(); + if (name.startsWith(QLatin1String("QML:"))) + name = name.mid(4); // remove the "QML:" prefix + text << Atom(Atom::String, name); text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); text << " instantiates the C++ class "; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn)); diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 022e1c2..d22a09a 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -173,9 +173,11 @@ const Node* Tree::findNode(const QStringList &path, } if (node && i == path.size() && (!(findFlags & NonFunction) || node->type() != Node::Function - || ((FunctionNode *)node)->metaness() == FunctionNode::MacroWithoutParams)) - if ((node != self) && (node->subType() != Node::QmlPropertyGroup)) + || ((FunctionNode *)node)->metaness() == FunctionNode::MacroWithoutParams)) { + if ((node != self) && (node->subType() != Node::QmlPropertyGroup)) { return node; + } + } current = current->parent(); } while (current); -- cgit v0.12 From 31d4037ad8e07fc4302a846271b28965f3e11069 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 8 Jun 2010 16:06:37 +0100 Subject: Fixed crash which occurs when switching between video clips When Phonon::MediaObject::setCurrentSource() is called when the MediaObject is connected to a Phonon::VideoWidget, the MMF::AbstractVideoOutput pointer is propagated inside the backend from the first MMF::AbstractVideoPlayer to the second. If the VideoWidget is subsquently re-sized, the code path enters the ScaleFactors branch of the MMF::SurfaceVideoPlayer::handleParametersChanged function. At this point, m_displayWindow is still set to the inital null value, and the assertion therefore fails. This change ensures that m_displayWindow is updated before attempting to apply the scale factor change. Task-number: QTBUG-11377 Reviewed-by: Thierry Bastian --- src/3rdparty/phonon/mmf/videoplayer_surface.cpp | 42 +++++++++++++++++-------- src/3rdparty/phonon/mmf/videoplayer_surface.h | 3 ++ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp index 5d8db26..343370c 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp @@ -118,23 +118,14 @@ void MMF::SurfaceVideoPlayer::handleParametersChanged(VideoParameters parameters if (player) { int err = KErrNone; if (parameters & WindowHandle) { - if (m_displayWindow) - player->RemoveDisplayWindow(*m_displayWindow); - - RWindow *window = static_cast(m_window); - if (window) { - window->SetBackgroundColor(TRgb(0, 0, 0, 255)); - TRAP(err, player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, rect, rect)); - if (KErrNone != err) { - setError(tr("Video display error"), err); - window = 0; - } - } - m_displayWindow = window; + removeDisplayWindow(); + addDisplayWindow(rect); } if (KErrNone == err) { if (parameters & ScaleFactors) { + if (!m_displayWindow) + addDisplayWindow(rect); Q_ASSERT(m_displayWindow); TRAP(err, player->SetVideoExtentL(*m_displayWindow, rect)); if (KErrNone == err) @@ -148,5 +139,30 @@ void MMF::SurfaceVideoPlayer::handleParametersChanged(VideoParameters parameters } } +void MMF::SurfaceVideoPlayer::addDisplayWindow(const TRect &rect) +{ + Q_ASSERT(!m_displayWindow); + RWindow *window = static_cast(m_window); + if (window) { + window->SetBackgroundColor(TRgb(0, 0, 0, 255)); + CVideoPlayerUtility2 *player = static_cast(m_player.data()); + Q_ASSERT(player); + TRAPD(err, player->AddDisplayWindowL(m_wsSession, m_screenDevice, *window, rect, rect)); + if (KErrNone == err) + m_displayWindow = window; + else + setError(tr("Video display error"), err); + } +} + +void MMF::SurfaceVideoPlayer::removeDisplayWindow() +{ + CVideoPlayerUtility2 *player = static_cast(m_player.data()); + if (player && m_displayWindow) { + player->RemoveDisplayWindow(*m_displayWindow); + m_displayWindow = 0; + } +} + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/videoplayer_surface.h b/src/3rdparty/phonon/mmf/videoplayer_surface.h index c05da9c..8572fdc 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_surface.h +++ b/src/3rdparty/phonon/mmf/videoplayer_surface.h @@ -62,6 +62,9 @@ private: void handleVideoWindowChanged(); void handleParametersChanged(VideoParameters parameters); + void addDisplayWindow(const TRect &rect); + void removeDisplayWindow(); + private: // Window handle which has been passed to the MMF via // CVideoPlayerUtility2::SetDisplayWindowL -- cgit v0.12 From 64f711e91a30c7689314f4bceca78745236f8bee Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Thu, 17 Jun 2010 09:42:52 +0100 Subject: MMF Phonon backend: call winId() from VideoWidget constructor This is to be consistent with the backends for other platforms, which also call QWidget::winId() on the VideoWidget (or one of its children) during construction. Reviewed-by: Thierry Bastian --- src/3rdparty/phonon/mmf/abstractvideooutput.cpp | 3 ++- src/3rdparty/phonon/mmf/abstractvideoplayer.cpp | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractvideooutput.cpp b/src/3rdparty/phonon/mmf/abstractvideooutput.cpp index a8aabfd..2d221ed 100644 --- a/src/3rdparty/phonon/mmf/abstractvideooutput.cpp +++ b/src/3rdparty/phonon/mmf/abstractvideooutput.cpp @@ -60,7 +60,8 @@ MMF::AbstractVideoOutput::AbstractVideoOutput(QWidget *parent) , m_aspectRatio(DefaultAspectRatio) , m_scaleMode(DefaultScaleMode) { - + // Ensure that this widget has a native window handle + winId(); } MMF::AbstractVideoOutput::~AbstractVideoOutput() diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp index c45ed98..9ea4d18 100644 --- a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp @@ -384,9 +384,6 @@ void MMF::AbstractVideoPlayer::initVideoOutput() // Suppress warnings in release builds Q_UNUSED(connected); - // Do these after all connections are complete, to ensure - // that any signals generated get to their destinations. - m_videoOutput->winId(); m_videoOutput->setVideoSize(m_videoFrameSize); } -- cgit v0.12 From 6f6ec0ee680c7d4b5cf70116e756cca90668fd90 Mon Sep 17 00:00:00 2001 From: Adrian Constantin Date: Wed, 7 Jul 2010 16:13:07 +0300 Subject: Set QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH to default value Remove workaround introduced in Qt 4.6 as not needed any more Reviewed-by: Adrian Constantin --- mkspecs/linux-g++-maemo/qmake.conf | 3 --- 1 file changed, 3 deletions(-) diff --git a/mkspecs/linux-g++-maemo/qmake.conf b/mkspecs/linux-g++-maemo/qmake.conf index cced090..a977e7a 100644 --- a/mkspecs/linux-g++-maemo/qmake.conf +++ b/mkspecs/linux-g++-maemo/qmake.conf @@ -27,7 +27,4 @@ QMAKE_CXXFLAGS_RELEASE += -g -fno-omit-frame-pointer -fno-optimize-sibling-call # Work round PowerVR SGX 1.3 driver bug with glScissor & FBOs: DEFINES += QT_GL_NO_SCISSOR_TEST -# Work round SGX 1.4 driver bug (text corrupted), modify glyph cache width: -DEFINES += QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 - load(qt_config) -- cgit v0.12 From 495dfda1bea31017d08a435dcb61b43b4df81d24 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 7 Jul 2010 15:38:22 +0200 Subject: Phonon MediaSource fails to load when passed as a resource file Files fail to load when passing resoure path to mediasource. The original regression seems to be caused by a behavior change as reported here: http://bugreports.qt.nokia.com/browse/QTBUG-12015 Note a merge request is also pending on Gitorious http://gitorious.org/phonon/phonon/merge_requests/17 Task-number: QTBUG-9323 Reviewed-by: thierry --- src/3rdparty/phonon/phonon/mediasource.cpp | 2 +- tests/auto/mediaobject/tst_mediaobject.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/phonon/phonon/mediasource.cpp b/src/3rdparty/phonon/phonon/mediasource.cpp index be22dc3..11d2428 100644 --- a/src/3rdparty/phonon/phonon/mediasource.cpp +++ b/src/3rdparty/phonon/phonon/mediasource.cpp @@ -50,7 +50,7 @@ MediaSource::MediaSource(const QString &filename) const QFileInfo fileInfo(filename); if (fileInfo.exists()) { bool localFs = QAbstractFileEngine::LocalDiskFlag & QFSFileEngine(filename).fileFlags(QAbstractFileEngine::LocalDiskFlag); - if (localFs) { + if (localFs && !filename.startsWith(QLatin1String(":/")) && !filename.startsWith(QLatin1String("qrc://"))) { d->url = QUrl::fromLocalFile(fileInfo.absoluteFilePath()); } else { #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp index 994057b..2f98521 100644 --- a/tests/auto/mediaobject/tst_mediaobject.cpp +++ b/tests/auto/mediaobject/tst_mediaobject.cpp @@ -204,9 +204,8 @@ void tst_MediaObject::testPlayFromResource() #ifdef Q_OS_SYMBIAN QSKIP("Not implemented yet.", SkipAll); #else - QFile file(MEDIA_FILEPATH); MediaObject media; - media.setCurrentSource(&file); + media.setCurrentSource(QString(MEDIA_FILEPATH)); QVERIFY(media.state() != Phonon::ErrorState); if (media.state() != Phonon::StoppedState) QTest::waitForSignal(&media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), 10000); -- cgit v0.12 From f91a2789c385af25310ac5f0463d5bb3311ec089 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 7 Jul 2010 16:06:11 +0200 Subject: Fix crash when removing columns in merged row Change 4b709b41f5a7ae8dc6e537b644158f5201ce0a98 tried to make sure that rows with merged cells would not be completely removed, as this would cause a crash. However, when removing just a few columns from a merged cell, the span of the cell should be reduced by the number of columns removed. The "touched" guard would cause the span to be decreased a maximum of one time, regardless of how many columns were removed, leaving the table in an invalid state, as the column count would be smaller than the span of the cell. This would assert later on. To avoid this, we only guard against removal, not against decreasing the span. Task-number: QTBUG-11646 Reviewed-by: Thomas Zander --- src/gui/text/qtexttable.cpp | 7 ++++--- tests/auto/qtexttable/tst_qtexttable.cpp | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index 5100176..ada18c8 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -915,12 +915,13 @@ void QTextTable::removeColumns(int pos, int num) for (int r = 0; r < d->nRows; ++r) { for (int c = pos; c < pos + num; ++c) { int cell = d->grid[r*d->nCols + c]; - if (touchedCells.contains(cell)) - continue; - touchedCells << cell; QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); QTextCharFormat fmt = collection->charFormat(it->format); int span = fmt.tableCellColumnSpan(); + if (touchedCells.contains(cell) && span <= 1) + continue; + touchedCells << cell; + if (span > 1) { fmt.setTableCellColumnSpan(span - 1); p->setCharFormat(it.position(), 1, fmt); diff --git a/tests/auto/qtexttable/tst_qtexttable.cpp b/tests/auto/qtexttable/tst_qtexttable.cpp index 2e6007e..c6ead5a 100644 --- a/tests/auto/qtexttable/tst_qtexttable.cpp +++ b/tests/auto/qtexttable/tst_qtexttable.cpp @@ -93,6 +93,7 @@ private slots: void removeColumns3(); void removeColumns4(); void removeColumns5(); + void removeColumnsInTableWithMergedRows(); private: QTextTable *create2x2Table(); @@ -931,5 +932,18 @@ void tst_QTextTable::removeColumns5() QCOMPARE(table->cellAt(3, 2).firstPosition(), 11); } +void tst_QTextTable::removeColumnsInTableWithMergedRows() +{ + QTextTable *table = cursor.insertTable(3, 4); + table->mergeCells(0, 0, 1, 4); + QCOMPARE(table->rows(), 3); + QCOMPARE(table->columns(), 4); + + table->removeColumns(0, table->columns() - 1); + + QCOMPARE(table->rows(), 3); + QCOMPARE(table->columns(), 1); +} + QTEST_MAIN(tst_QTextTable) #include "tst_qtexttable.moc" -- cgit v0.12 From 4337d695410301b97b753231c3b8fc9560a9d4c7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 5 Jul 2010 11:52:11 +0200 Subject: immediately set function context when entering a namespace otherwise, tr() calls without absolute qualification will not be properly qualified inside the first function if it has no qualification, either. Task-number: QTBUG-11742 (not really) --- .../lupdate/testdata/good/parsecpp/main.cpp | 27 ++++++++++++++++++++++ .../testdata/good/parsecpp/project.ts.result | 13 +++++++++++ tools/linguist/lupdate/cpp.cpp | 7 +++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp index 0765bfc..f58f932 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -275,3 +275,30 @@ void bogosity() // no spaces here. test collateral damage from ignoring equal sign Class::member=QObject::tr("just QObject"); } + + + +namespace Internal { + +class Message : public QObject +{ + Q_OBJECT +public: + Message(QObject *parent = 0); +}; + +} // The temporary closing of the namespace triggers the problem + +namespace Internal { + +static inline QString message1() +{ + return Message::tr("message1"); // Had no namespace +} + +static inline QString message2() +{ + return Message::tr("message2"); // Already had namespace +} + +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 208191d..7ac318e 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -120,6 +120,19 @@ backslashed \ stuff.
+ Internal::Message + + + message1 + + + + + message2 + + + + Kåntekst diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 609bd3d..bc9bb26 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1686,9 +1686,14 @@ void CppParser::parseInternal(ConversionData &cd, QSet &inclusions) HashString ns = HashString(text); yyTok = getToken(); if (yyTok == Tok_LeftBrace) { + yyTok = getToken(); namespaceDepths.push(namespaces.count()); enterNamespace(&namespaces, ns); - yyTok = getToken(); + + functionContext = namespaces; + functionContextUnresolved.clear(); + prospectiveContext.clear(); + pendingContext.clear(); } else if (yyTok == Tok_Equals) { // e.g. namespace Is = OuterSpace::InnerSpace; QList fullName; -- cgit v0.12 From f2187e31de13a6ab8631a9067487dab555f7c2e7 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 6 Jul 2010 11:06:40 +0200 Subject: SSL backend: load libraries for certificates only once Reviewed-by: Olivier Goffart --- src/network/ssl/qsslsocket.cpp | 6 ++--- src/network/ssl/qsslsocket_openssl.cpp | 42 ++++++++++++++++++---------------- src/network/ssl/qsslsocket_p.h | 11 ++++----- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index f85fa84..809e8aa 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1849,7 +1849,7 @@ QList QSslSocketPrivate::defaultCiphers() */ QList QSslSocketPrivate::supportedCiphers() { - QSslSocketPrivate::ensureInitialized(); + QSslSocketPrivate::ensureCertsAndCiphersLoaded(); QMutexLocker locker(&globalData()->mutex); return globalData()->supportedCiphers; } @@ -1879,7 +1879,7 @@ void QSslSocketPrivate::setDefaultSupportedCiphers(const QList &ciph */ QList QSslSocketPrivate::defaultCaCertificates() { - QSslSocketPrivate::ensureInitialized(); + QSslSocketPrivate::ensureCertsAndCiphersLoaded(); QMutexLocker locker(&globalData()->mutex); return globalData()->config->caCertificates; } @@ -1962,7 +1962,7 @@ void QSslConfigurationPrivate::setDefaultConfiguration(const QSslConfiguration & */ void QSslConfigurationPrivate::deepCopyDefaultConfiguration(QSslConfigurationPrivate *ptr) { - QSslSocketPrivate::ensureInitialized(); + QSslSocketPrivate::ensureCertsAndCiphersLoaded(); QMutexLocker locker(&globalData()->mutex); const QSslConfigurationPrivate *global = globalData()->config.constData(); diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index d7088ee..b602b29 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -74,8 +74,9 @@ QT_BEGIN_NAMESPACE -bool QSslSocketPrivate::s_libraryLoaded = false; -bool QSslSocketPrivate::s_loadedCiphersAndCerts = false; +bool QSslSocketPrivate::s_initialized = false; +QBasicAtomicInt QSslSocketPrivate::s_CertsAndCiphersLoaded; +Q_GLOBAL_STATIC(QMutex, s_CertsAndCiphersLoadedMutex); // Useful defines #define SSL_ERRORSTR() QString::fromLocal8Bit(q_ERR_error_string(q_ERR_get_error(), NULL)) @@ -170,7 +171,7 @@ QSslSocketBackendPrivate::QSslSocketBackendPrivate() session(0) { // Calls SSL_library_init(). - ensureInitialized(); + ensureCertsAndCiphersLoaded(); } QSslSocketBackendPrivate::~QSslSocketBackendPrivate() @@ -421,18 +422,18 @@ void QSslSocketPrivate::deinitialize() bool QSslSocketPrivate::supportsSsl() { - return ensureLibraryLoaded(); + return ensureInitialized(); } -bool QSslSocketPrivate::ensureLibraryLoaded() +bool QSslSocketPrivate::ensureInitialized() { if (!q_resolveOpenSslSymbols()) return false; // Check if the library itself needs to be initialized. QMutexLocker locker(openssl_locks()->initLock()); - if (!s_libraryLoaded) { - s_libraryLoaded = true; + if (!s_initialized) { + s_initialized = true; // Initialize OpenSSL. q_CRYPTO_set_id_callback(id_function); @@ -473,16 +474,6 @@ bool QSslSocketPrivate::ensureLibraryLoaded() return true; } -void QSslSocketPrivate::ensureCiphersAndCertsLoaded() -{ - if (s_loadedCiphersAndCerts) - return; - s_loadedCiphersAndCerts = true; - - resetDefaultCiphers(); - setDefaultCaCertificates(systemCaCertificates()); -} - /*! \internal @@ -490,13 +481,18 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded() been initialized. */ -void QSslSocketPrivate::ensureInitialized() +void QSslSocketPrivate::ensureCertsAndCiphersLoaded() { - if (!supportsSsl()) + // use double-checked locking to speed up this function + if (s_CertsAndCiphersLoaded) return; - ensureCiphersAndCertsLoaded(); + QMutexLocker locker(s_CertsAndCiphersLoadedMutex()); + if (s_CertsAndCiphersLoaded) + return; + if (!supportsSsl()) + return; //load symbols needed to receive certificates from system store #if defined(Q_OS_MAC) QLibrary securityLib("/System/Library/Frameworks/Security.framework/Versions/Current/Security"); @@ -532,6 +528,12 @@ void QSslSocketPrivate::ensureInitialized() qWarning("could not load crypt32 library"); // should never happen } #endif + resetDefaultCiphers(); + setDefaultCaCertificates(systemCaCertificates()); + // we need to make sure that s_CertsAndCiphersLoaded is executed after the library loading above + // (the compiler/processor might reorder instructions otherwise) + if (!s_CertsAndCiphersLoaded.testAndSetRelease(0, 1)) + Q_ASSERT_X(false, "certificate store", "certificate store has already been initialized!"); } /*! diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 72b3ef7..b474175 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -63,6 +63,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -113,7 +114,8 @@ public: QString verificationPeerName; static bool supportsSsl(); - static void ensureInitialized(); + static bool ensureInitialized(); + static void ensureCertsAndCiphersLoaded(); static void deinitialize(); static QList defaultCiphers(); static QList supportedCiphers(); @@ -161,11 +163,8 @@ public: virtual QSslCipher sessionCipher() const = 0; private: - static bool ensureLibraryLoaded(); - static void ensureCiphersAndCertsLoaded(); - - static bool s_libraryLoaded; - static bool s_loadedCiphersAndCerts; + static bool s_initialized; + static QBasicAtomicInt s_CertsAndCiphersLoaded; }; QT_END_NAMESPACE -- cgit v0.12 From 4c100e6f1ddecff46e5b1e46a481b62c275bc30d Mon Sep 17 00:00:00 2001 From: Roland Wolf Date: Wed, 26 May 2010 16:53:41 +0200 Subject: dummy commit to check permissions --- src/testfile.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/testfile.txt diff --git a/src/testfile.txt b/src/testfile.txt new file mode 100644 index 0000000..e69de29 -- cgit v0.12 From 09f3e7adf39ef93a9181486680fb6575b4d56de5 Mon Sep 17 00:00:00 2001 From: Michael D Scull Date: Wed, 26 May 2010 17:30:14 +0200 Subject: Michaels first commit --- doc/src/frameworks-technologies/modelview.qdoc | 840 +++++++++++++++++++++++++ doc/src/images/clock.png | Bin 0 -> 16514 bytes doc/src/images/columnview.png | Bin 0 -> 11717 bytes doc/src/images/combobox.png | Bin 0 -> 5022 bytes doc/src/images/dummy_tree.png | Bin 0 -> 20189 bytes doc/src/images/edit.png | Bin 0 -> 19636 bytes doc/src/images/example_model.png | Bin 0 -> 16577 bytes doc/src/images/header.png | Bin 0 -> 30302 bytes doc/src/images/lineedit.png | Bin 0 -> 2613 bytes doc/src/images/list_table_tree.png | Bin 0 -> 85530 bytes doc/src/images/listview.png | Bin 0 -> 9695 bytes doc/src/images/lotto.png | Bin 0 -> 17015 bytes doc/src/images/modelview.png | Bin 0 -> 2887 bytes doc/src/images/path.png | Bin 0 -> 31015 bytes doc/src/images/qcompleter.png | Bin 0 -> 17017 bytes doc/src/images/readonlytable.png | Bin 0 -> 28971 bytes doc/src/images/readonlytable_role.png | Bin 0 -> 27467 bytes doc/src/images/selection2.png | Bin 0 -> 23784 bytes doc/src/images/standardwidget.png | Bin 0 -> 1466 bytes doc/src/images/tableview.png | Bin 0 -> 10102 bytes doc/src/images/tree.png | Bin 0 -> 27074 bytes doc/src/images/tree_2.png | Bin 0 -> 14084 bytes doc/src/images/tree_2_with_algorithm.png | Bin 0 -> 16921 bytes doc/src/images/tree_city.png | Bin 0 -> 30398 bytes doc/src/images/treeview.png | Bin 0 -> 17173 bytes doc/src/images/widgetmapper.png | Bin 0 -> 20145 bytes 26 files changed, 840 insertions(+) create mode 100755 doc/src/frameworks-technologies/modelview.qdoc create mode 100755 doc/src/images/clock.png create mode 100755 doc/src/images/columnview.png create mode 100755 doc/src/images/combobox.png create mode 100755 doc/src/images/dummy_tree.png create mode 100755 doc/src/images/edit.png create mode 100755 doc/src/images/example_model.png create mode 100755 doc/src/images/header.png create mode 100755 doc/src/images/lineedit.png create mode 100755 doc/src/images/list_table_tree.png create mode 100755 doc/src/images/listview.png create mode 100755 doc/src/images/lotto.png create mode 100755 doc/src/images/modelview.png create mode 100755 doc/src/images/path.png create mode 100755 doc/src/images/qcompleter.png create mode 100755 doc/src/images/readonlytable.png create mode 100755 doc/src/images/readonlytable_role.png create mode 100755 doc/src/images/selection2.png create mode 100755 doc/src/images/standardwidget.png create mode 100755 doc/src/images/tableview.png create mode 100755 doc/src/images/tree.png create mode 100755 doc/src/images/tree_2.png create mode 100755 doc/src/images/tree_2_with_algorithm.png create mode 100755 doc/src/images/tree_city.png create mode 100755 doc/src/images/treeview.png create mode 100755 doc/src/images/widgetmapper.png diff --git a/doc/src/frameworks-technologies/modelview.qdoc b/doc/src/frameworks-technologies/modelview.qdoc new file mode 100755 index 0000000..7729cd2 --- /dev/null +++ b/doc/src/frameworks-technologies/modelview.qdoc @@ -0,0 +1,840 @@ +/*! + + \contentspage{modelview.html}{Crash Course in Model/View Programming} + \page modelview.html + +\title Crash Course in Model/View Programming +Contents: +\tableofcontents + +\section1 1 Introduction +Model/View is a technology used to separate data from views in widgets that handle data sets. Standard Widgets are not designed for separating data from views and this is why Qt 4 has two different types of widgets. Both types of widgets look the same, but they interact with data differently. + \table + \row + \o Standard widgets use data that is part of the widget. + \o \image standardwidget.png + \row + \o View classes operate on external data (the model) + \o \image modelview.png + \endtable +\section2 1.1 Standard widgets +Let's have a closer look at a standard table widget. A table widget is a 2D array of the data elements that the user can change. The table widget can be integrated into a program flow by reading and writing the data elements that the table widget provides. This method is very intuitive and useful in many applications. + +Displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the widget; one inside the widget. The developer needs to know where up-to-date data is so the both copies contain the most recent data. The tight coupling of presentation and data makes it harder to write unit tests. + +\section2 1.2 Model/View to the rescue +Model/View stepped up to provide a solution that uses a more versatile architecture. Model/View eliminates the data consistency problems that may occur with standard widgets. Model/View also makes it easier to use more than one view of the same data because one model can be passed on to many views. The most important difference is that model/view widgets do not store data behind the table cells. In fact, they operate directly from your data. Since view classes do not know your data's structure, you need to provide a wrapper to make your data conform to the \l QAbstractItemModel interface. A view uses this interface to read from and write to your data and any class that implements \l QAbstractItemModel is a model. Once the view receives a pointer to a model, it will read and display its content and be its editor. + +\section2 1.3 Overview of the model/view widgets +Here is an overview of the model/view widgets and their corresponding standard widgets. + \table + \header + \o Widget + \o Standard Widget +(a convenience class with data in the widget) + \o Model/View View Class (for use with external data) + \row + \o \image listview.png + \o \l QListWidget + \o \l QListView + \row + \o \image tableview.png + \o \l QTableWidget + \o \l QTableView + \row + \o \image treeview.png + \o \l QTreeWidget + \o \l QTreeView + \row + \o \image columnview.png + \o + \o \l QColumnView shows a tree as a hierarchy of lists + \row + \o \image combobox.png + \o {2, 1} \l QComboBox can work as both a view class and also as a traditional widget + \endtable +\section2 1.4 Having adapters between forms and models can come in handy. +We often prefer editing data stored in tables (e.g. in database tables) in forms rather than in tables. There is no direct model/view counterpart for separating data and views for widgets that operate on one value instead of a dataset, so we need an adapter in order to connect the form to the source of data. + +\l QDataWidgetMapper is a great solution because it maps form widgets to a table row and it makes it very easy to build forms for database tables. \image widgetmapper.png + +Another example of an adapter is \l QCompleter. Qt has QCompleter for providing auto completions in Qt widgets such as \l QComboBox and, as shown below, \l QLineEdit. \l QCompleter uses a model as its data source, so \l QCompleter, in itself, is a very handy adapter. \image qcompleter.png + +\section1 2 A Simple Model/View Application +If you want to develop a model/view application, where should you start? We recommend starting with a simple example and extending it step-by-step. This makes understanding the architecture a lot easier. Trying to understand the model/view architecture in detail before invoking the IDE has proven to be less convenient for many developers. It is substantially easier to start with a simple model/view application that has demo data. Give it a try! Simply replace the data in the examples below with your own. + +Below are 7 very simple and independent applications that show different sides of model/view programming. The source code can be downloaded from @todo___________paste link here_________________________ + +\section2 2.1 A read only table +We start with an application that uses a \l QTableView to show data. We will add editing capabilities later. + +-------------------------------------------------------------main.cpp--------------------- +\code +#include +#include "modelview.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ModelView w; + w.show(); + return a.exec(); +} +\endcode + +We have the usual main() function; +-------------------------------------------------------------modelview.h--------------------- +\code +#ifndef MODELVIEW_H +#define MODELVIEW_H + +#include + +class QTableView; //forward declaration + +class ModelView : public QMainWindow +{ + Q_OBJECT +private: + QTableView *tableView; +public: + ModelView(QWidget *parent = 0); + +}; + +#endif // MODELVIEW_H +\endcode + +The application is a \l QMainWindow that holds a \l QTableView. + +-------------------------------------------------------------modelview.cpp--------------------- +\code +#include +#include "modelview.h" +#include "mymodel.h" + +ModelView::ModelView(QWidget *parent) + : QMainWindow(parent) +{ + tableView = new QTableView(this); + setCentralWidget(tableView); + tableView->setModel(new MyModel(this) ); +} + +\endcode + +Here is the interesting part: We use \c tableView->setModel(new MyModel(this) ); to instantiate the Model and pass its pointer to \l {QTableView::}{tableView()} OR \l QTableView::tableView() OR \l QTableView::tableView . \l {QTableView::}{tableView} will invoke the methods of the pointer it has received to find out two things: + \list + \o How many rows and columns should be displayed + \o What content should be printed into each cell. + \endlist + +The model needs some code to respond to this. + +We have a table data set, so let's start with QAbstractTableModel since it is easier to use. +-------------------------------------------------------------mymodel.h--------------------- +\code +#ifndef MYMODEL_H +#define MYMODEL_H + +#include + +class MyModel : public QAbstractTableModel +{ + Q_OBJECT +public: + MyModel(QObject *parent); + int rowCount(const QModelIndex &parent = QModelIndex()) const ; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; +}; + +#endif // MYMODEL_H +\endcode + +QAbstractTableModel requires the implementation of three abstract methods. + + +-------------------------------------------------------------mymodel.cpp--------------------- +\code +HIER FEHLT mymodel.cpp !!! +\endcode + +The number of rows and columns is set by \c MyModel::rowCount() and \c MyModel::columnCount(). +When the view has to know what the cell 's text is, it calls the \l{QAbstractItemModel::data()}{data()} method. Row and column information is specified with parameter \c index and the role is set to Qt::Display Role. Other roles are covered in the next section. In our example, the data that should be displayed is generated. In a real application, \c MyModel would have a member called \c MyData, which serves as the target for all reading and writing operations. + +This small example demonstrates the passive nature of a model. The model does not know when it will be used or which data is needed. It simply provides data each time the view requests it. + +What happens when the model 's data needs to be changed? How does the view know when data changes and needs to be read again? The model has to emit a signal that indicates what range of cells has changed. This will be demonstrated in section 2.3. + +\section2 2.2 Extending the read only example with roles +In addition to controlling what text the view displays, the model also controls the text's appearance. When we slightly change the model, we get the following result: \image readonlytable_role.png + + +In fact, nothing except for the \l{QAbstractItemModel::data()}{data()} method needs to be changed to set fonts, background colour, alignment and a checkbox. Here is the \l{QAbstractItemModel::data()}{data()} method that produces the result shown above: + +\code +HIER FEHLT WAS !!! +\endcode + +Each formatting property will be requested from the model with a separate call to the \l{QAbstractItemModel::data()}{data()} method. The \c role parameter is used to let the model know which property is being requested: + + \table + \header + \o Role (enum Qt::ItemDataRole ) + \o Meaning + \o Type + \row + \o Qt::DisplayRole + \o text + \o QString + \row + \o Qt::FontRole + \o font + \o QFont + \row + \o Qt::BackgroundRole + \o brush for the background of the cell + \o QBrush + \row + \o Qt::TextAlignmentRole + \o text alignment + \o enum Qt::AlignmentFlag + \row + \o {1, 3} Qt::CheckStateRole + \o {1, 3} suppresses checkboxes with QVariant(), sets checkboxes with Qt::Checked or Qt::Unchecked + \o {1, 3} enum Qt::ItemDataRole + + \endtable + +Refer to Qt documentation to learn more about enum Qt::ItemDataRole's capabilities. + + +Now we need to determine how using a seperated model impacts the application's performance, so let's trace how often the view calls the \l{QAbstractItemModel::data()}{data()} method. In order to track how often the view calls the model, we have put a debug statement in the \l{QAbstractItemModel::data()}{data()} method, which logs onto stdio. In our small example, \l{QAbstractItemModel::data()}{data()} will be called 42 times. Each time you hover the cursor over the field, \l{QAbstractItemModel::data()}{data()} will be called again - 7 times for each cell. That's why it is important to make sure that your data is available when \l{QAbstractItemModel::data()}{data()}) is invoked and expensive lookup operations are cached. + +\section2 2.3 A clock inside a table cell +\image clock.png + +We still have a read only table, but this time the content changes every second because we are showing the current time. +\code +QVariant MyModel::data(const QModelIndex &index, int role ) const +{ + QVariant returnVal; + int row = index.row(); + int col = index.column(); + + if(role == Qt::DisplayRole) + + { + if(row == 0 && col == 0 ) + { + returnVal = QTime::currentTime().toString(); + } + } + return returnVal; +} +\endcode + +Something is missing to make the clock tick. We need to tell the view every second that the time has changed and that it needs to be read again. We do this with a timer. In the constructor, we set its interval to 1 second and it connect its timeout signal. +\code +MyModel::MyModel(QObject *parent) + :QAbstractTableModel(parent) +{ +// selectedCell = 0; + timer = new QTimer(this); + timer->setInterval(1000); + connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit()) ); + timer->start(); +} +\endcode + +Here is the corresponding slot: +\code + +void MyModel::timerHit() +{ + //we identify the top left cell + QModelIndex topLeft = createIndex ( 0,0 ); + //emit a signal to make the view reread identified data + emit dataChanged ( topLeft, topLeft ); +} +\endcode + +We ask the view to read the data in the top left cell again by emitting the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal. Note that we did not explicitly connect the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal to the view. This happened automatically when we called \l{QAbstractItemModel::setModel()}{setModel()} . + +\section2 2.4 Setting up Headers for Columns and Rows +Headers can be hidden via a view method. +\c tableView->verticalHeader()->hide(); +\image header.png + + +The header content, however , is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: +\code +QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (role == Qt::DisplayRole) + { + if (orientation == Qt::Horizontal) { + switch (section) + { + case 0: + return QString("first"); + case 1: + return QString("second"); + case 2: + return QString("third"); + } + } + } + return QVariant(); +} +\endcode + + +\section2 2.5 The minimal Editing example +In this example, we are going to build an application that automatically populates a window title with content by repeating values entered into table cells. + +The model decides whether editing capabilities are available . We only have to modify the model in order for the available editing capabilities to be enabled. This is done by reimplementing the following virtual methods: \l{QAbstractItemModel::setData()}{setData()} and \l{QAbstractItemModel::flags()}{flags()}. +\code +#ifndef MYMODEL_H +#define MYMODEL_H + +#include +#include + +class MyModel : public QAbstractTableModel +{ + Q_OBJECT +public: + MyModel(QObject *parent); + int rowCount(const QModelIndex &parent = QModelIndex()) const ; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); + Qt::ItemFlags flags ( const QModelIndex & index ) const ; +private: + QStringList m_gridData; //holds text entered into QTableView + int modelIndexToOffset(const QModelIndex & index) const; +signals: + void editCompleted(const QString &); +}; + +#endif // MYMODEL_H +\endcode + +We use \c QStringList m_gridData to store our data. This makes \c m_gridData the core of MyModel. The rest of \c MyModel acts like a wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We have also introduced the \l{QAbstractItemModel::editCompleted()}{editCompleted()} signal, which makes it possible to transfer the modified text to the window title. +\code +#include "mymodel.h" + +const int COLS= 3; +const int ROWS= 2; + +MyModel::MyModel(QObject *parent) + :QAbstractTableModel(parent) +{ + //gridData needs to have 6 element, one for each table cell + m_gridData << "1/1" << "1/2" << "1/3" << "2/1" << "2/2" << "2/3" ; +} +\endcode + +In the constructor, we fill \c QStringList gridData with 6 items. (one item for every field in the table) +\code +HIER FEHLT WAS!!! +\endcode + +\l{QAbstractItemModel::setData()}{setData()} will be called each time the user edits a cell. The \c index parameter tells us which field has been edited and \c value provides the result of the editing process. The role will always be set to \c Qt::EditRole because our cells only contain text. If a checkbox were present and user permissions are set to allow the checkbox to be selected, calls would also be made with the role set to \c Qt::CheckStateRole. +\code +HIER FEHLT WAS!!! +\endcode + +Various properties of a cell can be adjusted with \l{QAbstractItemModel::flags()}{flags()}. Returning \c Qt::ItemIsEditable | Qt::ItemIsEnabled is enough to show an editor that a cell has been selected. If editing one cell modifies more data than the data in that particular cell, the model must emit a \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal in order for the data that has been changed to be read. + +\section1 3 Intermediate Topics +\section2 3.1 TreeView +You can convert the example above into an application with a tree view. Simply replace QTableView with QTreeView, which results in a read/write tree. No changes have to be made to the model. The tree won't have any hierarchies because there aren't any hierarchies in the model itself. +\image dummy_tree.png + + +QListView, QTableView and QTreeView all use a model abstraction, which is a merged list, table and tree. This makes it possible to use several different types of view classes from the same model. +\image list_table_tree.png + +This is how our example model looks so far: +\image example_model.png + + +We want to, however, present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which is a container for hierarchical data that also implements QAbstractItemModel. To show a tree, QStandardItemModel must be populated with QStandardItems, which are able to hold all the standard properties of items like text, fonts, checkboxes or brushes. \image tree_2_with_algorithm.png +\code +#include +#include +#include +#include "modelview.h" + + +const int ROWS = 2; +const int COLUMNS = 3; + +ModelView::ModelView(QWidget *parent) + : QMainWindow(parent) +{ + treeView = new QTreeView(this); + setCentralWidget(treeView); + standardModel = new QStandardItemModel ; + + QList preparedColumn =prepareColumn("first", "second", "third"); + QStandardItem *item = standardModel->invisibleRootItem(); + // adding a row to the invisible root item produces a root element + item->appendRow(preparedColumn); + + QList secondRow =prepareColumn("111", "222", "333"); + // adding a row to an item starts a subtree + preparedColumn.first()->appendRow(secondRow); + + treeView->setModel( standardModel ); + treeView->expandAll(); +} + +//--------------------------------------------------------------------------- +QList ModelView::prepareColumn(const QString &first, + const QString &second, + const QString &third ) +{ + QList colItems; + colItems << new QStandardItem(first); + colItems << new QStandardItem(second); + colItems << new QStandardItem(third); + return colItems; +} + +\endcode + +We simply instantiate a QStandardItemModel and add a couple of QStandardItems to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other QStandardItems. Nodes are collapsed and expanded within the view. + +\section2 3.2 Working with selection +We want to access a selected item's content in order to output it into the window title together with the hierarchy level. +\image selection2.png + + +So let's create a couple of items: +\code +#include +#include +#include +#include "modelview.h" + +ModelView::ModelView(QWidget *parent) + : QMainWindow(parent) +{ + treeView = new QTreeView(this); + setCentralWidget(treeView); + standardModel = new QStandardItemModel ; + QStandardItem *rootNode = standardModel->invisibleRootItem(); + + + //defining a couple of items + QStandardItem *americaItem = new QStandardItem("America"); + QStandardItem *mexicoItem = new QStandardItem("Canada"); + QStandardItem *usaItem = new QStandardItem("USA"); + QStandardItem *bostonItem = new QStandardItem("Boston"); + QStandardItem *europeItem = new QStandardItem("Europe"); + QStandardItem *italyItem = new QStandardItem("Italy"); + QStandardItem *romeItem = new QStandardItem("Rome"); + QStandardItem *veronaItem = new QStandardItem("Verona"); + + //building up the hierarchy + rootNode-> appendRow(americaItem); + rootNode-> appendRow(europeItem); + americaItem-> appendRow(mexicoItem); + americaItem-> appendRow(usaItem); + usaItem-> appendRow(bostonItem); + europeItem-> appendRow(italyItem); + italyItem-> appendRow(romeItem); + italyItem-> appendRow(veronaItem); + + //register the model + treeView->setModel( standardModel ); + treeView->expandAll(); + + //selection changes shall trigger a slot + QItemSelectionModel *selectionModel= treeView->selectionModel(); + connect(selectionModel, SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & )), + this, SLOT(selectionChangedSlot(const QItemSelection & , const QItemSelection & ))); +} +\endcode + +Views manage selections within a separate selection model, which can be retrieved with the \l{QAbstractItemModel::selectionModel()}{selectionModel()} method. We retrieve the selection Model in order to connect a slot to its \l{QAbstractItemModel::selectionChanged()}{selectionChanged()} signal. +\code +HIER FEHLT WAS!!! +\endcode + +We get the model index that corresponds to the selection by calling +\c treeView->selectionModel()->currentIndex() and we get the the field's string by using the model index. Then we just calculate the item's \c hierarchyLevel. Top level items do not have parents and the \l{QAbstractItemModel::parent()}{parent()} method will return a default constructed QModelIndex(). This is why we use the \l{QAbstractItemModel::parent()}{parent()} method to iterate to the top level while counting the steps performed during iteration. + +The selection model (as shown above) can be retrieved, but it can also be set with \c QAbstractItemView::setSelectionModel. This is how it's possible to have 3 view classes with synchronised selections because only one instance of a selection model is used. The instance of a selection model is retrieved from the first view class with \l{QAbstractItemModel::selectionModel()}{selectionModel()} and the result is assigned to the second and third view class with \l{QAbstractItemModel::setSelectionModel()}{setSelectionModel()}; +\section2 3.3 Predefined Models +The typical way to use model/view is to wrap specific data to make it usable with view classes. Qt, however, also provides predefined models for common underlying data structures. If one of the available data structures is suitable for your application, a predefined model can be a good choice. + + \table + \row + \o QStringListModel + \o Stores a list of strings + \row + \o QStandardItemModel + \o Stores arbitrary hierarchical items + \row + \o {1, 2} QFileSystemModel +QDirModel (deprecated) + \o {1, 2} Encapsulate the local file system + \row + \o QSqlQueryModel + \o Encapsulate an SQL result set + \row + \o QSqlTableModel + \o Encapsulates an SQL table + \row + \o QSqlRelationalTableModel + \o Encapsulates an SQL table with foreign keys + \row + \o QSortFilterProxyModel + \o Sorts and/or filters another model + + \endtable + +\section2 3.4 Delegates +In all examples so far, data is presented as text or a checkbox in a cell and is edited as text or a checkbox. The component that provides these presentation and editing services is called a “delegate.” We are only just beginning to work with the delegate because the view uses a default delegate. But imagine that we want to have a different editor.(e.g. a slider or a drop down list) Or imagine that we want to present data as graphics. Let's take a look at an example called Stardelegate, ( \l{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html}{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html} ) in which stars are used to show a rating: \image stardelegate.png + +The view has a method that replaces the default delegate and installs a custom delegate. This method is called \l{QAbstractItemModel::setItemDelegate()}{setItemDelegate()}. A new delegate can be written by creating a class that inherits from QStyledItemDelegate. In order to write a delegate that displays stars and has no input capabilities, we only need to overwrite 2 methods. +\code + class StarDelegate : public QStyledItemDelegate + { + Q_OBJECT + public: + StarDelegate(QWidget *parent = 0); + void paint(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const; + QSize sizeHint(const QStyleOptionViewItem &option, + const QModelIndex &index) const; + }; + +\endcode + +\l{QAbstractItemModel::paint()}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \c index.data(). \c SizeHint specifies the stars dimensions so the the cell will provide enough height and width to accommodate the stars. + +Writing custom delegates is the right choice if you want to show your data with a custom graphical representation inside the grid of the view class. If you want to leave the grid, you can write a custom view class. + +\section2 3.5 Debugging with ModelTest +The passive nature of models provides new challenges for programmers. Inconsistencies in the model can cause the application to crash. Since the model is hit by numerous calls from the view, it is hard to find out which call has crashed the application and which operation has introduced the problem. + +Qt provides software called ModelTest, which checks models while your programming is running. Every time the model is changed, ModelTest scans the model and reports errors with an assert. This is especially important for tree models, since their hierarchical nature leaves many possibilities for subtle inconsistencies. http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest + +Unlike view classes, ModelTest uses out of range indexes to test the model. This means your application may crash with ModelTest even if it runs perfectly without it. So you also need to handle all of the indexes that are out of range when using ModelTest. + + + + + + + + + +\section2 3.6 Model/View NG + +\image path.png + +Model/View was introduced in Qt 4.0 and is a frequently used technology. Feedback from clients and new development trends have shown, that there is a need to further develop the model/view technology. Therefore a research project at Nokia is looking into ways to go beyond the current implementation. + +One limitation of model/view is that view classes are basically all fixed grids. It is possible, but really hard to make a list view with icons placed on a curve; or cells expanding on mouse over events to show additional information. In order to achieve graphically rich view experiences, Model/View NG will use QGraphicsView to render elements. Nodel/View NG also aims to make model/view programming more intuitive. One way to achieve this is to have separate models for lists, tables and trees. The current model abstraction is complex because it is capable of representing a list, a table or a tree. + +Model/View NG is a research project. You are welcome to checkout the source code, monitor progress and take part in discussions at the following address: \l{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG}{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG} + +\section1 4 Good Sources for Additional Information +\section2 4.1 Books +Model/View programming is covered quite extensively in the documentation of Qt but also in several good books. + \list 1 + \o 1.C++ GUI Programming with Qt 4 / Jasmin Blanchette, Mark Summerfield, Prentice Hall, 2nd edition, ISBN 0-13-235416-0 +also available in German: C++ GUI Programmierung mit Qt 4: Die offizielle Einführung, Addison-Wesley, ISBN 3-827327-29-6 + \o 1.The Book of Qt4, The Art of Building Qt Applications / Daniel Molkentin, Open Source Press ISBN 1-59327-147-6 +Translated from: Qt 4, Einführung in die Applikationsentwicklung, Open Source Press, ISBN 3-937514-12-0 + \o 1.Foundations of Qt Development / Johan Thelin, Apress, ISBN 1-59059-831-8 + \endlist + + +The following list provides an overview of example programs contained in the books above. Some of them make very good templates for developing similar applications. + + \table + \header + \o example name + \o view class used + \o model used + \o aspects touched + \o + \row + \o Team Leaders + \o QListview + \o QStringListModel + \o + \o Book 1, Chapter 10, Figure 10.6 + \row + \o Directory Viewer + \o QTreeView + \o QDirModel + \o + \o Book 1, Chapter 10, Figure 10.7 + \row + \o Color Names + \o QListView + \o QSortFilterProxyModel +applied to QStringListModel + \o + \o Book 1, Chapter 10, Figure 10.8 + \row + \o Currencies + \o QTableView + \o custom model based on +QAbstractTableModel + \o read only + \o Book 1, Chapter 10, Figure 10.10 + \row + \o Cities + \o QTableView + \o custom model based on +QAbstractTableModel + \o read / write + \o Book 1, Chapter 10, Figure 10.12 + \row + \o Boolean Parser + \o QTreeView + \o custom model based on +QAbstractItemModel + \o read only + \o Book 1, Chapter 10, Figure 10.14 + \row + \o Track Editor + \o {2, 1} QTableWidget + \o custom delegate providing a custom editor + \o Book 1, Chapter 10, Figure 10.15 + + \row + \o Four directory views + \o QListView +QTableView +QTreeView + \o QDirModel + \o demonstrates the use of multiple views + \o Book2, Chapter 8.2 + \row + \o Address Book + \o QListView +QTableView +QTreeView + \o custom model based on +QAbstractTableModel + \o read / write + \o Book2, Chapter 8.4 + \row + \o Address Book with sorting + \o + \o QProxyModel + \o introducing sort and filter capabilities + \o Book2, Chapter 8.5 + \row + \o Address Book +with checkboxes + \o + \o + \o introducing checkboxes +in model/view + \o Book2, Chapter 8.6 + \row + \o Address Book +with transposed grid + \o + \o custom proxy Model based on QAbstractProxyModel + \o introducing a custom model + \o Book2, Chapter 8.7 + \row + \o Address Book +with drag and drop + \o + \o + \o introducing drag and drop support + \o Book2, Chapter 8.8 + \row + \o Address Book with custom editor + \o + \o + \o introducing custom delegates + \o Book2, Chapter 8.9 + \row + \o Views + \o QListView +QTableView +QTreeView + \o QStandardItemModel + \o read only + \o Book 3, Chapter 5, figure 5-3 + \row + \o Bardelegate + \o QTableView + \o + \o custom delegate for presentation based on QAbstractItemDelegate + \o Book 3, Chapter 5, figure 5-5 + \row + \o Editdelegate + \o QTableView + \o + \o custom delegate for editing based on QAbstractItemDelegate + \o Book 3, Chapter 5, figure 5-6 + \row + \o Singleitemview + \o custom view based on +QAbstractItemView + \o + \o custom view + \o Book 3, +Chapter 5, +figure 5-7 + \row + \o listmodel + \o QTableView + \o custom Model based on +QAbstractTableModel + \o read only + \o Book 3, +Chapter 5, +Figure 5-8 + \row + \o treemodel + \o QTreeView + \o custom Model based on +QAbstractItemModel + \o read only + \o Book 3, +Chapter 5, +Figure 5-10 + \row + \o edit integers + \o QListView + \o custom Model based on +QAbstractListModel + \o read / write + \o Book 3, +Chapter 5, +Listing 5-37, Figure 5-11 + \row + \o sorting + \o QTableView + \o QSortFilterProxyModel +applied to QStringListModel + \o demonstrates sorting + \o Book 3, Chapter 5, Figure 5-12 + + \endtable + + +\section2 4.2 Qt documentation +Qt 4.6 comes with 17 examples and 2 Demonstrations for model/view. The examples can be found here: \l{http://doc.qt.nokia.com/4.6/examples-itemviews.html}{http://doc.qt.nokia.com/4.6/examples-itemviews.html} + \table + \header + \o example name + \o view class used + \o model used + \o aspects touched + \row + \o Address Book + \o QTableView + \o QTableModel +QSortFilterProxyModel + \o usage of QSortFilterProxyModel to generate different subsets from one data pool + \row + \o Basic Sort/Filter Model + \o QTreeView + \o QStandardItemModel +QSortFilterProxyModel + \o + \row + \o Chart + \o custom view + \o QStandardItemModel + \o designing custom views that cooperate with selection models + \row + \o Color Editor Factory + \o {2, 1} QTableWidget + \o enhancing the standard delegate with a new custom editor to choose colours + \row + \o Combo Widget Mapper + \o QDataWidgetMapper to map QLineEdit, QTextEdit and QComboBox + \o QStandardItemModel + \o shows how a QComboBox can serve as a view class + \row + \o Custom Sort/Filter Model + \o QTreeView + \o QStandardItemModel +QSortFilterProxyModel + \o subclass QSortFilterProxyModel +for advanced sorting and filtering + \row + \o Dir View + \o QTreeView + \o QDirModel + \o very small example to demonstrate how to assign a model to a view + \row + \o Editable Tree Model + \o QTreeView + \o custom tree model + \o comprehensive example for working with trees, demonstrates editing cells and tree structure with an underlying custom model + \row + \o Fetch More + \o QListView + \o custom list model + \o dynamically changing model + \row + \o Frozen Column + \o QTableView + \o QStandardItemModel + \o + \row + \o Pixelator + \o QTableView + \o custom table model + \o implementation of a custom delegate + \row + \o Puzzle + \o QListView + \o custom list model + \o model/view with drag and drop + \row + \o Simple DOM Model + \o QTreeView + \o custom tree model + \o read only example for a custom tree model + \row + \o Simple Tree Model + \o QTreeView + \o custom tree model + \o read only example for a custom tree model + \row + \o Simple Widget Mapper + \o QDataWidgetMapper to map QLineEdit, QTextEdit and QSpinBox + \o QStandardItemModel + \o basic QDataWidgetMapper usage + \row + \o Spin Box Delegate + \o QTableView + \o QStandardItemModel + \o custom delegate that uses a spin box as a cell editor + \row + \o Star Delegate + \o {2, 1} QTableWidget + \o comprehensive custom delegate example. + \endtable + +Demonstrations are similar to examples except that no walk-through is provided for the code lines. Demonstrations are also sometimes more feature rich. + \l{http://doc.qt.nokia.com/4.6/demos.html}{http://doc.qt.nokia.com/4.6/demos.html} + \list + \o The \bold Interview demonstration shows the same model and selection being shared between three different views. + \o Demonstration \bold Spreadsheet demonstrates the use of a table view as a spreadsheet, using custom delegates to render each item according to the type of data it contains. + \endlist + +A reference documentation for model/view technology is also available. \l{http://doc.qt.nokia.com/4.6/model-view-programming.html}{http://doc.qt.nokia.com/4.6/model-view-programming.html} + +*/ \ No newline at end of file diff --git a/doc/src/images/clock.png b/doc/src/images/clock.png new file mode 100755 index 0000000..c7f6a1b Binary files /dev/null and b/doc/src/images/clock.png differ diff --git a/doc/src/images/columnview.png b/doc/src/images/columnview.png new file mode 100755 index 0000000..2fb972e Binary files /dev/null and b/doc/src/images/columnview.png differ diff --git a/doc/src/images/combobox.png b/doc/src/images/combobox.png new file mode 100755 index 0000000..d172b41 Binary files /dev/null and b/doc/src/images/combobox.png differ diff --git a/doc/src/images/dummy_tree.png b/doc/src/images/dummy_tree.png new file mode 100755 index 0000000..7373ea6 Binary files /dev/null and b/doc/src/images/dummy_tree.png differ diff --git a/doc/src/images/edit.png b/doc/src/images/edit.png new file mode 100755 index 0000000..161b06f Binary files /dev/null and b/doc/src/images/edit.png differ diff --git a/doc/src/images/example_model.png b/doc/src/images/example_model.png new file mode 100755 index 0000000..4261261 Binary files /dev/null and b/doc/src/images/example_model.png differ diff --git a/doc/src/images/header.png b/doc/src/images/header.png new file mode 100755 index 0000000..2597635 Binary files /dev/null and b/doc/src/images/header.png differ diff --git a/doc/src/images/lineedit.png b/doc/src/images/lineedit.png new file mode 100755 index 0000000..83d1c47 Binary files /dev/null and b/doc/src/images/lineedit.png differ diff --git a/doc/src/images/list_table_tree.png b/doc/src/images/list_table_tree.png new file mode 100755 index 0000000..b2daf1f Binary files /dev/null and b/doc/src/images/list_table_tree.png differ diff --git a/doc/src/images/listview.png b/doc/src/images/listview.png new file mode 100755 index 0000000..fa49c52 Binary files /dev/null and b/doc/src/images/listview.png differ diff --git a/doc/src/images/lotto.png b/doc/src/images/lotto.png new file mode 100755 index 0000000..dd751cf Binary files /dev/null and b/doc/src/images/lotto.png differ diff --git a/doc/src/images/modelview.png b/doc/src/images/modelview.png new file mode 100755 index 0000000..7b042af Binary files /dev/null and b/doc/src/images/modelview.png differ diff --git a/doc/src/images/path.png b/doc/src/images/path.png new file mode 100755 index 0000000..73107ff Binary files /dev/null and b/doc/src/images/path.png differ diff --git a/doc/src/images/qcompleter.png b/doc/src/images/qcompleter.png new file mode 100755 index 0000000..d25caac Binary files /dev/null and b/doc/src/images/qcompleter.png differ diff --git a/doc/src/images/readonlytable.png b/doc/src/images/readonlytable.png new file mode 100755 index 0000000..90bcba4 Binary files /dev/null and b/doc/src/images/readonlytable.png differ diff --git a/doc/src/images/readonlytable_role.png b/doc/src/images/readonlytable_role.png new file mode 100755 index 0000000..7d2d416 Binary files /dev/null and b/doc/src/images/readonlytable_role.png differ diff --git a/doc/src/images/selection2.png b/doc/src/images/selection2.png new file mode 100755 index 0000000..66c757f Binary files /dev/null and b/doc/src/images/selection2.png differ diff --git a/doc/src/images/standardwidget.png b/doc/src/images/standardwidget.png new file mode 100755 index 0000000..3ccccf1 Binary files /dev/null and b/doc/src/images/standardwidget.png differ diff --git a/doc/src/images/tableview.png b/doc/src/images/tableview.png new file mode 100755 index 0000000..8be1b6c Binary files /dev/null and b/doc/src/images/tableview.png differ diff --git a/doc/src/images/tree.png b/doc/src/images/tree.png new file mode 100755 index 0000000..3f046c9 Binary files /dev/null and b/doc/src/images/tree.png differ diff --git a/doc/src/images/tree_2.png b/doc/src/images/tree_2.png new file mode 100755 index 0000000..6ee1f4a Binary files /dev/null and b/doc/src/images/tree_2.png differ diff --git a/doc/src/images/tree_2_with_algorithm.png b/doc/src/images/tree_2_with_algorithm.png new file mode 100755 index 0000000..ecf9101 Binary files /dev/null and b/doc/src/images/tree_2_with_algorithm.png differ diff --git a/doc/src/images/tree_city.png b/doc/src/images/tree_city.png new file mode 100755 index 0000000..57f03d9 Binary files /dev/null and b/doc/src/images/tree_city.png differ diff --git a/doc/src/images/treeview.png b/doc/src/images/treeview.png new file mode 100755 index 0000000..af31fe9 Binary files /dev/null and b/doc/src/images/treeview.png differ diff --git a/doc/src/images/widgetmapper.png b/doc/src/images/widgetmapper.png new file mode 100755 index 0000000..9627088 Binary files /dev/null and b/doc/src/images/widgetmapper.png differ -- cgit v0.12 From 4df3fb13821e13ecf581d87f2d224b2f1b964609 Mon Sep 17 00:00:00 2001 From: Roland Wolf Date: Thu, 27 May 2010 10:37:48 +0200 Subject: clean up previous test commit --- src/testfile.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/testfile.txt diff --git a/src/testfile.txt b/src/testfile.txt deleted file mode 100644 index e69de29..0000000 -- cgit v0.12 From f574700f920ae5d5bda25ba217d6face9f3d3902 Mon Sep 17 00:00:00 2001 From: Michael D Scull Date: Thu, 27 May 2010 15:12:58 +0200 Subject: Rolands ModelView Source --- .../tutorials/modelview/1_readonly/1_readonly.pro | 10 +++ examples/tutorials/modelview/1_readonly/main.cpp | 10 +++ .../tutorials/modelview/1_readonly/modelview.cpp | 12 ++++ .../tutorials/modelview/1_readonly/modelview.h | 18 ++++++ .../tutorials/modelview/1_readonly/mymodel.cpp | 30 +++++++++ examples/tutorials/modelview/1_readonly/mymodel.h | 16 +++++ .../modelview/2_formatting/2_formatting.pro | 10 +++ examples/tutorials/modelview/2_formatting/main.cpp | 10 +++ .../tutorials/modelview/2_formatting/modelview.cpp | 12 ++++ .../tutorials/modelview/2_formatting/modelview.h | 17 +++++ .../tutorials/modelview/2_formatting/mymodel.cpp | 73 ++++++++++++++++++++++ .../tutorials/modelview/2_formatting/mymodel.h | 16 +++++ .../modelview/3_changingmodel/3_changingmodel.pro | 10 +++ .../tutorials/modelview/3_changingmodel/main.cpp | 10 +++ .../modelview/3_changingmodel/modelview.cpp | 12 ++++ .../modelview/3_changingmodel/modelview.h | 17 +++++ .../modelview/3_changingmodel/mymodel.cpp | 53 ++++++++++++++++ .../tutorials/modelview/3_changingmodel/mymodel.h | 23 +++++++ .../tutorials/modelview/4_headers/4_headers.pro | 10 +++ examples/tutorials/modelview/4_headers/main.cpp | 10 +++ .../tutorials/modelview/4_headers/modelview.cpp | 14 +++++ examples/tutorials/modelview/4_headers/modelview.h | 18 ++++++ examples/tutorials/modelview/4_headers/mymodel.cpp | 50 +++++++++++++++ examples/tutorials/modelview/4_headers/mymodel.h | 17 +++++ examples/tutorials/modelview/5_edit/5_edit.pro | 10 +++ examples/tutorials/modelview/5_edit/main.cpp | 10 +++ examples/tutorials/modelview/5_edit/modelview.cpp | 20 ++++++ examples/tutorials/modelview/5_edit/modelview.h | 19 ++++++ examples/tutorials/modelview/5_edit/mymodel.cpp | 58 +++++++++++++++++ examples/tutorials/modelview/5_edit/mymodel.h | 24 +++++++ .../tutorials/modelview/6_treeview/6_treeview.pro | 5 ++ examples/tutorials/modelview/6_treeview/main.cpp | 10 +++ .../tutorials/modelview/6_treeview/modelview.cpp | 40 ++++++++++++ .../tutorials/modelview/6_treeview/modelview.h | 24 +++++++ .../modelview/7_selections/7_selections.pro | 5 ++ examples/tutorials/modelview/7_selections/main.cpp | 10 +++ .../tutorials/modelview/7_selections/modelview.cpp | 63 +++++++++++++++++++ .../tutorials/modelview/7_selections/modelview.h | 23 +++++++ examples/tutorials/modelview/qmake.pro | 10 +++ 39 files changed, 809 insertions(+) create mode 100755 examples/tutorials/modelview/1_readonly/1_readonly.pro create mode 100755 examples/tutorials/modelview/1_readonly/main.cpp create mode 100755 examples/tutorials/modelview/1_readonly/modelview.cpp create mode 100755 examples/tutorials/modelview/1_readonly/modelview.h create mode 100755 examples/tutorials/modelview/1_readonly/mymodel.cpp create mode 100755 examples/tutorials/modelview/1_readonly/mymodel.h create mode 100755 examples/tutorials/modelview/2_formatting/2_formatting.pro create mode 100755 examples/tutorials/modelview/2_formatting/main.cpp create mode 100755 examples/tutorials/modelview/2_formatting/modelview.cpp create mode 100755 examples/tutorials/modelview/2_formatting/modelview.h create mode 100755 examples/tutorials/modelview/2_formatting/mymodel.cpp create mode 100755 examples/tutorials/modelview/2_formatting/mymodel.h create mode 100755 examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro create mode 100755 examples/tutorials/modelview/3_changingmodel/main.cpp create mode 100755 examples/tutorials/modelview/3_changingmodel/modelview.cpp create mode 100755 examples/tutorials/modelview/3_changingmodel/modelview.h create mode 100755 examples/tutorials/modelview/3_changingmodel/mymodel.cpp create mode 100755 examples/tutorials/modelview/3_changingmodel/mymodel.h create mode 100755 examples/tutorials/modelview/4_headers/4_headers.pro create mode 100755 examples/tutorials/modelview/4_headers/main.cpp create mode 100755 examples/tutorials/modelview/4_headers/modelview.cpp create mode 100755 examples/tutorials/modelview/4_headers/modelview.h create mode 100755 examples/tutorials/modelview/4_headers/mymodel.cpp create mode 100755 examples/tutorials/modelview/4_headers/mymodel.h create mode 100755 examples/tutorials/modelview/5_edit/5_edit.pro create mode 100755 examples/tutorials/modelview/5_edit/main.cpp create mode 100755 examples/tutorials/modelview/5_edit/modelview.cpp create mode 100755 examples/tutorials/modelview/5_edit/modelview.h create mode 100755 examples/tutorials/modelview/5_edit/mymodel.cpp create mode 100755 examples/tutorials/modelview/5_edit/mymodel.h create mode 100755 examples/tutorials/modelview/6_treeview/6_treeview.pro create mode 100755 examples/tutorials/modelview/6_treeview/main.cpp create mode 100755 examples/tutorials/modelview/6_treeview/modelview.cpp create mode 100755 examples/tutorials/modelview/6_treeview/modelview.h create mode 100755 examples/tutorials/modelview/7_selections/7_selections.pro create mode 100755 examples/tutorials/modelview/7_selections/main.cpp create mode 100755 examples/tutorials/modelview/7_selections/modelview.cpp create mode 100755 examples/tutorials/modelview/7_selections/modelview.h create mode 100755 examples/tutorials/modelview/qmake.pro diff --git a/examples/tutorials/modelview/1_readonly/1_readonly.pro b/examples/tutorials/modelview/1_readonly/1_readonly.pro new file mode 100755 index 0000000..1162d5a --- /dev/null +++ b/examples/tutorials/modelview/1_readonly/1_readonly.pro @@ -0,0 +1,10 @@ +TARGET = mv_readonly + +TEMPLATE = app + +SOURCES += main.cpp \ + modelview.cpp \ + mymodel.cpp + +HEADERS += modelview.h \ + mymodel.h diff --git a/examples/tutorials/modelview/1_readonly/main.cpp b/examples/tutorials/modelview/1_readonly/main.cpp new file mode 100755 index 0000000..998503c --- /dev/null +++ b/examples/tutorials/modelview/1_readonly/main.cpp @@ -0,0 +1,10 @@ +#include +#include "modelview.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ModelView w; + w.show(); + return a.exec(); +} diff --git a/examples/tutorials/modelview/1_readonly/modelview.cpp b/examples/tutorials/modelview/1_readonly/modelview.cpp new file mode 100755 index 0000000..becd61d --- /dev/null +++ b/examples/tutorials/modelview/1_readonly/modelview.cpp @@ -0,0 +1,12 @@ +#include +#include "modelview.h" +#include "mymodel.h" + +ModelView::ModelView(QWidget *parent) + : QMainWindow(parent) +{ + tableView = new QTableView(this); + setCentralWidget(tableView); + tableView->setModel(new MyModel(this) ); +} + diff --git a/examples/tutorials/modelview/1_readonly/modelview.h b/examples/tutorials/modelview/1_readonly/modelview.h new file mode 100755 index 0000000..f1b63bd --- /dev/null +++ b/examples/tutorials/modelview/1_readonly/modelview.h @@ -0,0 +1,18 @@ +#ifndef MODELVIEW_H +#define MODELVIEW_H + +#include + +class QTableView; //forward declaration + +class ModelView : public QMainWindow +{ + Q_OBJECT +private: + QTableView *tableView; +public: + ModelView(QWidget *parent = 0); + +}; + +#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/1_readonly/mymodel.cpp b/examples/tutorials/modelview/1_readonly/mymodel.cpp new file mode 100755 index 0000000..ff3e2d2 --- /dev/null +++ b/examples/tutorials/modelview/1_readonly/mymodel.cpp @@ -0,0 +1,30 @@ +#include "mymodel.h" + +MyModel::MyModel(QObject *parent) + :QAbstractTableModel(parent) +{ +} + +//------------------------------------------------------- +int MyModel::rowCount(const QModelIndex & /*parent*/ ) const +{ + return 2; +} + +//------------------------------------------------------- +int MyModel::columnCount(const QModelIndex & /*parent*/ ) const +{ + return 3; +} + +//------------------------------------------------------- +QVariant MyModel::data(const QModelIndex &index, int role ) const +{ + if(role == Qt::DisplayRole) + { + return QString("Row%1, Column%2") + .arg(index.row() + 1) + .arg(index.column() +1); + } + return QVariant(); +} diff --git a/examples/tutorials/modelview/1_readonly/mymodel.h b/examples/tutorials/modelview/1_readonly/mymodel.h new file mode 100755 index 0000000..01ae6cb --- /dev/null +++ b/examples/tutorials/modelview/1_readonly/mymodel.h @@ -0,0 +1,16 @@ +#ifndef MYMODEL_H +#define MYMODEL_H + +#include + +class MyModel : public QAbstractTableModel +{ + Q_OBJECT +public: + MyModel(QObject *parent); + int rowCount(const QModelIndex &parent = QModelIndex()) const ; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; +}; + +#endif // MYMODEL_H diff --git a/examples/tutorials/modelview/2_formatting/2_formatting.pro b/examples/tutorials/modelview/2_formatting/2_formatting.pro new file mode 100755 index 0000000..7e70d81 --- /dev/null +++ b/examples/tutorials/modelview/2_formatting/2_formatting.pro @@ -0,0 +1,10 @@ +TARGET = mv_formatting + +TEMPLATE = app + +SOURCES += main.cpp \ + modelview.cpp \ + mymodel.cpp + +HEADERS += modelview.h \ + mymodel.h diff --git a/examples/tutorials/modelview/2_formatting/main.cpp b/examples/tutorials/modelview/2_formatting/main.cpp new file mode 100755 index 0000000..998503c --- /dev/null +++ b/examples/tutorials/modelview/2_formatting/main.cpp @@ -0,0 +1,10 @@ +#include +#include "modelview.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ModelView w; + w.show(); + return a.exec(); +} diff --git a/examples/tutorials/modelview/2_formatting/modelview.cpp b/examples/tutorials/modelview/2_formatting/modelview.cpp new file mode 100755 index 0000000..becd61d --- /dev/null +++ b/examples/tutorials/modelview/2_formatting/modelview.cpp @@ -0,0 +1,12 @@ +#include +#include "modelview.h" +#include "mymodel.h" + +ModelView::ModelView(QWidget *parent) + : QMainWindow(parent) +{ + tableView = new QTableView(this); + setCentralWidget(tableView); + tableView->setModel(new MyModel(this) ); +} + diff --git a/examples/tutorials/modelview/2_formatting/modelview.h b/examples/tutorials/modelview/2_formatting/modelview.h new file mode 100755 index 0000000..98bee38 --- /dev/null +++ b/examples/tutorials/modelview/2_formatting/modelview.h @@ -0,0 +1,17 @@ +#ifndef MODELVIEW_H +#define MODELVIEW_H + +#include + +class QTableView; //forward declaration + +class ModelView : public QMainWindow +{ + Q_OBJECT +private: + QTableView *tableView; +public: + ModelView(QWidget *parent = 0); +}; + +#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/2_formatting/mymodel.cpp b/examples/tutorials/modelview/2_formatting/mymodel.cpp new file mode 100755 index 0000000..48b1134 --- /dev/null +++ b/examples/tutorials/modelview/2_formatting/mymodel.cpp @@ -0,0 +1,73 @@ +#include +#include +#include "mymodel.h" +#include + +MyModel::MyModel(QObject *parent) + :QAbstractTableModel(parent) +{ +} + +//------------------------------------------------------- +int MyModel::rowCount(const QModelIndex & /*parent */ ) const +{ + return 2; +} + +//------------------------------------------------------- +int MyModel::columnCount(const QModelIndex & /*parent */ ) const +{ + return 3; +} + +//------------------------------------------------------- +QVariant MyModel::data(const QModelIndex &index, int role ) const +{ + int row = index.row(); + int col = index.column(); + // generate a log message when this method gets called + qDebug() << QString("row %1, col%2, role %3") + .arg(row).arg(col).arg(role); + + switch(role){ + case Qt::DisplayRole: + if(row == 0 && col == 1 )return QString("<--left"); + if(row == 1 && col == 1 )return QString("right-->"); + + return QString("Row%1, Column%2") + .arg(row + 1) + .arg(col +1); + break; + case Qt::FontRole: + if(row == 0 && col ==0 ) //change font only for cell(0,0) + { + QFont boldFont; + boldFont.setBold(true); + return boldFont; + } + break; + case Qt::BackgroundRole: + + if(row == 1 && col ==2 ) //change background only for cell(1,2) + { + QBrush redBackground(QColor(Qt::red)); + return redBackground; + } + break; + case Qt::TextAlignmentRole: + + if(row == 1 && col ==1 ) //change text alignment only for cell(1,1) + { + return Qt::AlignRight + Qt::AlignVCenter; + } + break; + case Qt::CheckStateRole: + + if(row == 1 && col ==0 ) //add a checkbox to cell(1,0) + { + return Qt::Checked; + } + } + return QVariant(); +} + diff --git a/examples/tutorials/modelview/2_formatting/mymodel.h b/examples/tutorials/modelview/2_formatting/mymodel.h new file mode 100755 index 0000000..01ae6cb --- /dev/null +++ b/examples/tutorials/modelview/2_formatting/mymodel.h @@ -0,0 +1,16 @@ +#ifndef MYMODEL_H +#define MYMODEL_H + +#include + +class MyModel : public QAbstractTableModel +{ + Q_OBJECT +public: + MyModel(QObject *parent); + int rowCount(const QModelIndex &parent = QModelIndex()) const ; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; +}; + +#endif // MYMODEL_H diff --git a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro new file mode 100755 index 0000000..d61ee4c --- /dev/null +++ b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro @@ -0,0 +1,10 @@ +TARGET = mv_changingmodel + +TEMPLATE = app + +SOURCES += main.cpp \ + modelview.cpp \ + mymodel.cpp + +HEADERS += modelview.h \ + mymodel.h diff --git a/examples/tutorials/modelview/3_changingmodel/main.cpp b/examples/tutorials/modelview/3_changingmodel/main.cpp new file mode 100755 index 0000000..998503c --- /dev/null +++ b/examples/tutorials/modelview/3_changingmodel/main.cpp @@ -0,0 +1,10 @@ +#include +#include "modelview.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ModelView w; + w.show(); + return a.exec(); +} diff --git a/examples/tutorials/modelview/3_changingmodel/modelview.cpp b/examples/tutorials/modelview/3_changingmodel/modelview.cpp new file mode 100755 index 0000000..becd61d --- /dev/null +++ b/examples/tutorials/modelview/3_changingmodel/modelview.cpp @@ -0,0 +1,12 @@ +#include +#include "modelview.h" +#include "mymodel.h" + +ModelView::ModelView(QWidget *parent) + : QMainWindow(parent) +{ + tableView = new QTableView(this); + setCentralWidget(tableView); + tableView->setModel(new MyModel(this) ); +} + diff --git a/examples/tutorials/modelview/3_changingmodel/modelview.h b/examples/tutorials/modelview/3_changingmodel/modelview.h new file mode 100755 index 0000000..98bee38 --- /dev/null +++ b/examples/tutorials/modelview/3_changingmodel/modelview.h @@ -0,0 +1,17 @@ +#ifndef MODELVIEW_H +#define MODELVIEW_H + +#include + +class QTableView; //forward declaration + +class ModelView : public QMainWindow +{ + Q_OBJECT +private: + QTableView *tableView; +public: + ModelView(QWidget *parent = 0); +}; + +#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp new file mode 100755 index 0000000..d594175 --- /dev/null +++ b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp @@ -0,0 +1,53 @@ +#include +#include +#include +#include "mymodel.h" + + +MyModel::MyModel(QObject *parent) + :QAbstractTableModel(parent) +{ +// selectedCell = 0; + timer = new QTimer(this); + timer->setInterval(1000); + connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit()) ); + timer->start(); +} + +//------------------------------------------------------- +int MyModel::rowCount(const QModelIndex & /*parent */ ) const +{ + return 2; +} + +//------------------------------------------------------- +int MyModel::columnCount(const QModelIndex & /*parent */ ) const +{ + return 3; +} + +//------------------------------------------------------- +QVariant MyModel::data(const QModelIndex &index, int role ) const +{ + int row = index.row(); + int col = index.column(); + + if(role == Qt::DisplayRole) + { + if(row == 0 && col == 0 ) + { + return QTime::currentTime().toString(); + } + } + return QVariant(); +} + +//------------------------------------------------------- +void MyModel::timerHit() +{ + //we identify the top left cell + QModelIndex topLeft = createIndex ( 0,0 ); + //emit a signal to make the view reread identified data + emit dataChanged ( topLeft, topLeft ); +} + diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.h b/examples/tutorials/modelview/3_changingmodel/mymodel.h new file mode 100755 index 0000000..9cc023b --- /dev/null +++ b/examples/tutorials/modelview/3_changingmodel/mymodel.h @@ -0,0 +1,23 @@ +#ifndef MYMODEL_H +#define MYMODEL_H + +#include + +class QTimer; // forward declaration + +class MyModel : public QAbstractTableModel +{ + Q_OBJECT +public: + MyModel(QObject *parent); + int rowCount(const QModelIndex &parent = QModelIndex()) const ; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QTimer *timer; +private: + int selectedCell; +private slots: + void timerHit(); +}; + +#endif // MYMODEL_H diff --git a/examples/tutorials/modelview/4_headers/4_headers.pro b/examples/tutorials/modelview/4_headers/4_headers.pro new file mode 100755 index 0000000..d6f8d23 --- /dev/null +++ b/examples/tutorials/modelview/4_headers/4_headers.pro @@ -0,0 +1,10 @@ +TARGET = mv_headers + +TEMPLATE = app + +SOURCES += main.cpp \ + modelview.cpp \ + mymodel.cpp + +HEADERS += modelview.h \ + mymodel.h diff --git a/examples/tutorials/modelview/4_headers/main.cpp b/examples/tutorials/modelview/4_headers/main.cpp new file mode 100755 index 0000000..998503c --- /dev/null +++ b/examples/tutorials/modelview/4_headers/main.cpp @@ -0,0 +1,10 @@ +#include +#include "modelview.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ModelView w; + w.show(); + return a.exec(); +} diff --git a/examples/tutorials/modelview/4_headers/modelview.cpp b/examples/tutorials/modelview/4_headers/modelview.cpp new file mode 100755 index 0000000..39394da --- /dev/null +++ b/examples/tutorials/modelview/4_headers/modelview.cpp @@ -0,0 +1,14 @@ +#include +#include +#include "modelview.h" +#include "mymodel.h" + +ModelView::ModelView(QWidget *parent) + : QMainWindow(parent) +{ + tableView = new QTableView(this); + setCentralWidget(tableView); + tableView->setModel(new MyModel(this) ); + tableView->verticalHeader()->hide(); +} + diff --git a/examples/tutorials/modelview/4_headers/modelview.h b/examples/tutorials/modelview/4_headers/modelview.h new file mode 100755 index 0000000..f1b63bd --- /dev/null +++ b/examples/tutorials/modelview/4_headers/modelview.h @@ -0,0 +1,18 @@ +#ifndef MODELVIEW_H +#define MODELVIEW_H + +#include + +class QTableView; //forward declaration + +class ModelView : public QMainWindow +{ + Q_OBJECT +private: + QTableView *tableView; +public: + ModelView(QWidget *parent = 0); + +}; + +#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/4_headers/mymodel.cpp b/examples/tutorials/modelview/4_headers/mymodel.cpp new file mode 100755 index 0000000..a032fe5 --- /dev/null +++ b/examples/tutorials/modelview/4_headers/mymodel.cpp @@ -0,0 +1,50 @@ +#include "mymodel.h" + +MyModel::MyModel(QObject *parent) + :QAbstractTableModel(parent) +{ +} + +//------------------------------------------------------- +int MyModel::rowCount(const QModelIndex & /*parent*/ ) const +{ + return 2; +} + +//------------------------------------------------------- +int MyModel::columnCount(const QModelIndex & /*parent*/ ) const +{ + return 3; +} + +//------------------------------------------------------- +QVariant MyModel::data(const QModelIndex &index, int role ) const +{ + if(role == Qt::DisplayRole) + { + return QString("Row%1, Column%2") + .arg(index.row() + 1) + .arg(index.column() +1); + } + return QVariant(); +} + + +QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (role == Qt::DisplayRole) + { + if (orientation == Qt::Horizontal) { + switch (section) + { + case 0: + return QString("first"); + case 1: + return QString("second"); + case 2: + return QString("third"); + } + } + } + return QVariant(); +} diff --git a/examples/tutorials/modelview/4_headers/mymodel.h b/examples/tutorials/modelview/4_headers/mymodel.h new file mode 100755 index 0000000..327ca10 --- /dev/null +++ b/examples/tutorials/modelview/4_headers/mymodel.h @@ -0,0 +1,17 @@ +#ifndef MYMODEL_H +#define MYMODEL_H + +#include + +class MyModel : public QAbstractTableModel +{ + Q_OBJECT +public: + MyModel(QObject *parent); + int rowCount(const QModelIndex &parent = QModelIndex()) const ; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + QVariant headerData(int section, Qt::Orientation orientation, int role) const; +}; + +#endif // MYMODEL_H diff --git a/examples/tutorials/modelview/5_edit/5_edit.pro b/examples/tutorials/modelview/5_edit/5_edit.pro new file mode 100755 index 0000000..e18c596 --- /dev/null +++ b/examples/tutorials/modelview/5_edit/5_edit.pro @@ -0,0 +1,10 @@ +TARGET = mv_edit + +TEMPLATE = app + +SOURCES += main.cpp \ + modelview.cpp \ + mymodel.cpp + +HEADERS += modelview.h \ + mymodel.h diff --git a/examples/tutorials/modelview/5_edit/main.cpp b/examples/tutorials/modelview/5_edit/main.cpp new file mode 100755 index 0000000..998503c --- /dev/null +++ b/examples/tutorials/modelview/5_edit/main.cpp @@ -0,0 +1,10 @@ +#include +#include "modelview.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ModelView w; + w.show(); + return a.exec(); +} diff --git a/examples/tutorials/modelview/5_edit/modelview.cpp b/examples/tutorials/modelview/5_edit/modelview.cpp new file mode 100755 index 0000000..b6e8e34 --- /dev/null +++ b/examples/tutorials/modelview/5_edit/modelview.cpp @@ -0,0 +1,20 @@ +#include +#include "modelview.h" +#include "mymodel.h" + +ModelView::ModelView(QWidget *parent) + : QMainWindow(parent) +{ + tableView = new QTableView(this); + setCentralWidget(tableView); + QAbstractTableModel *myModel = new MyModel(this); + tableView->setModel( myModel ); + + //transfer changes to the model to the window title + connect(myModel, SIGNAL(editCompleted(const QString &) ), this, SLOT(setWindowTitle(const QString &))); +} + +void ModelView::showWindowTitle(const QString & title) +{ +setWindowTitle( title ); +} diff --git a/examples/tutorials/modelview/5_edit/modelview.h b/examples/tutorials/modelview/5_edit/modelview.h new file mode 100755 index 0000000..e1591f9 --- /dev/null +++ b/examples/tutorials/modelview/5_edit/modelview.h @@ -0,0 +1,19 @@ +#ifndef MODELVIEW_H +#define MODELVIEW_H + +#include + +class QTableView; //forward declaration + +class ModelView : public QMainWindow +{ + Q_OBJECT +private: + QTableView *tableView; +public: + ModelView(QWidget *parent = 0); +public slots: + void showWindowTitle(const QString & title); +}; + +#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/5_edit/mymodel.cpp b/examples/tutorials/modelview/5_edit/mymodel.cpp new file mode 100755 index 0000000..c64a6b7 --- /dev/null +++ b/examples/tutorials/modelview/5_edit/mymodel.cpp @@ -0,0 +1,58 @@ +#include "mymodel.h" + +const int COLS= 3; +const int ROWS= 2; + +MyModel::MyModel(QObject *parent) + :QAbstractTableModel(parent) +{ + //gridData needs to have 6 element, one for each table cell + m_gridData << "1/1" << "1/2" << "1/3" << "2/1" << "2/2" << "2/3" ; +} + +//------------------------------------------------------- +int MyModel::rowCount(const QModelIndex & /*parent*/ ) const +{ + return ROWS; +} + +//------------------------------------------------------- +int MyModel::columnCount(const QModelIndex & /*parent*/ ) const +{ + return COLS; +} + +//------------------------------------------------------- +QVariant MyModel::data(const QModelIndex &index, int role ) const +{ + if(role == Qt::DisplayRole) + { + return m_gridData[modelIndexToOffset(index)]; + } + return QVariant(); +} + +//----------------------------------------------------------------- +bool MyModel::setData ( const QModelIndex & index, const QVariant & value, int role ) +{ + if(role == Qt::EditRole) + { + m_gridData[modelIndexToOffset(index)] = value.toString(); + emit editCompleted(m_gridData.join(" | ") ); + } + return true; +} + +//----------------------------------------------------------------- +Qt::ItemFlags MyModel::flags ( const QModelIndex & /*index*/ ) const +{ + return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled ; +} + +//----------------------------------------------------------------- +//convert row and column information to array offset +int MyModel::modelIndexToOffset(const QModelIndex & index) const +{ + return index.row()*COLS + index.column(); +} + diff --git a/examples/tutorials/modelview/5_edit/mymodel.h b/examples/tutorials/modelview/5_edit/mymodel.h new file mode 100755 index 0000000..f8fac77 --- /dev/null +++ b/examples/tutorials/modelview/5_edit/mymodel.h @@ -0,0 +1,24 @@ +#ifndef MYMODEL_H +#define MYMODEL_H + +#include +#include + +class MyModel : public QAbstractTableModel +{ + Q_OBJECT +public: + MyModel(QObject *parent); + int rowCount(const QModelIndex &parent = QModelIndex()) const ; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); + Qt::ItemFlags flags ( const QModelIndex & index ) const ; +private: + QStringList m_gridData; //holds text entered into QTableView + int modelIndexToOffset(const QModelIndex & index) const; +signals: + void editCompleted(const QString &); +}; + +#endif // MYMODEL_H diff --git a/examples/tutorials/modelview/6_treeview/6_treeview.pro b/examples/tutorials/modelview/6_treeview/6_treeview.pro new file mode 100755 index 0000000..6d078be --- /dev/null +++ b/examples/tutorials/modelview/6_treeview/6_treeview.pro @@ -0,0 +1,5 @@ +TARGET = mv_tree +TEMPLATE = app +SOURCES += main.cpp \ + modelview.cpp +HEADERS += modelview.h diff --git a/examples/tutorials/modelview/6_treeview/main.cpp b/examples/tutorials/modelview/6_treeview/main.cpp new file mode 100755 index 0000000..998503c --- /dev/null +++ b/examples/tutorials/modelview/6_treeview/main.cpp @@ -0,0 +1,10 @@ +#include +#include "modelview.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ModelView w; + w.show(); + return a.exec(); +} diff --git a/examples/tutorials/modelview/6_treeview/modelview.cpp b/examples/tutorials/modelview/6_treeview/modelview.cpp new file mode 100755 index 0000000..a5488f7 --- /dev/null +++ b/examples/tutorials/modelview/6_treeview/modelview.cpp @@ -0,0 +1,40 @@ +#include +#include +#include +#include "modelview.h" + + +const int ROWS = 2; +const int COLUMNS = 3; + +ModelView::ModelView(QWidget *parent) + : QMainWindow(parent) +{ + treeView = new QTreeView(this); + setCentralWidget(treeView); + standardModel = new QStandardItemModel ; + + QList preparedColumn =prepareColumn("first", "second", "third"); + QStandardItem *item = standardModel->invisibleRootItem(); + // adding a row to the invisible root item produces a root element + item->appendRow(preparedColumn); + + QList secondRow =prepareColumn("111", "222", "333"); + // adding a row to an item starts a subtree + preparedColumn.first()->appendRow(secondRow); + + treeView->setModel( standardModel ); + treeView->expandAll(); +} + +//--------------------------------------------------------------------------- +QList ModelView::prepareColumn(const QString &first, + const QString &second, + const QString &third ) +{ + QList colItems; + colItems << new QStandardItem(first); + colItems << new QStandardItem(second); + colItems << new QStandardItem(third); + return colItems; +} diff --git a/examples/tutorials/modelview/6_treeview/modelview.h b/examples/tutorials/modelview/6_treeview/modelview.h new file mode 100755 index 0000000..1ab23ea --- /dev/null +++ b/examples/tutorials/modelview/6_treeview/modelview.h @@ -0,0 +1,24 @@ +#ifndef MODELVIEW_H +#define MODELVIEW_H + +#include + +class QTreeView; //forward declaration +class QStandardItemModel; +class QStandardItem; + + +class ModelView : public QMainWindow +{ + Q_OBJECT +private: + QTreeView *treeView; + QStandardItemModel *standardModel; + QList prepareColumn(const QString &first, + const QString &second, + const QString &third ); +public: + ModelView(QWidget *parent = 0); +}; + +#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/7_selections/7_selections.pro b/examples/tutorials/modelview/7_selections/7_selections.pro new file mode 100755 index 0000000..952641c6 --- /dev/null +++ b/examples/tutorials/modelview/7_selections/7_selections.pro @@ -0,0 +1,5 @@ +TARGET = mv_selections +TEMPLATE = app +SOURCES += main.cpp \ + modelview.cpp +HEADERS += modelview.h diff --git a/examples/tutorials/modelview/7_selections/main.cpp b/examples/tutorials/modelview/7_selections/main.cpp new file mode 100755 index 0000000..998503c --- /dev/null +++ b/examples/tutorials/modelview/7_selections/main.cpp @@ -0,0 +1,10 @@ +#include +#include "modelview.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ModelView w; + w.show(); + return a.exec(); +} diff --git a/examples/tutorials/modelview/7_selections/modelview.cpp b/examples/tutorials/modelview/7_selections/modelview.cpp new file mode 100755 index 0000000..49c5bb8 --- /dev/null +++ b/examples/tutorials/modelview/7_selections/modelview.cpp @@ -0,0 +1,63 @@ +#include +#include +#include +#include "modelview.h" + +ModelView::ModelView(QWidget *parent) + : QMainWindow(parent) +{ + treeView = new QTreeView(this); + setCentralWidget(treeView); + standardModel = new QStandardItemModel ; + QStandardItem *rootNode = standardModel->invisibleRootItem(); + + + //defining a couple of items + QStandardItem *americaItem = new QStandardItem("America"); + QStandardItem *mexicoItem = new QStandardItem("Canada"); + QStandardItem *usaItem = new QStandardItem("USA"); + QStandardItem *bostonItem = new QStandardItem("Boston"); + QStandardItem *europeItem = new QStandardItem("Europe"); + QStandardItem *italyItem = new QStandardItem("Italy"); + QStandardItem *romeItem = new QStandardItem("Rome"); + QStandardItem *veronaItem = new QStandardItem("Verona"); + + //building up the hierarchy + rootNode-> appendRow(americaItem); + rootNode-> appendRow(europeItem); + americaItem-> appendRow(mexicoItem); + americaItem-> appendRow(usaItem); + usaItem-> appendRow(bostonItem); + europeItem-> appendRow(italyItem); + italyItem-> appendRow(romeItem); + italyItem-> appendRow(veronaItem); + + //register the model + treeView->setModel( standardModel ); + treeView->expandAll(); + + //selection changes shall trigger a slot + QItemSelectionModel *selectionModel= treeView->selectionModel(); + connect(selectionModel, SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & )), + this, SLOT(selectionChangedSlot(const QItemSelection & , const QItemSelection & ))); +} + +//------------------------------------------------------------------------------------ +void ModelView::selectionChangedSlot(const QItemSelection & /*newSelection*/, const QItemSelection & /*oldSelection*/) +{ + const QModelIndex index = treeView->selectionModel()->currentIndex(); + QString selectedText = index.data(Qt::DisplayRole).toString(); + int hierarchyLevel=1; + QModelIndex seekRoot = index; + while(seekRoot.parent() != QModelIndex() ) + { + seekRoot = seekRoot.parent(); + hierarchyLevel++; + } + QString showString = QString("%1, Level %2").arg(selectedText) + .arg(hierarchyLevel); + setWindowTitle(showString); +} + + + diff --git a/examples/tutorials/modelview/7_selections/modelview.h b/examples/tutorials/modelview/7_selections/modelview.h new file mode 100755 index 0000000..0e638a9 --- /dev/null +++ b/examples/tutorials/modelview/7_selections/modelview.h @@ -0,0 +1,23 @@ +#ifndef MODELVIEW_H +#define MODELVIEW_H + +#include + +class QTreeView; //forward declaration +class QStandardItemModel; +class QItemSelection; + + +class ModelView : public QMainWindow +{ + Q_OBJECT +private: + QTreeView *treeView; + QStandardItemModel *standardModel; +private slots: + void selectionChangedSlot(const QItemSelection & newSelection, const QItemSelection & oldSelection); +public: + ModelView(QWidget *parent = 0); +}; + +#endif // MODELVIEW_H diff --git a/examples/tutorials/modelview/qmake.pro b/examples/tutorials/modelview/qmake.pro new file mode 100755 index 0000000..7f684ba --- /dev/null +++ b/examples/tutorials/modelview/qmake.pro @@ -0,0 +1,10 @@ +TEMPLATE = subdirs + +SUBDIRS = 1_readonly \ + 2_formatting \ + 3_changingmodel \ + 4_headers \ + 5_edit \ + 6_treeview \ + 7_selections + -- cgit v0.12 From cdc354e3e777b6de28710c05b83567fa3ad63658 Mon Sep 17 00:00:00 2001 From: Michael D Scull Date: Tue, 22 Jun 2010 11:56:24 +0200 Subject: new version of modelview.qdoc with snippets --- doc/src/frameworks-technologies/modelview.qdoc | 168 +++++-------------------- 1 file changed, 29 insertions(+), 139 deletions(-) diff --git a/doc/src/frameworks-technologies/modelview.qdoc b/doc/src/frameworks-technologies/modelview.qdoc index 7729cd2..5f9969b 100755 --- a/doc/src/frameworks-technologies/modelview.qdoc +++ b/doc/src/frameworks-technologies/modelview.qdoc @@ -69,59 +69,16 @@ Below are 7 very simple and independent applications that show different sides o We start with an application that uses a \l QTableView to show data. We will add editing capabilities later. -------------------------------------------------------------main.cpp--------------------- -\code -#include -#include "modelview.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - ModelView w; - w.show(); - return a.exec(); -} -\endcode + \snippet examples/tutorials/modelview/1_readonly/main.cpp We have the usual main() function; -------------------------------------------------------------modelview.h--------------------- -\code -#ifndef MODELVIEW_H -#define MODELVIEW_H - -#include - -class QTableView; //forward declaration - -class ModelView : public QMainWindow -{ - Q_OBJECT -private: - QTableView *tableView; -public: - ModelView(QWidget *parent = 0); - -}; - -#endif // MODELVIEW_H -\endcode + \snippet examples/tutorials/modelview/1_readonly/modelview.h The application is a \l QMainWindow that holds a \l QTableView. -------------------------------------------------------------modelview.cpp--------------------- -\code -#include -#include "modelview.h" -#include "mymodel.h" - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - tableView = new QTableView(this); - setCentralWidget(tableView); - tableView->setModel(new MyModel(this) ); -} - -\endcode + \snippet examples/tutorials/modelview/1_readonly/modelview.cpp Here is the interesting part: We use \c tableView->setModel(new MyModel(this) ); to instantiate the Model and pass its pointer to \l {QTableView::}{tableView()} OR \l QTableView::tableView() OR \l QTableView::tableView . \l {QTableView::}{tableView} will invoke the methods of the pointer it has received to find out two things: \list @@ -133,32 +90,13 @@ The model needs some code to respond to this. We have a table data set, so let's start with QAbstractTableModel since it is easier to use. -------------------------------------------------------------mymodel.h--------------------- -\code -#ifndef MYMODEL_H -#define MYMODEL_H - -#include - -class MyModel : public QAbstractTableModel -{ - Q_OBJECT -public: - MyModel(QObject *parent); - int rowCount(const QModelIndex &parent = QModelIndex()) const ; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; -}; - -#endif // MYMODEL_H -\endcode + \snippet examples/tutorials/modelview/1_readonly/mymodel.h QAbstractTableModel requires the implementation of three abstract methods. -------------------------------------------------------------mymodel.cpp--------------------- -\code -HIER FEHLT mymodel.cpp !!! -\endcode + \snippet examples/tutorials/modelview/1_readonly/mymodel.cpp The number of rows and columns is set by \c MyModel::rowCount() and \c MyModel::columnCount(). When the view has to know what the cell 's text is, it calls the \l{QAbstractItemModel::data()}{data()} method. Row and column information is specified with parameter \c index and the role is set to Qt::Display Role. Other roles are covered in the next section. In our example, the data that should be displayed is generated. In a real application, \c MyModel would have a member called \c MyData, which serves as the target for all reading and writing operations. @@ -173,9 +111,8 @@ In addition to controlling what text the view displays, the model also controls In fact, nothing except for the \l{QAbstractItemModel::data()}{data()} method needs to be changed to set fonts, background colour, alignment and a checkbox. Here is the \l{QAbstractItemModel::data()}{data()} method that produces the result shown above: -\code -HIER FEHLT WAS !!! -\endcode +-------------------------------------------------------------mymodel.cpp--------------------- + \snippet examples/tutorials/modelview/2_formatting/mymodel.cpp Each formatting property will be requested from the model with a separate call to the \l{QAbstractItemModel::data()}{data()} method. The \c role parameter is used to let the model know which property is being requested: @@ -216,6 +153,8 @@ Now we need to determine how using a seperated model impacts the application's p \image clock.png We still have a read only table, but this time the content changes every second because we are showing the current time. + +!!!!!I CAN'T FIND THIS FILE!!!!! \code QVariant MyModel::data(const QModelIndex &index, int role ) const { @@ -236,6 +175,8 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const \endcode Something is missing to make the clock tick. We need to tell the view every second that the time has changed and that it needs to be read again. We do this with a timer. In the constructor, we set its interval to 1 second and it connect its timeout signal. + +?????(include section from 3_changingmodel/mymodel.cpp)????? \code MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) @@ -249,6 +190,8 @@ MyModel::MyModel(QObject *parent) \endcode Here is the corresponding slot: + +?????(include section from 3_changingmodel/mymodel.cpp)????? \code void MyModel::timerHit() @@ -269,6 +212,9 @@ Headers can be hidden via a view method. The header content, however , is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: + + +?????(include section from 4_headers/mymodel.cpp)????? \code QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const { @@ -295,34 +241,12 @@ QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) In this example, we are going to build an application that automatically populates a window title with content by repeating values entered into table cells. The model decides whether editing capabilities are available . We only have to modify the model in order for the available editing capabilities to be enabled. This is done by reimplementing the following virtual methods: \l{QAbstractItemModel::setData()}{setData()} and \l{QAbstractItemModel::flags()}{flags()}. -\code -#ifndef MYMODEL_H -#define MYMODEL_H - -#include -#include - -class MyModel : public QAbstractTableModel -{ - Q_OBJECT -public: - MyModel(QObject *parent); - int rowCount(const QModelIndex &parent = QModelIndex()) const ; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); - Qt::ItemFlags flags ( const QModelIndex & index ) const ; -private: - QStringList m_gridData; //holds text entered into QTableView - int modelIndexToOffset(const QModelIndex & index) const; -signals: - void editCompleted(const QString &); -}; - -#endif // MYMODEL_H -\endcode +-------------------------------------------------------------mymodel.h--------------------- + \snippet examples/tutorials/modelview/5_edit/mymodel.h We use \c QStringList m_gridData to store our data. This makes \c m_gridData the core of MyModel. The rest of \c MyModel acts like a wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We have also introduced the \l{QAbstractItemModel::editCompleted()}{editCompleted()} signal, which makes it possible to transfer the modified text to the window title. + +?????(include section from 5_edit/mymodel.cpp)????? \code #include "mymodel.h" @@ -338,11 +262,13 @@ MyModel::MyModel(QObject *parent) \endcode In the constructor, we fill \c QStringList gridData with 6 items. (one item for every field in the table) +?????(include section from 5_edit/mymodel.cpp)????? \code HIER FEHLT WAS!!! \endcode \l{QAbstractItemModel::setData()}{setData()} will be called each time the user edits a cell. The \c index parameter tells us which field has been edited and \c value provides the result of the editing process. The role will always be set to \c Qt::EditRole because our cells only contain text. If a checkbox were present and user permissions are set to allow the checkbox to be selected, calls would also be made with the role set to \c Qt::CheckStateRole. +?????(include section from 5_edit/mymodel.cpp)????? \code HIER FEHLT WAS!!! \endcode @@ -363,49 +289,8 @@ This is how our example model looks so far: We want to, however, present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which is a container for hierarchical data that also implements QAbstractItemModel. To show a tree, QStandardItemModel must be populated with QStandardItems, which are able to hold all the standard properties of items like text, fonts, checkboxes or brushes. \image tree_2_with_algorithm.png -\code -#include -#include -#include -#include "modelview.h" - - -const int ROWS = 2; -const int COLUMNS = 3; - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - treeView = new QTreeView(this); - setCentralWidget(treeView); - standardModel = new QStandardItemModel ; - - QList preparedColumn =prepareColumn("first", "second", "third"); - QStandardItem *item = standardModel->invisibleRootItem(); - // adding a row to the invisible root item produces a root element - item->appendRow(preparedColumn); - - QList secondRow =prepareColumn("111", "222", "333"); - // adding a row to an item starts a subtree - preparedColumn.first()->appendRow(secondRow); - - treeView->setModel( standardModel ); - treeView->expandAll(); -} - -//--------------------------------------------------------------------------- -QList ModelView::prepareColumn(const QString &first, - const QString &second, - const QString &third ) -{ - QList colItems; - colItems << new QStandardItem(first); - colItems << new QStandardItem(second); - colItems << new QStandardItem(third); - return colItems; -} - -\endcode +-------------------------------------------------------------modelview.cpp--------------------- + \snippet examples/tutorials/modelview/6_treeview/modelview.cpp We simply instantiate a QStandardItemModel and add a couple of QStandardItems to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other QStandardItems. Nodes are collapsed and expanded within the view. @@ -415,6 +300,7 @@ We want to access a selected item's content in order to output it into the windo So let's create a couple of items: +?????(include section from 7_selections/modelview.cpp)????? \code #include #include @@ -462,6 +348,8 @@ ModelView::ModelView(QWidget *parent) \endcode Views manage selections within a separate selection model, which can be retrieved with the \l{QAbstractItemModel::selectionModel()}{selectionModel()} method. We retrieve the selection Model in order to connect a slot to its \l{QAbstractItemModel::selectionChanged()}{selectionChanged()} signal. + +?????(include section from 7_selections/modelview.cpp)????? \code HIER FEHLT WAS!!! \endcode @@ -503,6 +391,8 @@ QDirModel (deprecated) In all examples so far, data is presented as text or a checkbox in a cell and is edited as text or a checkbox. The component that provides these presentation and editing services is called a “delegate.” We are only just beginning to work with the delegate because the view uses a default delegate. But imagine that we want to have a different editor.(e.g. a slider or a drop down list) Or imagine that we want to present data as graphics. Let's take a look at an example called Stardelegate, ( \l{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html}{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html} ) in which stars are used to show a rating: \image stardelegate.png The view has a method that replaces the default delegate and installs a custom delegate. This method is called \l{QAbstractItemModel::setItemDelegate()}{setItemDelegate()}. A new delegate can be written by creating a class that inherits from QStyledItemDelegate. In order to write a delegate that displays stars and has no input capabilities, we only need to overwrite 2 methods. + +!!!!!I CAN'T FIND THIS FILE!!!!! \code class StarDelegate : public QStyledItemDelegate { -- cgit v0.12 From 6de484f195366b560e10f95b04d2f0e7303a2b63 Mon Sep 17 00:00:00 2001 From: Roland Wolf Date: Tue, 22 Jun 2010 14:26:05 +0200 Subject: integrating modelview tutorial in the build system, first attempt --- doc/src/frameworks-technologies/modelview.qdoc | 730 ------------------------ doc/src/tutorials/modelview.qdoc | 732 +++++++++++++++++++++++++ examples/tutorials/modelview/modelview.pro | 10 + examples/tutorials/modelview/qmake.pro | 10 - examples/tutorials/tutorials.pro | 4 +- 5 files changed, 745 insertions(+), 741 deletions(-) delete mode 100755 doc/src/frameworks-technologies/modelview.qdoc create mode 100755 doc/src/tutorials/modelview.qdoc create mode 100755 examples/tutorials/modelview/modelview.pro delete mode 100755 examples/tutorials/modelview/qmake.pro diff --git a/doc/src/frameworks-technologies/modelview.qdoc b/doc/src/frameworks-technologies/modelview.qdoc deleted file mode 100755 index 5f9969b..0000000 --- a/doc/src/frameworks-technologies/modelview.qdoc +++ /dev/null @@ -1,730 +0,0 @@ -/*! - - \contentspage{modelview.html}{Crash Course in Model/View Programming} - \page modelview.html - -\title Crash Course in Model/View Programming -Contents: -\tableofcontents - -\section1 1 Introduction -Model/View is a technology used to separate data from views in widgets that handle data sets. Standard Widgets are not designed for separating data from views and this is why Qt 4 has two different types of widgets. Both types of widgets look the same, but they interact with data differently. - \table - \row - \o Standard widgets use data that is part of the widget. - \o \image standardwidget.png - \row - \o View classes operate on external data (the model) - \o \image modelview.png - \endtable -\section2 1.1 Standard widgets -Let's have a closer look at a standard table widget. A table widget is a 2D array of the data elements that the user can change. The table widget can be integrated into a program flow by reading and writing the data elements that the table widget provides. This method is very intuitive and useful in many applications. - -Displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the widget; one inside the widget. The developer needs to know where up-to-date data is so the both copies contain the most recent data. The tight coupling of presentation and data makes it harder to write unit tests. - -\section2 1.2 Model/View to the rescue -Model/View stepped up to provide a solution that uses a more versatile architecture. Model/View eliminates the data consistency problems that may occur with standard widgets. Model/View also makes it easier to use more than one view of the same data because one model can be passed on to many views. The most important difference is that model/view widgets do not store data behind the table cells. In fact, they operate directly from your data. Since view classes do not know your data's structure, you need to provide a wrapper to make your data conform to the \l QAbstractItemModel interface. A view uses this interface to read from and write to your data and any class that implements \l QAbstractItemModel is a model. Once the view receives a pointer to a model, it will read and display its content and be its editor. - -\section2 1.3 Overview of the model/view widgets -Here is an overview of the model/view widgets and their corresponding standard widgets. - \table - \header - \o Widget - \o Standard Widget -(a convenience class with data in the widget) - \o Model/View View Class (for use with external data) - \row - \o \image listview.png - \o \l QListWidget - \o \l QListView - \row - \o \image tableview.png - \o \l QTableWidget - \o \l QTableView - \row - \o \image treeview.png - \o \l QTreeWidget - \o \l QTreeView - \row - \o \image columnview.png - \o - \o \l QColumnView shows a tree as a hierarchy of lists - \row - \o \image combobox.png - \o {2, 1} \l QComboBox can work as both a view class and also as a traditional widget - \endtable -\section2 1.4 Having adapters between forms and models can come in handy. -We often prefer editing data stored in tables (e.g. in database tables) in forms rather than in tables. There is no direct model/view counterpart for separating data and views for widgets that operate on one value instead of a dataset, so we need an adapter in order to connect the form to the source of data. - -\l QDataWidgetMapper is a great solution because it maps form widgets to a table row and it makes it very easy to build forms for database tables. \image widgetmapper.png - -Another example of an adapter is \l QCompleter. Qt has QCompleter for providing auto completions in Qt widgets such as \l QComboBox and, as shown below, \l QLineEdit. \l QCompleter uses a model as its data source, so \l QCompleter, in itself, is a very handy adapter. \image qcompleter.png - -\section1 2 A Simple Model/View Application -If you want to develop a model/view application, where should you start? We recommend starting with a simple example and extending it step-by-step. This makes understanding the architecture a lot easier. Trying to understand the model/view architecture in detail before invoking the IDE has proven to be less convenient for many developers. It is substantially easier to start with a simple model/view application that has demo data. Give it a try! Simply replace the data in the examples below with your own. - -Below are 7 very simple and independent applications that show different sides of model/view programming. The source code can be downloaded from @todo___________paste link here_________________________ - -\section2 2.1 A read only table -We start with an application that uses a \l QTableView to show data. We will add editing capabilities later. - --------------------------------------------------------------main.cpp--------------------- - \snippet examples/tutorials/modelview/1_readonly/main.cpp - -We have the usual main() function; --------------------------------------------------------------modelview.h--------------------- - \snippet examples/tutorials/modelview/1_readonly/modelview.h - -The application is a \l QMainWindow that holds a \l QTableView. - --------------------------------------------------------------modelview.cpp--------------------- - \snippet examples/tutorials/modelview/1_readonly/modelview.cpp - -Here is the interesting part: We use \c tableView->setModel(new MyModel(this) ); to instantiate the Model and pass its pointer to \l {QTableView::}{tableView()} OR \l QTableView::tableView() OR \l QTableView::tableView . \l {QTableView::}{tableView} will invoke the methods of the pointer it has received to find out two things: - \list - \o How many rows and columns should be displayed - \o What content should be printed into each cell. - \endlist - -The model needs some code to respond to this. - -We have a table data set, so let's start with QAbstractTableModel since it is easier to use. --------------------------------------------------------------mymodel.h--------------------- - \snippet examples/tutorials/modelview/1_readonly/mymodel.h - -QAbstractTableModel requires the implementation of three abstract methods. - - --------------------------------------------------------------mymodel.cpp--------------------- - \snippet examples/tutorials/modelview/1_readonly/mymodel.cpp - -The number of rows and columns is set by \c MyModel::rowCount() and \c MyModel::columnCount(). -When the view has to know what the cell 's text is, it calls the \l{QAbstractItemModel::data()}{data()} method. Row and column information is specified with parameter \c index and the role is set to Qt::Display Role. Other roles are covered in the next section. In our example, the data that should be displayed is generated. In a real application, \c MyModel would have a member called \c MyData, which serves as the target for all reading and writing operations. - -This small example demonstrates the passive nature of a model. The model does not know when it will be used or which data is needed. It simply provides data each time the view requests it. - -What happens when the model 's data needs to be changed? How does the view know when data changes and needs to be read again? The model has to emit a signal that indicates what range of cells has changed. This will be demonstrated in section 2.3. - -\section2 2.2 Extending the read only example with roles -In addition to controlling what text the view displays, the model also controls the text's appearance. When we slightly change the model, we get the following result: \image readonlytable_role.png - - -In fact, nothing except for the \l{QAbstractItemModel::data()}{data()} method needs to be changed to set fonts, background colour, alignment and a checkbox. Here is the \l{QAbstractItemModel::data()}{data()} method that produces the result shown above: - --------------------------------------------------------------mymodel.cpp--------------------- - \snippet examples/tutorials/modelview/2_formatting/mymodel.cpp - -Each formatting property will be requested from the model with a separate call to the \l{QAbstractItemModel::data()}{data()} method. The \c role parameter is used to let the model know which property is being requested: - - \table - \header - \o Role (enum Qt::ItemDataRole ) - \o Meaning - \o Type - \row - \o Qt::DisplayRole - \o text - \o QString - \row - \o Qt::FontRole - \o font - \o QFont - \row - \o Qt::BackgroundRole - \o brush for the background of the cell - \o QBrush - \row - \o Qt::TextAlignmentRole - \o text alignment - \o enum Qt::AlignmentFlag - \row - \o {1, 3} Qt::CheckStateRole - \o {1, 3} suppresses checkboxes with QVariant(), sets checkboxes with Qt::Checked or Qt::Unchecked - \o {1, 3} enum Qt::ItemDataRole - - \endtable - -Refer to Qt documentation to learn more about enum Qt::ItemDataRole's capabilities. - - -Now we need to determine how using a seperated model impacts the application's performance, so let's trace how often the view calls the \l{QAbstractItemModel::data()}{data()} method. In order to track how often the view calls the model, we have put a debug statement in the \l{QAbstractItemModel::data()}{data()} method, which logs onto stdio. In our small example, \l{QAbstractItemModel::data()}{data()} will be called 42 times. Each time you hover the cursor over the field, \l{QAbstractItemModel::data()}{data()} will be called again - 7 times for each cell. That's why it is important to make sure that your data is available when \l{QAbstractItemModel::data()}{data()}) is invoked and expensive lookup operations are cached. - -\section2 2.3 A clock inside a table cell -\image clock.png - -We still have a read only table, but this time the content changes every second because we are showing the current time. - -!!!!!I CAN'T FIND THIS FILE!!!!! -\code -QVariant MyModel::data(const QModelIndex &index, int role ) const -{ - QVariant returnVal; - int row = index.row(); - int col = index.column(); - - if(role == Qt::DisplayRole) - - { - if(row == 0 && col == 0 ) - { - returnVal = QTime::currentTime().toString(); - } - } - return returnVal; -} -\endcode - -Something is missing to make the clock tick. We need to tell the view every second that the time has changed and that it needs to be read again. We do this with a timer. In the constructor, we set its interval to 1 second and it connect its timeout signal. - -?????(include section from 3_changingmodel/mymodel.cpp)????? -\code -MyModel::MyModel(QObject *parent) - :QAbstractTableModel(parent) -{ -// selectedCell = 0; - timer = new QTimer(this); - timer->setInterval(1000); - connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit()) ); - timer->start(); -} -\endcode - -Here is the corresponding slot: - -?????(include section from 3_changingmodel/mymodel.cpp)????? -\code - -void MyModel::timerHit() -{ - //we identify the top left cell - QModelIndex topLeft = createIndex ( 0,0 ); - //emit a signal to make the view reread identified data - emit dataChanged ( topLeft, topLeft ); -} -\endcode - -We ask the view to read the data in the top left cell again by emitting the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal. Note that we did not explicitly connect the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal to the view. This happened automatically when we called \l{QAbstractItemModel::setModel()}{setModel()} . - -\section2 2.4 Setting up Headers for Columns and Rows -Headers can be hidden via a view method. -\c tableView->verticalHeader()->hide(); -\image header.png - - -The header content, however , is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: - - -?????(include section from 4_headers/mymodel.cpp)????? -\code -QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (role == Qt::DisplayRole) - { - if (orientation == Qt::Horizontal) { - switch (section) - { - case 0: - return QString("first"); - case 1: - return QString("second"); - case 2: - return QString("third"); - } - } - } - return QVariant(); -} -\endcode - - -\section2 2.5 The minimal Editing example -In this example, we are going to build an application that automatically populates a window title with content by repeating values entered into table cells. - -The model decides whether editing capabilities are available . We only have to modify the model in order for the available editing capabilities to be enabled. This is done by reimplementing the following virtual methods: \l{QAbstractItemModel::setData()}{setData()} and \l{QAbstractItemModel::flags()}{flags()}. --------------------------------------------------------------mymodel.h--------------------- - \snippet examples/tutorials/modelview/5_edit/mymodel.h - -We use \c QStringList m_gridData to store our data. This makes \c m_gridData the core of MyModel. The rest of \c MyModel acts like a wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We have also introduced the \l{QAbstractItemModel::editCompleted()}{editCompleted()} signal, which makes it possible to transfer the modified text to the window title. - -?????(include section from 5_edit/mymodel.cpp)????? -\code -#include "mymodel.h" - -const int COLS= 3; -const int ROWS= 2; - -MyModel::MyModel(QObject *parent) - :QAbstractTableModel(parent) -{ - //gridData needs to have 6 element, one for each table cell - m_gridData << "1/1" << "1/2" << "1/3" << "2/1" << "2/2" << "2/3" ; -} -\endcode - -In the constructor, we fill \c QStringList gridData with 6 items. (one item for every field in the table) -?????(include section from 5_edit/mymodel.cpp)????? -\code -HIER FEHLT WAS!!! -\endcode - -\l{QAbstractItemModel::setData()}{setData()} will be called each time the user edits a cell. The \c index parameter tells us which field has been edited and \c value provides the result of the editing process. The role will always be set to \c Qt::EditRole because our cells only contain text. If a checkbox were present and user permissions are set to allow the checkbox to be selected, calls would also be made with the role set to \c Qt::CheckStateRole. -?????(include section from 5_edit/mymodel.cpp)????? -\code -HIER FEHLT WAS!!! -\endcode - -Various properties of a cell can be adjusted with \l{QAbstractItemModel::flags()}{flags()}. Returning \c Qt::ItemIsEditable | Qt::ItemIsEnabled is enough to show an editor that a cell has been selected. If editing one cell modifies more data than the data in that particular cell, the model must emit a \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal in order for the data that has been changed to be read. - -\section1 3 Intermediate Topics -\section2 3.1 TreeView -You can convert the example above into an application with a tree view. Simply replace QTableView with QTreeView, which results in a read/write tree. No changes have to be made to the model. The tree won't have any hierarchies because there aren't any hierarchies in the model itself. -\image dummy_tree.png - - -QListView, QTableView and QTreeView all use a model abstraction, which is a merged list, table and tree. This makes it possible to use several different types of view classes from the same model. -\image list_table_tree.png - -This is how our example model looks so far: -\image example_model.png - - -We want to, however, present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which is a container for hierarchical data that also implements QAbstractItemModel. To show a tree, QStandardItemModel must be populated with QStandardItems, which are able to hold all the standard properties of items like text, fonts, checkboxes or brushes. \image tree_2_with_algorithm.png --------------------------------------------------------------modelview.cpp--------------------- - \snippet examples/tutorials/modelview/6_treeview/modelview.cpp - -We simply instantiate a QStandardItemModel and add a couple of QStandardItems to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other QStandardItems. Nodes are collapsed and expanded within the view. - -\section2 3.2 Working with selection -We want to access a selected item's content in order to output it into the window title together with the hierarchy level. -\image selection2.png - - -So let's create a couple of items: -?????(include section from 7_selections/modelview.cpp)????? -\code -#include -#include -#include -#include "modelview.h" - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - treeView = new QTreeView(this); - setCentralWidget(treeView); - standardModel = new QStandardItemModel ; - QStandardItem *rootNode = standardModel->invisibleRootItem(); - - - //defining a couple of items - QStandardItem *americaItem = new QStandardItem("America"); - QStandardItem *mexicoItem = new QStandardItem("Canada"); - QStandardItem *usaItem = new QStandardItem("USA"); - QStandardItem *bostonItem = new QStandardItem("Boston"); - QStandardItem *europeItem = new QStandardItem("Europe"); - QStandardItem *italyItem = new QStandardItem("Italy"); - QStandardItem *romeItem = new QStandardItem("Rome"); - QStandardItem *veronaItem = new QStandardItem("Verona"); - - //building up the hierarchy - rootNode-> appendRow(americaItem); - rootNode-> appendRow(europeItem); - americaItem-> appendRow(mexicoItem); - americaItem-> appendRow(usaItem); - usaItem-> appendRow(bostonItem); - europeItem-> appendRow(italyItem); - italyItem-> appendRow(romeItem); - italyItem-> appendRow(veronaItem); - - //register the model - treeView->setModel( standardModel ); - treeView->expandAll(); - - //selection changes shall trigger a slot - QItemSelectionModel *selectionModel= treeView->selectionModel(); - connect(selectionModel, SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & )), - this, SLOT(selectionChangedSlot(const QItemSelection & , const QItemSelection & ))); -} -\endcode - -Views manage selections within a separate selection model, which can be retrieved with the \l{QAbstractItemModel::selectionModel()}{selectionModel()} method. We retrieve the selection Model in order to connect a slot to its \l{QAbstractItemModel::selectionChanged()}{selectionChanged()} signal. - -?????(include section from 7_selections/modelview.cpp)????? -\code -HIER FEHLT WAS!!! -\endcode - -We get the model index that corresponds to the selection by calling -\c treeView->selectionModel()->currentIndex() and we get the the field's string by using the model index. Then we just calculate the item's \c hierarchyLevel. Top level items do not have parents and the \l{QAbstractItemModel::parent()}{parent()} method will return a default constructed QModelIndex(). This is why we use the \l{QAbstractItemModel::parent()}{parent()} method to iterate to the top level while counting the steps performed during iteration. - -The selection model (as shown above) can be retrieved, but it can also be set with \c QAbstractItemView::setSelectionModel. This is how it's possible to have 3 view classes with synchronised selections because only one instance of a selection model is used. The instance of a selection model is retrieved from the first view class with \l{QAbstractItemModel::selectionModel()}{selectionModel()} and the result is assigned to the second and third view class with \l{QAbstractItemModel::setSelectionModel()}{setSelectionModel()}; -\section2 3.3 Predefined Models -The typical way to use model/view is to wrap specific data to make it usable with view classes. Qt, however, also provides predefined models for common underlying data structures. If one of the available data structures is suitable for your application, a predefined model can be a good choice. - - \table - \row - \o QStringListModel - \o Stores a list of strings - \row - \o QStandardItemModel - \o Stores arbitrary hierarchical items - \row - \o {1, 2} QFileSystemModel -QDirModel (deprecated) - \o {1, 2} Encapsulate the local file system - \row - \o QSqlQueryModel - \o Encapsulate an SQL result set - \row - \o QSqlTableModel - \o Encapsulates an SQL table - \row - \o QSqlRelationalTableModel - \o Encapsulates an SQL table with foreign keys - \row - \o QSortFilterProxyModel - \o Sorts and/or filters another model - - \endtable - -\section2 3.4 Delegates -In all examples so far, data is presented as text or a checkbox in a cell and is edited as text or a checkbox. The component that provides these presentation and editing services is called a “delegate.” We are only just beginning to work with the delegate because the view uses a default delegate. But imagine that we want to have a different editor.(e.g. a slider or a drop down list) Or imagine that we want to present data as graphics. Let's take a look at an example called Stardelegate, ( \l{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html}{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html} ) in which stars are used to show a rating: \image stardelegate.png - -The view has a method that replaces the default delegate and installs a custom delegate. This method is called \l{QAbstractItemModel::setItemDelegate()}{setItemDelegate()}. A new delegate can be written by creating a class that inherits from QStyledItemDelegate. In order to write a delegate that displays stars and has no input capabilities, we only need to overwrite 2 methods. - -!!!!!I CAN'T FIND THIS FILE!!!!! -\code - class StarDelegate : public QStyledItemDelegate - { - Q_OBJECT - public: - StarDelegate(QWidget *parent = 0); - void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const; - QSize sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const; - }; - -\endcode - -\l{QAbstractItemModel::paint()}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \c index.data(). \c SizeHint specifies the stars dimensions so the the cell will provide enough height and width to accommodate the stars. - -Writing custom delegates is the right choice if you want to show your data with a custom graphical representation inside the grid of the view class. If you want to leave the grid, you can write a custom view class. - -\section2 3.5 Debugging with ModelTest -The passive nature of models provides new challenges for programmers. Inconsistencies in the model can cause the application to crash. Since the model is hit by numerous calls from the view, it is hard to find out which call has crashed the application and which operation has introduced the problem. - -Qt provides software called ModelTest, which checks models while your programming is running. Every time the model is changed, ModelTest scans the model and reports errors with an assert. This is especially important for tree models, since their hierarchical nature leaves many possibilities for subtle inconsistencies. http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest - -Unlike view classes, ModelTest uses out of range indexes to test the model. This means your application may crash with ModelTest even if it runs perfectly without it. So you also need to handle all of the indexes that are out of range when using ModelTest. - - - - - - - - - -\section2 3.6 Model/View NG - -\image path.png - -Model/View was introduced in Qt 4.0 and is a frequently used technology. Feedback from clients and new development trends have shown, that there is a need to further develop the model/view technology. Therefore a research project at Nokia is looking into ways to go beyond the current implementation. - -One limitation of model/view is that view classes are basically all fixed grids. It is possible, but really hard to make a list view with icons placed on a curve; or cells expanding on mouse over events to show additional information. In order to achieve graphically rich view experiences, Model/View NG will use QGraphicsView to render elements. Nodel/View NG also aims to make model/view programming more intuitive. One way to achieve this is to have separate models for lists, tables and trees. The current model abstraction is complex because it is capable of representing a list, a table or a tree. - -Model/View NG is a research project. You are welcome to checkout the source code, monitor progress and take part in discussions at the following address: \l{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG}{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG} - -\section1 4 Good Sources for Additional Information -\section2 4.1 Books -Model/View programming is covered quite extensively in the documentation of Qt but also in several good books. - \list 1 - \o 1.C++ GUI Programming with Qt 4 / Jasmin Blanchette, Mark Summerfield, Prentice Hall, 2nd edition, ISBN 0-13-235416-0 -also available in German: C++ GUI Programmierung mit Qt 4: Die offizielle Einführung, Addison-Wesley, ISBN 3-827327-29-6 - \o 1.The Book of Qt4, The Art of Building Qt Applications / Daniel Molkentin, Open Source Press ISBN 1-59327-147-6 -Translated from: Qt 4, Einführung in die Applikationsentwicklung, Open Source Press, ISBN 3-937514-12-0 - \o 1.Foundations of Qt Development / Johan Thelin, Apress, ISBN 1-59059-831-8 - \endlist - - -The following list provides an overview of example programs contained in the books above. Some of them make very good templates for developing similar applications. - - \table - \header - \o example name - \o view class used - \o model used - \o aspects touched - \o - \row - \o Team Leaders - \o QListview - \o QStringListModel - \o - \o Book 1, Chapter 10, Figure 10.6 - \row - \o Directory Viewer - \o QTreeView - \o QDirModel - \o - \o Book 1, Chapter 10, Figure 10.7 - \row - \o Color Names - \o QListView - \o QSortFilterProxyModel -applied to QStringListModel - \o - \o Book 1, Chapter 10, Figure 10.8 - \row - \o Currencies - \o QTableView - \o custom model based on -QAbstractTableModel - \o read only - \o Book 1, Chapter 10, Figure 10.10 - \row - \o Cities - \o QTableView - \o custom model based on -QAbstractTableModel - \o read / write - \o Book 1, Chapter 10, Figure 10.12 - \row - \o Boolean Parser - \o QTreeView - \o custom model based on -QAbstractItemModel - \o read only - \o Book 1, Chapter 10, Figure 10.14 - \row - \o Track Editor - \o {2, 1} QTableWidget - \o custom delegate providing a custom editor - \o Book 1, Chapter 10, Figure 10.15 - - \row - \o Four directory views - \o QListView -QTableView -QTreeView - \o QDirModel - \o demonstrates the use of multiple views - \o Book2, Chapter 8.2 - \row - \o Address Book - \o QListView -QTableView -QTreeView - \o custom model based on -QAbstractTableModel - \o read / write - \o Book2, Chapter 8.4 - \row - \o Address Book with sorting - \o - \o QProxyModel - \o introducing sort and filter capabilities - \o Book2, Chapter 8.5 - \row - \o Address Book -with checkboxes - \o - \o - \o introducing checkboxes -in model/view - \o Book2, Chapter 8.6 - \row - \o Address Book -with transposed grid - \o - \o custom proxy Model based on QAbstractProxyModel - \o introducing a custom model - \o Book2, Chapter 8.7 - \row - \o Address Book -with drag and drop - \o - \o - \o introducing drag and drop support - \o Book2, Chapter 8.8 - \row - \o Address Book with custom editor - \o - \o - \o introducing custom delegates - \o Book2, Chapter 8.9 - \row - \o Views - \o QListView -QTableView -QTreeView - \o QStandardItemModel - \o read only - \o Book 3, Chapter 5, figure 5-3 - \row - \o Bardelegate - \o QTableView - \o - \o custom delegate for presentation based on QAbstractItemDelegate - \o Book 3, Chapter 5, figure 5-5 - \row - \o Editdelegate - \o QTableView - \o - \o custom delegate for editing based on QAbstractItemDelegate - \o Book 3, Chapter 5, figure 5-6 - \row - \o Singleitemview - \o custom view based on -QAbstractItemView - \o - \o custom view - \o Book 3, -Chapter 5, -figure 5-7 - \row - \o listmodel - \o QTableView - \o custom Model based on -QAbstractTableModel - \o read only - \o Book 3, -Chapter 5, -Figure 5-8 - \row - \o treemodel - \o QTreeView - \o custom Model based on -QAbstractItemModel - \o read only - \o Book 3, -Chapter 5, -Figure 5-10 - \row - \o edit integers - \o QListView - \o custom Model based on -QAbstractListModel - \o read / write - \o Book 3, -Chapter 5, -Listing 5-37, Figure 5-11 - \row - \o sorting - \o QTableView - \o QSortFilterProxyModel -applied to QStringListModel - \o demonstrates sorting - \o Book 3, Chapter 5, Figure 5-12 - - \endtable - - -\section2 4.2 Qt documentation -Qt 4.6 comes with 17 examples and 2 Demonstrations for model/view. The examples can be found here: \l{http://doc.qt.nokia.com/4.6/examples-itemviews.html}{http://doc.qt.nokia.com/4.6/examples-itemviews.html} - \table - \header - \o example name - \o view class used - \o model used - \o aspects touched - \row - \o Address Book - \o QTableView - \o QTableModel -QSortFilterProxyModel - \o usage of QSortFilterProxyModel to generate different subsets from one data pool - \row - \o Basic Sort/Filter Model - \o QTreeView - \o QStandardItemModel -QSortFilterProxyModel - \o - \row - \o Chart - \o custom view - \o QStandardItemModel - \o designing custom views that cooperate with selection models - \row - \o Color Editor Factory - \o {2, 1} QTableWidget - \o enhancing the standard delegate with a new custom editor to choose colours - \row - \o Combo Widget Mapper - \o QDataWidgetMapper to map QLineEdit, QTextEdit and QComboBox - \o QStandardItemModel - \o shows how a QComboBox can serve as a view class - \row - \o Custom Sort/Filter Model - \o QTreeView - \o QStandardItemModel -QSortFilterProxyModel - \o subclass QSortFilterProxyModel -for advanced sorting and filtering - \row - \o Dir View - \o QTreeView - \o QDirModel - \o very small example to demonstrate how to assign a model to a view - \row - \o Editable Tree Model - \o QTreeView - \o custom tree model - \o comprehensive example for working with trees, demonstrates editing cells and tree structure with an underlying custom model - \row - \o Fetch More - \o QListView - \o custom list model - \o dynamically changing model - \row - \o Frozen Column - \o QTableView - \o QStandardItemModel - \o - \row - \o Pixelator - \o QTableView - \o custom table model - \o implementation of a custom delegate - \row - \o Puzzle - \o QListView - \o custom list model - \o model/view with drag and drop - \row - \o Simple DOM Model - \o QTreeView - \o custom tree model - \o read only example for a custom tree model - \row - \o Simple Tree Model - \o QTreeView - \o custom tree model - \o read only example for a custom tree model - \row - \o Simple Widget Mapper - \o QDataWidgetMapper to map QLineEdit, QTextEdit and QSpinBox - \o QStandardItemModel - \o basic QDataWidgetMapper usage - \row - \o Spin Box Delegate - \o QTableView - \o QStandardItemModel - \o custom delegate that uses a spin box as a cell editor - \row - \o Star Delegate - \o {2, 1} QTableWidget - \o comprehensive custom delegate example. - \endtable - -Demonstrations are similar to examples except that no walk-through is provided for the code lines. Demonstrations are also sometimes more feature rich. - \l{http://doc.qt.nokia.com/4.6/demos.html}{http://doc.qt.nokia.com/4.6/demos.html} - \list - \o The \bold Interview demonstration shows the same model and selection being shared between three different views. - \o Demonstration \bold Spreadsheet demonstrates the use of a table view as a spreadsheet, using custom delegates to render each item according to the type of data it contains. - \endlist - -A reference documentation for model/view technology is also available. \l{http://doc.qt.nokia.com/4.6/model-view-programming.html}{http://doc.qt.nokia.com/4.6/model-view-programming.html} - -*/ \ No newline at end of file diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc new file mode 100755 index 0000000..1be4b46 --- /dev/null +++ b/doc/src/tutorials/modelview.qdoc @@ -0,0 +1,732 @@ +/*! + + \page modelview.html + \startpage {index.html}{Qt Reference Documentation} + \contentspage Tutorials + \contentspage{modelview.html}{Crash Course in Model/View Programming} + +\title Crash Course in Model/View Programming +Contents: +\tableofcontents + +\section1 1 Introduction +Model/View is a technology used to separate data from views in widgets that handle data sets. Standard Widgets are not designed for separating data from views and this is why Qt 4 has two different types of widgets. Both types of widgets look the same, but they interact with data differently. + \table + \row + \o Standard widgets use data that is part of the widget. + \o \image standardwidget.png + \row + \o View classes operate on external data (the model) + \o \image modelview.png + \endtable +\section2 1.1 Standard widgets +Let's have a closer look at a standard table widget. A table widget is a 2D array of the data elements that the user can change. The table widget can be integrated into a program flow by reading and writing the data elements that the table widget provides. This method is very intuitive and useful in many applications. + +Displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the widget; one inside the widget. The developer needs to know where up-to-date data is so the both copies contain the most recent data. The tight coupling of presentation and data makes it harder to write unit tests. + +\section2 1.2 Model/View to the rescue +Model/View stepped up to provide a solution that uses a more versatile architecture. Model/View eliminates the data consistency problems that may occur with standard widgets. Model/View also makes it easier to use more than one view of the same data because one model can be passed on to many views. The most important difference is that model/view widgets do not store data behind the table cells. In fact, they operate directly from your data. Since view classes do not know your data's structure, you need to provide a wrapper to make your data conform to the \l QAbstractItemModel interface. A view uses this interface to read from and write to your data and any class that implements \l QAbstractItemModel is a model. Once the view receives a pointer to a model, it will read and display its content and be its editor. + +\section2 1.3 Overview of the model/view widgets +Here is an overview of the model/view widgets and their corresponding standard widgets. + \table + \header + \o Widget + \o Standard Widget +(a convenience class with data in the widget) + \o Model/View View Class (for use with external data) + \row + \o \image listview.png + \o \l QListWidget + \o \l QListView + \row + \o \image tableview.png + \o \l QTableWidget + \o \l QTableView + \row + \o \image treeview.png + \o \l QTreeWidget + \o \l QTreeView + \row + \o \image columnview.png + \o + \o \l QColumnView shows a tree as a hierarchy of lists + \row + \o \image combobox.png + \o {2, 1} \l QComboBox can work as both a view class and also as a traditional widget + \endtable +\section2 1.4 Having adapters between forms and models can come in handy. +We often prefer editing data stored in tables (e.g. in database tables) in forms rather than in tables. There is no direct model/view counterpart for separating data and views for widgets that operate on one value instead of a dataset, so we need an adapter in order to connect the form to the source of data. + +\l QDataWidgetMapper is a great solution because it maps form widgets to a table row and it makes it very easy to build forms for database tables. \image widgetmapper.png + +Another example of an adapter is \l QCompleter. Qt has QCompleter for providing auto completions in Qt widgets such as \l QComboBox and, as shown below, \l QLineEdit. \l QCompleter uses a model as its data source, so \l QCompleter, in itself, is a very handy adapter. \image qcompleter.png + +\section1 2 A Simple Model/View Application +If you want to develop a model/view application, where should you start? We recommend starting with a simple example and extending it step-by-step. This makes understanding the architecture a lot easier. Trying to understand the model/view architecture in detail before invoking the IDE has proven to be less convenient for many developers. It is substantially easier to start with a simple model/view application that has demo data. Give it a try! Simply replace the data in the examples below with your own. + +Below are 7 very simple and independent applications that show different sides of model/view programming. The source code can be downloaded from @todo___________paste link here_________________________ + +\section2 2.1 A read only table +We start with an application that uses a \l QTableView to show data. We will add editing capabilities later. + +-------------------------------------------------------------main.cpp--------------------- + \snippet examples/tutorials/modelview/1_readonly/main.cpp + +We have the usual main() function; +-------------------------------------------------------------modelview.h--------------------- + \snippet examples/tutorials/modelview/1_readonly/modelview.h + +The application is a \l QMainWindow that holds a \l QTableView. + +-------------------------------------------------------------modelview.cpp--------------------- + \snippet examples/tutorials/modelview/1_readonly/modelview.cpp + +Here is the interesting part: We use \c tableView->setModel(new MyModel(this) ); to instantiate the Model and pass its pointer to \l {QTableView::}{tableView()} OR \l QTableView::tableView() OR \l QTableView::tableView . \l {QTableView::}{tableView} will invoke the methods of the pointer it has received to find out two things: + \list + \o How many rows and columns should be displayed + \o What content should be printed into each cell. + \endlist + +The model needs some code to respond to this. + +We have a table data set, so let's start with QAbstractTableModel since it is easier to use. +-------------------------------------------------------------mymodel.h--------------------- + \snippet examples/tutorials/modelview/1_readonly/mymodel.h + +QAbstractTableModel requires the implementation of three abstract methods. + + +-------------------------------------------------------------mymodel.cpp--------------------- + \snippet examples/tutorials/modelview/1_readonly/mymodel.cpp + +The number of rows and columns is set by \c MyModel::rowCount() and \c MyModel::columnCount(). +When the view has to know what the cell 's text is, it calls the \l{QAbstractItemModel::data()}{data()} method. Row and column information is specified with parameter \c index and the role is set to Qt::Display Role. Other roles are covered in the next section. In our example, the data that should be displayed is generated. In a real application, \c MyModel would have a member called \c MyData, which serves as the target for all reading and writing operations. + +This small example demonstrates the passive nature of a model. The model does not know when it will be used or which data is needed. It simply provides data each time the view requests it. + +What happens when the model 's data needs to be changed? How does the view know when data changes and needs to be read again? The model has to emit a signal that indicates what range of cells has changed. This will be demonstrated in section 2.3. + +\section2 2.2 Extending the read only example with roles +In addition to controlling what text the view displays, the model also controls the text's appearance. When we slightly change the model, we get the following result: \image readonlytable_role.png + + +In fact, nothing except for the \l{QAbstractItemModel::data()}{data()} method needs to be changed to set fonts, background colour, alignment and a checkbox. Here is the \l{QAbstractItemModel::data()}{data()} method that produces the result shown above: + +-------------------------------------------------------------mymodel.cpp--------------------- + \snippet examples/tutorials/modelview/2_formatting/mymodel.cpp + +Each formatting property will be requested from the model with a separate call to the \l{QAbstractItemModel::data()}{data()} method. The \c role parameter is used to let the model know which property is being requested: + + \table + \header + \o Role (enum Qt::ItemDataRole ) + \o Meaning + \o Type + \row + \o Qt::DisplayRole + \o text + \o QString + \row + \o Qt::FontRole + \o font + \o QFont + \row + \o Qt::BackgroundRole + \o brush for the background of the cell + \o QBrush + \row + \o Qt::TextAlignmentRole + \o text alignment + \o enum Qt::AlignmentFlag + \row + \o {1, 3} Qt::CheckStateRole + \o {1, 3} suppresses checkboxes with QVariant(), sets checkboxes with Qt::Checked or Qt::Unchecked + \o {1, 3} enum Qt::ItemDataRole + + \endtable + +Refer to Qt documentation to learn more about enum Qt::ItemDataRole's capabilities. + + +Now we need to determine how using a seperated model impacts the application's performance, so let's trace how often the view calls the \l{QAbstractItemModel::data()}{data()} method. In order to track how often the view calls the model, we have put a debug statement in the \l{QAbstractItemModel::data()}{data()} method, which logs onto stdio. In our small example, \l{QAbstractItemModel::data()}{data()} will be called 42 times. Each time you hover the cursor over the field, \l{QAbstractItemModel::data()}{data()} will be called again - 7 times for each cell. That's why it is important to make sure that your data is available when \l{QAbstractItemModel::data()}{data()}) is invoked and expensive lookup operations are cached. + +\section2 2.3 A clock inside a table cell +\image clock.png + +We still have a read only table, but this time the content changes every second because we are showing the current time. + +!!!!!I CAN'T FIND THIS FILE!!!!! +\code +QVariant MyModel::data(const QModelIndex &index, int role ) const +{ + QVariant returnVal; + int row = index.row(); + int col = index.column(); + + if(role == Qt::DisplayRole) + + { + if(row == 0 && col == 0 ) + { + returnVal = QTime::currentTime().toString(); + } + } + return returnVal; +} +\endcode + +Something is missing to make the clock tick. We need to tell the view every second that the time has changed and that it needs to be read again. We do this with a timer. In the constructor, we set its interval to 1 second and it connect its timeout signal. + +?????(include section from 3_changingmodel/mymodel.cpp)????? +\code +MyModel::MyModel(QObject *parent) + :QAbstractTableModel(parent) +{ +// selectedCell = 0; + timer = new QTimer(this); + timer->setInterval(1000); + connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit()) ); + timer->start(); +} +\endcode + +Here is the corresponding slot: + +?????(include section from 3_changingmodel/mymodel.cpp)????? +\code + +void MyModel::timerHit() +{ + //we identify the top left cell + QModelIndex topLeft = createIndex ( 0,0 ); + //emit a signal to make the view reread identified data + emit dataChanged ( topLeft, topLeft ); +} +\endcode + +We ask the view to read the data in the top left cell again by emitting the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal. Note that we did not explicitly connect the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal to the view. This happened automatically when we called \l{QAbstractItemModel::setModel()}{setModel()} . + +\section2 2.4 Setting up Headers for Columns and Rows +Headers can be hidden via a view method. +\c tableView->verticalHeader()->hide(); +\image header.png + + +The header content, however , is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: + + +?????(include section from 4_headers/mymodel.cpp)????? +\code +QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (role == Qt::DisplayRole) + { + if (orientation == Qt::Horizontal) { + switch (section) + { + case 0: + return QString("first"); + case 1: + return QString("second"); + case 2: + return QString("third"); + } + } + } + return QVariant(); +} +\endcode + + +\section2 2.5 The minimal Editing example +In this example, we are going to build an application that automatically populates a window title with content by repeating values entered into table cells. + +The model decides whether editing capabilities are available . We only have to modify the model in order for the available editing capabilities to be enabled. This is done by reimplementing the following virtual methods: \l{QAbstractItemModel::setData()}{setData()} and \l{QAbstractItemModel::flags()}{flags()}. +-------------------------------------------------------------mymodel.h--------------------- + \snippet examples/tutorials/modelview/5_edit/mymodel.h + +We use \c QStringList m_gridData to store our data. This makes \c m_gridData the core of MyModel. The rest of \c MyModel acts like a wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We have also introduced the \l{QAbstractItemModel::editCompleted()}{editCompleted()} signal, which makes it possible to transfer the modified text to the window title. + +?????(include section from 5_edit/mymodel.cpp)????? +\code +#include "mymodel.h" + +const int COLS= 3; +const int ROWS= 2; + +MyModel::MyModel(QObject *parent) + :QAbstractTableModel(parent) +{ + //gridData needs to have 6 element, one for each table cell + m_gridData << "1/1" << "1/2" << "1/3" << "2/1" << "2/2" << "2/3" ; +} +\endcode + +In the constructor, we fill \c QStringList gridData with 6 items. (one item for every field in the table) +?????(include section from 5_edit/mymodel.cpp)????? +\code +HIER FEHLT WAS!!! +\endcode + +\l{QAbstractItemModel::setData()}{setData()} will be called each time the user edits a cell. The \c index parameter tells us which field has been edited and \c value provides the result of the editing process. The role will always be set to \c Qt::EditRole because our cells only contain text. If a checkbox were present and user permissions are set to allow the checkbox to be selected, calls would also be made with the role set to \c Qt::CheckStateRole. +?????(include section from 5_edit/mymodel.cpp)????? +\code +HIER FEHLT WAS!!! +\endcode + +Various properties of a cell can be adjusted with \l{QAbstractItemModel::flags()}{flags()}. Returning \c Qt::ItemIsEditable | Qt::ItemIsEnabled is enough to show an editor that a cell has been selected. If editing one cell modifies more data than the data in that particular cell, the model must emit a \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal in order for the data that has been changed to be read. + +\section1 3 Intermediate Topics +\section2 3.1 TreeView +You can convert the example above into an application with a tree view. Simply replace QTableView with QTreeView, which results in a read/write tree. No changes have to be made to the model. The tree won't have any hierarchies because there aren't any hierarchies in the model itself. +\image dummy_tree.png + + +QListView, QTableView and QTreeView all use a model abstraction, which is a merged list, table and tree. This makes it possible to use several different types of view classes from the same model. +\image list_table_tree.png + +This is how our example model looks so far: +\image example_model.png + + +We want to, however, present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which is a container for hierarchical data that also implements QAbstractItemModel. To show a tree, QStandardItemModel must be populated with QStandardItems, which are able to hold all the standard properties of items like text, fonts, checkboxes or brushes. \image tree_2_with_algorithm.png +-------------------------------------------------------------modelview.cpp--------------------- + \snippet examples/tutorials/modelview/6_treeview/modelview.cpp + +We simply instantiate a QStandardItemModel and add a couple of QStandardItems to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other QStandardItems. Nodes are collapsed and expanded within the view. + +\section2 3.2 Working with selection +We want to access a selected item's content in order to output it into the window title together with the hierarchy level. +\image selection2.png + + +So let's create a couple of items: +?????(include section from 7_selections/modelview.cpp)????? +\code +#include +#include +#include +#include "modelview.h" + +ModelView::ModelView(QWidget *parent) + : QMainWindow(parent) +{ + treeView = new QTreeView(this); + setCentralWidget(treeView); + standardModel = new QStandardItemModel ; + QStandardItem *rootNode = standardModel->invisibleRootItem(); + + + //defining a couple of items + QStandardItem *americaItem = new QStandardItem("America"); + QStandardItem *mexicoItem = new QStandardItem("Canada"); + QStandardItem *usaItem = new QStandardItem("USA"); + QStandardItem *bostonItem = new QStandardItem("Boston"); + QStandardItem *europeItem = new QStandardItem("Europe"); + QStandardItem *italyItem = new QStandardItem("Italy"); + QStandardItem *romeItem = new QStandardItem("Rome"); + QStandardItem *veronaItem = new QStandardItem("Verona"); + + //building up the hierarchy + rootNode-> appendRow(americaItem); + rootNode-> appendRow(europeItem); + americaItem-> appendRow(mexicoItem); + americaItem-> appendRow(usaItem); + usaItem-> appendRow(bostonItem); + europeItem-> appendRow(italyItem); + italyItem-> appendRow(romeItem); + italyItem-> appendRow(veronaItem); + + //register the model + treeView->setModel( standardModel ); + treeView->expandAll(); + + //selection changes shall trigger a slot + QItemSelectionModel *selectionModel= treeView->selectionModel(); + connect(selectionModel, SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & )), + this, SLOT(selectionChangedSlot(const QItemSelection & , const QItemSelection & ))); +} +\endcode + +Views manage selections within a separate selection model, which can be retrieved with the \l{QAbstractItemModel::selectionModel()}{selectionModel()} method. We retrieve the selection Model in order to connect a slot to its \l{QAbstractItemModel::selectionChanged()}{selectionChanged()} signal. + +?????(include section from 7_selections/modelview.cpp)????? +\code +HIER FEHLT WAS!!! +\endcode + +We get the model index that corresponds to the selection by calling +\c treeView->selectionModel()->currentIndex() and we get the the field's string by using the model index. Then we just calculate the item's \c hierarchyLevel. Top level items do not have parents and the \l{QAbstractItemModel::parent()}{parent()} method will return a default constructed QModelIndex(). This is why we use the \l{QAbstractItemModel::parent()}{parent()} method to iterate to the top level while counting the steps performed during iteration. + +The selection model (as shown above) can be retrieved, but it can also be set with \c QAbstractItemView::setSelectionModel. This is how it's possible to have 3 view classes with synchronised selections because only one instance of a selection model is used. The instance of a selection model is retrieved from the first view class with \l{QAbstractItemModel::selectionModel()}{selectionModel()} and the result is assigned to the second and third view class with \l{QAbstractItemModel::setSelectionModel()}{setSelectionModel()}; +\section2 3.3 Predefined Models +The typical way to use model/view is to wrap specific data to make it usable with view classes. Qt, however, also provides predefined models for common underlying data structures. If one of the available data structures is suitable for your application, a predefined model can be a good choice. + + \table + \row + \o QStringListModel + \o Stores a list of strings + \row + \o QStandardItemModel + \o Stores arbitrary hierarchical items + \row + \o {1, 2} QFileSystemModel +QDirModel (deprecated) + \o {1, 2} Encapsulate the local file system + \row + \o QSqlQueryModel + \o Encapsulate an SQL result set + \row + \o QSqlTableModel + \o Encapsulates an SQL table + \row + \o QSqlRelationalTableModel + \o Encapsulates an SQL table with foreign keys + \row + \o QSortFilterProxyModel + \o Sorts and/or filters another model + + \endtable + +\section2 3.4 Delegates +In all examples so far, data is presented as text or a checkbox in a cell and is edited as text or a checkbox. The component that provides these presentation and editing services is called a “delegate.” We are only just beginning to work with the delegate because the view uses a default delegate. But imagine that we want to have a different editor.(e.g. a slider or a drop down list) Or imagine that we want to present data as graphics. Let's take a look at an example called Stardelegate, ( \l{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html}{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html} ) in which stars are used to show a rating: \image stardelegate.png + +The view has a method that replaces the default delegate and installs a custom delegate. This method is called \l{QAbstractItemModel::setItemDelegate()}{setItemDelegate()}. A new delegate can be written by creating a class that inherits from QStyledItemDelegate. In order to write a delegate that displays stars and has no input capabilities, we only need to overwrite 2 methods. + +!!!!!I CAN'T FIND THIS FILE!!!!! +\code + class StarDelegate : public QStyledItemDelegate + { + Q_OBJECT + public: + StarDelegate(QWidget *parent = 0); + void paint(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const; + QSize sizeHint(const QStyleOptionViewItem &option, + const QModelIndex &index) const; + }; + +\endcode + +\l{QAbstractItemModel::paint()}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \c index.data(). \c SizeHint specifies the stars dimensions so the the cell will provide enough height and width to accommodate the stars. + +Writing custom delegates is the right choice if you want to show your data with a custom graphical representation inside the grid of the view class. If you want to leave the grid, you can write a custom view class. + +\section2 3.5 Debugging with ModelTest +The passive nature of models provides new challenges for programmers. Inconsistencies in the model can cause the application to crash. Since the model is hit by numerous calls from the view, it is hard to find out which call has crashed the application and which operation has introduced the problem. + +Qt provides software called ModelTest, which checks models while your programming is running. Every time the model is changed, ModelTest scans the model and reports errors with an assert. This is especially important for tree models, since their hierarchical nature leaves many possibilities for subtle inconsistencies. http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest + +Unlike view classes, ModelTest uses out of range indexes to test the model. This means your application may crash with ModelTest even if it runs perfectly without it. So you also need to handle all of the indexes that are out of range when using ModelTest. + + + + + + + + + +\section2 3.6 Model/View NG + +\image path.png + +Model/View was introduced in Qt 4.0 and is a frequently used technology. Feedback from clients and new development trends have shown, that there is a need to further develop the model/view technology. Therefore a research project at Nokia is looking into ways to go beyond the current implementation. + +One limitation of model/view is that view classes are basically all fixed grids. It is possible, but really hard to make a list view with icons placed on a curve; or cells expanding on mouse over events to show additional information. In order to achieve graphically rich view experiences, Model/View NG will use QGraphicsView to render elements. Nodel/View NG also aims to make model/view programming more intuitive. One way to achieve this is to have separate models for lists, tables and trees. The current model abstraction is complex because it is capable of representing a list, a table or a tree. + +Model/View NG is a research project. You are welcome to checkout the source code, monitor progress and take part in discussions at the following address: \l{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG}{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG} + +\section1 4 Good Sources for Additional Information +\section2 4.1 Books +Model/View programming is covered quite extensively in the documentation of Qt but also in several good books. + \list 1 + \o 1.C++ GUI Programming with Qt 4 / Jasmin Blanchette, Mark Summerfield, Prentice Hall, 2nd edition, ISBN 0-13-235416-0 +also available in German: C++ GUI Programmierung mit Qt 4: Die offizielle Einführung, Addison-Wesley, ISBN 3-827327-29-6 + \o 1.The Book of Qt4, The Art of Building Qt Applications / Daniel Molkentin, Open Source Press ISBN 1-59327-147-6 +Translated from: Qt 4, Einführung in die Applikationsentwicklung, Open Source Press, ISBN 3-937514-12-0 + \o 1.Foundations of Qt Development / Johan Thelin, Apress, ISBN 1-59059-831-8 + \endlist + + +The following list provides an overview of example programs contained in the books above. Some of them make very good templates for developing similar applications. + + \table + \header + \o example name + \o view class used + \o model used + \o aspects touched + \o + \row + \o Team Leaders + \o QListview + \o QStringListModel + \o + \o Book 1, Chapter 10, Figure 10.6 + \row + \o Directory Viewer + \o QTreeView + \o QDirModel + \o + \o Book 1, Chapter 10, Figure 10.7 + \row + \o Color Names + \o QListView + \o QSortFilterProxyModel +applied to QStringListModel + \o + \o Book 1, Chapter 10, Figure 10.8 + \row + \o Currencies + \o QTableView + \o custom model based on +QAbstractTableModel + \o read only + \o Book 1, Chapter 10, Figure 10.10 + \row + \o Cities + \o QTableView + \o custom model based on +QAbstractTableModel + \o read / write + \o Book 1, Chapter 10, Figure 10.12 + \row + \o Boolean Parser + \o QTreeView + \o custom model based on +QAbstractItemModel + \o read only + \o Book 1, Chapter 10, Figure 10.14 + \row + \o Track Editor + \o {2, 1} QTableWidget + \o custom delegate providing a custom editor + \o Book 1, Chapter 10, Figure 10.15 + + \row + \o Four directory views + \o QListView +QTableView +QTreeView + \o QDirModel + \o demonstrates the use of multiple views + \o Book2, Chapter 8.2 + \row + \o Address Book + \o QListView +QTableView +QTreeView + \o custom model based on +QAbstractTableModel + \o read / write + \o Book2, Chapter 8.4 + \row + \o Address Book with sorting + \o + \o QProxyModel + \o introducing sort and filter capabilities + \o Book2, Chapter 8.5 + \row + \o Address Book +with checkboxes + \o + \o + \o introducing checkboxes +in model/view + \o Book2, Chapter 8.6 + \row + \o Address Book +with transposed grid + \o + \o custom proxy Model based on QAbstractProxyModel + \o introducing a custom model + \o Book2, Chapter 8.7 + \row + \o Address Book +with drag and drop + \o + \o + \o introducing drag and drop support + \o Book2, Chapter 8.8 + \row + \o Address Book with custom editor + \o + \o + \o introducing custom delegates + \o Book2, Chapter 8.9 + \row + \o Views + \o QListView +QTableView +QTreeView + \o QStandardItemModel + \o read only + \o Book 3, Chapter 5, figure 5-3 + \row + \o Bardelegate + \o QTableView + \o + \o custom delegate for presentation based on QAbstractItemDelegate + \o Book 3, Chapter 5, figure 5-5 + \row + \o Editdelegate + \o QTableView + \o + \o custom delegate for editing based on QAbstractItemDelegate + \o Book 3, Chapter 5, figure 5-6 + \row + \o Singleitemview + \o custom view based on +QAbstractItemView + \o + \o custom view + \o Book 3, +Chapter 5, +figure 5-7 + \row + \o listmodel + \o QTableView + \o custom Model based on +QAbstractTableModel + \o read only + \o Book 3, +Chapter 5, +Figure 5-8 + \row + \o treemodel + \o QTreeView + \o custom Model based on +QAbstractItemModel + \o read only + \o Book 3, +Chapter 5, +Figure 5-10 + \row + \o edit integers + \o QListView + \o custom Model based on +QAbstractListModel + \o read / write + \o Book 3, +Chapter 5, +Listing 5-37, Figure 5-11 + \row + \o sorting + \o QTableView + \o QSortFilterProxyModel +applied to QStringListModel + \o demonstrates sorting + \o Book 3, Chapter 5, Figure 5-12 + + \endtable + + +\section2 4.2 Qt documentation +Qt 4.6 comes with 17 examples and 2 Demonstrations for model/view. The examples can be found here: \l{http://doc.qt.nokia.com/4.6/examples-itemviews.html}{http://doc.qt.nokia.com/4.6/examples-itemviews.html} + \table + \header + \o example name + \o view class used + \o model used + \o aspects touched + \row + \o Address Book + \o QTableView + \o QTableModel +QSortFilterProxyModel + \o usage of QSortFilterProxyModel to generate different subsets from one data pool + \row + \o Basic Sort/Filter Model + \o QTreeView + \o QStandardItemModel +QSortFilterProxyModel + \o + \row + \o Chart + \o custom view + \o QStandardItemModel + \o designing custom views that cooperate with selection models + \row + \o Color Editor Factory + \o {2, 1} QTableWidget + \o enhancing the standard delegate with a new custom editor to choose colours + \row + \o Combo Widget Mapper + \o QDataWidgetMapper to map QLineEdit, QTextEdit and QComboBox + \o QStandardItemModel + \o shows how a QComboBox can serve as a view class + \row + \o Custom Sort/Filter Model + \o QTreeView + \o QStandardItemModel +QSortFilterProxyModel + \o subclass QSortFilterProxyModel +for advanced sorting and filtering + \row + \o Dir View + \o QTreeView + \o QDirModel + \o very small example to demonstrate how to assign a model to a view + \row + \o Editable Tree Model + \o QTreeView + \o custom tree model + \o comprehensive example for working with trees, demonstrates editing cells and tree structure with an underlying custom model + \row + \o Fetch More + \o QListView + \o custom list model + \o dynamically changing model + \row + \o Frozen Column + \o QTableView + \o QStandardItemModel + \o + \row + \o Pixelator + \o QTableView + \o custom table model + \o implementation of a custom delegate + \row + \o Puzzle + \o QListView + \o custom list model + \o model/view with drag and drop + \row + \o Simple DOM Model + \o QTreeView + \o custom tree model + \o read only example for a custom tree model + \row + \o Simple Tree Model + \o QTreeView + \o custom tree model + \o read only example for a custom tree model + \row + \o Simple Widget Mapper + \o QDataWidgetMapper to map QLineEdit, QTextEdit and QSpinBox + \o QStandardItemModel + \o basic QDataWidgetMapper usage + \row + \o Spin Box Delegate + \o QTableView + \o QStandardItemModel + \o custom delegate that uses a spin box as a cell editor + \row + \o Star Delegate + \o {2, 1} QTableWidget + \o comprehensive custom delegate example. + \endtable + +Demonstrations are similar to examples except that no walk-through is provided for the code lines. Demonstrations are also sometimes more feature rich. + \l{http://doc.qt.nokia.com/4.6/demos.html}{http://doc.qt.nokia.com/4.6/demos.html} + \list + \o The \bold Interview demonstration shows the same model and selection being shared between three different views. + \o Demonstration \bold Spreadsheet demonstrates the use of a table view as a spreadsheet, using custom delegates to render each item according to the type of data it contains. + \endlist + +A reference documentation for model/view technology is also available. \l{http://doc.qt.nokia.com/4.6/model-view-programming.html}{http://doc.qt.nokia.com/4.6/model-view-programming.html} + +*/ \ No newline at end of file diff --git a/examples/tutorials/modelview/modelview.pro b/examples/tutorials/modelview/modelview.pro new file mode 100755 index 0000000..7f684ba --- /dev/null +++ b/examples/tutorials/modelview/modelview.pro @@ -0,0 +1,10 @@ +TEMPLATE = subdirs + +SUBDIRS = 1_readonly \ + 2_formatting \ + 3_changingmodel \ + 4_headers \ + 5_edit \ + 6_treeview \ + 7_selections + diff --git a/examples/tutorials/modelview/qmake.pro b/examples/tutorials/modelview/qmake.pro deleted file mode 100755 index 7f684ba..0000000 --- a/examples/tutorials/modelview/qmake.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS = 1_readonly \ - 2_formatting \ - 3_changingmodel \ - 4_headers \ - 5_edit \ - 6_treeview \ - 7_selections - diff --git a/examples/tutorials/tutorials.pro b/examples/tutorials/tutorials.pro index 949fdf6..34723c2 100644 --- a/examples/tutorials/tutorials.pro +++ b/examples/tutorials/tutorials.pro @@ -1,6 +1,8 @@ TEMPLATE = subdirs SUBDIRS = \ - addressbook + addressbook \ + modelview + # install sources.files = README *.pro -- cgit v0.12 From ca10c2c5a8190cac9c2ae0526f2e250add09d6f2 Mon Sep 17 00:00:00 2001 From: Michael D Scull Date: Wed, 23 Jun 2010 17:19:49 +0200 Subject: correction of snippet tags --- doc/src/tutorials/modelview.qdoc | 41 ++++++--------------- examples/tutorials/modelview/._.DS_Store | Bin 0 -> 4096 bytes examples/tutorials/modelview/1_readonly/main.cpp | 2 + .../tutorials/modelview/1_readonly/modelview.cpp | 3 +- .../tutorials/modelview/1_readonly/modelview.h | 3 ++ .../tutorials/modelview/1_readonly/mymodel.cpp | 2 + examples/tutorials/modelview/1_readonly/mymodel.h | 2 + .../tutorials/modelview/2_formatting/mymodel.cpp | 3 +- .../modelview/3_changingmodel/mymodel.cpp | 7 ++-- examples/tutorials/modelview/4_headers/mymodel.cpp | 3 +- examples/tutorials/modelview/5_edit/mymodel.cpp | 8 +++- examples/tutorials/modelview/5_edit/mymodel.h | 2 + .../tutorials/modelview/6_treeview/modelview.cpp | 2 + .../tutorials/modelview/7_selections/modelview.cpp | 6 ++- examples/tutorials/modelview/qmake.pro | 10 +++++ 15 files changed, 57 insertions(+), 37 deletions(-) create mode 100755 examples/tutorials/modelview/._.DS_Store create mode 100755 examples/tutorials/modelview/qmake.pro diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index 1be4b46..3c73a80 100755 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -1,9 +1,7 @@ /*! - \page modelview.html - \startpage {index.html}{Qt Reference Documentation} - \contentspage Tutorials \contentspage{modelview.html}{Crash Course in Model/View Programming} + \page modelview.html \title Crash Course in Model/View Programming Contents: @@ -71,16 +69,16 @@ Below are 7 very simple and independent applications that show different sides o We start with an application that uses a \l QTableView to show data. We will add editing capabilities later. -------------------------------------------------------------main.cpp--------------------- - \snippet examples/tutorials/modelview/1_readonly/main.cpp + \snippet examples/tutorials/modelview/1_readonly/main.cpp Quoting ModelView Tutorial We have the usual main() function; -------------------------------------------------------------modelview.h--------------------- - \snippet examples/tutorials/modelview/1_readonly/modelview.h + \snippet examples/tutorials/modelview/1_readonly/modelview.h Quoting ModelView Tutorial The application is a \l QMainWindow that holds a \l QTableView. -------------------------------------------------------------modelview.cpp--------------------- - \snippet examples/tutorials/modelview/1_readonly/modelview.cpp + \snippet examples/tutorials/modelview/1_readonly/modelview.cpp Quoting ModelView Tutorial Here is the interesting part: We use \c tableView->setModel(new MyModel(this) ); to instantiate the Model and pass its pointer to \l {QTableView::}{tableView()} OR \l QTableView::tableView() OR \l QTableView::tableView . \l {QTableView::}{tableView} will invoke the methods of the pointer it has received to find out two things: \list @@ -92,13 +90,13 @@ The model needs some code to respond to this. We have a table data set, so let's start with QAbstractTableModel since it is easier to use. -------------------------------------------------------------mymodel.h--------------------- - \snippet examples/tutorials/modelview/1_readonly/mymodel.h + \snippet examples/tutorials/modelview/1_readonly/mymodel.h Quoting ModelView Tutorial QAbstractTableModel requires the implementation of three abstract methods. -------------------------------------------------------------mymodel.cpp--------------------- - \snippet examples/tutorials/modelview/1_readonly/mymodel.cpp + \snippet examples/tutorials/modelview/1_readonly/mymodel.cpp Quoting ModelView Tutorial The number of rows and columns is set by \c MyModel::rowCount() and \c MyModel::columnCount(). When the view has to know what the cell 's text is, it calls the \l{QAbstractItemModel::data()}{data()} method. Row and column information is specified with parameter \c index and the role is set to Qt::Display Role. Other roles are covered in the next section. In our example, the data that should be displayed is generated. In a real application, \c MyModel would have a member called \c MyData, which serves as the target for all reading and writing operations. @@ -114,7 +112,7 @@ In addition to controlling what text the view displays, the model also controls In fact, nothing except for the \l{QAbstractItemModel::data()}{data()} method needs to be changed to set fonts, background colour, alignment and a checkbox. Here is the \l{QAbstractItemModel::data()}{data()} method that produces the result shown above: -------------------------------------------------------------mymodel.cpp--------------------- - \snippet examples/tutorials/modelview/2_formatting/mymodel.cpp + \snippet examples/tutorials/modelview/2_formatting/mymodel.cpp Quoting ModelView Tutorial Each formatting property will be requested from the model with a separate call to the \l{QAbstractItemModel::data()}{data()} method. The \c role parameter is used to let the model know which property is being requested: @@ -178,7 +176,6 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const Something is missing to make the clock tick. We need to tell the view every second that the time has changed and that it needs to be read again. We do this with a timer. In the constructor, we set its interval to 1 second and it connect its timeout signal. -?????(include section from 3_changingmodel/mymodel.cpp)????? \code MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) @@ -193,7 +190,6 @@ MyModel::MyModel(QObject *parent) Here is the corresponding slot: -?????(include section from 3_changingmodel/mymodel.cpp)????? \code void MyModel::timerHit() @@ -215,8 +211,6 @@ Headers can be hidden via a view method. The header content, however , is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: - -?????(include section from 4_headers/mymodel.cpp)????? \code QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const { @@ -244,11 +238,10 @@ In this example, we are going to build an application that automatically populat The model decides whether editing capabilities are available . We only have to modify the model in order for the available editing capabilities to be enabled. This is done by reimplementing the following virtual methods: \l{QAbstractItemModel::setData()}{setData()} and \l{QAbstractItemModel::flags()}{flags()}. -------------------------------------------------------------mymodel.h--------------------- - \snippet examples/tutorials/modelview/5_edit/mymodel.h + \snippet examples/tutorials/modelview/5_edit/mymodel.h Quoting ModelView Tutorial We use \c QStringList m_gridData to store our data. This makes \c m_gridData the core of MyModel. The rest of \c MyModel acts like a wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We have also introduced the \l{QAbstractItemModel::editCompleted()}{editCompleted()} signal, which makes it possible to transfer the modified text to the window title. -?????(include section from 5_edit/mymodel.cpp)????? \code #include "mymodel.h" @@ -264,16 +257,10 @@ MyModel::MyModel(QObject *parent) \endcode In the constructor, we fill \c QStringList gridData with 6 items. (one item for every field in the table) -?????(include section from 5_edit/mymodel.cpp)????? -\code -HIER FEHLT WAS!!! -\endcode + \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_e \l{QAbstractItemModel::setData()}{setData()} will be called each time the user edits a cell. The \c index parameter tells us which field has been edited and \c value provides the result of the editing process. The role will always be set to \c Qt::EditRole because our cells only contain text. If a checkbox were present and user permissions are set to allow the checkbox to be selected, calls would also be made with the role set to \c Qt::CheckStateRole. -?????(include section from 5_edit/mymodel.cpp)????? -\code -HIER FEHLT WAS!!! -\endcode + \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_f Various properties of a cell can be adjusted with \l{QAbstractItemModel::flags()}{flags()}. Returning \c Qt::ItemIsEditable | Qt::ItemIsEnabled is enough to show an editor that a cell has been selected. If editing one cell modifies more data than the data in that particular cell, the model must emit a \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal in order for the data that has been changed to be read. @@ -292,7 +279,7 @@ This is how our example model looks so far: We want to, however, present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which is a container for hierarchical data that also implements QAbstractItemModel. To show a tree, QStandardItemModel must be populated with QStandardItems, which are able to hold all the standard properties of items like text, fonts, checkboxes or brushes. \image tree_2_with_algorithm.png -------------------------------------------------------------modelview.cpp--------------------- - \snippet examples/tutorials/modelview/6_treeview/modelview.cpp + \snippet examples/tutorials/modelview/6_treeview/modelview.cpp Quoting ModelView Tutorial We simply instantiate a QStandardItemModel and add a couple of QStandardItems to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other QStandardItems. Nodes are collapsed and expanded within the view. @@ -302,7 +289,6 @@ We want to access a selected item's content in order to output it into the windo So let's create a couple of items: -?????(include section from 7_selections/modelview.cpp)????? \code #include #include @@ -351,10 +337,7 @@ ModelView::ModelView(QWidget *parent) Views manage selections within a separate selection model, which can be retrieved with the \l{QAbstractItemModel::selectionModel()}{selectionModel()} method. We retrieve the selection Model in order to connect a slot to its \l{QAbstractItemModel::selectionChanged()}{selectionChanged()} signal. -?????(include section from 7_selections/modelview.cpp)????? -\code -HIER FEHLT WAS!!! -\endcode + \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_b We get the model index that corresponds to the selection by calling \c treeView->selectionModel()->currentIndex() and we get the the field's string by using the model index. Then we just calculate the item's \c hierarchyLevel. Top level items do not have parents and the \l{QAbstractItemModel::parent()}{parent()} method will return a default constructed QModelIndex(). This is why we use the \l{QAbstractItemModel::parent()}{parent()} method to iterate to the top level while counting the steps performed during iteration. diff --git a/examples/tutorials/modelview/._.DS_Store b/examples/tutorials/modelview/._.DS_Store new file mode 100755 index 0000000..338bd7b Binary files /dev/null and b/examples/tutorials/modelview/._.DS_Store differ diff --git a/examples/tutorials/modelview/1_readonly/main.cpp b/examples/tutorials/modelview/1_readonly/main.cpp index 998503c..bdf740c 100755 --- a/examples/tutorials/modelview/1_readonly/main.cpp +++ b/examples/tutorials/modelview/1_readonly/main.cpp @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #include #include "modelview.h" @@ -8,3 +9,4 @@ int main(int argc, char *argv[]) w.show(); return a.exec(); } +//! [Quoting ModelView Tutorial] \ No newline at end of file diff --git a/examples/tutorials/modelview/1_readonly/modelview.cpp b/examples/tutorials/modelview/1_readonly/modelview.cpp index becd61d..14311f9 100755 --- a/examples/tutorials/modelview/1_readonly/modelview.cpp +++ b/examples/tutorials/modelview/1_readonly/modelview.cpp @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #include #include "modelview.h" #include "mymodel.h" @@ -9,4 +10,4 @@ ModelView::ModelView(QWidget *parent) setCentralWidget(tableView); tableView->setModel(new MyModel(this) ); } - +//! [Quoting ModelView Tutorial] \ No newline at end of file diff --git a/examples/tutorials/modelview/1_readonly/modelview.h b/examples/tutorials/modelview/1_readonly/modelview.h index f1b63bd..93b6b90 100755 --- a/examples/tutorials/modelview/1_readonly/modelview.h +++ b/examples/tutorials/modelview/1_readonly/modelview.h @@ -1,6 +1,8 @@ +//! [Quoting ModelView Tutorial] #ifndef MODELVIEW_H #define MODELVIEW_H + #include class QTableView; //forward declaration @@ -16,3 +18,4 @@ public: }; #endif // MODELVIEW_H +//! [Quoting ModelView Tutorial] \ No newline at end of file diff --git a/examples/tutorials/modelview/1_readonly/mymodel.cpp b/examples/tutorials/modelview/1_readonly/mymodel.cpp index ff3e2d2..3386907 100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.cpp +++ b/examples/tutorials/modelview/1_readonly/mymodel.cpp @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #include "mymodel.h" MyModel::MyModel(QObject *parent) @@ -28,3 +29,4 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const } return QVariant(); } +//! [Quoting ModelView Tutorial] \ No newline at end of file diff --git a/examples/tutorials/modelview/1_readonly/mymodel.h b/examples/tutorials/modelview/1_readonly/mymodel.h index 01ae6cb..aac1bf0 100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.h +++ b/examples/tutorials/modelview/1_readonly/mymodel.h @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #ifndef MYMODEL_H #define MYMODEL_H @@ -14,3 +15,4 @@ public: }; #endif // MYMODEL_H +//! [Quoting ModelView Tutorial] \ No newline at end of file diff --git a/examples/tutorials/modelview/2_formatting/mymodel.cpp b/examples/tutorials/modelview/2_formatting/mymodel.cpp index 48b1134..916dabc 100755 --- a/examples/tutorials/modelview/2_formatting/mymodel.cpp +++ b/examples/tutorials/modelview/2_formatting/mymodel.cpp @@ -3,6 +3,7 @@ #include "mymodel.h" #include +//! [Quoting ModelView Tutorial] MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) { @@ -70,4 +71,4 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const } return QVariant(); } - +//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp index d594175..fa7f566 100755 --- a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp +++ b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp @@ -3,7 +3,7 @@ #include #include "mymodel.h" - +//! [quoting mymodel_a] MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) { @@ -13,7 +13,7 @@ MyModel::MyModel(QObject *parent) connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit()) ); timer->start(); } - +//! [quoting mymodel_a] //------------------------------------------------------- int MyModel::rowCount(const QModelIndex & /*parent */ ) const { @@ -43,6 +43,7 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const } //------------------------------------------------------- +//! [quoting mymodel_b ] void MyModel::timerHit() { //we identify the top left cell @@ -50,4 +51,4 @@ void MyModel::timerHit() //emit a signal to make the view reread identified data emit dataChanged ( topLeft, topLeft ); } - +//! [quoting mymodel_b ] diff --git a/examples/tutorials/modelview/4_headers/mymodel.cpp b/examples/tutorials/modelview/4_headers/mymodel.cpp index a032fe5..7891c80 100755 --- a/examples/tutorials/modelview/4_headers/mymodel.cpp +++ b/examples/tutorials/modelview/4_headers/mymodel.cpp @@ -29,7 +29,7 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const return QVariant(); } - +//! [quoting mymodel_c] QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const { if (role == Qt::DisplayRole) @@ -48,3 +48,4 @@ QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) } return QVariant(); } +//! [quoting mymodel_c] \ No newline at end of file diff --git a/examples/tutorials/modelview/5_edit/mymodel.cpp b/examples/tutorials/modelview/5_edit/mymodel.cpp index c64a6b7..ef45bc3 100755 --- a/examples/tutorials/modelview/5_edit/mymodel.cpp +++ b/examples/tutorials/modelview/5_edit/mymodel.cpp @@ -1,3 +1,4 @@ +//! [quoting mymodel_d] #include "mymodel.h" const int COLS= 3; @@ -9,7 +10,9 @@ MyModel::MyModel(QObject *parent) //gridData needs to have 6 element, one for each table cell m_gridData << "1/1" << "1/2" << "1/3" << "2/1" << "2/2" << "2/3" ; } +//! [quoting mymodel_d] +//! [quoting mymodel_e] //------------------------------------------------------- int MyModel::rowCount(const QModelIndex & /*parent*/ ) const { @@ -31,8 +34,11 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const } return QVariant(); } +//! [quoting mymodel_e] //----------------------------------------------------------------- + +//! [quoting mymodel_f] bool MyModel::setData ( const QModelIndex & index, const QVariant & value, int role ) { if(role == Qt::EditRole) @@ -55,4 +61,4 @@ int MyModel::modelIndexToOffset(const QModelIndex & index) const { return index.row()*COLS + index.column(); } - +//! [quoting mymodel_f] diff --git a/examples/tutorials/modelview/5_edit/mymodel.h b/examples/tutorials/modelview/5_edit/mymodel.h index f8fac77..1612fa0 100755 --- a/examples/tutorials/modelview/5_edit/mymodel.h +++ b/examples/tutorials/modelview/5_edit/mymodel.h @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #ifndef MYMODEL_H #define MYMODEL_H @@ -22,3 +23,4 @@ signals: }; #endif // MYMODEL_H +//! [Quoting ModelView Tutorial] \ No newline at end of file diff --git a/examples/tutorials/modelview/6_treeview/modelview.cpp b/examples/tutorials/modelview/6_treeview/modelview.cpp index a5488f7..b5b4d06 100755 --- a/examples/tutorials/modelview/6_treeview/modelview.cpp +++ b/examples/tutorials/modelview/6_treeview/modelview.cpp @@ -1,3 +1,4 @@ +//! [Quoting ModelView Tutorial] #include #include #include @@ -38,3 +39,4 @@ QList ModelView::prepareColumn(const QString &first, colItems << new QStandardItem(third); return colItems; } +//! [Quoting ModelView Tutorial] \ No newline at end of file diff --git a/examples/tutorials/modelview/7_selections/modelview.cpp b/examples/tutorials/modelview/7_selections/modelview.cpp index 49c5bb8..eac6df9 100755 --- a/examples/tutorials/modelview/7_selections/modelview.cpp +++ b/examples/tutorials/modelview/7_selections/modelview.cpp @@ -1,3 +1,4 @@ +//! [quoting modelview_a] #include #include #include @@ -41,8 +42,11 @@ ModelView::ModelView(QWidget *parent) connect(selectionModel, SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & )), this, SLOT(selectionChangedSlot(const QItemSelection & , const QItemSelection & ))); } +//! [quoting modelview_a] //------------------------------------------------------------------------------------ + +//! [quoting modelview_b] void ModelView::selectionChangedSlot(const QItemSelection & /*newSelection*/, const QItemSelection & /*oldSelection*/) { const QModelIndex index = treeView->selectionModel()->currentIndex(); @@ -58,6 +62,6 @@ void ModelView::selectionChangedSlot(const QItemSelection & /*newSelection*/, co .arg(hierarchyLevel); setWindowTitle(showString); } - +//! [quoting modelview_b] diff --git a/examples/tutorials/modelview/qmake.pro b/examples/tutorials/modelview/qmake.pro new file mode 100755 index 0000000..7f684ba --- /dev/null +++ b/examples/tutorials/modelview/qmake.pro @@ -0,0 +1,10 @@ +TEMPLATE = subdirs + +SUBDIRS = 1_readonly \ + 2_formatting \ + 3_changingmodel \ + 4_headers \ + 5_edit \ + 6_treeview \ + 7_selections + -- cgit v0.12 From 798433c9046281a8739eb6b313c7dd0fc7b5e3b1 Mon Sep 17 00:00:00 2001 From: Michael D Scull Date: Mon, 28 Jun 2010 12:49:05 +0200 Subject: I've cleaned up the qdoc file a bit. --- doc/src/tutorials/modelview.qdoc | 213 +++++++-------------- .../modelview/3_changingmodel/mymodel.cpp | 3 +- 2 files changed, 70 insertions(+), 146 deletions(-) diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index 3c73a80..c9caf17 100755 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -56,9 +56,13 @@ Here is an overview of the model/view widgets and their corresponding standard w \section2 1.4 Having adapters between forms and models can come in handy. We often prefer editing data stored in tables (e.g. in database tables) in forms rather than in tables. There is no direct model/view counterpart for separating data and views for widgets that operate on one value instead of a dataset, so we need an adapter in order to connect the form to the source of data. -\l QDataWidgetMapper is a great solution because it maps form widgets to a table row and it makes it very easy to build forms for database tables. \image widgetmapper.png -Another example of an adapter is \l QCompleter. Qt has QCompleter for providing auto completions in Qt widgets such as \l QComboBox and, as shown below, \l QLineEdit. \l QCompleter uses a model as its data source, so \l QCompleter, in itself, is a very handy adapter. \image qcompleter.png +\l QDataWidgetMapper is a great solution because it maps form widgets to a table row and it makes it very easy to build forms for database tables. +\image widgetmapper.png + + +Another example of an adapter is \l QCompleter. Qt has QCompleter for providing auto completions in Qt widgets such as \l QComboBox and, as shown below, \l QLineEdit. \l QCompleter uses a model as its data source, so \l QCompleter, in itself, is a very handy adapter. +\image qcompleter.png \section1 2 A Simple Model/View Application If you want to develop a model/view application, where should you start? We recommend starting with a simple example and extending it step-by-step. This makes understanding the architecture a lot easier. Trying to understand the model/view architecture in detail before invoking the IDE has proven to be less convenient for many developers. It is substantially easier to start with a simple model/view application that has demo data. Give it a try! Simply replace the data in the examples below with your own. @@ -71,7 +75,7 @@ We start with an application that uses a \l QTableView to show data. We will add -------------------------------------------------------------main.cpp--------------------- \snippet examples/tutorials/modelview/1_readonly/main.cpp Quoting ModelView Tutorial -We have the usual main() function; +We have the usual \l {tutorials/modelview/1_readonly/main.cpp}{main()} function; -------------------------------------------------------------modelview.h--------------------- \snippet examples/tutorials/modelview/1_readonly/modelview.h Quoting ModelView Tutorial @@ -80,7 +84,7 @@ The application is a \l QMainWindow that holds a \l QTableView. -------------------------------------------------------------modelview.cpp--------------------- \snippet examples/tutorials/modelview/1_readonly/modelview.cpp Quoting ModelView Tutorial -Here is the interesting part: We use \c tableView->setModel(new MyModel(this) ); to instantiate the Model and pass its pointer to \l {QTableView::}{tableView()} OR \l QTableView::tableView() OR \l QTableView::tableView . \l {QTableView::}{tableView} will invoke the methods of the pointer it has received to find out two things: +Here is the interesting part: We use \c tableView->setModel(new MyModel(this) ); to instantiate the Model and pass its pointer to \l {QTableView}{tableView()}. \l {QTableView}{tableView} will invoke the methods of the pointer it has received to find out two things: \list \o How many rows and columns should be displayed \o What content should be printed into each cell. @@ -154,54 +158,17 @@ Now we need to determine how using a seperated model impacts the application's p We still have a read only table, but this time the content changes every second because we are showing the current time. -!!!!!I CAN'T FIND THIS FILE!!!!! -\code -QVariant MyModel::data(const QModelIndex &index, int role ) const -{ - QVariant returnVal; - int row = index.row(); - int col = index.column(); - - if(role == Qt::DisplayRole) - - { - if(row == 0 && col == 0 ) - { - returnVal = QTime::currentTime().toString(); - } - } - return returnVal; -} -\endcode + \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_QVariant Something is missing to make the clock tick. We need to tell the view every second that the time has changed and that it needs to be read again. We do this with a timer. In the constructor, we set its interval to 1 second and it connect its timeout signal. -\code -MyModel::MyModel(QObject *parent) - :QAbstractTableModel(parent) -{ -// selectedCell = 0; - timer = new QTimer(this); - timer->setInterval(1000); - connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit()) ); - timer->start(); -} -\endcode + \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_a Here is the corresponding slot: -\code + \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_b -void MyModel::timerHit() -{ - //we identify the top left cell - QModelIndex topLeft = createIndex ( 0,0 ); - //emit a signal to make the view reread identified data - emit dataChanged ( topLeft, topLeft ); -} -\endcode - -We ask the view to read the data in the top left cell again by emitting the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal. Note that we did not explicitly connect the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal to the view. This happened automatically when we called \l{QAbstractItemModel::setModel()}{setModel()} . +We ask the view to read the data in the top left cell again by emitting the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal. Note that we did not explicitly connect the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal to the view. This happened automatically when we called \l{QTableView::setModel}{setModel()} . \section2 2.4 Setting up Headers for Columns and Rows Headers can be hidden via a view method. @@ -209,28 +176,9 @@ Headers can be hidden via a view method. \image header.png -The header content, however , is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: +The header content, however, is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: -\code -QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (role == Qt::DisplayRole) - { - if (orientation == Qt::Horizontal) { - switch (section) - { - case 0: - return QString("first"); - case 1: - return QString("second"); - case 2: - return QString("third"); - } - } - } - return QVariant(); -} -\endcode + \snippet examples/tutorials/modelview/4_headers/mymodel.cpp quoting mymodel_c \section2 2.5 The minimal Editing example @@ -242,19 +190,7 @@ The model decides whether editing capabilities are available . We only have to m We use \c QStringList m_gridData to store our data. This makes \c m_gridData the core of MyModel. The rest of \c MyModel acts like a wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We have also introduced the \l{QAbstractItemModel::editCompleted()}{editCompleted()} signal, which makes it possible to transfer the modified text to the window title. -\code -#include "mymodel.h" - -const int COLS= 3; -const int ROWS= 2; - -MyModel::MyModel(QObject *parent) - :QAbstractTableModel(parent) -{ - //gridData needs to have 6 element, one for each table cell - m_gridData << "1/1" << "1/2" << "1/3" << "2/1" << "2/2" << "2/3" ; -} -\endcode + \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_d In the constructor, we fill \c QStringList gridData with 6 items. (one item for every field in the table) \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_e @@ -266,6 +202,7 @@ Various properties of a cell can be adjusted with \l{QAbstractItemModel::flags() \section1 3 Intermediate Topics \section2 3.1 TreeView + You can convert the example above into an application with a tree view. Simply replace QTableView with QTreeView, which results in a read/write tree. No changes have to be made to the model. The tree won't have any hierarchies because there aren't any hierarchies in the model itself. \image dummy_tree.png @@ -273,76 +210,33 @@ You can convert the example above into an application with a tree view. Simply r QListView, QTableView and QTreeView all use a model abstraction, which is a merged list, table and tree. This makes it possible to use several different types of view classes from the same model. \image list_table_tree.png + This is how our example model looks so far: \image example_model.png -We want to, however, present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which is a container for hierarchical data that also implements QAbstractItemModel. To show a tree, QStandardItemModel must be populated with QStandardItems, which are able to hold all the standard properties of items like text, fonts, checkboxes or brushes. \image tree_2_with_algorithm.png +We want to present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which is a container for hierarchical data that also implements QAbstractItemModel. To show a tree, QStandardItemModel must be populated with \l{QStandardItem}{QStandardItems}, which are able to hold all the standard properties of items like text, fonts, checkboxes or brushes. \image tree_2_with_algorithm.png -------------------------------------------------------------modelview.cpp--------------------- \snippet examples/tutorials/modelview/6_treeview/modelview.cpp Quoting ModelView Tutorial -We simply instantiate a QStandardItemModel and add a couple of QStandardItems to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other QStandardItems. Nodes are collapsed and expanded within the view. +We simply instantiate a QStandardItemModel and add a couple of QStandardItems to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other \l{QStandardItem}{QStandardItems}. Nodes are collapsed and expanded within the view. \section2 3.2 Working with selection + + We want to access a selected item's content in order to output it into the window title together with the hierarchy level. \image selection2.png - So let's create a couple of items: -\code -#include -#include -#include -#include "modelview.h" - -ModelView::ModelView(QWidget *parent) - : QMainWindow(parent) -{ - treeView = new QTreeView(this); - setCentralWidget(treeView); - standardModel = new QStandardItemModel ; - QStandardItem *rootNode = standardModel->invisibleRootItem(); - - - //defining a couple of items - QStandardItem *americaItem = new QStandardItem("America"); - QStandardItem *mexicoItem = new QStandardItem("Canada"); - QStandardItem *usaItem = new QStandardItem("USA"); - QStandardItem *bostonItem = new QStandardItem("Boston"); - QStandardItem *europeItem = new QStandardItem("Europe"); - QStandardItem *italyItem = new QStandardItem("Italy"); - QStandardItem *romeItem = new QStandardItem("Rome"); - QStandardItem *veronaItem = new QStandardItem("Verona"); - - //building up the hierarchy - rootNode-> appendRow(americaItem); - rootNode-> appendRow(europeItem); - americaItem-> appendRow(mexicoItem); - americaItem-> appendRow(usaItem); - usaItem-> appendRow(bostonItem); - europeItem-> appendRow(italyItem); - italyItem-> appendRow(romeItem); - italyItem-> appendRow(veronaItem); - - //register the model - treeView->setModel( standardModel ); - treeView->expandAll(); - - //selection changes shall trigger a slot - QItemSelectionModel *selectionModel= treeView->selectionModel(); - connect(selectionModel, SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & )), - this, SLOT(selectionChangedSlot(const QItemSelection & , const QItemSelection & ))); -} -\endcode - + \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_a Views manage selections within a separate selection model, which can be retrieved with the \l{QAbstractItemModel::selectionModel()}{selectionModel()} method. We retrieve the selection Model in order to connect a slot to its \l{QAbstractItemModel::selectionChanged()}{selectionChanged()} signal. \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_b We get the model index that corresponds to the selection by calling -\c treeView->selectionModel()->currentIndex() and we get the the field's string by using the model index. Then we just calculate the item's \c hierarchyLevel. Top level items do not have parents and the \l{QAbstractItemModel::parent()}{parent()} method will return a default constructed QModelIndex(). This is why we use the \l{QAbstractItemModel::parent()}{parent()} method to iterate to the top level while counting the steps performed during iteration. +\l{QItemSelectionModel::currentIndex()}{treeView->selectionModel()->currentIndex()} and we get the the field's string by using the model index. Then we just calculate the item's \c hierarchyLevel. Top level items do not have parents and the \l{QAbstractItemModel::parent()}{parent()} method will return a default constructed \l{QModelIndex}{QModelIndex()}. This is why we use the \l{QAbstractItemModel::parent()}{parent()} method to iterate to the top level while counting the steps performed during iteration. -The selection model (as shown above) can be retrieved, but it can also be set with \c QAbstractItemView::setSelectionModel. This is how it's possible to have 3 view classes with synchronised selections because only one instance of a selection model is used. The instance of a selection model is retrieved from the first view class with \l{QAbstractItemModel::selectionModel()}{selectionModel()} and the result is assigned to the second and third view class with \l{QAbstractItemModel::setSelectionModel()}{setSelectionModel()}; +The selection model (as shown above) can be retrieved, but it can also be set with \l{QAbstractItemView}{QAbstractItemView::setSelectionModel}. This is how it's possible to have 3 view classes with synchronised selections because only one instance of a selection model is used. The instance of a selection model is retrieved from the first view class with \l{QAbstractItemModel::selectionModel()}{selectionModel()} and the result is assigned to the second and third view class with \l{QAbstractItemModel::setSelectionModel()}{setSelectionModel()}; \section2 3.3 Predefined Models The typical way to use model/view is to wrap specific data to make it usable with view classes. Qt, however, also provides predefined models for common underlying data structures. If one of the available data structures is suitable for your application, a predefined model can be a good choice. @@ -354,9 +248,12 @@ The typical way to use model/view is to wrap specific data to make it usable wit \o QStandardItemModel \o Stores arbitrary hierarchical items \row - \o {1, 2} QFileSystemModel -QDirModel (deprecated) - \o {1, 2} Encapsulate the local file system + \o QFileSystemModel + \raw HTML +
+ \endraw + QDirModel (deprecated) + \o Encapsulate the local file system \row \o QSqlQueryModel \o Encapsulate an SQL result set @@ -375,9 +272,8 @@ QDirModel (deprecated) \section2 3.4 Delegates In all examples so far, data is presented as text or a checkbox in a cell and is edited as text or a checkbox. The component that provides these presentation and editing services is called a “delegate.” We are only just beginning to work with the delegate because the view uses a default delegate. But imagine that we want to have a different editor.(e.g. a slider or a drop down list) Or imagine that we want to present data as graphics. Let's take a look at an example called Stardelegate, ( \l{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html}{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html} ) in which stars are used to show a rating: \image stardelegate.png -The view has a method that replaces the default delegate and installs a custom delegate. This method is called \l{QAbstractItemModel::setItemDelegate()}{setItemDelegate()}. A new delegate can be written by creating a class that inherits from QStyledItemDelegate. In order to write a delegate that displays stars and has no input capabilities, we only need to overwrite 2 methods. +The view has a method that replaces the default delegate and installs a custom delegate. This method is called \l{QAbstractItemView::setItemDelegate()}{setItemDelegate()}. A new delegate can be written by creating a class that inherits from QStyledItemDelegate. In order to write a delegate that displays stars and has no input capabilities, we only need to overwrite 2 methods. -!!!!!I CAN'T FIND THIS FILE!!!!! \code class StarDelegate : public QStyledItemDelegate { @@ -392,20 +288,22 @@ The view has a method that replaces the default delegate and installs a custom d \endcode -\l{QAbstractItemModel::paint()}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \c index.data(). \c SizeHint specifies the stars dimensions so the the cell will provide enough height and width to accommodate the stars. +\l{QStyledItemDelegate::paint()}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \l{QModelIndex::data()}{index.data()}. \l{QStyledItemDelegate::SizeHint}{SizeHint} specifies the stars dimensions so the the cell will provide enough height and width to accommodate the stars. Writing custom delegates is the right choice if you want to show your data with a custom graphical representation inside the grid of the view class. If you want to leave the grid, you can write a custom view class. \section2 3.5 Debugging with ModelTest The passive nature of models provides new challenges for programmers. Inconsistencies in the model can cause the application to crash. Since the model is hit by numerous calls from the view, it is hard to find out which call has crashed the application and which operation has introduced the problem. -Qt provides software called ModelTest, which checks models while your programming is running. Every time the model is changed, ModelTest scans the model and reports errors with an assert. This is especially important for tree models, since their hierarchical nature leaves many possibilities for subtle inconsistencies. http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest +Qt provides software called ModelTest, which checks models while your programming is running. Every time the model is changed, ModelTest scans the model and reports errors with an assert. This is especially important for tree models, since their hierarchical nature leaves many possibilities for subtle inconsistencies. \l http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest Unlike view classes, ModelTest uses out of range indexes to test the model. This means your application may crash with ModelTest even if it runs perfectly without it. So you also need to handle all of the indexes that are out of range when using ModelTest. - +\raw HTML +
+\endraw @@ -413,25 +311,50 @@ Unlike view classes, ModelTest uses out of range indexes to test the model. Thi \section2 3.6 Model/View NG -\image path.png +\raw HTML + +
+\endraw -Model/View was introduced in Qt 4.0 and is a frequently used technology. Feedback from clients and new development trends have shown, that there is a need to further develop the model/view technology. Therefore a research project at Nokia is looking into ways to go beyond the current implementation. +\raw HTML + +\endraw +Model/View was introduced in Qt 4.0 and is a frequently used technology. Feedback from clients and new development trends have shown, that there is a need to further develop the model/view technology. Therefore a research project at Nokia is looking into ways to go beyond the current implementation. +\raw HTML +
+\endraw One limitation of model/view is that view classes are basically all fixed grids. It is possible, but really hard to make a list view with icons placed on a curve; or cells expanding on mouse over events to show additional information. In order to achieve graphically rich view experiences, Model/View NG will use QGraphicsView to render elements. Nodel/View NG also aims to make model/view programming more intuitive. One way to achieve this is to have separate models for lists, tables and trees. The current model abstraction is complex because it is capable of representing a list, a table or a tree. - +\raw HTML +
+\endraw Model/View NG is a research project. You are welcome to checkout the source code, monitor progress and take part in discussions at the following address: \l{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG}{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG} +\raw HTML +
+\endraw + +\inlineimage path.png + +\raw HTML +
+\endraw +\raw HTML +
+\endraw \section1 4 Good Sources for Additional Information \section2 4.1 Books Model/View programming is covered quite extensively in the documentation of Qt but also in several good books. \list 1 - \o 1.C++ GUI Programming with Qt 4 / Jasmin Blanchette, Mark Summerfield, Prentice Hall, 2nd edition, ISBN 0-13-235416-0 + \o C++ GUI Programming with Qt 4 / Jasmin Blanchette, Mark Summerfield, Prentice Hall, 2nd edition, ISBN 0-13-235416-0 also available in German: C++ GUI Programmierung mit Qt 4: Die offizielle Einführung, Addison-Wesley, ISBN 3-827327-29-6 - \o 1.The Book of Qt4, The Art of Building Qt Applications / Daniel Molkentin, Open Source Press ISBN 1-59327-147-6 + \o The Book of Qt4, The Art of Building Qt Applications / Daniel Molkentin, Open Source Press ISBN 1-59327-147-6 Translated from: Qt 4, Einführung in die Applikationsentwicklung, Open Source Press, ISBN 3-937514-12-0 - \o 1.Foundations of Qt Development / Johan Thelin, Apress, ISBN 1-59059-831-8 + \o Foundations of Qt Development / Johan Thelin, Apress, ISBN 1-59059-831-8 \endlist - +\raw HTML +
+\endraw The following list provides an overview of example programs contained in the books above. Some of them make very good templates for developing similar applications. diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp index fa7f566..8943003 100755 --- a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp +++ b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp @@ -27,6 +27,7 @@ int MyModel::columnCount(const QModelIndex & /*parent */ ) const } //------------------------------------------------------- +//! [quoting mymodel_QVariant ] QVariant MyModel::data(const QModelIndex &index, int role ) const { int row = index.row(); @@ -41,7 +42,7 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const } return QVariant(); } - +//! [quoting mymodel_QVariant ] //------------------------------------------------------- //! [quoting mymodel_b ] void MyModel::timerHit() -- cgit v0.12 From 269b910f08f54333834c3a4d91b250b185a53863 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 28 Jun 2010 15:52:45 +0200 Subject: Doc: Added the standard three clause BSD license header. Reviewed-by: Trust Me --- examples/tutorials/modelview/1_readonly/main.cpp | 42 +++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/examples/tutorials/modelview/1_readonly/main.cpp b/examples/tutorials/modelview/1_readonly/main.cpp index bdf740c..ad11f38 100755 --- a/examples/tutorials/modelview/1_readonly/main.cpp +++ b/examples/tutorials/modelview/1_readonly/main.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + //! [Quoting ModelView Tutorial] #include #include "modelview.h" @@ -9,4 +49,4 @@ int main(int argc, char *argv[]) w.show(); return a.exec(); } -//! [Quoting ModelView Tutorial] \ No newline at end of file +//! [Quoting ModelView Tutorial] -- cgit v0.12 From 5938c706524fa9a7de531847bedae19a97fa130b Mon Sep 17 00:00:00 2001 From: Michael D Scull Date: Thu, 1 Jul 2010 10:32:05 +0200 Subject: replaced image, license headers, more links in modelview.qdoc file --- doc/src/images/columnview.png | Bin 11717 -> 3480 bytes doc/src/tutorials/modelview.qdoc | 30 ++++++++-------- .../tutorials/modelview/1_readonly/1_readonly.pro | 40 +++++++++++++++++++++ .../tutorials/modelview/1_readonly/modelview.cpp | 40 +++++++++++++++++++++ .../tutorials/modelview/1_readonly/modelview.h | 40 +++++++++++++++++++++ .../tutorials/modelview/1_readonly/mymodel.cpp | 40 +++++++++++++++++++++ examples/tutorials/modelview/1_readonly/mymodel.h | 40 +++++++++++++++++++++ .../modelview/2_formatting/2_formatting.pro | 40 +++++++++++++++++++++ examples/tutorials/modelview/2_formatting/main.cpp | 40 +++++++++++++++++++++ .../tutorials/modelview/2_formatting/modelview.cpp | 40 +++++++++++++++++++++ .../tutorials/modelview/2_formatting/modelview.h | 40 +++++++++++++++++++++ .../tutorials/modelview/2_formatting/mymodel.cpp | 40 +++++++++++++++++++++ .../tutorials/modelview/2_formatting/mymodel.h | 40 +++++++++++++++++++++ .../modelview/3_changingmodel/3_changingmodel.pro | 40 +++++++++++++++++++++ .../tutorials/modelview/3_changingmodel/main.cpp | 40 +++++++++++++++++++++ .../modelview/3_changingmodel/modelview.cpp | 40 +++++++++++++++++++++ .../modelview/3_changingmodel/modelview.h | 40 +++++++++++++++++++++ .../modelview/3_changingmodel/mymodel.cpp | 40 +++++++++++++++++++++ .../tutorials/modelview/3_changingmodel/mymodel.h | 40 +++++++++++++++++++++ .../tutorials/modelview/4_headers/4_headers.pro | 40 +++++++++++++++++++++ examples/tutorials/modelview/4_headers/main.cpp | 40 +++++++++++++++++++++ .../tutorials/modelview/4_headers/modelview.cpp | 40 +++++++++++++++++++++ examples/tutorials/modelview/4_headers/modelview.h | 40 +++++++++++++++++++++ examples/tutorials/modelview/4_headers/mymodel.cpp | 40 +++++++++++++++++++++ examples/tutorials/modelview/4_headers/mymodel.h | 40 +++++++++++++++++++++ examples/tutorials/modelview/5_edit/5_edit.pro | 40 +++++++++++++++++++++ examples/tutorials/modelview/5_edit/main.cpp | 40 +++++++++++++++++++++ examples/tutorials/modelview/5_edit/modelview.cpp | 40 +++++++++++++++++++++ examples/tutorials/modelview/5_edit/modelview.h | 40 +++++++++++++++++++++ examples/tutorials/modelview/5_edit/mymodel.cpp | 40 +++++++++++++++++++++ examples/tutorials/modelview/5_edit/mymodel.h | 40 +++++++++++++++++++++ .../tutorials/modelview/6_treeview/6_treeview.pro | 40 +++++++++++++++++++++ examples/tutorials/modelview/6_treeview/main.cpp | 40 +++++++++++++++++++++ .../tutorials/modelview/6_treeview/modelview.cpp | 40 +++++++++++++++++++++ .../tutorials/modelview/6_treeview/modelview.h | 40 +++++++++++++++++++++ .../modelview/7_selections/7_selections.pro | 40 +++++++++++++++++++++ examples/tutorials/modelview/7_selections/main.cpp | 40 +++++++++++++++++++++ .../tutorials/modelview/7_selections/modelview.cpp | 40 +++++++++++++++++++++ .../tutorials/modelview/7_selections/modelview.h | 40 +++++++++++++++++++++ 39 files changed, 1495 insertions(+), 15 deletions(-) mode change 100755 => 100644 doc/src/images/columnview.png diff --git a/doc/src/images/columnview.png b/doc/src/images/columnview.png old mode 100755 new mode 100644 index 2fb972e..127b795 Binary files a/doc/src/images/columnview.png and b/doc/src/images/columnview.png differ diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index c9caf17..67908b9 100755 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -3,7 +3,7 @@ \contentspage{modelview.html}{Crash Course in Model/View Programming} \page modelview.html -\title Crash Course in Model/View Programming +\title An Introduction to Model/View Programming Contents: \tableofcontents @@ -84,7 +84,7 @@ The application is a \l QMainWindow that holds a \l QTableView. -------------------------------------------------------------modelview.cpp--------------------- \snippet examples/tutorials/modelview/1_readonly/modelview.cpp Quoting ModelView Tutorial -Here is the interesting part: We use \c tableView->setModel(new MyModel(this) ); to instantiate the Model and pass its pointer to \l {QTableView}{tableView()}. \l {QTableView}{tableView} will invoke the methods of the pointer it has received to find out two things: +Here is the interesting part: We use \l{QTableView::setModel()}{tableView->setModel(new MyModel(this) );} to instantiate the Model and pass its pointer to \l {QTableView}{tableView()}. \l {QTableView}{tableView} will invoke the methods of the pointer it has received to find out two things: \list \o How many rows and columns should be displayed \o What content should be printed into each cell. @@ -102,8 +102,8 @@ QAbstractTableModel requires the implementation of three abstract methods. -------------------------------------------------------------mymodel.cpp--------------------- \snippet examples/tutorials/modelview/1_readonly/mymodel.cpp Quoting ModelView Tutorial -The number of rows and columns is set by \c MyModel::rowCount() and \c MyModel::columnCount(). -When the view has to know what the cell 's text is, it calls the \l{QAbstractItemModel::data()}{data()} method. Row and column information is specified with parameter \c index and the role is set to Qt::Display Role. Other roles are covered in the next section. In our example, the data that should be displayed is generated. In a real application, \c MyModel would have a member called \c MyData, which serves as the target for all reading and writing operations. +The number of rows and columns is set by \l{QAbstractItemModel::rowCount()}{MyModel::rowCount()} and \l{QAbstractItemModel::columnCount()}{MyModel::columnCount()}. +When the view has to know what the cell 's text is, it calls the method. Row and column information is specified with parameter \c index and the role is set to \l{Qt::ItemDataRole}{Qt::DisplayRole}. Other roles are covered in the next section. In our example, the data that should be displayed is generated. In a real application, \c MyModel would have a member called \c MyData, which serves as the target for all reading and writing operations. This small example demonstrates the passive nature of a model. The model does not know when it will be used or which data is needed. It simply provides data each time the view requests it. @@ -126,7 +126,7 @@ Each formatting property will be requested from the model with a separate call t \o Meaning \o Type \row - \o Qt::DisplayRole + \o \l{Qt::ItemDataRole}{Qt::DisplayRole} \o text \o QString \row @@ -143,15 +143,15 @@ Each formatting property will be requested from the model with a separate call t \o enum Qt::AlignmentFlag \row \o {1, 3} Qt::CheckStateRole - \o {1, 3} suppresses checkboxes with QVariant(), sets checkboxes with Qt::Checked or Qt::Unchecked - \o {1, 3} enum Qt::ItemDataRole + \o {1, 3} suppresses checkboxes with \l{QVariant}{QVariant()}, sets checkboxes with Qt::Checked or Qt::Unchecked + \o {1, 3} \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} \endtable Refer to Qt documentation to learn more about enum Qt::ItemDataRole's capabilities. -Now we need to determine how using a seperated model impacts the application's performance, so let's trace how often the view calls the \l{QAbstractItemModel::data()}{data()} method. In order to track how often the view calls the model, we have put a debug statement in the \l{QAbstractItemModel::data()}{data()} method, which logs onto stdio. In our small example, \l{QAbstractItemModel::data()}{data()} will be called 42 times. Each time you hover the cursor over the field, \l{QAbstractItemModel::data()}{data()} will be called again - 7 times for each cell. That's why it is important to make sure that your data is available when \l{QAbstractItemModel::data()}{data()}) is invoked and expensive lookup operations are cached. +Now we need to determine how using a seperated model impacts the application's performance, so let's trace how often the view calls the \l{QAbstractItemModel::data()}{data()} method. In order to track how often the view calls the model, we have put a debug statement in the \l{QAbstractItemModel::data()}{data()} method, which logs onto stdio. In our small example, \l{QAbstractItemModel::data()}{data()} will be called 42 times. Each time you hover the cursor over the field, \l{QAbstractItemModel::data()}{data()} will be called again - 7 times for each cell. That's why it is important to make sure that your data is available when \l{QAbstractItemModel::data()}{data()} is invoked and expensive lookup operations are cached. \section2 2.3 A clock inside a table cell \image clock.png @@ -168,7 +168,7 @@ Here is the corresponding slot: \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_b -We ask the view to read the data in the top left cell again by emitting the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal. Note that we did not explicitly connect the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal to the view. This happened automatically when we called \l{QTableView::setModel}{setModel()} . +We ask the view to read the data in the top left cell again by emitting the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal. Note that we did not explicitly connect the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal to the view. This happened automatically when we called \l{QTableView::setModel()}{setModel()}. \section2 2.4 Setting up Headers for Columns and Rows Headers can be hidden via a view method. @@ -219,7 +219,7 @@ We want to present a real tree. We have wrapped our data in the examples above i -------------------------------------------------------------modelview.cpp--------------------- \snippet examples/tutorials/modelview/6_treeview/modelview.cpp Quoting ModelView Tutorial -We simply instantiate a QStandardItemModel and add a couple of QStandardItems to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other \l{QStandardItem}{QStandardItems}. Nodes are collapsed and expanded within the view. +We simply instantiate a QStandardItemModel and add a couple of \l{QStandardItem}{QStandardItems} to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other \l{QStandardItem}{QStandardItems}. Nodes are collapsed and expanded within the view. \section2 3.2 Working with selection @@ -229,14 +229,14 @@ We want to access a selected item's content in order to output it into the windo So let's create a couple of items: \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_a -Views manage selections within a separate selection model, which can be retrieved with the \l{QAbstractItemModel::selectionModel()}{selectionModel()} method. We retrieve the selection Model in order to connect a slot to its \l{QAbstractItemModel::selectionChanged()}{selectionChanged()} signal. +Views manage selections within a separate selection model, which can be retrieved with the \l{QAbstractItemView::selectionModel()}{selectionModel()} method. We retrieve the selection Model in order to connect a slot to its \l{QAbstractItemView::selectionChanged()}{selectionChanged()} signal. \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_b We get the model index that corresponds to the selection by calling \l{QItemSelectionModel::currentIndex()}{treeView->selectionModel()->currentIndex()} and we get the the field's string by using the model index. Then we just calculate the item's \c hierarchyLevel. Top level items do not have parents and the \l{QAbstractItemModel::parent()}{parent()} method will return a default constructed \l{QModelIndex}{QModelIndex()}. This is why we use the \l{QAbstractItemModel::parent()}{parent()} method to iterate to the top level while counting the steps performed during iteration. -The selection model (as shown above) can be retrieved, but it can also be set with \l{QAbstractItemView}{QAbstractItemView::setSelectionModel}. This is how it's possible to have 3 view classes with synchronised selections because only one instance of a selection model is used. The instance of a selection model is retrieved from the first view class with \l{QAbstractItemModel::selectionModel()}{selectionModel()} and the result is assigned to the second and third view class with \l{QAbstractItemModel::setSelectionModel()}{setSelectionModel()}; +The selection model (as shown above) can be retrieved, but it can also be set with \l{QAbstractItemView}{QAbstractItemView::setSelectionModel}. This is how it's possible to have 3 view classes with synchronised selections because only one instance of a selection model is used. The instance of a selection model is retrieved from the first view class with \l{QAbstractItemView::selectionModel()}{selectionModel()} and the result is assigned to the second and third view class with \l{QAbstractItemView::setSelectionModel()}{setSelectionModel()}; \section2 3.3 Predefined Models The typical way to use model/view is to wrap specific data to make it usable with view classes. Qt, however, also provides predefined models for common underlying data structures. If one of the available data structures is suitable for your application, a predefined model can be a good choice. @@ -252,7 +252,7 @@ The typical way to use model/view is to wrap specific data to make it usable wit \raw HTML
\endraw - QDirModel (deprecated) + QDirModel \o Encapsulate the local file system \row \o QSqlQueryModel @@ -288,7 +288,7 @@ The view has a method that replaces the default delegate and installs a custom d \endcode -\l{QStyledItemDelegate::paint()}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \l{QModelIndex::data()}{index.data()}. \l{QStyledItemDelegate::SizeHint}{SizeHint} specifies the stars dimensions so the the cell will provide enough height and width to accommodate the stars. +\l{QStyledItemDelegate::paint()}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \l{QModelIndex::data()}{index.data()}. \l{QGraphicsLayoutItem::sizeHint()}{sizeHint} specifies the stars dimensions so the the cell will provide enough height and width to accommodate the stars. Writing custom delegates is the right choice if you want to show your data with a custom graphical representation inside the grid of the view class. If you want to leave the grid, you can write a custom view class. @@ -540,7 +540,7 @@ Qt 4.6 comes with 17 examples and 2 Demonstrations for model/view. The examples \row \o Address Book \o QTableView - \o QTableModel + \o QAbstractTableModel QSortFilterProxyModel \o usage of QSortFilterProxyModel to generate different subsets from one data pool \row diff --git a/examples/tutorials/modelview/1_readonly/1_readonly.pro b/examples/tutorials/modelview/1_readonly/1_readonly.pro index 1162d5a..8528cde 100755 --- a/examples/tutorials/modelview/1_readonly/1_readonly.pro +++ b/examples/tutorials/modelview/1_readonly/1_readonly.pro @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + TARGET = mv_readonly TEMPLATE = app diff --git a/examples/tutorials/modelview/1_readonly/modelview.cpp b/examples/tutorials/modelview/1_readonly/modelview.cpp index 14311f9..027be56 100755 --- a/examples/tutorials/modelview/1_readonly/modelview.cpp +++ b/examples/tutorials/modelview/1_readonly/modelview.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + //! [Quoting ModelView Tutorial] #include #include "modelview.h" diff --git a/examples/tutorials/modelview/1_readonly/modelview.h b/examples/tutorials/modelview/1_readonly/modelview.h index 93b6b90..d0f96cd 100755 --- a/examples/tutorials/modelview/1_readonly/modelview.h +++ b/examples/tutorials/modelview/1_readonly/modelview.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + //! [Quoting ModelView Tutorial] #ifndef MODELVIEW_H #define MODELVIEW_H diff --git a/examples/tutorials/modelview/1_readonly/mymodel.cpp b/examples/tutorials/modelview/1_readonly/mymodel.cpp index 3386907..c441720 100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.cpp +++ b/examples/tutorials/modelview/1_readonly/mymodel.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + //! [Quoting ModelView Tutorial] #include "mymodel.h" diff --git a/examples/tutorials/modelview/1_readonly/mymodel.h b/examples/tutorials/modelview/1_readonly/mymodel.h index aac1bf0..c0ddf4ac6 100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.h +++ b/examples/tutorials/modelview/1_readonly/mymodel.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + //! [Quoting ModelView Tutorial] #ifndef MYMODEL_H #define MYMODEL_H diff --git a/examples/tutorials/modelview/2_formatting/2_formatting.pro b/examples/tutorials/modelview/2_formatting/2_formatting.pro index 7e70d81..cdf72bf 100755 --- a/examples/tutorials/modelview/2_formatting/2_formatting.pro +++ b/examples/tutorials/modelview/2_formatting/2_formatting.pro @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + TARGET = mv_formatting TEMPLATE = app diff --git a/examples/tutorials/modelview/2_formatting/main.cpp b/examples/tutorials/modelview/2_formatting/main.cpp index 998503c..7be212e 100755 --- a/examples/tutorials/modelview/2_formatting/main.cpp +++ b/examples/tutorials/modelview/2_formatting/main.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include "modelview.h" diff --git a/examples/tutorials/modelview/2_formatting/modelview.cpp b/examples/tutorials/modelview/2_formatting/modelview.cpp index becd61d..2b05d4c 100755 --- a/examples/tutorials/modelview/2_formatting/modelview.cpp +++ b/examples/tutorials/modelview/2_formatting/modelview.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include "modelview.h" #include "mymodel.h" diff --git a/examples/tutorials/modelview/2_formatting/modelview.h b/examples/tutorials/modelview/2_formatting/modelview.h index 98bee38..7291487 100755 --- a/examples/tutorials/modelview/2_formatting/modelview.h +++ b/examples/tutorials/modelview/2_formatting/modelview.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #ifndef MODELVIEW_H #define MODELVIEW_H diff --git a/examples/tutorials/modelview/2_formatting/mymodel.cpp b/examples/tutorials/modelview/2_formatting/mymodel.cpp index 916dabc..e9e68de 100755 --- a/examples/tutorials/modelview/2_formatting/mymodel.cpp +++ b/examples/tutorials/modelview/2_formatting/mymodel.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include #include "mymodel.h" diff --git a/examples/tutorials/modelview/2_formatting/mymodel.h b/examples/tutorials/modelview/2_formatting/mymodel.h index 01ae6cb..4dc405a 100755 --- a/examples/tutorials/modelview/2_formatting/mymodel.h +++ b/examples/tutorials/modelview/2_formatting/mymodel.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #ifndef MYMODEL_H #define MYMODEL_H diff --git a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro index d61ee4c..8b217cb 100755 --- a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro +++ b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + TARGET = mv_changingmodel TEMPLATE = app diff --git a/examples/tutorials/modelview/3_changingmodel/main.cpp b/examples/tutorials/modelview/3_changingmodel/main.cpp index 998503c..7be212e 100755 --- a/examples/tutorials/modelview/3_changingmodel/main.cpp +++ b/examples/tutorials/modelview/3_changingmodel/main.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include "modelview.h" diff --git a/examples/tutorials/modelview/3_changingmodel/modelview.cpp b/examples/tutorials/modelview/3_changingmodel/modelview.cpp index becd61d..2b05d4c 100755 --- a/examples/tutorials/modelview/3_changingmodel/modelview.cpp +++ b/examples/tutorials/modelview/3_changingmodel/modelview.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include "modelview.h" #include "mymodel.h" diff --git a/examples/tutorials/modelview/3_changingmodel/modelview.h b/examples/tutorials/modelview/3_changingmodel/modelview.h index 98bee38..7291487 100755 --- a/examples/tutorials/modelview/3_changingmodel/modelview.h +++ b/examples/tutorials/modelview/3_changingmodel/modelview.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #ifndef MODELVIEW_H #define MODELVIEW_H diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp index 8943003..d806945 100755 --- a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp +++ b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include #include diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.h b/examples/tutorials/modelview/3_changingmodel/mymodel.h index 9cc023b..47b026e 100755 --- a/examples/tutorials/modelview/3_changingmodel/mymodel.h +++ b/examples/tutorials/modelview/3_changingmodel/mymodel.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #ifndef MYMODEL_H #define MYMODEL_H diff --git a/examples/tutorials/modelview/4_headers/4_headers.pro b/examples/tutorials/modelview/4_headers/4_headers.pro index d6f8d23..13b0b1d 100755 --- a/examples/tutorials/modelview/4_headers/4_headers.pro +++ b/examples/tutorials/modelview/4_headers/4_headers.pro @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + TARGET = mv_headers TEMPLATE = app diff --git a/examples/tutorials/modelview/4_headers/main.cpp b/examples/tutorials/modelview/4_headers/main.cpp index 998503c..7be212e 100755 --- a/examples/tutorials/modelview/4_headers/main.cpp +++ b/examples/tutorials/modelview/4_headers/main.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include "modelview.h" diff --git a/examples/tutorials/modelview/4_headers/modelview.cpp b/examples/tutorials/modelview/4_headers/modelview.cpp index 39394da..f661ab5 100755 --- a/examples/tutorials/modelview/4_headers/modelview.cpp +++ b/examples/tutorials/modelview/4_headers/modelview.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include #include "modelview.h" diff --git a/examples/tutorials/modelview/4_headers/modelview.h b/examples/tutorials/modelview/4_headers/modelview.h index f1b63bd..7669e35 100755 --- a/examples/tutorials/modelview/4_headers/modelview.h +++ b/examples/tutorials/modelview/4_headers/modelview.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #ifndef MODELVIEW_H #define MODELVIEW_H diff --git a/examples/tutorials/modelview/4_headers/mymodel.cpp b/examples/tutorials/modelview/4_headers/mymodel.cpp index 7891c80..94fde34 100755 --- a/examples/tutorials/modelview/4_headers/mymodel.cpp +++ b/examples/tutorials/modelview/4_headers/mymodel.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include "mymodel.h" MyModel::MyModel(QObject *parent) diff --git a/examples/tutorials/modelview/4_headers/mymodel.h b/examples/tutorials/modelview/4_headers/mymodel.h index 327ca10..ada3169 100755 --- a/examples/tutorials/modelview/4_headers/mymodel.h +++ b/examples/tutorials/modelview/4_headers/mymodel.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #ifndef MYMODEL_H #define MYMODEL_H diff --git a/examples/tutorials/modelview/5_edit/5_edit.pro b/examples/tutorials/modelview/5_edit/5_edit.pro index e18c596..d0a2571 100755 --- a/examples/tutorials/modelview/5_edit/5_edit.pro +++ b/examples/tutorials/modelview/5_edit/5_edit.pro @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + TARGET = mv_edit TEMPLATE = app diff --git a/examples/tutorials/modelview/5_edit/main.cpp b/examples/tutorials/modelview/5_edit/main.cpp index 998503c..7be212e 100755 --- a/examples/tutorials/modelview/5_edit/main.cpp +++ b/examples/tutorials/modelview/5_edit/main.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include "modelview.h" diff --git a/examples/tutorials/modelview/5_edit/modelview.cpp b/examples/tutorials/modelview/5_edit/modelview.cpp index b6e8e34..d8853c9 100755 --- a/examples/tutorials/modelview/5_edit/modelview.cpp +++ b/examples/tutorials/modelview/5_edit/modelview.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include "modelview.h" #include "mymodel.h" diff --git a/examples/tutorials/modelview/5_edit/modelview.h b/examples/tutorials/modelview/5_edit/modelview.h index e1591f9..97c840c 100755 --- a/examples/tutorials/modelview/5_edit/modelview.h +++ b/examples/tutorials/modelview/5_edit/modelview.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #ifndef MODELVIEW_H #define MODELVIEW_H diff --git a/examples/tutorials/modelview/5_edit/mymodel.cpp b/examples/tutorials/modelview/5_edit/mymodel.cpp index ef45bc3..6007da1 100755 --- a/examples/tutorials/modelview/5_edit/mymodel.cpp +++ b/examples/tutorials/modelview/5_edit/mymodel.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + //! [quoting mymodel_d] #include "mymodel.h" diff --git a/examples/tutorials/modelview/5_edit/mymodel.h b/examples/tutorials/modelview/5_edit/mymodel.h index 1612fa0..54f2b30 100755 --- a/examples/tutorials/modelview/5_edit/mymodel.h +++ b/examples/tutorials/modelview/5_edit/mymodel.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + //! [Quoting ModelView Tutorial] #ifndef MYMODEL_H #define MYMODEL_H diff --git a/examples/tutorials/modelview/6_treeview/6_treeview.pro b/examples/tutorials/modelview/6_treeview/6_treeview.pro index 6d078be..fa27c3a 100755 --- a/examples/tutorials/modelview/6_treeview/6_treeview.pro +++ b/examples/tutorials/modelview/6_treeview/6_treeview.pro @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + TARGET = mv_tree TEMPLATE = app SOURCES += main.cpp \ diff --git a/examples/tutorials/modelview/6_treeview/main.cpp b/examples/tutorials/modelview/6_treeview/main.cpp index 998503c..7be212e 100755 --- a/examples/tutorials/modelview/6_treeview/main.cpp +++ b/examples/tutorials/modelview/6_treeview/main.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include "modelview.h" diff --git a/examples/tutorials/modelview/6_treeview/modelview.cpp b/examples/tutorials/modelview/6_treeview/modelview.cpp index b5b4d06..a25e4e9 100755 --- a/examples/tutorials/modelview/6_treeview/modelview.cpp +++ b/examples/tutorials/modelview/6_treeview/modelview.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + //! [Quoting ModelView Tutorial] #include #include diff --git a/examples/tutorials/modelview/6_treeview/modelview.h b/examples/tutorials/modelview/6_treeview/modelview.h index 1ab23ea..2329e89 100755 --- a/examples/tutorials/modelview/6_treeview/modelview.h +++ b/examples/tutorials/modelview/6_treeview/modelview.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #ifndef MODELVIEW_H #define MODELVIEW_H diff --git a/examples/tutorials/modelview/7_selections/7_selections.pro b/examples/tutorials/modelview/7_selections/7_selections.pro index 952641c6..671dc24 100755 --- a/examples/tutorials/modelview/7_selections/7_selections.pro +++ b/examples/tutorials/modelview/7_selections/7_selections.pro @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + TARGET = mv_selections TEMPLATE = app SOURCES += main.cpp \ diff --git a/examples/tutorials/modelview/7_selections/main.cpp b/examples/tutorials/modelview/7_selections/main.cpp index 998503c..7be212e 100755 --- a/examples/tutorials/modelview/7_selections/main.cpp +++ b/examples/tutorials/modelview/7_selections/main.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #include #include "modelview.h" diff --git a/examples/tutorials/modelview/7_selections/modelview.cpp b/examples/tutorials/modelview/7_selections/modelview.cpp index eac6df9..2ef980d 100755 --- a/examples/tutorials/modelview/7_selections/modelview.cpp +++ b/examples/tutorials/modelview/7_selections/modelview.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + //! [quoting modelview_a] #include #include diff --git a/examples/tutorials/modelview/7_selections/modelview.h b/examples/tutorials/modelview/7_selections/modelview.h index 0e638a9..5229ac3 100755 --- a/examples/tutorials/modelview/7_selections/modelview.h +++ b/examples/tutorials/modelview/7_selections/modelview.h @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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$ +** +****************************************************************************/ + #ifndef MODELVIEW_H #define MODELVIEW_H -- cgit v0.12 From b7bf2ab2d0aa9e3bf073126f0e15c71e39567fcc Mon Sep 17 00:00:00 2001 From: Michael D Scull Date: Fri, 2 Jul 2010 18:10:13 +0200 Subject: new image for tutorial.qdoc --- doc/src/getting-started/tutorials.qdoc | 12 ++++ doc/src/images/treeview_sml.png | Bin 0 -> 17419 bytes doc/src/tutorials/modelview.qdoc | 115 ++++++++++++++++++++++++++++++--- 3 files changed, 118 insertions(+), 9 deletions(-) create mode 100755 doc/src/images/treeview_sml.png diff --git a/doc/src/getting-started/tutorials.qdoc b/doc/src/getting-started/tutorials.qdoc index 6e1cee8..0a83170 100644 --- a/doc/src/getting-started/tutorials.qdoc +++ b/doc/src/getting-started/tutorials.qdoc @@ -71,6 +71,18 @@ A guided tour through the translations process, explaining the tools provided for developers, translators and release managers. + + \row + \o{2,1} \l{modelview.html}{\bold{ModelView}} + \o{2,1} + + \row + \o \image treeview_sml.png ModelView + \o This tutorial gives an introduction to ModelView programming using the Qt cross-platform framework + + \o + \o + \row \o{2,1} \l{QTestLib Tutorial}{\bold QTestLib} \o{2,1} \l{qmake Tutorial}{\bold qmake} diff --git a/doc/src/images/treeview_sml.png b/doc/src/images/treeview_sml.png new file mode 100755 index 0000000..fb6de1d Binary files /dev/null and b/doc/src/images/treeview_sml.png differ diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index 67908b9..bc03f44 100755 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -1,12 +1,63 @@ /*! - - \contentspage{modelview.html}{Crash Course in Model/View Programming} \page modelview.html -\title An Introduction to Model/View Programming -Contents: -\tableofcontents + \startpage {index.html}{Qt Reference Documentation} + \contentspage {modelview-index.html}{ModelView Contents} + \nextpage {modelview-part1.html}{Introduction} + \title ModelView Contents Page + \brief An introduction to ModelView programming + + This tutorial gives an introduction to ModelView programming using the Qt + cross-platform framework. + + \image treeview.png + + \omit + It doesn't cover everything; the emphasis is on teaching the programming + philosophy of ModelView programming, and Qt's features are introduced as needed. + Some commonly used features are never used in this tutorial. + \endomit + + In the process, we will learn about some basic technologies provided by Qt, + such as: + + \list + \o The difference between standard and modelview widgets + \o Adapters betweeen forms and models + \o Developing a simple Model/View application + \o Intermediate topics such as: + \list + \o Tree views + \o Selection + \o Predefined models + \o Delegates + \o Debugging with model test + \endlist + \endlist + + If you are completely new to Qt, please read \l{How to Learn Qt} if you + have not already done so. + + The tutorial's source code is located in Qt's \c examples/tutorials/modelview + directory. + + \list 1 + \o \l{modelview-part1.html}{Introduction} + \o \l{modelview-part2.html}{Developing a simple ModelView application} + \o \l{modelview-part3.html}{Intermediate Topics} + \o \l{modelview-part4.html}{Good Sources for Additional Information} + \endlist + +*/ + +/*! + \page modelview-part1.html + \title An Introduction to Model/View Programming + + \raw HTML +
+ \endraw \section1 1 Introduction Model/View is a technology used to separate data from views in widgets that handle data sets. Standard Widgets are not designed for separating data from views and this is why Qt 4 has two different types of widgets. Both types of widgets look the same, but they interact with data differently. \table @@ -64,6 +115,27 @@ We often prefer editing data stored in tables (e.g. in database tables) in forms Another example of an adapter is \l QCompleter. Qt has QCompleter for providing auto completions in Qt widgets such as \l QComboBox and, as shown below, \l QLineEdit. \l QCompleter uses a model as its data source, so \l QCompleter, in itself, is a very handy adapter. \image qcompleter.png + +*/ + +/*! + + + \page modelview-part2-main-cpp.html + \title main.cpp + \quotefile tutorials/modelview/1_readonly/main.cpp + + +*/ + +/*! + \page modelview-part2.html + \title ModelView Chapter 2 - A Simple Model/View Application + + \raw HTML +
+ \endraw + \section1 2 A Simple Model/View Application If you want to develop a model/view application, where should you start? We recommend starting with a simple example and extending it step-by-step. This makes understanding the architecture a lot easier. Trying to understand the model/view architecture in detail before invoking the IDE has proven to be less convenient for many developers. It is substantially easier to start with a simple model/view application that has demo data. Give it a try! Simply replace the data in the examples below with your own. @@ -75,7 +147,7 @@ We start with an application that uses a \l QTableView to show data. We will add -------------------------------------------------------------main.cpp--------------------- \snippet examples/tutorials/modelview/1_readonly/main.cpp Quoting ModelView Tutorial -We have the usual \l {tutorials/modelview/1_readonly/main.cpp}{main()} function; +We have the usual \l {modelview-part2-main-cpp.html}{main()} function; -------------------------------------------------------------modelview.h--------------------- \snippet examples/tutorials/modelview/1_readonly/modelview.h Quoting ModelView Tutorial @@ -148,7 +220,7 @@ Each formatting property will be requested from the model with a separate call t \endtable -Refer to Qt documentation to learn more about enum Qt::ItemDataRole's capabilities. +Refer to Qt documentation to learn more about enum Qt::ItemDataRole's capabilities. Now we need to determine how using a seperated model impacts the application's performance, so let's trace how often the view calls the \l{QAbstractItemModel::data()}{data()} method. In order to track how often the view calls the model, we have put a debug statement in the \l{QAbstractItemModel::data()}{data()} method, which logs onto stdio. In our small example, \l{QAbstractItemModel::data()}{data()} will be called 42 times. Each time you hover the cursor over the field, \l{QAbstractItemModel::data()}{data()} will be called again - 7 times for each cell. That's why it is important to make sure that your data is available when \l{QAbstractItemModel::data()}{data()} is invoked and expensive lookup operations are cached. @@ -198,9 +270,20 @@ In the constructor, we fill \c QStringList gridData with 6 items. (one item for \l{QAbstractItemModel::setData()}{setData()} will be called each time the user edits a cell. The \c index parameter tells us which field has been edited and \c value provides the result of the editing process. The role will always be set to \c Qt::EditRole because our cells only contain text. If a checkbox were present and user permissions are set to allow the checkbox to be selected, calls would also be made with the role set to \c Qt::CheckStateRole. \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_f -Various properties of a cell can be adjusted with \l{QAbstractItemModel::flags()}{flags()}. Returning \c Qt::ItemIsEditable | Qt::ItemIsEnabled is enough to show an editor that a cell has been selected. If editing one cell modifies more data than the data in that particular cell, the model must emit a \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal in order for the data that has been changed to be read. +Various properties of a cell can be adjusted with \l{QAbstractItemModel::flags()}{flags()}. Returning \c Qt::ItemIsEditable | \c Qt::ItemIsEnabled is enough to show an editor that a cell has been selected. If editing one cell modifies more data than the data in that particular cell, the model must emit a \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal in order for the data that has been changed to be read. + +*/ +/*! + \page modelview-part3.html + \title ModelView Chapter 3 - Intermediate Topics + \raw HTML +
+ \endraw \section1 3 Intermediate Topics + \raw HTML +
+ \endraw \section2 3.1 TreeView You can convert the example above into an application with a tree view. Simply replace QTableView with QTreeView, which results in a read/write tree. No changes have to be made to the model. The tree won't have any hierarchies because there aren't any hierarchies in the model itself. @@ -288,7 +371,7 @@ The view has a method that replaces the default delegate and installs a custom d \endcode -\l{QStyledItemDelegate::paint()}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \l{QModelIndex::data()}{index.data()}. \l{QGraphicsLayoutItem::sizeHint()}{sizeHint} specifies the stars dimensions so the the cell will provide enough height and width to accommodate the stars. +\l{QStyledItemDelegate::paint()}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \l{QModelIndex::data()}{index.data()}. \l{QAbstractItemDelegate::sizeHint()}{sizeHint} specifies the stars dimensions so the the cell will provide enough height and width to accommodate the stars. Writing custom delegates is the right choice if you want to show your data with a custom graphical representation inside the grid of the view class. If you want to leave the grid, you can write a custom view class. @@ -342,7 +425,21 @@ Model/View NG is a research project. You are welcome to checkout the source code \raw HTML
\endraw + +*/ + +/*! + \page modelview-part4.html + + \title ModelView Chapter 4 - Good Sources for Additional Information + + \raw HTML +
+ \endraw \section1 4 Good Sources for Additional Information +\raw HTML +
+\endraw \section2 4.1 Books Model/View programming is covered quite extensively in the documentation of Qt but also in several good books. \list 1 -- cgit v0.12 From 03da6bf799823d8b2f7aa8ebe337076dd5d170e4 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Jul 2010 18:12:46 +0100 Subject: Added trace statements to Phonon MMF backend Reviewed-by: trustme --- src/3rdparty/phonon/mmf/videoplayer_surface.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp index 343370c..f380e69 100644 --- a/src/3rdparty/phonon/mmf/videoplayer_surface.cpp +++ b/src/3rdparty/phonon/mmf/videoplayer_surface.cpp @@ -107,6 +107,9 @@ void MMF::SurfaceVideoPlayer::handleVideoWindowChanged() void MMF::SurfaceVideoPlayer::handleParametersChanged(VideoParameters parameters) { + TRACE_CONTEXT(SurfaceVideoPlayer::handleParametersChanged, EVideoApi); + TRACE_ENTRY("parameters 0x%x", parameters.operator int()); + TRect rect; if (m_videoOutput) { m_videoOutput->dump(); @@ -137,12 +140,20 @@ void MMF::SurfaceVideoPlayer::handleParametersChanged(VideoParameters parameters } } } + + TRACE_EXIT_0(); } void MMF::SurfaceVideoPlayer::addDisplayWindow(const TRect &rect) { + TRACE_CONTEXT(SurfaceVideoPlayer::addDisplayWindow, EVideoApi); + TRACE_ENTRY("rect %d %d - %d %d", rect.iTl.iX, rect.iTl.iY, rect.iBr.iX, rect.iBr.iY); + Q_ASSERT(!m_displayWindow); RWindow *window = static_cast(m_window); + + TRACE("window 0x%08x", window); + if (window) { window->SetBackgroundColor(TRgb(0, 0, 0, 255)); CVideoPlayerUtility2 *player = static_cast(m_player.data()); @@ -152,11 +163,17 @@ void MMF::SurfaceVideoPlayer::addDisplayWindow(const TRect &rect) m_displayWindow = window; else setError(tr("Video display error"), err); + TRACE("err %d", err); } + + TRACE_EXIT_0(); } void MMF::SurfaceVideoPlayer::removeDisplayWindow() { + TRACE_CONTEXT(SurfaceVideoPlayer::removeDisplayWindow, EVideoApi); + TRACE("player 0x%08x window 0x%08x", m_player.data(), m_displayWindow); + CVideoPlayerUtility2 *player = static_cast(m_player.data()); if (player && m_displayWindow) { player->RemoveDisplayWindow(*m_displayWindow); -- cgit v0.12 From 656fd8d3f308205c811a8b1b1c9230ce5f8fc49e Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 7 Jul 2010 18:43:04 +0100 Subject: Use lower case for including system header files All platform includes are now lower case, i.e. '#include ' rather than '#include '. Note that Qt includes are still camel case, e.g. '#include ' Task-number: QTBUG-6528 Reviewed-by: trustme --- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 2 +- src/3rdparty/phonon/mmf/audioequalizer.cpp | 2 +- src/3rdparty/phonon/mmf/bassboost.cpp | 2 +- src/3rdparty/phonon/mmf/environmentalreverb.cpp | 2 +- src/3rdparty/phonon/mmf/loudness.cpp | 2 +- src/3rdparty/phonon/mmf/stereowidening.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 70adcf6..8879636 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -21,7 +21,7 @@ along with this library. If not, see . #include -#include +#include #include diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index 1d2bbd4..28433f6 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -16,7 +16,7 @@ along with this library. If not, see . */ -#include +#include #include "audioequalizer.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index 67076f6..81d9208 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -16,7 +16,7 @@ along with this library. If not, see . */ -#include +#include #include "bassboost.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/environmentalreverb.cpp b/src/3rdparty/phonon/mmf/environmentalreverb.cpp index d4f5223..c500385 100644 --- a/src/3rdparty/phonon/mmf/environmentalreverb.cpp +++ b/src/3rdparty/phonon/mmf/environmentalreverb.cpp @@ -16,7 +16,7 @@ along with this library. If not, see . */ -#include +#include #include "environmentalreverb.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/loudness.cpp b/src/3rdparty/phonon/mmf/loudness.cpp index ca05ab0..22d7518 100644 --- a/src/3rdparty/phonon/mmf/loudness.cpp +++ b/src/3rdparty/phonon/mmf/loudness.cpp @@ -16,7 +16,7 @@ along with this library. If not, see . */ -#include +#include #include "loudness.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/stereowidening.cpp b/src/3rdparty/phonon/mmf/stereowidening.cpp index f90651b..e452160 100644 --- a/src/3rdparty/phonon/mmf/stereowidening.cpp +++ b/src/3rdparty/phonon/mmf/stereowidening.cpp @@ -16,7 +16,7 @@ along with this library. If not, see . */ -#include +#include #include "stereowidening.h" QT_BEGIN_NAMESPACE -- cgit v0.12 From 95e55e6bbfaf76166b64e7f57c612826afd19a86 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 7 Jul 2010 20:39:30 +0200 Subject: typos fixed Reviewed-by: TrustMe --- examples/qtconcurrent/progressdialog/main.cpp | 2 +- src/corelib/concurrent/qtconcurrentmap.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/qtconcurrent/progressdialog/main.cpp b/examples/qtconcurrent/progressdialog/main.cpp index 04a18dc..369d82c 100644 --- a/examples/qtconcurrent/progressdialog/main.cpp +++ b/examples/qtconcurrent/progressdialog/main.cpp @@ -70,7 +70,7 @@ int main(int argc, char **argv) QProgressDialog dialog; dialog.setLabelText(QString("Progressing using %1 thread(s)...").arg(QThread::idealThreadCount())); - // Create a QFutureWatcher and conncect signals and slots. + // Create a QFutureWatcher and connect signals and slots. QFutureWatcher futureWatcher; QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); diff --git a/src/corelib/concurrent/qtconcurrentmap.cpp b/src/corelib/concurrent/qtconcurrentmap.cpp index 39a13fb..e74d69c 100644 --- a/src/corelib/concurrent/qtconcurrentmap.cpp +++ b/src/corelib/concurrent/qtconcurrentmap.cpp @@ -70,7 +70,7 @@ \value UnorderedReduce Reduction is done in an arbitrary order. \value OrderedReduce Reduction is done in the order of the original sequence. - \value SequentialReduce Reduction is done sequentally: only one + \value SequentialReduce Reduction is done sequentially: only one thread will enter the reduce function at a time. (Parallel reduction might be supported in a future version of Qt Concurrent.) */ -- cgit v0.12 From 28f84d2ed4000391f855140f57c359bc858d4799 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 8 Jul 2010 09:18:50 +0200 Subject: qdoc: Fixed table of contents for namespace pages. Task-number: QTBUG-11992 --- tools/qdoc3/htmlgenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 441cfc6..1e455dd 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -2034,7 +2034,8 @@ void HtmlGenerator::generateTableOfContents(const Node *node, } } } - else if (sections && (node->type() == Node::Class)) { + else if (sections && ((node->type() == Node::Class) || + (node->type() == Node::Namespace))) { QList
::ConstIterator s = sections->begin(); while (s != sections->end()) { if (!s->members.isEmpty() || !s->reimpMembers.isEmpty()) { -- cgit v0.12 From ab4e036137ba21bd6296837af1594db45064bce3 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 10:18:07 +0200 Subject: Doc: fixing typos --- doc/src/declarative/qdeclarativeintro.qdoc | 2 +- doc/src/getting-started/examples.qdoc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index 9126a79..3f1b184 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -314,7 +314,7 @@ Item { \section2 Signal Handlers -Signal handlers allow actions to be taken in reponse to an event. For instance, +Signal handlers allow actions to be taken in response to an event. For instance, the \l MouseArea element has signal handlers to handle mouse press, release and click: diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index b6766d5..a32d120 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -343,8 +343,8 @@ /*! \page examples-draganddrop.html \ingroup all-examples - \title Drag & Drop Examples - \brief How to access your platform's native darg & drop functionality + \title Drag & Drop Examples + \brief How to access your platform's native darg & drop functionality \image draganddrop-examples.png -- cgit v0.12 From 8feb9c7ee7deda8c5fa3459108d349497af82924 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 10:20:09 +0200 Subject: Doc: fixing typo --- tools/qdoc3/test/qt-html-templates.qdocconf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 31c9d5a..b7dead2 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -113,7 +113,6 @@ HTML.postheader = "
\n" \ "
  • Tutorials
  • \n" \ "
  • Demos
  • \n" \ "
  • QML Examples
  • \n" \ - "
  • QML Demos
  • \n" \ " \n" \ "
    \n" \ " \n" \ @@ -160,8 +159,8 @@ HTML.footer = " \n" \ "
    \n" \ "
    X
    \n" \ "
    \n" \ - "

    Thank you for giving your feedback.

    Make sure it is related the page. For more general bugs and \n" \ - " requests, please use the Qt Bug Tracker

    \n" \ + "

    Thank you for giving your feedback.

    Make sure it is related to this specific page. For more general bugs and \n" \ + " requests, please use the Qt Bug Tracker.

    \n" \ "

    \n" \ "

    \n" \ "
    \n" \ -- cgit v0.12 From 272ccd24941465fd6a8fc79d9f7ab8546a6ce870 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 10:21:17 +0200 Subject: Doc: Fixing broken link --- doc/src/index.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 18a1746..22ee63f 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -44,7 +44,7 @@
  • Installation & first steps
  • How to learn Qt
  • Tutorials
  • -
  • Examples
  • +
  • Examples
  • Whats new in Qt 4.7
  • -- cgit v0.12 From 25e3227fc922f75cc772aadb9dd07cc8b965dcbd Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 8 Jul 2010 10:24:49 +0200 Subject: doc: Added doc for accessing views and models from delegates. Task-number: QTBUG-11648 --- doc/src/declarative/qdeclarativemodels.qdoc | 73 +++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index b44e6f2..a2f4d3a 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -429,4 +429,77 @@ Rectangle { } \endcode +\section1 Accessing Views and Models from Delegates + +You can access the view for which a delegate is used, and its +properties, by using ListView.view in a delegate on a ListView, or +GridView.view in a delegate on a GridView, etc. In particular, you can +access the model and its properties by using ListView.view.model. + +This is useful when you want to use the same delegate for a number of +views, for example, but you want decorations or other features to be +different for each view, and you would like these different settings to +be properties of each of the views. Similarly, it might be of interest +to access or show some properties of the model. + +In the following example, the delegate shows the property \e{language} +of the model, and the color of one of the fields depends on the +property \e{fruit_color} of the view. + +\code +Rectangle { + width: 200; height: 200 + + ListModel { + id: fruitModel + property string language: "en" + ListElement { + name: "Apple" + cost: 2.45 + } + ListElement { + name: "Orange" + cost: 3.25 + } + ListElement { + name: "Banana" + cost: 1.95 + } + } + + Component { + id: fruitDelegate + Row { + Text { text: " Fruit: " + name; color: ListView.view.fruit_color } + Text { text: " Cost: $" + cost } + Text { text: " Language: " + ListView.view.model.language } + } + } + + ListView { + property color fruit_color: "green" + model: fruitModel + delegate: fruitDelegate + anchors.fill: parent + } +} +\endcode + +Another important case is when some action (e.g. mouse click) in the +delegate should update data in the model. In this case you can define +a function in the model, e.g.: + +\code + setData(int row, const QString & field_name, QVariant new_value), +\endcode + +...and call it from the delegate using: + +\code + ListView.view.model.setData(index, field, value) +\endcode + +...assuming that \e{field} holds the name of the field which should be +updated, and that \e{value} holds the new value. + */ -- cgit v0.12 From 2ef8b92ececbf9d33d7c0b44f46c7c975fb0fdaa Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 8 Jul 2010 08:42:27 +0200 Subject: QUUid::createUuid() should not generate identical sequences on UNIX An unintended side-effect of commit 90a082c9076f35dcca092ade019891e92692710e is that if qrand() is used without being seeded first, then createUuid() would always generate the same sequence. This quite likely to happen considering the Qt does not actually seed the PRNG, but does use it in many places (we do not call qsrand(), but we do often call qrand()). Fix this by changing qrand() to calculate a seed, instead of defaulting to 1. This allows us to remove the qsrand() overload with no arguments, since qrand() will now seed automatically unless manually seeded by the programmer. Task-number: QTBUG-11213 Reviewed-by: thiago --- src/corelib/global/qglobal.cpp | 58 ++++++------------------------------------ src/corelib/plugin/quuid.cpp | 12 +++------ 2 files changed, 12 insertions(+), 58 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 66519be..b24ba38 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2586,55 +2586,6 @@ void qsrand(uint seed) #endif } -/*! \internal - \relates - \since 4.6 - - Seed the PRNG, but only if it has not already been seeded. - - The default seed is a combination of current time, a stack address and a - serial counter (since thread stack addresses are re-used). -*/ -void qsrand() -{ -#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) - SeedStorage *seedStorage = randTLS(); - if (seedStorage) { - SeedStorageType *pseed = seedStorage->localData(); - if (pseed) { - // already seeded - return; - } - seedStorage->setLocalData(pseed = new SeedStorageType); - // start beyond 1 to avoid the sequence reset - static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); - *pseed = QDateTime::currentDateTime().toTime_t() - + quintptr(&pseed) - + serial.fetchAndAddRelaxed(1); -#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) - // for Windows and Symbian the srand function must still be called. - srand(*pseed); -#endif - } - -//QT_NO_THREAD implementations -#else - static unsigned int seed = 0; - - if (seed) - return; - -#if defined(Q_OS_SYMBIAN) - seed = Math::Random(); -#elif defined(Q_OS_WIN) - seed = GetTickCount(); -#else - seed = quintptr(&seed) + QDateTime::currentDateTime().toTime_t(); -#endif - srand(seed); -#endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) -} - /*! \relates \since 4.2 @@ -2658,7 +2609,14 @@ int qrand() SeedStorageType *pseed = seedStorage->localData(); if (!pseed) { seedStorage->setLocalData(pseed = new SeedStorageType); - *pseed = 1; + + // Seed the PRNG, but only if it has not already been seeded. The + // default seed is a combination of current time, a stack address + // and a serial counter (since thread stack addresses are re-used). + static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); + *pseed = QDateTime::currentDateTime().toTime_t() + + quintptr(&pseed) + + serial.fetchAndAddRelaxed(1); } return rand_r(pseed); } else { diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 8541c7d..6a7d35c 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -577,23 +577,19 @@ QUuid QUuid::createUuid() QT_BEGIN_INCLUDE_NAMESPACE #include "qdatetime.h" -#include "stdlib.h" // For srand/rand QT_END_INCLUDE_NAMESPACE -extern void qsrand(); // in qglobal.cpp - QUuid QUuid::createUuid() { static const int intbits = sizeof(int)*8; static int randbits = 0; if (!randbits) { + int r = 0; int max = RAND_MAX; - do { ++randbits; } while ((max=max>>1)); + do { ++r; } while ((max=max>>1)); + randbits = r; } - // reseed, but only if not already seeded - qsrand(); - QUuid result; uint *data = &(result.data1); int chunks = 16 / sizeof(uint); @@ -601,7 +597,7 @@ QUuid QUuid::createUuid() uint randNumber = 0; for (int filled = 0; filled < intbits; filled += randbits) randNumber |= qrand()< Date: Thu, 8 Jul 2010 10:30:43 +0200 Subject: Doc: Fixing typo - background file name --- examples/declarative/tutorials/samegame/samegame1/samegame.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/declarative/tutorials/samegame/samegame1/samegame.qml index 68f8712..80567ef 100644 --- a/examples/declarative/tutorials/samegame/samegame1/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame1/samegame.qml @@ -55,7 +55,7 @@ Rectangle { Image { id: background anchors.fill: parent - source: "../shared/pics/background.jpg" + source: "../shared/pics/background.png" fillMode: Image.PreserveAspectCrop } } -- cgit v0.12 From 3062dac75befacffc1964d49392a58f5fb0b583f Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 10:36:50 +0200 Subject: Doc: adding HTML class names and style docs to the generator --- tools/qdoc3/htmlgenerator.cpp | 66 ++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 1e455dd..5b6ea28 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -909,13 +909,13 @@ int HtmlGenerator::generateAtom(const Atom *atom, else out() << ""; - out() << "Constant" - << "Value" - << "Description\n"; + out() << "Constant" + << "Value" + << "Description\n"; } else { out() << "" - << "\n"; + << "\n"; } } else { @@ -1129,9 +1129,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::TableItemLeft: { if (inTableHeader) - out() << "string().split(","); if (spans.size() == 2) { @@ -1764,35 +1764,37 @@ void HtmlGenerator::generateHeader(const QString& title, if (offlineDocs) { - out() << " "; + out() << " "; // Style common to all browsers + // out() << " "; // Only for Qt Creator out() << "\n"; - out() << "\n"; // narrow mainly for Creator + out() << "\n"; // narrow mainly for Creator + out() << " \n"; out() << " \n"; } else { out() << " "; - out() << " \n"; - out() << "\n"; - out() << "\n"; - out() << "\n"; + // out() << " \n"; + // out() << "\n"; + // out() << "\n"; + // out() << "\n"; // jquery functions out() << " \n"; out() << " \n"; // menus and small docs js and css - out() << " \n"; - out() << " \n"; - out() << " "; - out() << " "; + // out() << " \n"; + // out() << " \n"; + // out() << " "; + // out() << " "; // syntax highlighter js and css // out() << " \n"; @@ -1804,7 +1806,7 @@ void HtmlGenerator::generateHeader(const QString& title, // out() << " \n"; out() << "\n"; - out() << "\n"; + out() << "\n"; // CheckEmptyAndLoadList() activating online search } #ifdef GENERATE_MAC_REFS @@ -2296,20 +2298,20 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, out() << ""; else out() << ""; - out() << ""; if (!(node->type() == Node::Fake)) { Text brief = node->doc().trimmedBriefText(name); if (!brief.isEmpty()) { - out() << ""; } } else { - out() << ""; } @@ -4073,7 +4075,7 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, else out() << ""; - out() << ""; else out() << ""; - out() << ""; else out() << ""; - out() << ""; -- cgit v0.12 From baab1d25cbae435a6a84ba75c2702350adb027cc Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 10:49:14 +0200 Subject: Doc: fixing link to devnet --- tools/qdoc3/test/qt-html-templates.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index b7dead2..e032d6f 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -17,7 +17,7 @@ HTML.postheader = "
    \n" \ "
    \n" \ "
      \n" \ "
    • Qt HOME
    • \n" \ - "
    • DEV
    • \n" \ + "
    • DEV
    • \n" \ "
    • LABS
    • \n" \ "
    • \n" \ " DOC
    • \n" \ -- cgit v0.12 From a538ccb93fd05b26dc7a7058bbb62e0dcb682f81 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 11:13:17 +0200 Subject: Doc: changing index page --- doc/src/index.qdoc | 33 +- doc/src/template/style/OfflineStyle.css | 832 ---------------------------- tools/qdoc3/htmlgenerator.cpp | 52 +- tools/qdoc3/test/qt-html-templates.qdocconf | 1 - 4 files changed, 62 insertions(+), 856 deletions(-) delete mode 100644 doc/src/template/style/OfflineStyle.css diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 22ee63f..657f5d0 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -44,7 +44,7 @@
    • Installation & first steps
    • How to learn Qt
    • Tutorials
    • -
    • Examples
    • +
    • Examples
    • Whats new in Qt 4.7
    @@ -56,30 +56,29 @@ diff --git a/doc/src/template/style/OfflineStyle.css b/doc/src/template/style/OfflineStyle.css deleted file mode 100644 index afa7de0..0000000 --- a/doc/src/template/style/OfflineStyle.css +++ /dev/null @@ -1,832 +0,0 @@ -@media screen -{ - html - { - color: #000000; - background: #FFFFFF; - } - body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td - { - margin: 0; - padding: 0; - } - table - { - border-collapse: collapse; - border-spacing: 0; - } - fieldset, img - { - border: 0; - } - address, caption, cite, code, dfn, em, strong, th, var, optgroup - { - font-style: inherit; - font-weight: inherit; - } - del, ins - { - text-decoration: none; - } - li - { - list-style: none; - } - caption, th - { - text-align: left; - } - h1, h2, h3, h4, h5, h6 - { - font-size: 100%; - } - q:before, q:after - { - content: ''; - } - abbr, acronym - { - border: 0; - font-variant: normal; - } - sup - { - vertical-align: baseline; - } - sub - { - vertical-align: baseline; - } - tt, .qmlreadonly span, .qmldefault span - { - word-spacing:5px; - } - .heading - { - font: normal 600 16px/1.0 Arial; - } - .subtitle - { - font-size: 13px; - } - .small-subtitle - { - font-size: 13px; - } - legend - { - color: #000000; - } - input, button, textarea, select, optgroup, option - { - font-family: inherit; - font-size: inherit; - font-style: inherit; - font-weight: inherit; - } - input, button, textarea, select - { - font-size: 100%; - } - body - { - font: normal 13px/1.2 Verdana; - color: #363534; - } - strong - { - font-weight: bold; - } - em - { - font-style: italic; - } - a - { - color: #00732f; - text-decoration: none; - } - .header, .footer, .wrapper - { - /*min-width: 600px;*/ - max-width: 1500px; - margin: 0 5px; - } - .wrapper - { - position:relative; - top:50px; - } - .wrapper .bd - { - position: relative; - } - - .header, .footer - { - display: block; - clear: both; - overflow: hidden; - } - .header - { - height: 115px; - position: relative; - } - - - .header .qtref - { - position: absolute; - top: 28px; - left: 88px; - width: 302px; - height: 22px; - } - .header .qtref span - { - display: block; - height: 22px; - } - .wrap .content h1 - { - font: 600 18px/1.2 Arial; - } - .wrap .content h2 - { - font: 600 16px/1.2 Arial; - } - .wrap .content h3 - { - font: 600 14px/1.2 Arial; - } - .wrap .content h4 - { - font: 600 12px/1.2 Arial; - } - - .wrap .content p - { - line-height: 20px; - padding: 5px; - } - .wrap .content table p - { - line-height: 20px; - padding: 0px; - } - .wrap .content ul - { - padding-left: 25px; - padding-top: 10px; - } - a:hover - { - color: #4c0033; - text-decoration: underline; - } - .content a:visited - { - color: #4c0033; - text-decoration: none; - } - .content a:visited:hover - { - color: #4c0033; - text-decoration: underline; - } - - pre - { - border: 1px solid #DDDDDD; - margin: 0 20px 10px 10px; - padding: 20px 15px 20px 20px; - overflow-x: auto; - } - table, pre - { - -moz-border-radius: 7px 7px 7px 7px; - background-color: #F6F6F6; - border: 1px solid #E6E6E6; - border-collapse: separate; - font-size: 11px; - /*min-width: 395px;*/ - margin-bottom: 25px; - display: inline-block; - } - thead - { - margin-top: 5px; - font:600 12px/1.2 Arial; - } - th - { - padding: 5px 15px 5px 15px; - background-color: #E1E1E1; - /* border-bottom: 1px solid #E6E6E6;*/ - border-left: 1px solid #E6E6E6; - /* border-right: 1px solid #E6E6E6;*/ - } - td - { - padding: 3px 15px 3px 20px; - /* border-left: 1px solid #E6E6E6; - border-right: 1px solid #E6E6E6;*/ - } - tr.odd td:hover, tr.even td:hover - { - /* border-right: 1px solid #C3C3C3; - border-left: 1px solid #C3C3C3;*/ - } - - td.rightAlign - { - padding: 3px 15px 3px 10px; - } - table tr.odd - { - border-left: 1px solid #E6E6E6; - background-color: #F6F6F6; - color: #66666E; - } - table tr.even - { - border-left: 1px solid #E6E6E6; - background-color: #ffffff; - color: #66666E; - } - table tr.odd td:hover, table tr.even td:hover - { - background-color: #E6E6E6; - } - - span.comment - { - color: #8B0000; - font-style: italic; - } - span.string, span.char - { - color: #254117; - } - - .qmltype - { - text-align: center; - font-size: 160%; - } - .qmlreadonly - { - float: right; - color: #254117; - } - - .qmldefault - { - float: right; - color: red; - } - - .footer - { - border-top:1px solid #E5E5E5; - min-height: 100px; - color: #797775; - font: normal 9px/1 Verdana; - text-align: center; - padding-top: 40px; - margin: 0; - } - - - .wrap - { - margin: 0 5px 0 5px; - } - .wrap .toolbar - { - display:block; - } - - .wrap .breadcrumb ul li - { - float: left; - background: url(../images/breadcrumb.png) no-repeat 0 5px; - padding-left: 15px; - margin-left: 15px; - font-weight: bold; - } - .wrap .breadcrumb ul li.last - { - font-weight: normal; - } - .wrap .breadcrumb ul li a - { - /* color: #363534;*/ - color: #00732F; - } - .wrap .breadcrumb ul li.first - { - background-image: none; - padding-left: 0; - margin-left: 0; - } - .wrap .content - { - word-wrap:break-word; - } - .wrap .content li - { - /*padding-left: 12px;*/ - background: url(../images/bullet_sq.png) no-repeat 0 5px; - font: normal 400 10pt/1 Verdana; - /* color: #44a51c;*/ - margin-bottom: 10px; - } - - .offline .wrap .content - { - padding-top: 15px; - } - - .header:after, .footer:after, .breadcrumb:after, .wrap .content:after, .group:after - { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; - } - - hr - { - background-color: #E6E6E6; - border: 1px solid #E6E6E6; - height: 1px; - width: 100%; - text-align: left; - margin: 5px 0px 5px 0px; - } - - .content .alignedsummary - { - margin: 5px; - width:100%; - } - - - .toc - { - float: right; - -moz-border-radius: 7px 7px 7px 7px; - background-color: #F6F6F6; - border: 1px solid #DDDDDD; - margin: 0 20px 10px 10px; - padding: 20px 15px 20px 20px; - height: auto; - width: 200px; - } - - .toc h3, .generic a - { - font: 600 12px/1.2 Arial; - } - - .wrap .content .toc ul - { - padding-left: 0px; - } - - - .wrap .content .toc .level2 - { - margin-left: 15px; - } - - .wrap .content .toc .level3 - { - margin-left: 30px; - } - - .content .toc li - { - font: normal 10px/1.2 Verdana; - background: url(../images/bullet_dn.png) no-repeat 0 5px; - } - - - .generic{ - max-width:75%; - } - .generic td{ - padding:0; - } - - .generic .odd .alphaChar{ - background-color: #F6F6F6; - } - - .generic .even .alphaChar{ - background-color: #FFFFFF; - } - - .highlightedCode - { - margin:10px; - } - - .flowList{ - vertical-align:top; - } - .alphaChar{ - width:100%; - background-color:#F6F6F6; - border:1px solid #E6E6E6; - font-size:12pt; - padding-left:10px; - margin-top:10px; - margin-bottom:10px; - } - - .flowList dl{ - } - .flowList dd{ - display:inline-block; - margin-left:10px; - width:250px; - } - .wrap .content .flowList p{ - padding:0px; - } - - .relpage - { - -moz-border-radius: 7px 7px 7px 7px; - border: 1px solid #DDDDDD; - padding: 25px 25px; - clear: both; - } - .relpage ul - { - float: none; - padding: 15px; - } - .content .relpage li - { - font: normal 11px/1.2 Verdana; - } - h3.fn, span.fn - { - background-color: #F6F6F6; - border-width: 1px; - border-style: solid; - border-color: #E6E6E6; - font-weight: bold; - word-spacing:3px; - } - - .functionIndex { - font-size:12pt; - word-spacing:10px; - margin-bottom:10px; - background-color: #F6F6F6; - border-width: 1px; - border-style: solid; - border-color: #E6E6E6; - width:100%; - } - - .centerAlign { text-align:center;} - .rightAlign {text-align:right;} - .leftAlign {text-align:left;} - .topAlign{vertical-align:top } - .functionIndex a{display:inline-block;} - - /* start index box */ - .indexbox - { - width: 100%; - display:inline-block; - } - - .indexboxcont { display: block; } - - .indexboxbar - { - border-bottom:1px solid #E5E5E5; - margin-bottom: 25px; - } - - .indexboxcont .section - { - display: inline-block; - padding:0 2% 0 1%; - vertical-align:top; - } - - .indexboxcont .section { - float: left; - } - - .indexboxcont .section p - { - padding-top: 20px; - padding-bottom: 20px; - } - .indexboxcont .sectionlist - { - display: inline-block; - vertical-align:top; - padding: 0; - } - .indexboxcont .sectionlist ul - { - margin-bottom: 20px; - } - - .indexboxcont .sectionlist ul li - { - line-height: 12px; - } - - .content .indexboxcont li - { - font: normal 600 13px/1 Verdana; - } - - .indexbox a:hover, .indexbox a:visited:hover - { - color: #4c0033; - text-decoration: underline; - } - - .indexbox a:visited - { - color: #00732f; - text-decoration: none; - } - - .indexbox .indexIcon { - width: 11%; - } - - - .indexboxcont:after - { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; - } - - body.offline - { - background-image: none; - } - - .offline .footer { - margin: 0; - } - .offline .header - { - width: 100%; - margin: 0; - height: auto; - background-color: #ffffff; - padding: 10px 0 5px 0; - overflow: visible; - border-bottom: solid #E5E5E5 1px; - z-index:1; - position:fixed; - } - - .offline .header .content - { - } - .offline .header .qtref - { - color: #00732F; - position: static; - float: left; - margin-left: 5px; - font: bold 18px/1 Arial; - } - - .offline .header .qtref:visited - { - color: #00732F; - } - .offline .header .qtref:hover - { - color: #00732F; - text-decoration:none; - } - .offline .header .qtref span - { - background-image: none; - text-indent: 0; - text-decoration:none; - } - - .offline .wrap - { - margin: 0 5px 0 5px; - } - - .offline .wrap .toolbar - { - display:block; - padding-top:5px; - } - - .offline .wrap .breadcrumb ul li { - font-weight: normal; - } - - .offline .wrap .breadcrumb ul li a { - /*color: #44a51c;*/ - } - - .offline .wrap .breadcrumb ul li.last a { - /*color: #363534;*/ - } - - - - .narrow .indexboxcont .section { - width: 64%; - padding-left: 0; - } - - .narrow .indexboxcont .sectionlist { - width: 32.5%; - } - - .header .icon, - .sidebar, - .feedback, - .t_button, - .feedback, - #feedbackBox, - #feedback, - #blurpage, - .indexbox .indexIcon span, - .wrapper .hd, - .offline .indexbox .indexIcon, - .offline .header #nav-logo, - #offlinemenu, - #offlinesearch, - .offline .header #nav-topright, - .offline .header #shortCut , - .offline .wrapper .hd, - .offline .wrapper .ft, - .offline .sidebar, - .offline .wrap .feedback - { - display:none; - } - - /* end offline mode */ -#narrowmenu { - display: none; - float: right; - margin: 15px 40px 0 0; - font-size: 11px; - } - - .narrow #narrowmenu { - display: block; - } - - #narrowsearch{ - display:none; - } - - #narrowmenu ul - { - border-bottom:solid 1px #E5E5E5; - border-left:solid 1px #E5E5E5; - border-right:solid 1px #E5E5E5; - } - - #narrowmenu a { - line-height: 1.1; - background: url(../images/arrow_down.png) no-repeat 100% 50%; - white-space: nowrap; - padding: 0 16px 0 5px; - } - - #narrowmenu li { - margin-left: 20px; - } - - #narrowmenu li li { - margin: 0 0 5px 0; - } - - #narrowmenu li li a { - padding: 0; - background-image: none; - } - - #narrowmenu li, - #narrowmenu li ul { - background-color: #fff; - } - - #narrowmenu li ul { - width: auto; - padding: 5px; - margin-top:-15px; - } - - .sf-menu li:hover ul, .sf-menu li.sfHover ul { - top: 1.2em; - } -.sf-menu, .sf-menu * { - margin: 0; - padding: 0; - list-style: none; -} -.sf-menu { - line-height: 1.0; -} -.sf-menu ul { - position: absolute; - top: -999em; - width: 10em; /* left offset of submenus need to match (see below) */ -} -.sf-menu ul li { - width: 100%; -} -.sf-menu li:hover { - visibility: inherit; /* fixes IE7 'sticky bug' */ -} -.sf-menu li { - float: left; - position: relative; -} -.sf-menu a { - display: block; - position: relative; -} -.sf-menu li:hover ul, -.sf-menu li.sfHover ul { - left: 0; - top: 2.5em; /* match top ul list item height */ - z-index: 99; -} -ul.sf-menu li:hover li ul, -ul.sf-menu li.sfHover li ul { - top: -999em; -} -ul.sf-menu li li:hover ul, -ul.sf-menu li li.sfHover ul { - left: 10em; /* match ul width */ - top: 0; -} -ul.sf-menu li li:hover li ul, -ul.sf-menu li li.sfHover li ul { - top: -999em; -} -ul.sf-menu li li li:hover ul, -ul.sf-menu li li li.sfHover ul { - left: 10em; /* match ul width */ - top: 0; -} - .wrap .content ol li { - background:none; - font:400 10pt/1 Verdana; - margin-bottom:10px; - margin-left:12px; - } - .wrap .content ol li { - list-style-type:decimal; - - } - - - -} -/* end of screen media */ - -/* start of print media */ - -@media print -{ - input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft - { - display: none; - background: none; - } - .content - { - position: absolute; - top: 0px; - left: 0px; - background: none; - display: block; - } -} -/* end of print media */ diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 5b6ea28..5c2d17a 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1757,22 +1757,41 @@ void HtmlGenerator::generateHeader(const QString& title, else shortVersion = "Qt " + shortVersion + ": "; } - + // Generating page title out() << " " << shortVersion << protectEnc(title) << "\n"; - - //out() << " Qt Reference Documentation"; - + // Adding style sheet + out() << " "; + // Adding jquery and functions - providing online tools and search features + out() << " \n"; + out() << " \n"; + // Adding style and js for small windows + out() << " \n"; + out() << " \n"; + out() << " "; + out() << " "; + + // Adding syntax highlighter // future release + + // Setting assistant configuration if (offlineDocs) { +<<<<<<< Updated upstream:tools/qdoc3/htmlgenerator.cpp out() << " "; // Style common to all browsers // out() << " "; // Only for Qt Creator out() << "\n"; out() << "\n"; // narrow mainly for Creator out() << " \n"; out() << " \n"; +======= + out() << "\n"; + out() << "\n"; // narrow mainly for Creator +// out() << " \n"; +>>>>>>> Stashed changes:tools/qdoc3/htmlgenerator.cpp } + // Setting online doc configuration else { +<<<<<<< Updated upstream:tools/qdoc3/htmlgenerator.cpp out() << " "; // out() << " \n"; +======= + // Custom browser styles + out() << " \n"; + out() << "\n"; + out() << "\n"; + out() << "\n"; +>>>>>>> Stashed changes:tools/qdoc3/htmlgenerator.cpp // jquery functions - out() << " \n"; - out() << " \n"; // menus and small docs js and css +<<<<<<< Updated upstream:tools/qdoc3/htmlgenerator.cpp // out() << " \n"; // out() << " \n"; // out() << " "; @@ -1807,6 +1841,12 @@ void HtmlGenerator::generateHeader(const QString& title, out() << "\n"; out() << "\n"; // CheckEmptyAndLoadList() activating online search +======= + + out() << "\n"; + // CheckEmptyAndLoadList activating search + out() << "\n"; +>>>>>>> Stashed changes:tools/qdoc3/htmlgenerator.cpp } #ifdef GENERATE_MAC_REFS diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index e032d6f..550d80f 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -22,7 +22,6 @@ HTML.postheader = "
    \n" \ "
  • \n" \ " DOC
  • \n" \ "
  • BLOG
  • \n" \ - "
  • SHOP
  • \n" \ " \n" \ "
    \n" \ "
    \n" \ -- cgit v0.12 From 5a6e3d952327753cb0cc00fa22804c5dab435c39 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 11:17:16 +0200 Subject: Doc: cleaning html generator --- tools/qdoc3/htmlgenerator.cpp | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 5c2d17a..7075efc 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1775,23 +1775,17 @@ void HtmlGenerator::generateHeader(const QString& title, // Setting assistant configuration if (offlineDocs) { -<<<<<<< Updated upstream:tools/qdoc3/htmlgenerator.cpp out() << " "; // Style common to all browsers // out() << " "; // Only for Qt Creator out() << "\n"; out() << "\n"; // narrow mainly for Creator - out() << " \n"; - out() << " \n"; -======= out() << "\n"; out() << "\n"; // narrow mainly for Creator // out() << " \n"; ->>>>>>> Stashed changes:tools/qdoc3/htmlgenerator.cpp } // Setting online doc configuration else { -<<<<<<< Updated upstream:tools/qdoc3/htmlgenerator.cpp out() << " "; // out() << " \n"; -======= // Custom browser styles out() << " \n"; ->>>>>>> Stashed changes:tools/qdoc3/htmlgenerator.cpp - // jquery functions - // menus and small docs js and css -<<<<<<< Updated upstream:tools/qdoc3/htmlgenerator.cpp - // out() << " \n"; - // out() << " \n"; - // out() << " "; - // out() << " "; - - // syntax highlighter js and css - // out() << " \n"; - // out() << " \n"; - // out() << " \n"; - // out() << " \n"; - // out() << " \n"; out() << "\n"; out() << "\n"; // CheckEmptyAndLoadList() activating online search -======= out() << "\n"; // CheckEmptyAndLoadList activating search out() << "\n"; ->>>>>>> Stashed changes:tools/qdoc3/htmlgenerator.cpp } #ifdef GENERATE_MAC_REFS -- cgit v0.12 From 16264dc0035260d3e68f1ed22ea647e7c157bd3c Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 11:19:37 +0200 Subject: Doc: fixing escape character --- tools/qdoc3/test/qt-html-templates.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 550d80f..b428a90 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -17,7 +17,7 @@ HTML.postheader = "
    \n" \ "
    \n" \ "
      \n" \ "
    • Qt HOME
    • \n" \ - "
    • DEV
    • \n" \ + "
    • DEV
    • \n" \ "
    • LABS
    • \n" \ "
    • \n" \ " DOC
    • \n" \ -- cgit v0.12 From 25ace9513587abb5e52f78d900e6bec7b04bb663 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 11:35:27 +0200 Subject: Doc: more cleaning --- tools/qdoc3/htmlgenerator.cpp | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 7075efc..567a297 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1766,8 +1766,8 @@ void HtmlGenerator::generateHeader(const QString& title, out() << " \n"; // Adding style and js for small windows out() << " \n"; - out() << " \n"; out() << " "; + out() << " \n"; out() << " "; // Adding syntax highlighter // future release @@ -1775,32 +1775,14 @@ void HtmlGenerator::generateHeader(const QString& title, // Setting assistant configuration if (offlineDocs) { - out() << " "; // Style common to all browsers - // out() << " "; // Only for Qt Creator + // out() << " "; // Only for Qt Creator out() << "\n"; out() << "\n"; // narrow mainly for Creator - out() << "\n"; - out() << "\n"; // narrow mainly for Creator -// out() << " \n"; } // Setting online doc configuration else { - out() << " "; - // out() << " \n"; - // out() << "\n"; - // out() << "\n"; - // out() << "\n"; - // Custom browser styles + // Browser spec styles out() << " \n"; out() << "\n"; - out() << "\n"; // CheckEmptyAndLoadList() activating online search - - out() << "\n"; // CheckEmptyAndLoadList activating search out() << "\n"; } -- cgit v0.12 From f28a27987fa4e1b2faa1c57188c128afb735f70a Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 8 Jul 2010 11:47:09 +0200 Subject: Compile Re-add the stdlib.h include, since it brings in RAND_MAX Reviewed-by: TrustMe --- src/corelib/plugin/quuid.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 6a7d35c..f48cc2e 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -577,6 +577,7 @@ QUuid QUuid::createUuid() QT_BEGIN_INCLUDE_NAMESPACE #include "qdatetime.h" +#include // for RAND_MAX QT_END_INCLUDE_NAMESPACE QUuid QUuid::createUuid() -- cgit v0.12 From e2db7c19dcf53458d480e148cc21f0577bcb0a44 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 7 Jul 2010 12:50:26 +0200 Subject: respect UI_DIR when creating image collections Reviewed-by: joerg Task-number: QTBUG-11752 --- mkspecs/features/uic.prf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mkspecs/features/uic.prf b/mkspecs/features/uic.prf index 5324e65..0a18b47 100644 --- a/mkspecs/features/uic.prf +++ b/mkspecs/features/uic.prf @@ -86,20 +86,20 @@ defineReplace(imageCollectionCmd) { for(image, $$list($$split(1))) { EMBEDDED_IMAGES += $$image count(EMBEDDED_IMAGES, 5) { - isEmpty(RET): RET += echo $$EMBEDDED_IMAGES > images.tmp $$escape_expand(\\n\\t) - else: RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\\n\\t) + isEmpty(RET): RET += echo $$EMBEDDED_IMAGES > $${UI_DIR}/images.tmp $$escape_expand(\\n\\t) + else: RET += echo $$EMBEDDED_IMAGES >> $${UI_DIR}/images.tmp $$escape_expand(\\n\\t) unset(EMBEDDED_IMAGES) } } - !isEmpty(EMBEDDED_IMAGES):RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\\n\\t) + !isEmpty(EMBEDDED_IMAGES):RET += echo $$EMBEDDED_IMAGES >> $${UI_DIR}/images.tmp $$escape_expand(\\n\\t) !isEmpty(RET) { - RET += $$QMAKE_UIC3 -embed $$TARGET -f images.tmp -o $$2 $$escape_expand(\\n\\t) + RET += $$QMAKE_UIC3 -embed $$TARGET -f $${UI_DIR}/images.tmp -o $$2 $$escape_expand(\\n\\t) return($$RET) } return($$QMAKE_UIC3 -embed $$TARGET $$1 -o $$2) } -image_collection.output = qmake_image_collection$${first(QMAKE_EXT_CPP)} +image_collection.output = $${UI_DIR}/qmake_image_collection$${first(QMAKE_EXT_CPP)} image_collection.variable_out = SOURCES image_collection.input = IMAGES image_collection.CONFIG += combine @@ -109,7 +109,7 @@ image_collection.name = UIC3 Image collection in ${QMAKE_FILE_OUT} silent:image_collection.commands = @echo uic3 -embed ${QMAKE_FILE_IN} && $$image_collection.commands } else { image_collection.commands = ${QMAKE_FUNC_imageCollectionCmd} - silent:image_collection.commands = @echo uic3 -embed $$TARGET -f images.tmp && $image_collection.commands + silent:image_collection.commands = @echo uic3 -embed $$TARGET -f $${UI_DIR}/images.tmp && $image_collection.commands } QMAKE_EXTRA_COMPILERS += image_collection -- cgit v0.12 From b57afadf3f91f87eba02458faa2809dd07b45da5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 8 Jul 2010 12:27:42 +0200 Subject: fix build with sqlite2 --- src/sql/drivers/sqlite2/qsql_sqlite2.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.pri b/src/sql/drivers/sqlite2/qsql_sqlite2.pri index 76fe255..9a9f6cd 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.pri +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.pri @@ -1,4 +1,4 @@ -HEADERS += $PWD/qsql_sqlite2.h -SOURCES += $PWD/qsql_sqlite2.cpp +HEADERS += $$PWD/qsql_sqlite2.h +SOURCES += $$PWD/qsql_sqlite2.cpp !contains(LIBS, .*sqlite.*):LIBS += -lsqlite -- cgit v0.12 From bd576d42be264ff60503db0da509ad16139de09f Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 8 Jul 2010 12:47:11 +0200 Subject: Fix compilation when QT_NO_IM is defined Merge-request: 734 Reviewed-by: Oswald Buddenhagen --- src/gui/kernel/qapplication.cpp | 2 ++ src/gui/kernel/qapplication.h | 3 +++ src/gui/kernel/qwidget.cpp | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index ccfe88c..d984721 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5291,6 +5291,7 @@ bool QApplication::keypadNavigationEnabled() \sa QCoreApplication::instance() */ +#ifndef QT_NO_IM // ************************************************************************ // Input Method support // ************************************************************************ @@ -5356,6 +5357,7 @@ QInputContext *QApplication::inputContext() const #endif return d->inputContext; } +#endif // QT_NO_IM //Returns the current platform used by keyBindings uint QApplicationPrivate::currentPlatform(){ diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index d31d9e5..799d4c2 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -267,8 +267,11 @@ public: virtual void commitData(QSessionManager& sm); virtual void saveState(QSessionManager& sm); #endif + +#ifndef QT_NO_IM void setInputContext(QInputContext *); QInputContext *inputContext() const; +#endif static QLocale keyboardInputLocale(); static Qt::LayoutDirection keyboardInputDirection(); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 233df15..fed8d0a 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -338,8 +338,10 @@ QInputContext *QWidgetPrivate::inputContext() const #ifndef QT_NO_IM if (ic) return ic; -#endif return qApp->inputContext(); +#else + return 0; +#endif } /*! -- cgit v0.12 From a9c8decc741d8c2b340f38d7a854ef206672ab3e Mon Sep 17 00:00:00 2001 From: liang jian Date: Thu, 8 Jul 2010 12:56:03 +0200 Subject: Build Qt with option -Zc:wchar_t under MSVC This will make projects generated by visual studio being successfully linked to the Qt dlls if they use the QString::fromWCharArray() or QString::toWCharArray() methods. Merge-request: 727 Reviewed-by: Oswald Buddenhagen --- mkspecs/win32-msvc2005/qmake.conf | 2 +- mkspecs/win32-msvc2008/qmake.conf | 2 +- mkspecs/win32-msvc2010/qmake.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mkspecs/win32-msvc2005/qmake.conf b/mkspecs/win32-msvc2005/qmake.conf index 0406fd0..a5999cc 100644 --- a/mkspecs/win32-msvc2005/qmake.conf +++ b/mkspecs/win32-msvc2005/qmake.conf @@ -16,7 +16,7 @@ QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = byacc QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- +QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD diff --git a/mkspecs/win32-msvc2008/qmake.conf b/mkspecs/win32-msvc2008/qmake.conf index 9805e90..1aab8e1 100644 --- a/mkspecs/win32-msvc2008/qmake.conf +++ b/mkspecs/win32-msvc2008/qmake.conf @@ -16,7 +16,7 @@ QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = byacc QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- +QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD diff --git a/mkspecs/win32-msvc2010/qmake.conf b/mkspecs/win32-msvc2010/qmake.conf index 28d4d3c..34a7782 100644 --- a/mkspecs/win32-msvc2010/qmake.conf +++ b/mkspecs/win32-msvc2010/qmake.conf @@ -16,7 +16,7 @@ QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = byacc QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- +QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD -- cgit v0.12 From bc16436e33cfc61e0009474186cbb8210fb51df7 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 13:14:06 +0200 Subject: Doc: documenting docs --- tools/qdoc3/htmlgenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 567a297..8c7d5ad 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1777,7 +1777,7 @@ void HtmlGenerator::generateHeader(const QString& title, { // out() << " "; // Only for Qt Creator out() << "\n"; - out() << "\n"; // narrow mainly for Creator + out() << "\n"; // offline for Creator and Assistant } // Setting online doc configuration else -- cgit v0.12 From ea7aeec080c9c39449017ff683b27d3659236336 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 13:15:47 +0200 Subject: Doc: fixing style from 600 to bold weight --- doc/src/template/style/style.css | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 184a832..f7ff00a 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -18,7 +18,6 @@ fieldset, img { border: 0; - height:100%; width:100% } address, caption, cite, code, dfn, em, strong, th, var, optgroup @@ -66,7 +65,7 @@ } .heading { - font: normal 600 16px/1.0 Arial; + font: normal bold 16px/1.0 Arial; padding-bottom: 15px; } .subtitle @@ -212,7 +211,7 @@ font-size: 11px; } - .offline .sidebar, .offline .feedback, .offline .t_button + .offline .sidebar, .offline .feedback, .offline .t_button, .offline #narrowsearch, .offline #narrowmenu { display: none; } @@ -258,7 +257,7 @@ .sidebar .box h2 { - font: 600 16px/1.2 Arial; + font: bold 16px/1.2 Arial; padding: 0; /* min-height: 32px;*/ } @@ -493,7 +492,7 @@ .wrap .content h1 { - font: 600 18px/1.2 Arial; + font: bold 18px/1.2 Arial; } .wrap .content h2 { @@ -506,7 +505,7 @@ } .wrap .content h3 { - font: 600 14px/1.2 Arial; + font: bold 14px/1.2 Arial; /*border-bottom:1px solid #DDDDDD;*/ font:600 16px/1.2 Arial; margin-top:15px; @@ -934,7 +933,7 @@ .toc h3, .generic a { - font: 600 12px/1.2 Arial; + font: bold 12px/1.2 Arial; } .generic{ @@ -1141,7 +1140,7 @@ .content .indexboxcont li { - font: normal 600 13px/1 Verdana; + font: normal bold 13px/1 Verdana; } .indexbox a:hover, .indexbox a:visited:hover -- cgit v0.12 From 062ceb0ec312e54670362c76aefdcac5353d64cd Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Tue, 6 Jul 2010 15:51:48 +0200 Subject: Avoid unneeded addition Reviewed-By: Denis --- src/gui/kernel/qgesturemanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index e43a560..fe9dd8a 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE QGestureManager::QGestureManager(QObject *parent) - : QObject(parent), state(NotGesture), m_lastCustomGestureId(0) + : QObject(parent), state(NotGesture), m_lastCustomGestureId(Qt::CustomGesture) { qRegisterMetaType(); @@ -119,7 +119,7 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r if (type == Qt::CustomGesture) { // generate a new custom gesture id ++m_lastCustomGestureId; - type = Qt::GestureType(Qt::CustomGesture + m_lastCustomGestureId); + type = Qt::GestureType(m_lastCustomGestureId); } m_recognizers.insertMulti(type, recognizer); delete dummy; -- cgit v0.12 From 8b212b5f36ef7479bb902c6f8c8c1f4335f7f39f Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Wed, 7 Jul 2010 11:46:33 +0200 Subject: Change default TapAndHold timeout and make configurable The new default timeout is 700ms and is what Nokia Research found through usability studies. Nevertheless lets provide public API to set this through a platform plugin or similar. Reviewed-By: Denis --- src/gui/kernel/qgesture.cpp | 29 +++++++++++++++++++++++++++++ src/gui/kernel/qgesture.h | 3 +++ src/gui/kernel/qgesture_p.h | 1 + src/gui/kernel/qstandardgestures.cpp | 7 +++---- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index f5688f4..6359ecf 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -41,6 +41,7 @@ #include "qgesture.h" #include "private/qgesture_p.h" +#include "private/qstandardgestures_p.h" #ifndef QT_NO_GESTURES @@ -726,6 +727,34 @@ void QTapAndHoldGesture::setPosition(const QPointF &value) d_func()->position = value; } +/*! + Set the timeout, in milliseconds, before the gesture triggers. + + The recognizer will detect a touch down and and if \a msecs + later the touch is still down, it will trigger the QTapAndHoldGesture. + The default value is 700 milliseconds. +*/ +// static +void QTapAndHoldGesture::setTimeout(int msecs) +{ + QTapAndHoldGesturePrivate::Timeout = msecs; +} + +/*! + Gets the timeout, in milliseconds, before the gesture triggers. + + The recognizer will detect a touch down and and if timeout() + later the touch is still down, it will trigger the QTapAndHoldGesture. + The default value is 700 milliseconds. +*/ +// static +int QTapAndHoldGesture::timeout() +{ + return QTapAndHoldGesturePrivate::Timeout; +} + +int QTapAndHoldGesturePrivate::Timeout = 700; // in ms + QT_END_NAMESPACE #endif // QT_NO_GESTURES diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 8c10895..8f410b1 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -252,6 +252,9 @@ public: QPointF position() const; void setPosition(const QPointF &pos); + static void setTimeout(int msecs); + static int timeout(); + friend class QTapAndHoldGestureRecognizer; }; diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index f5474c1..29b923e 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -177,6 +177,7 @@ public: QPointF position; int timerId; + static int Timeout; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 62d8a53..e05f8cc 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -517,7 +517,6 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object, const QMouseEvent *me = static_cast(event); const QGraphicsSceneMouseEvent *gsme = static_cast(event); - enum { TimerInterval = 2000 }; enum { TapRadius = 40 }; switch (event->type()) { @@ -526,21 +525,21 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object, q->setHotSpot(d->position); if (d->timerId) q->killTimer(d->timerId); - d->timerId = q->startTimer(TimerInterval); + d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout); return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout case QEvent::MouseButtonPress: d->position = me->globalPos(); q->setHotSpot(d->position); if (d->timerId) q->killTimer(d->timerId); - d->timerId = q->startTimer(TimerInterval); + d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout); return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout case QEvent::TouchBegin: d->position = ev->touchPoints().at(0).startScreenPos(); q->setHotSpot(d->position); if (d->timerId) q->killTimer(d->timerId); - d->timerId = q->startTimer(TimerInterval); + d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout); return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout case QEvent::GraphicsSceneMouseRelease: case QEvent::MouseButtonRelease: -- cgit v0.12 From dc1443ac784201bd9c016519d01481aeeb3d8f53 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 13:18:34 +0200 Subject: Doc: changing offline style This file will however be replaced in the near future --- doc/src/template/style/OfflineStyle.css | 251 ++++++++++++++++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 doc/src/template/style/OfflineStyle.css diff --git a/doc/src/template/style/OfflineStyle.css b/doc/src/template/style/OfflineStyle.css new file mode 100644 index 0000000..9f5d28b --- /dev/null +++ b/doc/src/template/style/OfflineStyle.css @@ -0,0 +1,251 @@ +@media screen +{ + + .wrapper + { + top:50px; + background: none; + + } + .wrapper .bd + { + background: none; + position: relative; + } + + + + + body.offline + { + background-image: none; + background-color: #FFFFFF; + + } + + .offline .footer { + margin: 0; + } + .offline .header + { + width: 100%; + margin: 0; + height: auto; + background-color: #ffffff; + padding: 10px 0 5px 0; + overflow: visible; + border-bottom: solid #E5E5E5 1px; + z-index:1; + position:fixed; + } + + .offline .header .content + { + } + .offline .header .qtref + { + color: #00732F; + position: static; + float: left; + margin-left: 5px; + font: bold 18px/1 Arial; + } + + .offline .header .qtref:visited + { + color: #00732F; + } + .offline .header .qtref:hover + { + color: #00732F; + text-decoration:none; + } + .offline .header .qtref span + { + background-image: none; + text-indent: 0; + text-decoration:none; + } + + .offline .wrap + { + margin: 0 5px 0 5px; + } + + .offline .wrap .toolbar + { + display:block; + padding-top:5px; + } + + .offline .wrap .breadcrumb ul li { + font-weight: normal; + } + + .offline .wrap .breadcrumb ul li a { + /*color: #44a51c;*/ + } + + .offline .wrap .breadcrumb ul li.last a { + /*color: #363534;*/ + } + + + + .narrow .indexboxcont .section { + width: 64%; + padding-left: 0; + } + + .narrow .indexboxcont .sectionlist { + width: 32.5%; + } + + .header .icon, + .sidebar, + .feedback, + .t_button, + .feedback, + #feedbackBox, + #feedback, + #blurpage, + .indexbox .indexIcon span, + .wrapper .hd, + .offline .indexbox .indexIcon, + .offline .header #nav-logo, + #offlinemenu, + #offlinesearch, + .offline .header #nav-topright, + .offline .header #shortCut , + .offline .wrapper .hd, + .offline .wrapper .ft, + .offline .sidebar, + .offline .wrap .feedback + { + display:none; + } + + /* end offline mode */ +#narrowmenu { + display: none; + float: right; + margin: 15px 40px 0 0; + font-size: 11px; + } + + .narrow #narrowmenu { + display: block; + } + + #narrowsearch{ + display:none; + } + + #narrowmenu ul + { + border-bottom:solid 1px #E5E5E5; + border-left:solid 1px #E5E5E5; + border-right:solid 1px #E5E5E5; + } + + #narrowmenu a { + line-height: 1.1; + background: url(../images/arrow_down.png) no-repeat 100% 50%; + white-space: nowrap; + padding: 0 16px 0 5px; + } + + #narrowmenu li { + margin-left: 20px; + } + + #narrowmenu li li { + margin: 0 0 5px 0; + } + + #narrowmenu li li a { + padding: 0; + background-image: none; + } + + #narrowmenu li, + #narrowmenu li ul { + background-color: #fff; + } + + #narrowmenu li ul { + width: auto; + padding: 5px; + margin-top:-15px; + } + + .sf-menu li:hover ul, .sf-menu li.sfHover ul { + top: 1.2em; + } +.sf-menu, .sf-menu * { + margin: 0; + padding: 0; + list-style: none; +} +.sf-menu { + line-height: 1.0; +} +.sf-menu ul { + position: absolute; + top: -999em; + width: 10em; /* left offset of submenus need to match (see below) */ +} +.sf-menu ul li { + width: 100%; +} +.sf-menu li:hover { + visibility: inherit; /* fixes IE7 'sticky bug' */ +} +.sf-menu li { + float: left; + position: relative; +} +.sf-menu a { + display: block; + position: relative; +} +.sf-menu li:hover ul, +.sf-menu li.sfHover ul { + left: 0; + top: 2.5em; /* match top ul list item height */ + z-index: 99; +} +ul.sf-menu li:hover li ul, +ul.sf-menu li.sfHover li ul { + top: -999em; +} +ul.sf-menu li li:hover ul, +ul.sf-menu li li.sfHover ul { + left: 10em; /* match ul width */ + top: 0; +} +ul.sf-menu li li:hover li ul, +ul.sf-menu li li.sfHover li ul { + top: -999em; +} +ul.sf-menu li li li:hover ul, +ul.sf-menu li li li.sfHover ul { + left: 10em; /* match ul width */ + top: 0; +} + .wrap .content ol li { + background:none; + font:400 10pt/1 Verdana; + margin-bottom:10px; + margin-left:12px; + } + .wrap .content ol li { + list-style-type:decimal; + + } + + + +} +/* end of screen media */ + -- cgit v0.12 From 0f5e63c6c8cdb81bfd1d202475a13b5730be9623 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Jul 2010 13:22:19 +0200 Subject: Doc: change on index page --- doc/src/index.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 657f5d0..42fd4fc 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -60,7 +60,7 @@
    • Function index
    • Modules
    • Namespaces
    • -
    • Global stuff
    • +
    • Global Declarations
    -- cgit v0.12 From 5903558f17a7a3173ad7a592892262bf297b52f2 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 8 Jul 2010 13:43:57 +0200 Subject: qdoc: Fixed broken QML property links. Task-number: QTBUG-12038 --- tools/qdoc3/htmlgenerator.cpp | 2 +- tools/qdoc3/node.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 567a297..5a8fb86 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -2949,7 +2949,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, static const QString headerTag("headerfile"); static const QString funcTag("func"); static const QString linkTag("link"); - + // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*()" bool done = false; for (int i = 0, srcSize = src.size(); i < srcSize;) { diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index b077074..da62e29 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -299,7 +299,7 @@ InnerNode::~InnerNode() Node *InnerNode::findNode(const QString& name) { Node *node = childMap.value(name); - if (node) + if (node && node->subType() != QmlPropertyGroup) return node; if ((type() == Fake) && (subType() == QmlClass)) { for (int i=0; i Date: Thu, 8 Jul 2010 14:55:17 +0200 Subject: Doc: Correcting img bug Task-number: QTBUG-12028 --- doc/src/template/style/style.css | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index f7ff00a..5144020 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -18,7 +18,6 @@ fieldset, img { border: 0; - width:100% } address, caption, cite, code, dfn, em, strong, th, var, optgroup { -- cgit v0.12 From 48469ecd3f2918d16ccfacb5d65f3a5e0bbfa8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Thu, 8 Jul 2010 15:19:04 +0200 Subject: The Q_WGL define was removed years ago. The proper define should be Q_WS_WIN. Task-number: QTBUG-12040 Reviewed-by: Prasanth Reviewed-by: Eskil --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index c294e4f..0521bab 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -3447,7 +3447,7 @@ QGLWidget::~QGLWidget() bool doRelease = (glcx && glcx->windowCreated()); #endif delete d->glcx; -#if defined(Q_WGL) +#if defined(Q_WS_WIN) delete d->olcx; #endif #if defined(GLX_MESA_release_buffers) && defined(QGL_USE_MESA_EXT) -- cgit v0.12 From c69dc51e5e03aaa87a9385f5557a4f6b8aaeded3 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Thu, 8 Jul 2010 15:28:24 +0200 Subject: Corrected paths Merge-request: 715 Reviewed-by: Oswald Buddenhagen --- src/sql/drivers/drivers.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sql/drivers/drivers.pri b/src/sql/drivers/drivers.pri index 3af5525..87cc0b1 100644 --- a/src/sql/drivers/drivers.pri +++ b/src/sql/drivers/drivers.pri @@ -1,11 +1,11 @@ contains(sql-drivers, all):sql-driver += psql mysql odbc oci tds db2 sqlite ibase -contains(sql-drivers, psql):include($$PWD/sqlite/qsql_psql.pri) +contains(sql-drivers, psql):include($$PWD/psql/qsql_psql.pri) contains(sql-drivers, mysql):include($$PWD/mysql/qsql_mysql.pri) contains(sql-drivers, odbc):include($$PWD/odbc/qsql_odbc.pri) contains(sql-drivers, oci):include($$PWD/oci/qsql_oci.pri) contains(sql-drivers, tds):include($$PWD/tds/qsql_tds.pri) contains(sql-drivers, db2):include($$PWD/db2/qsql_db2.pri) -contains(sql-drivers, ibase):include($$PWD/db2/qsql_ibase.pri) +contains(sql-drivers, ibase):include($$PWD/ibase/qsql_ibase.pri) contains(sql-drivers, sqlite2):include($$PWD/sqlite2/qsql_sqlite2.pri) contains(sql-drivers, sqlite):include($$PWD/sqlite/qsql_sqlite.pri) -- cgit v0.12 From c48eb6d5d0a299449330dea8a6a59514942c8781 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 8 Jul 2010 15:27:14 +0200 Subject: Initalize the nativeDialogInUse variable When the variable was not initalized it would randomly show a native font dialog or a non native one if the DontUseNativeDialogs flag was set. Task-number: QTBUG-12042 Reviewed-by: cduclos --- src/gui/dialogs/qfontdialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index a4bf15d..e9e3f23 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -332,6 +332,7 @@ void QFontDialogPrivate::init() #ifdef Q_WS_MAC delegate = 0; + nativeDialogInUse = false; #endif } -- cgit v0.12 From aba1572d588396d3c9e29192ae86047b5b10070a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 8 Jul 2010 20:58:46 +0200 Subject: Doc: Fixed incorrect QML property type. Reviewed-by: Trust Me --- src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp index 0342c9f..9dcba60 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -612,7 +612,7 @@ QAction* QDeclarativeWebView::stopAction() const #endif // QT_NO_ACTION /*! - \qmlproperty real WebView::title + \qmlproperty string WebView::title This property holds the title of the web page currently viewed By default, this property contains an empty string. -- cgit v0.12 From 7787b548907add8b7c2ac642d161181070050ea4 Mon Sep 17 00:00:00 2001 From: ck Date: Fri, 9 Jul 2010 11:16:28 +0200 Subject: qhelpgenerator: Fix namespace syntax checking. --- tools/assistant/lib/qhelpprojectdata.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/assistant/lib/qhelpprojectdata.cpp b/tools/assistant/lib/qhelpprojectdata.cpp index b0faf0c..5247847 100644 --- a/tools/assistant/lib/qhelpprojectdata.cpp +++ b/tools/assistant/lib/qhelpprojectdata.cpp @@ -327,10 +327,12 @@ bool QHelpProjectDataPrivate::hasValidSyntax(const QString &nameSpace, QUrl url; const QLatin1String scheme("qthelp"); url.setScheme(scheme); - url.setHost(nameSpace); + const QString canonicalNamespace = nameSpace.toLower(); + url.setHost(canonicalNamespace); url.setPath(vFolder); - const QString expectedUrl(scheme + QLatin1String("://") + nameSpace + slash + vFolder); + const QString expectedUrl(scheme + QLatin1String("://") + + canonicalNamespace + slash + vFolder); return url.isValid() && url.toString() == expectedUrl; } -- cgit v0.12 From e0a102ee171ddcebb1104d98d8a4ff4993e91c1d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 9 Jul 2010 11:28:24 +0200 Subject: qdoc: Marked some missing declarative properties and functions as \internal. --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 60 +++++++++++----------- src/declarative/qml/qdeclarativeengine.cpp | 4 +- tools/qdoc3/test/qt-cpp-ignore.qdocconf | 3 +- 3 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 4abffc6..70874f2 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1388,26 +1388,6 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec */ /*! - \property QDeclarativeItem::baseline - \internal -*/ - -/*! - \property QDeclarativeItem::focus - \internal -*/ - -/*! - \property QDeclarativeItem::wantsFocus - \internal -*/ - -/*! - \property QDeclarativeItem::transformOrigin - \internal -*/ - -/*! \fn void QDeclarativeItem::childrenRectChanged(const QRectF &) \internal */ @@ -1970,6 +1950,9 @@ QVariant QDeclarativeItem::inputMethodQuery(Qt::InputMethodQuery query) const return v; } +/*! + \internal + */ void QDeclarativeItem::keyPressPreHandler(QKeyEvent *event) { Q_D(QDeclarativeItem); @@ -1980,6 +1963,9 @@ void QDeclarativeItem::keyPressPreHandler(QKeyEvent *event) d->doneEventPreHandler = true; } +/*! + \internal + */ void QDeclarativeItem::keyReleasePreHandler(QKeyEvent *event) { Q_D(QDeclarativeItem); @@ -1990,6 +1976,9 @@ void QDeclarativeItem::keyReleasePreHandler(QKeyEvent *event) d->doneEventPreHandler = true; } +/*! + \internal + */ void QDeclarativeItem::inputMethodPreHandler(QInputMethodEvent *event) { Q_D(QDeclarativeItem); @@ -2000,7 +1989,6 @@ void QDeclarativeItem::inputMethodPreHandler(QInputMethodEvent *event) d->doneEventPreHandler = true; } - /*! \internal */ @@ -2539,11 +2527,6 @@ QDeclarativeListProperty QDeclarativeItemPrivate::transi \sa {qmlstates}{States} */ -/*! - \property QDeclarativeItem::state - \internal -*/ - /*! \internal */ QString QDeclarativeItemPrivate::state() const { @@ -2566,11 +2549,6 @@ void QDeclarativeItemPrivate::setState(const QString &state) For more information see \l Transform. */ -/*! - \property QDeclarativeItem::transform - \internal -*/ - /*! \internal */ QDeclarativeListProperty QDeclarativeItem::transform() { @@ -2859,6 +2837,26 @@ void QDeclarativeItem::setSmooth(bool smooth) } /*! + \property QDeclarativeItem::focus + \internal +*/ + +/*! + \property QDeclarativeItem::transform + \internal +*/ + +/*! + \property QDeclarativeItem::transformOrigin + \internal +*/ + +/*! + \property QDeclarativeItem::wantsFocus + \internal +*/ + +/*! \internal Return the width of the item */ diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 036c854..1ce668c 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1077,7 +1077,7 @@ If you are certain the files will be local, you could simplify to: \snippet doc/src/snippets/declarative/componentCreation.js 2 To create a QML object from an arbitrary string of QML (instead of a file), -use \l{Qt::createQmlObject()}{Qt.createQmlObject()}. +use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}. */ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QScriptEngine *engine) @@ -1124,7 +1124,7 @@ Each object in this array has the members \c lineNumber, \c columnNumber, \c fil Note that this function returns immediately, and therefore may not work if the \a qml string loads new components (that is, external QML files that have not yet been loaded). -If this is the case, consider using \l{Qt::createComponent()}{Qt.createComponent()} instead. +If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createComponent()} instead. */ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine) diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf index dcf33dc..8cc4fd9 100644 --- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf +++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf @@ -90,4 +90,5 @@ Cpp.ignoredirectives = Q_DECLARE_HANDLE \ __attribute__ \ K_DECLARE_PRIVATE \ PHONON_OBJECT \ - PHONON_HEIR + PHONON_HEIR \ + Q_PRIVATE_PROPERTY -- cgit v0.12 From 8079d2951419a983df7b83cfa31f00665c3e76a3 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 9 Jul 2010 11:52:06 +0200 Subject: Fix a couple of memory leaks due to not releasing CFTypes on Mac Reviewed-by: Prasanth Ullattil --- src/corelib/io/qfsfileengine_unix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 33e00f6..76a3512 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1017,7 +1017,7 @@ QString QFSFileEngine::fileName(FileName file) const #if !defined(QWS) && defined(Q_OS_MAC) QCFType url = CFURLCreateWithFileSystemPath(0, QCFString(d->filePath), kCFURLPOSIXPathStyle, true); - if (CFDictionaryRef dict = CFBundleCopyInfoDictionaryForURL(url)) { + if (QCFType dict = CFBundleCopyInfoDictionaryForURL(url)) { if (CFTypeRef name = (CFTypeRef)CFDictionaryGetValue(dict, kCFBundleNameKey)) { if (CFGetTypeID(name) == CFStringGetTypeID()) return QCFString::toQString((CFStringRef)name); @@ -1135,7 +1135,7 @@ QString QFSFileEngine::fileName(FileName file) const if (FSResolveAliasFile(&fref, true, &isFolder, &isAlias) == noErr && isAlias) { AliasHandle alias; if (FSNewAlias(0, &fref, &alias) == noErr && alias) { - CFStringRef cfstr; + QCFString cfstr; if (FSCopyAliasInfo(alias, 0, 0, &cfstr, 0, 0) == noErr) return QCFString::toQString(cfstr); } -- cgit v0.12 From 3b0a4bcf854e1d63b947e3f1690748850d416a6f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 9 Jul 2010 12:07:20 +0200 Subject: doc: Fixed last of the declarative/QML qdoc warnings. --- doc/src/declarative/advtutorial.qdoc | 24 ++++++++++++++-------- .../graphicsitems/qdeclarativeloader.cpp | 7 +++---- .../graphicsitems/qdeclarativetextedit.cpp | 5 +++-- src/declarative/util/qdeclarativexmllistmodel.cpp | 2 +- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 9c72e95..740f6f9 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -164,14 +164,22 @@ The \c createBlock() function creates a block from the \c Block.qml file and moves the new block to its position on the game canvas. This involves several steps: \list -\o \l {Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml. - If the component is ready, we can call \c createObject() to create an instance of the \c Block item. -\o If \c createObject() returned null (i.e. if there was an error while - loading the object), print the error information. -\o Place the block in its position on the board and set its width and height. - Also, store it in the blocks array for future reference. -\o Finally, print error information to the console if the component could not be - loaded for some reason (for example, if the file is missing). + +\o \l {QML:Qt::createComponent()}{Qt.createComponent()} is called to + generate an element from \c Block.qml. If the component is ready, + we can call \c createObject() to create an instance of the \c Block + item. + +\o If \c createObject() returned null (i.e. if there was an error + while loading the object), print the error information. + +\o Place the block in its position on the board and set its width and + height. Also, store it in the blocks array for future reference. + +\o Finally, print error information to the console if the component + could not be loaded for some reason (for example, if the file is + missing). + \endlist diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index c8c9e44..cc7f8e5 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -118,9 +118,9 @@ void QDeclarativeLoaderPrivate::initResize() be instantiated may be specified directly by the \l sourceComponent property, or loaded from a URL via the \l source property. - Loader can be used to delay the creation of a component until it is required. - For example, this loads "Page1.qml" as a component into the \l Loader element - when the \l MouseArea is clicked: + Loader can be used to delay the creation of a component until it + is required. For example, this loads "Page1.qml" as a component + into the Loader element, when the \l MouseArea is clicked: \code import Qt 4.7 @@ -165,7 +165,6 @@ void QDeclarativeLoaderPrivate::initResize() /*! \internal \class QDeclarativeLoader - \qmlclass Loader */ /*! diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index c6566ff..3f179da 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -202,8 +202,9 @@ QString QDeclarativeTextEdit::text() const Sets the font size in pixels. - Using this function makes the font device dependent. - Use \l pointSize to set the size of the font in a device independent manner. + Using this function makes the font device dependent. Use + \l{TextEdit::font.pointSize} to set the size of the font in a + device independent manner. */ /*! diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 0692aaa..8ed34ab 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -589,7 +589,7 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty Date: Fri, 9 Jul 2010 12:18:18 +0200 Subject: Doc: Adding support for Qt Creator style Adding a variable to the qdocconf file will now generate the docs in Creator format Reviewed-by: Martin Smith --- tools/qdoc3/config.h | 1 + tools/qdoc3/htmlgenerator.cpp | 18 ++++++++++++++++-- tools/qdoc3/htmlgenerator.h | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index c29becc..af58a3f 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -143,6 +143,7 @@ class Config #define CONFIG_NATURALLANGUAGE "naturallanguage" #define CONFIG_OBSOLETELINKS "obsoletelinks" #define CONFIG_ONLINE "online" +#define CONFIG_CREATOR "creator" #define CONFIG_OUTPUTDIR "outputdir" #define CONFIG_OUTPUTENCODING "outputencoding" #define CONFIG_OUTPUTLANGUAGE "outputlanguage" diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index c1e01d7..16b45d6 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -214,6 +214,7 @@ HtmlGenerator::HtmlGenerator() numTableRows(0), threeColumnEnumValueTable(true), offlineDocs(true), + creatorDocs(false), funcLeftParen("\\S(\\()"), myTree(0), slow(false), @@ -276,6 +277,7 @@ void HtmlGenerator::initializeGenerator(const Config &config) project = config.getString(CONFIG_PROJECT); offlineDocs = !config.getBool(CONFIG_ONLINE); + creatorDocs = !config.getBool(CONFIG_CREATOR); projectDescription = config.getString(CONFIG_DESCRIPTION); if (projectDescription.isEmpty() && !project.isEmpty()) projectDescription = project + " Reference Documentation"; @@ -1775,9 +1777,17 @@ void HtmlGenerator::generateHeader(const QString& title, // Setting assistant configuration if (offlineDocs) { - // out() << " "; // Only for Qt Creator + out() << " "; // Only for Qt Creator out() << "\n"; - out() << "\n"; // offline for Creator and Assistant + //out() << "\n"; // offline for Assistant + out() << "\n"; // offline for Creator + } + if (creatorDocs) + { + out() << " "; // Only for Qt Creator + out() << "\n"; + //out() << "\n"; // offline for Assistant + out() << "\n"; // offline for Creator } // Setting online doc configuration else @@ -1847,6 +1857,10 @@ void HtmlGenerator::generateFooter(const Node *node) { out() << "\n"; } + if (creatorDocs) + { + out() << "\n"; + } else { out() << " \n"; diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 9c5be15..abfca60 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -288,6 +288,7 @@ class HtmlGenerator : public PageGenerator int numTableRows; bool threeColumnEnumValueTable; bool offlineDocs; + bool creatorDocs; QString link; QStringList sectionNumber; QRegExp funcLeftParen; -- cgit v0.12 From bf791d9beffe766bec954cb70495d13f773dc733 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 9 Jul 2010 12:43:12 +0200 Subject: doc: Fixed several qdoc warnings. --- doc/src/examples/trafficinfo.qdoc | 2 +- .../frameworks-technologies/model-view-programming.qdoc | 16 ++++++++-------- src/corelib/kernel/qabstractitemmodel.cpp | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/src/examples/trafficinfo.qdoc b/doc/src/examples/trafficinfo.qdoc index fe69d52..bc06178 100644 --- a/doc/src/examples/trafficinfo.qdoc +++ b/doc/src/examples/trafficinfo.qdoc @@ -145,5 +145,5 @@ The rest of the code in this example is just for representing the time and station information to the user, and uses techniques described in the - \l{Widgets Examples}. + \l{Widget Examples}. */ diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc index 94b9f0d..6c38060 100644 --- a/doc/src/frameworks-technologies/model-view-programming.qdoc +++ b/doc/src/frameworks-technologies/model-view-programming.qdoc @@ -900,7 +900,7 @@ after its application through the use of certain types of selection commands. These are discussed later in this section. - \section3 Current item & selected items + \section3 Current item and selected items In a view, there is always a current item and a selected item - two independent states. An item can be the current item and selected at the @@ -1257,7 +1257,7 @@ reimplement the \l{QAbstractItemModel::columnCount()}{columnCount()} function. - \section3 Model headers & data + \section3 Model headers and data For items in the view, we want to return the strings in the string list. The \l{QAbstractItemModel::data()}{data()} function is responsible for @@ -1350,7 +1350,7 @@ \snippet doc/src/snippets/stringlistmodel/model.cpp 1 - \section3 Inserting & removing rows + \section3 Inserting and removing rows It is possible to change the number of rows and columns in a model. In the string list model it only makes sense to change the number of rows, so we @@ -1634,7 +1634,7 @@ contain the text given in the search string. This pattern can also be used in the list and table widgets. - \section1 Using drag & drop with item views + \section1 Using drag & drop with item views Qt's drag and drop infrastructure is fully supported by the model/view framework. Items in lists, tables, and trees can be dragged within the views, and data can be @@ -1714,7 +1714,7 @@ of QAbstractItemModel::removeRows(), either directly or by inheriting the implementation from its base class. - \section3 Enabling drag & drop for items + \section3 Enabling drag & drop for items Models indicate to views which items can be dragged, and which will accept drops, by reimplementing the QAbstractItemModel::flags() function to provide suitable @@ -2124,12 +2124,12 @@ children may be displayed incorrectly in some views until the user attempts to view the non-existent child items. - \section2 Navigation & model index creation + \section2 Navigation and model index creation Hierarchical models need to provide functions that views can call to navigate the tree-like structures they expose, and obtain model indexes for items. - \section3 Parents & children + \section3 Parents and children Since the structure exposed to views is determined by the underlying data structure, it is up to each model subclass to create its own model indexes @@ -2153,7 +2153,7 @@ models to supply some unique identifier to this function to ensure that the model index can be re-associated with its corresponding item later on. - \section2 Drag & drop support and MIME type handling + \section2 Drag & drop support and MIME type handling The model/view classes support drag and drop operations, providing default behavior that is sufficient for many applications. However, it is also possible to customize diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 8415259..464a91c 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1197,7 +1197,7 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, \l{QAbstractItemModel::}{endInsertRows()} must be called. \sa {Model Classes}, {Model Subclassing Reference}, QModelIndex, - QAbstractItemView, {Using Drag and Drop with Item Views}, + QAbstractItemView, {Using drag & drop with item views}, {Simple DOM Model Example}, {Simple Tree Model Example}, {Editable Tree Model Example}, {Fetch More Example} */ @@ -1761,7 +1761,7 @@ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const where to place the data. This can occur in a tree when data is dropped on a parent. Models will usually append the data to the parent in this case. - \sa supportedDropActions(), {Using Drag and Drop with Item Views} + \sa supportedDropActions(), {Using drag & drop with item views} */ bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) @@ -1798,8 +1798,8 @@ bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti reimplement the dropMimeData() function to handle the additional operations. - \sa dropMimeData(), Qt::DropActions, {Using Drag and Drop with Item - Views} + \sa dropMimeData(), Qt::DropActions, {Using drag & drop with item + views} */ Qt::DropActions QAbstractItemModel::supportedDropActions() const { @@ -1815,7 +1815,7 @@ Qt::DropActions QAbstractItemModel::supportedDropActions() const supportedDragActions() is used by QAbstractItemView::startDrag() as the default values when a drag occurs. - \sa Qt::DropActions, {Using Drag and Drop with Item Views} + \sa Qt::DropActions, {Using drag & drop with item views} */ Qt::DropActions QAbstractItemModel::supportedDragActions() const { @@ -1831,7 +1831,7 @@ Qt::DropActions QAbstractItemModel::supportedDragActions() const Sets the supported drag \a actions for the items in the model. - \sa supportedDragActions(), {Using Drag and Drop with Item Views} + \sa supportedDragActions(), {Using drag & drop with item views} */ void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions) { -- cgit v0.12 From 630af9571cd65e4c74f682c401d791e2a1436d13 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 9 Jul 2010 13:06:10 +0200 Subject: doc: Fixed several qdoc warnings. --- src/gui/graphicsview/qgraphicsitem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 51dc543..74c51f4 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -133,7 +133,8 @@ \img graphicsview-parentchild.png - \section1 Transformation + \target Transformations + \section1 Transformations QGraphicsItem supports projective transformations in addition to its base position, pos(). There are several ways to change an item's transformation. -- cgit v0.12 From a168d8dbeb3eed11cb0ae373d9076f34216155bb Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 9 Jul 2010 13:14:21 +0200 Subject: doc: Fixed several qdoc warnings. --- doc/src/examples/movie.qdoc | 4 ++-- doc/src/frameworks-technologies/phonon.qdoc | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/examples/movie.qdoc b/doc/src/examples/movie.qdoc index 733f52d..4d7b3e0 100644 --- a/doc/src/examples/movie.qdoc +++ b/doc/src/examples/movie.qdoc @@ -30,8 +30,8 @@ \title Movie Example The Movie example demonstrates how to use QMovie and QLabel to - display animations. Now that Qt comes with \l{Phonon - Overview}{Phonon} (the multimedia framework), QMovie is mostly + display animations. Now that Qt comes with the \l{Phonon multimedia + framework} {Phonon multimedia framework}, QMovie is mostly useful if one wants to play a simple animation without the added complexity of a multimedia framework to install and deploy. diff --git a/doc/src/frameworks-technologies/phonon.qdoc b/doc/src/frameworks-technologies/phonon.qdoc index 023b4ce..5119638 100644 --- a/doc/src/frameworks-technologies/phonon.qdoc +++ b/doc/src/frameworks-technologies/phonon.qdoc @@ -34,6 +34,7 @@ \tableofcontents + \target Phonon Overview \section1 Introduction Qt uses the Phonon multimedia framework to provide functionality -- cgit v0.12 From 3b2e680b5f56227af0716b3bc07b11cb7e044d78 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 9 Jul 2010 13:16:48 +0200 Subject: doc: Fixed several qdoc warnings. --- doc/src/frameworks-technologies/model-view-programming.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc index 6c38060..131f063 100644 --- a/doc/src/frameworks-technologies/model-view-programming.qdoc +++ b/doc/src/frameworks-technologies/model-view-programming.qdoc @@ -2282,7 +2282,7 @@ \endlist For more information about drag and drop with item views, refer to - \l{Using Drag and Drop with Item Views}. + \l{Using drag & drop with item views}. \section3 Convenience views @@ -2293,7 +2293,7 @@ the existing contents with the data being transferred, the underlying model will set the data of the target items rather than insert new rows and columns into the model. For more information on drag and drop in convenience views, - you can see \l{Using Drag and Drop with Item Views}. + you can see \l{Using drag & drop with item views}. \section2 Performance optimization for large amounts of data -- cgit v0.12 From ad0e8a48eade0b2cdcf10a68f36d911784ff03ab Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 9 Jul 2010 13:25:50 +0200 Subject: doc: Fixed several qdoc warnings. --- doc/src/frameworks-technologies/dnd.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/frameworks-technologies/dnd.qdoc b/doc/src/frameworks-technologies/dnd.qdoc index 4a1b631..c5dd27c 100644 --- a/doc/src/frameworks-technologies/dnd.qdoc +++ b/doc/src/frameworks-technologies/dnd.qdoc @@ -45,7 +45,7 @@ outlines the approach used to enable it in custom widgets. Drag and drop operations are also supported by Qt's item views and by the graphics view framework. More information is available in - \l{Using Drag and Drop with Item Views} and \l{Graphics View + \l{Using drag & drop with item views} and \l{Graphics View Framework}. \section1 Drag and Drop Classes -- cgit v0.12 From 230ab8adb281aabc2d0ebf41ade5f2ec7f11e020 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 9 Jul 2010 10:11:13 +0200 Subject: Revert "SSL backend: load libraries for certificates only once" This reverts commit f2187e31de13a6ab8631a9067487dab555f7c2e7. Reviewed-by: Markus Goetz --- src/network/ssl/qsslsocket.cpp | 6 ++--- src/network/ssl/qsslsocket_openssl.cpp | 42 ++++++++++++++++------------------ src/network/ssl/qsslsocket_p.h | 11 +++++---- 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 809e8aa..f85fa84 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1849,7 +1849,7 @@ QList QSslSocketPrivate::defaultCiphers() */ QList QSslSocketPrivate::supportedCiphers() { - QSslSocketPrivate::ensureCertsAndCiphersLoaded(); + QSslSocketPrivate::ensureInitialized(); QMutexLocker locker(&globalData()->mutex); return globalData()->supportedCiphers; } @@ -1879,7 +1879,7 @@ void QSslSocketPrivate::setDefaultSupportedCiphers(const QList &ciph */ QList QSslSocketPrivate::defaultCaCertificates() { - QSslSocketPrivate::ensureCertsAndCiphersLoaded(); + QSslSocketPrivate::ensureInitialized(); QMutexLocker locker(&globalData()->mutex); return globalData()->config->caCertificates; } @@ -1962,7 +1962,7 @@ void QSslConfigurationPrivate::setDefaultConfiguration(const QSslConfiguration & */ void QSslConfigurationPrivate::deepCopyDefaultConfiguration(QSslConfigurationPrivate *ptr) { - QSslSocketPrivate::ensureCertsAndCiphersLoaded(); + QSslSocketPrivate::ensureInitialized(); QMutexLocker locker(&globalData()->mutex); const QSslConfigurationPrivate *global = globalData()->config.constData(); diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index b602b29..d7088ee 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -74,9 +74,8 @@ QT_BEGIN_NAMESPACE -bool QSslSocketPrivate::s_initialized = false; -QBasicAtomicInt QSslSocketPrivate::s_CertsAndCiphersLoaded; -Q_GLOBAL_STATIC(QMutex, s_CertsAndCiphersLoadedMutex); +bool QSslSocketPrivate::s_libraryLoaded = false; +bool QSslSocketPrivate::s_loadedCiphersAndCerts = false; // Useful defines #define SSL_ERRORSTR() QString::fromLocal8Bit(q_ERR_error_string(q_ERR_get_error(), NULL)) @@ -171,7 +170,7 @@ QSslSocketBackendPrivate::QSslSocketBackendPrivate() session(0) { // Calls SSL_library_init(). - ensureCertsAndCiphersLoaded(); + ensureInitialized(); } QSslSocketBackendPrivate::~QSslSocketBackendPrivate() @@ -422,18 +421,18 @@ void QSslSocketPrivate::deinitialize() bool QSslSocketPrivate::supportsSsl() { - return ensureInitialized(); + return ensureLibraryLoaded(); } -bool QSslSocketPrivate::ensureInitialized() +bool QSslSocketPrivate::ensureLibraryLoaded() { if (!q_resolveOpenSslSymbols()) return false; // Check if the library itself needs to be initialized. QMutexLocker locker(openssl_locks()->initLock()); - if (!s_initialized) { - s_initialized = true; + if (!s_libraryLoaded) { + s_libraryLoaded = true; // Initialize OpenSSL. q_CRYPTO_set_id_callback(id_function); @@ -474,6 +473,16 @@ bool QSslSocketPrivate::ensureInitialized() return true; } +void QSslSocketPrivate::ensureCiphersAndCertsLoaded() +{ + if (s_loadedCiphersAndCerts) + return; + s_loadedCiphersAndCerts = true; + + resetDefaultCiphers(); + setDefaultCaCertificates(systemCaCertificates()); +} + /*! \internal @@ -481,18 +490,13 @@ bool QSslSocketPrivate::ensureInitialized() been initialized. */ -void QSslSocketPrivate::ensureCertsAndCiphersLoaded() +void QSslSocketPrivate::ensureInitialized() { - // use double-checked locking to speed up this function - if (s_CertsAndCiphersLoaded) + if (!supportsSsl()) return; - QMutexLocker locker(s_CertsAndCiphersLoadedMutex()); - if (s_CertsAndCiphersLoaded) - return; + ensureCiphersAndCertsLoaded(); - if (!supportsSsl()) - return; //load symbols needed to receive certificates from system store #if defined(Q_OS_MAC) QLibrary securityLib("/System/Library/Frameworks/Security.framework/Versions/Current/Security"); @@ -528,12 +532,6 @@ void QSslSocketPrivate::ensureCertsAndCiphersLoaded() qWarning("could not load crypt32 library"); // should never happen } #endif - resetDefaultCiphers(); - setDefaultCaCertificates(systemCaCertificates()); - // we need to make sure that s_CertsAndCiphersLoaded is executed after the library loading above - // (the compiler/processor might reorder instructions otherwise) - if (!s_CertsAndCiphersLoaded.testAndSetRelease(0, 1)) - Q_ASSERT_X(false, "certificate store", "certificate store has already been initialized!"); } /*! diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index b474175..72b3ef7 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -63,7 +63,6 @@ #include #include -#include QT_BEGIN_NAMESPACE @@ -114,8 +113,7 @@ public: QString verificationPeerName; static bool supportsSsl(); - static bool ensureInitialized(); - static void ensureCertsAndCiphersLoaded(); + static void ensureInitialized(); static void deinitialize(); static QList defaultCiphers(); static QList supportedCiphers(); @@ -163,8 +161,11 @@ public: virtual QSslCipher sessionCipher() const = 0; private: - static bool s_initialized; - static QBasicAtomicInt s_CertsAndCiphersLoaded; + static bool ensureLibraryLoaded(); + static void ensureCiphersAndCertsLoaded(); + + static bool s_libraryLoaded; + static bool s_loadedCiphersAndCerts; }; QT_END_NAMESPACE -- cgit v0.12 From b1a52a071e3741d46df5c45423c6654d517ac4c2 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 9 Jul 2010 10:44:59 +0200 Subject: SSL library loading: load system libs only once ... and make the loading thread-safe. The global methods for loading the OpenSSL libraries and the system libraries are accessed from within different QSslSocket and QSslConfiguration instances, so they need to be thread-safe. Reviewed-by: Markus Goetz --- src/network/ssl/qsslsocket_openssl.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index d7088ee..b537582 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -475,27 +475,12 @@ bool QSslSocketPrivate::ensureLibraryLoaded() void QSslSocketPrivate::ensureCiphersAndCertsLoaded() { + QMutexLocker locker(openssl_locks()->initLock()); if (s_loadedCiphersAndCerts) return; s_loadedCiphersAndCerts = true; resetDefaultCiphers(); - setDefaultCaCertificates(systemCaCertificates()); -} - -/*! - \internal - - Declared static in QSslSocketPrivate, makes sure the SSL libraries have - been initialized. -*/ - -void QSslSocketPrivate::ensureInitialized() -{ - if (!supportsSsl()) - return; - - ensureCiphersAndCertsLoaded(); //load symbols needed to receive certificates from system store #if defined(Q_OS_MAC) @@ -532,6 +517,22 @@ void QSslSocketPrivate::ensureInitialized() qWarning("could not load crypt32 library"); // should never happen } #endif + setDefaultCaCertificates(systemCaCertificates()); +} + +/*! + \internal + + Declared static in QSslSocketPrivate, makes sure the SSL libraries have + been initialized. +*/ + +void QSslSocketPrivate::ensureInitialized() +{ + if (!supportsSsl()) + return; + + ensureCiphersAndCertsLoaded(); } /*! -- cgit v0.12 From 8e1edcd846a46cf55f2f198d3b959498b58fe352 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 9 Jul 2010 13:58:17 +0200 Subject: doc: Fixed several qdoc warnings. --- src/gui/text/qtextoption.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp index 8f31e46..9eeec0b 100644 --- a/src/gui/text/qtextoption.cpp +++ b/src/gui/text/qtextoption.cpp @@ -392,7 +392,12 @@ QList QTextOption::tabs() const /*! \fn Tab::Tab(qreal pos, TabType tabType, QChar delim = QChar()) - Creates a tab with the given position, tab type, and (for DelimiterTab) delimiter + + Creates a tab with the given position, tab type, and delimiter + (\a pos, \a tabType, \a delim). + + \note \a delim is only used when \a tabType is DelimiterTab. + \since 4.7 */ -- cgit v0.12 From 3e326e54856b1fce33ab2c005de2a46af6a4ea0f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 9 Jul 2010 13:59:56 +0200 Subject: Doc: Removed accidentally committed file. Reviewed-by: Trust Me --- examples/tutorials/modelview/._.DS_Store | Bin 4096 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 examples/tutorials/modelview/._.DS_Store diff --git a/examples/tutorials/modelview/._.DS_Store b/examples/tutorials/modelview/._.DS_Store deleted file mode 100755 index 338bd7b..0000000 Binary files a/examples/tutorials/modelview/._.DS_Store and /dev/null differ -- cgit v0.12 From 5f2437ae9a11c360139599b4d4b01270cd276a52 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 9 Jul 2010 14:08:30 +0200 Subject: doc: Fixed several qdoc warnings. --- src/corelib/kernel/qabstractitemmodel.cpp | 4 ++-- src/gui/itemviews/qabstractitemview.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 464a91c..e3fce18 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -2547,7 +2547,7 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star For example, as shown in the diagram, we move three rows from row 2 to 4 in the source, so \a sourceFirst is 2 and \a sourceLast is 4. - We move those items to above row 2 in the destination, so \a destinationRow is 2. + We move those items to above row 2 in the destination, so \a destinationChild is 2. \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 6 @@ -2558,7 +2558,7 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star \o To append rows to another parent, move them to after the last row. For example, as shown in the diagram, we move three rows to a - collection of 6 existing rows (ending in row 5), so \a destinationStart is 6: + collection of 6 existing rows (ending in row 5), so \a destinationChild is 6: \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 7 diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 4fb93fc..97499f3 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1363,7 +1363,7 @@ bool QAbstractItemView::dragEnabled() const Note that the model used needs to provide support for drag and drop operations. - \sa setDragDropMode() {Using Drag and Drop with Item Views} + \sa setDragDropMode() {Using drag & drop with item views} */ /*! -- cgit v0.12 From 653f180d4697e0c7ec1c58022622d5d140e7fda8 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Fri, 9 Jul 2010 14:33:16 +0200 Subject: Doc: fixing examples link --- doc/src/index.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 42fd4fc..92721c5 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -44,7 +44,7 @@
  • Installation & first steps
  • How to learn Qt
  • Tutorials
  • -
  • Examples
  • +
  • Examples
  • Whats new in Qt 4.7
  • -- cgit v0.12 From 5f6018564668d368f75e431c4cdac88d7421cff0 Mon Sep 17 00:00:00 2001 From: "Richard J. Moore" Date: Sun, 6 Jun 2010 22:10:08 +0100 Subject: Fix handling of SSL certificates with wildcard domain names Merge-request: 731 Task-number: QTBUG-4455 Reviewed-by: Peter Hartmann --- src/network/ssl/qsslsocket_openssl.cpp | 42 +++++++++++++++++++++++++++++--- src/network/ssl/qsslsocket_openssl_p.h | 1 + tests/auto/qsslsocket/tst_qsslsocket.cpp | 24 ++++++++++++++++++ 3 files changed, 63 insertions(+), 4 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index b537582..fa70381 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1101,17 +1101,16 @@ bool QSslSocketBackendPrivate::startHandshake() QString peerName = (verificationPeerName.isEmpty () ? q->peerName() : verificationPeerName); QString commonName = configuration.peerCertificate.subjectInfo(QSslCertificate::CommonName); - QRegExp regexp(commonName, Qt::CaseInsensitive, QRegExp::Wildcard); - if (!regexp.exactMatch(peerName)) { + if (!isMatchingHostname(commonName.lower(), peerName.lower())) { bool matched = false; foreach (const QString &altName, configuration.peerCertificate .alternateSubjectNames().values(QSsl::DnsEntry)) { - regexp.setPattern(altName); - if (regexp.exactMatch(peerName)) { + if (isMatchingHostname(altName.lower(), peerName.lower())) { matched = true; break; } } + if (!matched) { // No matches in common names or alternate names. QSslError error(QSslError::HostNameMismatch, configuration.peerCertificate); @@ -1241,4 +1240,39 @@ QList QSslSocketBackendPrivate::STACKOFX509_to_QSslCertificates return certificates; } +bool QSslSocketBackendPrivate::isMatchingHostname(const QString &cn, const QString &hostname) +{ + int wildcard = cn.indexOf(QLatin1Char('*')); + + // Check this is a wildcard cert, if not then just compare the strings + if (wildcard < 0) + return cn == hostname; + + int firstCnDot = cn.indexOf(QLatin1Char('.')); + int secondCnDot = cn.indexOf(QLatin1Char('.'), firstCnDot+1); + + // Check at least 3 components + if ((-1 == secondCnDot) || (secondCnDot+1 >= cn.length())) + return false; + + // Check * is last character of 1st component (ie. there's a following .) + if (wildcard+1 != firstCnDot) + return false; + + // Check only one star + if (cn.lastIndexOf(QLatin1Char('*')) != wildcard) + return false; + + // Check characters preceding * (if any) match + if (wildcard && (hostname.leftRef(wildcard) != cn.leftRef(wildcard))) + return false; + + // Check characters following first . match + if (hostname.midRef(hostname.indexOf(QLatin1Char('.'))) != cn.midRef(firstCnDot)) + return false; + + // Ok, I guess this was a wildcard CN and the hostname matches. + return true; +} + QT_END_NAMESPACE diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h index e41320d..fd02838 100644 --- a/src/network/ssl/qsslsocket_openssl_p.h +++ b/src/network/ssl/qsslsocket_openssl_p.h @@ -116,6 +116,7 @@ public: static QSslCipher QSslCipher_from_SSL_CIPHER(SSL_CIPHER *cipher); static QList STACKOFX509_to_QSslCertificates(STACK_OF(X509) *x509); + Q_AUTOTEST_EXPORT static bool isMatchingHostname(const QString &cn, const QString &hostname); }; #if defined(Q_OS_SYMBIAN) diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 0cf638b..0c12974 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -55,6 +55,7 @@ #include #include "private/qhostinfo_p.h" +#include "private/qsslsocket_openssl_p.h" #include "../network-settings.h" @@ -163,6 +164,7 @@ private slots: void setDefaultCiphers(); void supportedCiphers(); void systemCaCertificates(); + void wildcardCertificateNames(); void wildcard(); void setEmptyKey(); void spontaneousWrite(); @@ -1063,6 +1065,28 @@ void tst_QSslSocket::systemCaCertificates() QCOMPARE(certs, QSslSocket::defaultCaCertificates()); } +void tst_QSslSocket::wildcardCertificateNames() +{ + // Passing CN matches + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("www.example.com"), QString("www.example.com")), true ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example.com"), QString("www.example.com")), true ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("xxx*.example.com"), QString("xxxwww.example.com")), true ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("f*.example.com"), QString("foo.example.com")), true ); + + // Failing CN matches + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("xxx.example.com"), QString("www.example.com")), false ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*"), QString("www.example.com")), false ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.*.com"), QString("www.example.com")), false ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example.com"), QString("baa.foo.example.com")), false ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("f*.example.com"), QString("baa.example.com")), false ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.com"), QString("example.com")), false ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*fail.com"), QString("example.com")), false ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example."), QString("www.example.")), false ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example."), QString("www.example")), false ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString(""), QString("www")), false ); + QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*"), QString("www")), false ); +} + void tst_QSslSocket::wildcard() { QSKIP("TODO: solve wildcard problem", SkipAll); -- cgit v0.12 From c50d351df3b7fe2f0d10444c1080b6a8c9833e0f Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Fri, 9 Jul 2010 15:21:03 +0200 Subject: Doc: fixing offline style --- tools/qdoc3/htmlgenerator.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 16b45d6..c8218dc 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -214,7 +214,7 @@ HtmlGenerator::HtmlGenerator() numTableRows(0), threeColumnEnumValueTable(true), offlineDocs(true), - creatorDocs(false), + creatorDocs(true), funcLeftParen("\\S(\\()"), myTree(0), slow(false), @@ -1777,17 +1777,15 @@ void HtmlGenerator::generateHeader(const QString& title, // Setting assistant configuration if (offlineDocs) { - out() << " "; // Only for Qt Creator + out() << " "; // Only for Qt Creator out() << "\n"; - //out() << "\n"; // offline for Assistant - out() << "\n"; // offline for Creator + out() << "\n"; // offline for Assistant } if (creatorDocs) { - out() << " "; // Only for Qt Creator + out() << " "; // Only for Qt Creator out() << "\n"; - //out() << "\n"; // offline for Assistant - out() << "\n"; // offline for Creator + out() << "\n"; // offline for Creator } // Setting online doc configuration else -- cgit v0.12 From 63171ddd8ec99d9af17e0adcc2cad61586fed42b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 9 Jul 2010 16:49:39 +0200 Subject: QFileIconProvider: Load icons on demand. Drawing icons is quite costly and mostly, only 'file' and 'directory' are required. Speeds up application startup considerably. Reviewed-by: Olivier Goffart --- src/gui/itemviews/qfileiconprovider.cpp | 71 +++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp index 5dbd1f0..4748f89 100644 --- a/src/gui/itemviews/qfileiconprovider.cpp +++ b/src/gui/itemviews/qfileiconprovider.cpp @@ -100,69 +100,80 @@ public: QIcon getMacIcon(const QFileInfo &fi) const; #endif QFileIconProvider *q_ptr; - QString homePath; + const QString homePath; private: - QIcon file; - QIcon fileLink; - QIcon directory; - QIcon directoryLink; - QIcon harddisk; - QIcon floppy; - QIcon cdrom; - QIcon ram; - QIcon network; - QIcon computer; - QIcon desktop; - QIcon trashcan; - QIcon generic; - QIcon home; + mutable QIcon file; + mutable QIcon fileLink; + mutable QIcon directory; + mutable QIcon directoryLink; + mutable QIcon harddisk; + mutable QIcon floppy; + mutable QIcon cdrom; + mutable QIcon ram; + mutable QIcon network; + mutable QIcon computer; + mutable QIcon desktop; + mutable QIcon trashcan; + mutable QIcon generic; + mutable QIcon home; }; -QFileIconProviderPrivate::QFileIconProviderPrivate() +QFileIconProviderPrivate::QFileIconProviderPrivate() : + homePath(QDir::home().absolutePath()) { - QStyle *style = QApplication::style(); - file = style->standardIcon(QStyle::SP_FileIcon); - directory = style->standardIcon(QStyle::SP_DirIcon); - fileLink = style->standardIcon(QStyle::SP_FileLinkIcon); - directoryLink = style->standardIcon(QStyle::SP_DirLinkIcon); - harddisk = style->standardIcon(QStyle::SP_DriveHDIcon); - floppy = style->standardIcon(QStyle::SP_DriveFDIcon); - cdrom = style->standardIcon(QStyle::SP_DriveCDIcon); - network = style->standardIcon(QStyle::SP_DriveNetIcon); - computer = style->standardIcon(QStyle::SP_ComputerIcon); - desktop = style->standardIcon(QStyle::SP_DesktopIcon); - trashcan = style->standardIcon(QStyle::SP_TrashIcon); - home = style->standardIcon(QStyle::SP_DirHomeIcon); - homePath = QDir::home().absolutePath(); } QIcon QFileIconProviderPrivate::getIcon(QStyle::StandardPixmap name) const { switch (name) { case QStyle::SP_FileIcon: + if (file.isNull()) + file = QApplication::style()->standardIcon(name); return file; case QStyle::SP_FileLinkIcon: + if (fileLink.isNull()) + fileLink = QApplication::style()->standardIcon(name); return fileLink; case QStyle::SP_DirIcon: + if (directory.isNull()) + directory = QApplication::style()->standardIcon(name); return directory; case QStyle::SP_DirLinkIcon: + if (directoryLink.isNull()) + directoryLink = QApplication::style()->standardIcon(name); return directoryLink; case QStyle::SP_DriveHDIcon: + if (harddisk.isNull()) + harddisk = QApplication::style()->standardIcon(name); return harddisk; case QStyle::SP_DriveFDIcon: + if (floppy.isNull()) + floppy = QApplication::style()->standardIcon(name); return floppy; case QStyle::SP_DriveCDIcon: + if (cdrom.isNull()) + cdrom = QApplication::style()->standardIcon(name); return cdrom; case QStyle::SP_DriveNetIcon: + if (network.isNull()) + network = QApplication::style()->standardIcon(name); return network; case QStyle::SP_ComputerIcon: + if (computer.isNull()) + computer = QApplication::style()->standardIcon(name); return computer; case QStyle::SP_DesktopIcon: + if (desktop.isNull()) + desktop = QApplication::style()->standardIcon(name); return desktop; case QStyle::SP_TrashIcon: + if (trashcan.isNull()) + trashcan = QApplication::style()->standardIcon(name); return trashcan; case QStyle::SP_DirHomeIcon: + if (home.isNull()) + home = QApplication::style()->standardIcon(name); return home; default: return QIcon(); -- cgit v0.12 From bd287865d2b57395a340e85f1fac9b7ddff3ec14 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 9 Jul 2010 16:59:04 +0200 Subject: QIODPLB: Sync behavior of ungetBlock() and ungetChar() ungetChar() supports ungetting data that didn't originate from the QIODevicePrivateLinearBuffer, so ungetBlock() should too. --- src/corelib/io/qiodevice_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h index 4a25562..1dd51ea 100644 --- a/src/corelib/io/qiodevice_p.h +++ b/src/corelib/io/qiodevice_p.h @@ -155,10 +155,10 @@ public: if ((first - buf) < size) { // underflow, the existing valid data needs to move to the end of the (potentially bigger) buffer makeSpace(len + size, freeSpaceAtStart); - memcpy(first - size, block, size); } first -= size; len += size; + memcpy(first, block, size); } private: -- cgit v0.12 From 1b98fbd82c7145c2f81292f8a1feb6cac74e775d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 9 Jul 2010 11:39:01 +0200 Subject: Add NTLMv2 authentication support to QAuthenticator. This also fixes a long-standing bug in handling usernames of type "domainname\username", typical of Windows domains, that didn't work with the previous NTLMv1 code. Patch by subcontractor. Task-number: QTBUG-9408, QTBUG-2421, QT-3248 Reviewed-By: Markus Goetz --- src/network/kernel/qauthenticator.cpp | 286 +++++++++++++++++++++++++++++++++- 1 file changed, 279 insertions(+), 7 deletions(-) diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index e4023c8..e7442c0 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -50,6 +50,8 @@ #include #include #include +#include + QT_BEGIN_NAMESPACE @@ -162,7 +164,18 @@ QString QAuthenticator::user() const void QAuthenticator::setUser(const QString &user) { detach(); - d->user = user; + + int separatorPosn = 0; + separatorPosn = user.indexOf(QLatin1String("\\")); + + if (separatorPosn == -1) { + //No domain name present + d->user = user; + } else { + //domain name is present + d->realm = user.left(separatorPosn); + d->user = user.mid(separatorPosn+1); + } } /*! @@ -264,16 +277,17 @@ void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header, switch(method) { case Basic: - realm = QString::fromLatin1(options.value("realm")); + if(realm.isEmpty()) + realm = QString::fromLatin1(options.value("realm")); if (user.isEmpty()) phase = Done; break; case Ntlm: // #### extract from header - realm.clear(); break; case DigestMd5: { - realm = QString::fromLatin1(options.value("realm")); + if(realm.isEmpty()) + realm = QString::fromLatin1(options.value("realm")); if (options.value("stale").toLower() == "true") phase = Start; if (user.isEmpty()) @@ -661,6 +675,20 @@ QByteArray QAuthenticatorPrivate::digestMd5Response(const QByteArray &challenge, */ #define NTLMSSP_NEGOTIATE_56 0x80000000 +/* + * AvId values + */ +#define AVTIMESTAMP 7 + +//#define NTLMV1_CLIENT + + +//************************Global variables*************************** + +const int blockSize = 64; //As per RFC2104 Block-size is 512 bits +const int nDigestLen = 16; //Trunctaion Length of the Hmac-Md5 digest +const quint8 respversion = 1; +const quint8 hirespversion = 1; /* usage: // fill up ctx with what we know. @@ -803,6 +831,7 @@ public: // extracted QString targetNameStr, targetInfoStr; + QByteArray targetInfoBuff; }; @@ -818,6 +847,7 @@ public: // extracted QByteArray lmResponseBuf, ntlmResponseBuf; QString domainStr, userStr, workstationStr, sessionKeyStr; + QByteArray v2Hash; }; @@ -899,7 +929,7 @@ static QString qStringFromUcs2Le(const QByteArray& src) return QString((const QChar *)src.data(), src.size()/2); } - +#ifdef NTLMV1_CLIENT static QByteArray qEncodeNtlmResponse(const QAuthenticatorPrivate *ctx, const QNtlmPhase2Block& ch) { QCryptographicHash md4(QCryptographicHash::Md4); @@ -941,7 +971,232 @@ static QByteArray qEncodeLmResponse(const QAuthenticatorPrivate *ctx, const QNtl hash.fill(0); return rc; } +#endif + +/********************************************************************* +* Function Name: qEncodeHmacMd5 +* Params: +* key: Type - QByteArray +* - It is the Authentication key +* message: Type - QByteArray +* - This is the actual message which will be encoded +* using HMacMd5 hash algorithm +* +* Return Value: +* hmacDigest: Type - QByteArray +* +* Description: +* This function will be used to encode the input message using +* HMacMd5 hash algorithm. +* +* As per the RFC2104 the HMacMd5 algorithm can be specified +* --------------------------------------- +* MD5(K XOR opad, MD5(K XOR ipad, text)) +* --------------------------------------- +* +*********************************************************************/ +QByteArray qEncodeHmacMd5(QByteArray &key, const QByteArray &message) +{ + Q_ASSERT_X(!(message.isEmpty()),"qEncodeHmacMd5", "Empty message check"); + Q_ASSERT_X(!(key.isEmpty()),"qEncodeHmacMd5", "Empty key check"); + + QCryptographicHash hash(QCryptographicHash::Md5); + QByteArray hMsg; + + QByteArray iKeyPad(blockSize, 0x36); + QByteArray oKeyPad(blockSize, 0x5c); + + hash.reset(); + // Adjust the key length to blockSize + + if(blockSize < key.length()) { + hash.addData(key); + key = hash.result(); //MD5 will always return 16 bytes length output + } + + //Key will be <= 16 or 20 bytes as hash function (MD5 or SHA hash algorithms) + //key size can be max of Block size only + key = key.leftJustified(blockSize,0,true); + + //iKeyPad, oKeyPad and key are all of same size "blockSize" + + //xor of iKeyPad with Key and store the result into iKeyPad + for(int i = 0; iv2Hash.size() == 0) { + QCryptographicHash md4(QCryptographicHash::Md4); + QByteArray passUnicode = qStringAsUcs2Le(ctx->password); + md4.addData(passUnicode.data(), passUnicode.size()); + + QByteArray hashKey = md4.result(); + Q_ASSERT(hashKey.size() == 16); + // Assuming the user and domain is always unicode in challenge + QByteArray message = + qStringAsUcs2Le(ctx->user.toUpper()) + + qStringAsUcs2Le(ctx->realm); + + phase3->v2Hash = qEncodeHmacMd5(hashKey, message); + } + return phase3->v2Hash; +} + +static QByteArray clientChallenge(const QAuthenticatorPrivate *ctx) +{ + Q_ASSERT(ctx->cnonce.size() >= 8); + QByteArray clientCh = ctx->cnonce.right(8); + return clientCh; +} + +// caller has to ensure a valid targetInfoBuff +static bool qExtractServerTime(const QByteArray& targetInfoBuff, + quint64 *serverTime) +{ + Q_ASSERT(serverTime != 0); + bool retValue = false; + QDataStream ds(targetInfoBuff); + ds.setByteOrder(QDataStream::LittleEndian); + + quint16 avId; + quint16 avLen; + + ds >> avId; + ds >> avLen; + while(avId != 0) { + if(avId == AVTIMESTAMP) { + QByteArray timeArray(avLen, 0); + //avLen size of QByteArray is allocated + ds.readRawData(timeArray.data(), avLen); + bool ok; + *serverTime = timeArray.toHex().toLongLong(&ok, 16); + retValue = true; + break; + } + ds.skipRawData(avLen); + ds >> avId; + ds >> avLen; + } + return retValue; +} + +static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx, + const QNtlmPhase2Block& ch, + QNtlmPhase3Block *phase3) +{ + Q_ASSERT(phase3 != 0); + // return value stored in phase3 + qCreatev2Hash(ctx, phase3); + + QByteArray temp; + QDataStream ds(&temp, QIODevice::WriteOnly); + ds.setByteOrder(QDataStream::LittleEndian); + + ds << respversion; + ds << hirespversion; + + //Reserved + QByteArray reserved1(6, 0); + ds.writeRawData(reserved1.constData(), reserved1.size()); + + quint64 time = 0; + + //if server sends time, use it instead of current time + if(!(ch.targetInfo.len && qExtractServerTime(ch.targetInfoBuff, &time))) { + QDateTime currentTime(QDate::currentDate(), + QTime::currentTime(), Qt::UTC); + + // number of seconds between 1601 and epoc(1970) + // 369 years, 89 leap years + // ((369 * 365) + 89) * 24 * 3600 = 11644473600 + + time = Q_UINT64_C(currentTime.toTime_t() + 11644473600); + + // represented as 100 nano seconds + time = Q_UINT64_C(time * 10000000); + } + ds << time; + + //8 byte client challenge + QByteArray clientCh = clientChallenge(ctx); + ds.writeRawData(clientCh.constData(), clientCh.size()); + + //Reserved + QByteArray reserved2(4, 0); + ds.writeRawData(reserved2.constData(), reserved2.size()); + + if (ch.targetInfo.len > 0) { + ds.writeRawData(ch.targetInfoBuff.constData(), + ch.targetInfoBuff.size()); + } + + //Reserved + QByteArray reserved3(4, 0); + ds.writeRawData(reserved3.constData(), reserved3.size()); + + QByteArray message((const char*)ch.challenge, sizeof(ch.challenge)); + message.append(temp); + + QByteArray ntChallengeResp = qEncodeHmacMd5(phase3->v2Hash, message); + ntChallengeResp.append(temp); + + return ntChallengeResp; +} + +static QByteArray qEncodeLmv2Response(const QAuthenticatorPrivate *ctx, + const QNtlmPhase2Block& ch, + QNtlmPhase3Block *phase3) +{ + Q_ASSERT(phase3 != 0); + // return value stored in phase3 + qCreatev2Hash(ctx, phase3); + + QByteArray message((const char*)ch.challenge, sizeof(ch.challenge)); + QByteArray clientCh = clientChallenge(ctx); + message.append(clientCh); + + QByteArray lmChallengeResp = qEncodeHmacMd5(phase3->v2Hash, message); + lmChallengeResp.append(clientCh); + + return lmChallengeResp; +} static bool qNtlmDecodePhase2(const QByteArray& data, QNtlmPhase2Block& ch) { @@ -976,7 +1231,10 @@ static bool qNtlmDecodePhase2(const QByteArray& data, QNtlmPhase2Block& ch) } if (ch.targetInfo.len > 0) { - // UNUSED right now + if (ch.targetInfo.len + ch.targetInfo.offset > (unsigned)data.size()) + return false; + + ch.targetInfoBuff = data.mid(ch.targetInfo.offset, ch.targetInfo.len); } return true; @@ -996,7 +1254,8 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas bool unicode = ch.flags & NTLMSSP_NEGOTIATE_UNICODE; - ctx->realm = ch.targetNameStr; + if(ctx->realm.isEmpty()) + ctx->realm = ch.targetNameStr; pb.flags = NTLMSSP_NEGOTIATE_NTLM; if (unicode) @@ -1010,6 +1269,7 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas offset = qEncodeNtlmString(pb.domain, offset, ctx->realm, unicode); pb.domainStr = ctx->realm; + offset = qEncodeNtlmString(pb.user, offset, ctx->user, unicode); pb.userStr = ctx->user; @@ -1017,11 +1277,23 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas pb.workstationStr = ctx->workstation; // Get LM response +#ifdef NTLMV1_CLIENT pb.lmResponseBuf = qEncodeLmResponse(ctx, ch); +#else + if (ch.targetInfo.len > 0) { + pb.lmResponseBuf = QByteArray(); + } else { + pb.lmResponseBuf = qEncodeLmv2Response(ctx, ch, &pb); + } +#endif offset = qEncodeNtlmBuffer(pb.lmResponse, offset, pb.lmResponseBuf); // Get NTLM response +#ifdef NTLMV1_CLIENT pb.ntlmResponseBuf = qEncodeNtlmResponse(ctx, ch); +#else + pb.ntlmResponseBuf = qEncodeNtlmv2Response(ctx, ch, &pb); +#endif offset = qEncodeNtlmBuffer(pb.ntlmResponse, offset, pb.ntlmResponseBuf); -- cgit v0.12 From 943d63e45ad09f75daa7d2f3dcc17bb28fda1766 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 9 Jul 2010 17:43:19 +0200 Subject: Fix a crash when recursing into QSharedPointer from QSharedPointer::clear() We used to delete the tracked object before the new tracking was properly set up in QSharedPointer. That means if the tracked object's destructor or deletion function recursed into the QSharedPointer, it would find itself in an inconsistent state. So instead finish the setup and only then call out to user code. That ensures the internal state is always valid. Task-number: QTBUG-11730 Reviewed-by: ossi --- src/corelib/tools/qsharedpointer_impl.h | 31 +++++++------ tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 56 ++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 14 deletions(-) diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 964b279..d581751 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -323,12 +323,17 @@ namespace QtSharedPointer { typedef ExternalRefCountData Data; inline void ref() const { d->weakref.ref(); d->strongref.ref(); } - inline bool deref() + inline void deref() + { deref(d, this->value); } + static inline void deref(Data *d, T *value) { + if (!d) return; if (!d->strongref.deref()) { - internalDestroy(); + if (!d->destroy()) + delete value; } - return d->weakref.deref(); + if (!d->weakref.deref()) + delete d; } inline void internalConstruct(T *ptr) @@ -377,7 +382,7 @@ namespace QtSharedPointer { template inline ExternalRefCount(const ExternalRefCount &other) : Basic(other.value), d(other.d) { if (d) ref(); } - inline ~ExternalRefCount() { if (d && !deref()) delete d; } + inline ~ExternalRefCount() { deref(); } template inline void internalCopy(const ExternalRefCount &other) @@ -385,12 +390,6 @@ namespace QtSharedPointer { internalSet(other.d, other.data()); } - inline void internalDestroy() - { - if (!d->destroy()) - delete this->value; - } - inline void internalSwap(ExternalRefCount &other) { qSwap(d, other.d); @@ -423,10 +422,14 @@ namespace QtSharedPointer { else o = 0; } - if (d && !deref()) - delete d; - d = o; - this->value = d && d->strongref ? actual : 0; + + qSwap(d, o); + qSwap(this->value, actual); + if (!d || d->strongref == 0) + this->value = 0; + + // dereference saved data + deref(o, actual); } Data *d; diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index cb32c9a..4bbc9d8 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -92,6 +92,8 @@ private slots: void creating(); void creatingQObject(); void mixTrackingPointerCode(); + void reentrancyWhileDestructing(); + void threadStressTest_data(); void threadStressTest(); void validConstructs(); @@ -1770,6 +1772,60 @@ void tst_QSharedPointer::invalidConstructs() } } +namespace QTBUG11730 { + struct IB + { + virtual ~IB() {} + }; + + struct IA + { + virtual QSharedPointer getB() = 0; + }; + + struct B: public IB + { + IA *m_a; + B(IA *a_a) :m_a(a_a) + { } + ~B() + { + QSharedPointer b = m_a->getB(); + } + }; + + struct A: public IA + { + QSharedPointer b; + + virtual QSharedPointer getB() + { + return b; + } + + A() + { + b = QSharedPointer(new B(this)); + } + + ~A() + { + b.clear(); + } + }; +} + +void tst_QSharedPointer::reentrancyWhileDestructing() +{ + // this bug is about recursing back into QSharedPointer::clear() + // from inside it + // that is, the destructor of the object being deleted recurses + // into the same QSharedPointer object. + // First reported as QTBUG-11730 + QTBUG11730::A obj; +} + + QTEST_MAIN(tst_QSharedPointer) #include "tst_qsharedpointer.moc" -- cgit v0.12 From 47ba8dba3fe48d317974acd55afeea8a434c95f8 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Fri, 9 Jul 2010 21:36:15 +0200 Subject: Doc: Cleaning style and adding support for Creator Note: Support for creator has been disabled. HTML-generator needs an update. --- doc/src/template/style/style.css | 1323 +++++++++++++++++++------------ tools/qdoc3/htmlgenerator.cpp | 4 +- tools/qdoc3/test/assistant.qdocconf | 24 +- tools/qdoc3/test/qt-build-docs.qdocconf | 12 +- tools/qdoc3/test/qt.qdocconf | 7 - 5 files changed, 820 insertions(+), 550 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 5144020..9f80921 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -1,6 +1,8 @@ @media screen { - html + +/* basic elements */ + html { color: #000000; background: #FFFFFF; @@ -18,6 +20,7 @@ fieldset, img { border: 0; + max-width:100%; } address, caption, cite, code, dfn, em, strong, th, var, optgroup { @@ -39,7 +42,6 @@ h1, h2, h3, h4, h5, h6 { font-size: 100%; -/* font-weight: normal; */ } q:before, q:after { @@ -50,11 +52,7 @@ border: 0; font-variant: normal; } - sup - { - vertical-align: baseline; - } - sub + sup, sub { vertical-align: baseline; } @@ -62,19 +60,6 @@ { word-spacing:5px; } - .heading - { - font: normal bold 16px/1.0 Arial; - padding-bottom: 15px; - } - .subtitle - { - font-size: 13px; - } - .small-subtitle - { - font-size: 13px; - } legend { color: #000000; @@ -90,9 +75,19 @@ { font-size: 100%; } + strong + { + font-weight: bold; + } + em + { + font-style: italic; + } + + /* adding Qt theme */ html { - background-color: #e5e5e5; + /* background-color: #e5e5e5;*/ } body { @@ -100,73 +95,115 @@ font: normal 13px/1.2 Verdana; color: #363534; } - strong + a { - font-weight: bold; + color: #00732f; + text-decoration: none; } - em + hr { - font-style: italic; + background-color: #E6E6E6; + border: 1px solid #E6E6E6; + height: 1px; + width: 100%; + text-align: left; + margin: 15px 0px 15px 0px; } - a + + pre { - color: #00732f; - text-decoration: none; + border: 1px solid #DDDDDD; + -moz-border-radius: 7px 7px 7px 7px; + margin: 0 20px 10px 10px; + padding: 20px 15px 20px 20px; + overflow-x: auto; } - .header, .footer, .wrapper + table, pre { - min-width: 600px; - max-width: 1500px; - margin: 0 30px; + -moz-border-radius: 7px 7px 7px 7px; + background-color: #F6F6F6; + border: 1px solid #E6E6E6; + border-collapse: separate; + font-size: 11px; + margin-bottom: 25px; } - .wrapper + pre.highlightedCode { + display: block; + overflow:hidden; + } + thead { - background: url(../images/bg_r.png) repeat-y 100% 0; + margin-top: 5px; + font:600 12px/1.2 Arial; } - .wrapper .hd + th { - padding-left: 216px; - height: 15px; - background: url(../images/page.png) no-repeat 0 0; - overflow: hidden; + padding: 5px 15px 5px 15px; + background-color: #E1E1E1; + border-left: 1px solid #E6E6E6; } - .offline .wrapper .hd + td { - background: url(../images/page.png) no-repeat 0 -15px; + padding: 3px 15px 3px 20px; } - .wrapper .hd span + tr.odd td:hover, tr.even td:hover {} + + td.rightAlign + { + padding: 3px 5px 3px 10px; + } + table tr.odd { - height: 15px; - display: block; - overflow: hidden; - background: url(../images/page.png) no-repeat 100% -30px; + border-left: 1px solid #E6E6E6; + background-color: #F6F6F6; + color: #66666E; } - .wrapper .bd + table tr.even { - background: url(../images/bg_l.png) repeat-y 0 0; - position: relative; + border-left: 1px solid #E6E6E6; + background-color: #ffffff; + color: #66666E; } - .offline .wrapper .bd + table tr.odd td:hover, table tr.even td:hover { - background: url(../images/bg_l_blank.png) repeat-y 0 0; + /* background-color: #E6E6E6;*/ /* disabled until further notice */ } - .wrapper .ft + + span.comment { - padding-left: 216px; - height: 15px; - background: url(../images/page.png) no-repeat 0 -75px; - overflow: hidden; + color: #8B0000; + font-style: italic; } - .offline .wrapper .ft + span.string, span.char { - background: url(../images/page.png) no-repeat 0 -90px; + color: #254117; } - .wrapper .ft span + + +/* end basic elements */ + +/* font style elements */ + .heading { - height: 15px; - display: block; - background: url(../images/page.png) no-repeat 100% -60px; - overflow: hidden; + font: normal bold 16px/1.0 Arial; + padding-bottom: 15px; + } + .subtitle + { + font-size: 13px; + } + .small-subtitle + { + font-size: 13px; + } +/* end font style elements */ + +/* global settings*/ + .header, .footer, .wrapper + { + min-width: 600px; + max-width: 1500px; + margin: 0 30px; } .header, .footer { @@ -174,6 +211,17 @@ clear: both; overflow: hidden; } + .header:after, .footer:after, .breadcrumb:after, .wrap .content:after, .group:after + { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; + } + +/* end global settings*/ +/* header elements */ .header { height: 115px; @@ -201,105 +249,332 @@ text-indent: -999em; background: url(../images/sprites-combined.png) no-repeat -78px -235px; } - - .sidebar + .content a:visited { - float: left; - margin-left: 5px; - width: 200px; - font-size: 11px; + color: #4c0033; + text-decoration: none; } - - .offline .sidebar, .offline .feedback, .offline .t_button, .offline #narrowsearch, .offline #narrowmenu + .content a:visited:hover { - display: none; + color: #4c0033; + text-decoration: underline; } - - .sidebar .searchlabel + + #nav-topright { - padding: 0 0 2px 17px; - font: normal bold 11px/1.2 Verdana; + height: 70px; } - .sidebar .search + #nav-topright ul { - padding: 0 15px 0 16px; + list-style-type: none; + float: right; + width: 370px; + margin-top: 11px; } - .sidebar .search form + #nav-topright li { - background: url(../images/sprites-combined.png) no-repeat -6px -348px; - height:21px; - padding:2px 0 0 5px; - width:167px; + display: inline-block; + margin-right: 20px; + float: left; } - .sidebar .search form input#pageType + #nav-topright li.nav-topright-last { - width: 158px; - height: 19px; - padding: 0; - border: 0px; - outline: none; - font: 13px/1.2 Verdana; + margin-right: 0; } - .sidebar .box + #nav-topright li a { - padding: 17px 15px 5px 16px; + background: transparent url(../images/sprites-combined.png) no-repeat; + height: 18px; + display: block; + overflow: hidden; + text-indent: -9999px; } - .sidebar .box .first + #nav-topright li.nav-topright-home a { - background-image: none; + width: 65px; + background-position: -2px -91px; } - .sidebar .box h2 + #nav-topright li.nav-topright-home a:hover { - font: bold 16px/1.2 Arial; - padding: 0; -/* min-height: 32px;*/ + background-position: -2px -117px; } - .sidebar .box h2 span + + + #nav-topright li.nav-topright-dev a { - overflow: hidden; - display: inline-block; + width: 30px; + background-position: -76px -91px; } - .sidebar .box#lookup h2 + + #nav-topright li.nav-topright-dev a:hover { - background-image: none; + background-position: -76px -117px; } - .sidebar #lookup.box h2 span + + + #nav-topright li.nav-topright-labs a { -/* background: url(../images/sprites-combined.png) no-repeat -6px -311px; - width: 27px; - height: 35px; - margin-right: 13px;*/ + width: 40px; + background-position: -114px -91px; } - .sidebar .box#topics h2 + + #nav-topright li.nav-topright-labs a:hover { - background-image: none; + background-position: -114px -117px; } - .sidebar #topics.box h2 span + + #nav-topright li.nav-topright-doc a { - /* background: url(../images/sprites-combined.png) no-repeat -94px -311px; - width: 27px; - height: 32px; - margin-right: 13px;*/ + width: 32px; + background-position: -162px -91px; } - .sidebar .box#examples h2 + + #nav-topright li.nav-topright-doc a:hover, #nav-topright li.nav-topright-doc-active a { - background-image: none; + background-position: -162px -117px; } - .sidebar #examples.box h2 span + + #nav-topright li.nav-topright-blog a { - /* background: url(../images/sprites-combined.png) no-repeat -48px -311px; - width: 30px; - height: 31px; - margin-right: 9px;*/ + width: 40px; + background-position: -203px -91px; } - .sidebar .box .list + #nav-topright li.nav-topright-blog a:hover, #nav-topright li.nav-topright-blog-active a + { + background-position: -203px -117px; + } + + #nav-topright li.nav-topright-shop a + { + width: 40px; + background-position: -252px -91px; + } + + #nav-topright li.nav-topright-shop a:hover, #nav-topright li.nav-topright-shop-active a + { + background-position: -252px -117px; + } + + #nav-logo + { + background: transparent url(../images/sprites-combined.png ) no-repeat 0 -225px; + left: -3px; + position: absolute; + width: 75px; + height: 75px; + top: 13px; + } + #nav-logo a + { + width: 75px; + height: 75px; + display: block; + text-indent: -9999px; + overflow: hidden; + } + + + .shortCut-topleft-inactive + { + padding-left: 3px; + background: transparent url( ../images/sprites-combined.png) no-repeat 0px -58px; + height: 20px; + width: 47px; + } + .shortCut-topleft-inactive span + { + font-variant: normal; + } + .shortCut-topleft-inactive span a:hover, .shortCut-topleft-active a:hover + { + text-decoration:none; + } + #shortCut + { + padding-top: 10px; + font-weight: bolder; + color: #b0adab; + } + #shortCut ul + { + list-style-type: none; + float: left; + width: 347px; + margin-left: 100px; + } + #shortCut li + { + display: inline-block; + margin-right: 25px; + float: left; + white-space: nowrap; + } + #shortCut li a + { + color: #b0adab; + } + #shortCut li a:hover + { + color: #44a51c; + } + + + +/* end header elements */ +/* content and sidebar elements */ + .wrapper + { + background: url(../images/bg_r.png) repeat-y 100% 0; + } + .wrapper .hd + { + padding-left: 216px; + height: 15px; + background: url(../images/page.png) no-repeat 0 0; + overflow: hidden; + } + + + + + .wrapper .hd span + { + height: 15px; + display: block; + overflow: hidden; + background: url(../images/page.png) no-repeat 100% -30px; + } + .wrapper .bd + { + background: url(../images/bg_l.png) repeat-y 0 0; + position: relative; + } + + + + + .wrapper .ft + { + padding-left: 216px; + height: 15px; + background: url(../images/page.png) no-repeat 0 -75px; + overflow: hidden; + } + + + + + .wrapper .ft span + { + height: 15px; + display: block; + background: url(../images/page.png) no-repeat 100% -60px; + overflow: hidden; + } + .navTop{ + float:right; + display:block; + padding-right:15px; + + + } + + + +/* end content and sidebar elements */ +/* sidebar elements */ + .sidebar + { + float: left; + margin-left: 5px; + width: 200px; + font-size: 11px; + } + + + + + + + .sidebar .searchlabel + { + padding: 0 0 2px 17px; + font: normal bold 11px/1.2 Verdana; + } + + .sidebar .search + { + padding: 0 15px 0 16px; + } + + .sidebar .search form + { + background: url(../images/sprites-combined.png) no-repeat -6px -348px; + height:21px; + padding:2px 0 0 5px; + width:167px; + } + + .sidebar .search form input#pageType + { + width: 158px; + height: 19px; + padding: 0; + border: 0px; + outline: none; + font: 13px/1.2 Verdana; + } + + .sidebar .box + { + padding: 17px 15px 5px 16px; + } + + .sidebar .box .first + { + background-image: none; + } + + .sidebar .box h2 + { + font: bold 16px/1.2 Arial; + padding: 0; + } + .sidebar .box h2 span + { + overflow: hidden; + display: inline-block; + } + .sidebar .box#lookup h2 + { + background-image: none; + } + .sidebar #lookup.box h2 span + { + } + .sidebar .box#topics h2 + { + background-image: none; + } + .sidebar #topics.box h2 span + { + } + .sidebar .box#examples h2 + { + background-image: none; + } + .sidebar #examples.box h2 span + { + } + + .sidebar .box .list { display: block; max-height:200px; @@ -313,7 +588,6 @@ } .sidebar .box ul { - /*padding:10px;*/ padding-bottom:5px; padding-left:10px; padding-top:5px; @@ -340,16 +614,40 @@ color:#AAD2F0; font-style:italic; } + .sidebar .search form input.loading + { + background:url("../images/spinner.gif") no-repeat scroll right center transparent; + } + +.floatingResult{ + z-index:1; + position:relative; + padding-top:0px; + background-color:white; + border:solid 1px black; + height:250px; + width:600px; + overflow-x:hidden; + overflow-y:auto; +} + .floatingResult:hover{ + display:block; + } + .floatingResult:hover{ + } + +/* end sidebar elements */ +/* content elements */ .wrap { margin: 0 5px 0 208px; overflow: visible; } - .offline .wrap - { - margin: 0 5px 0 5px; - } + + + + .wrap .toolbar { background-color: #fafafa; @@ -435,11 +733,14 @@ color: #00732F; } - .offline .wrap .breadcrumb - { - } - .wrap .breadcrumb ul + .wrap .content + { + padding: 30px; + word-wrap:break-word; + } + + .wrap .breadcrumb ul { } .wrap .breadcrumb ul li @@ -464,30 +765,36 @@ padding-left: 0; margin-left: 0; } - .wrap .content - { - padding: 30px; - word-wrap:break-word; - } + + + + .wrap .content ol li { + background:none; + font:normal 10pt/1 Verdana; + + margin-bottom:10px; + margin-left:12px; + /*list-style-type:disc;*/ + } + .wrap .content li { - /*padding-left: 12px;*/ background: url(../images/bullet_sq.png) no-repeat 0 5px; font: normal 400 10pt/1 Verdana; - /* color: #44a51c;*/ margin-bottom: 10px; padding-left:12px; } - .content li:hover - { - /* text-decoration: underline;*/ - } - .offline .wrap .content - { - padding-top: 15px; - } + + + + + + + + + .content li:hover {} .wrap .content h1 { @@ -495,17 +802,14 @@ } .wrap .content h2 { - border-bottom:1px solid #DDDDDD; font:600 16px/1.2 Arial; margin-top:15px; - width:100%; - + width:100%; } .wrap .content h3 { font: bold 14px/1.2 Arial; - /*border-bottom:1px solid #DDDDDD;*/ font:600 16px/1.2 Arial; margin-top:15px; width:100%; @@ -514,320 +818,69 @@ { line-height: 20px; padding: 5px; - /* text-align:justify;*/ } .wrap .content table p { line-height: 20px; - padding: 0px; - } - .wrap .content ul - { - padding-left: 25px; - padding-top: 10px; - } - a:hover - { - color: #4c0033; - text-decoration: underline; - } - .content a:visited - { - color: #4c0033; - text-decoration: none; - } - .content a:visited:hover - { - color: #4c0033; - text-decoration: underline; - } .footer - { - min-height: 100px; - color: #797775; - font: normal 9px/1 Verdana; - text-align: center; - padding-top: 40px; - background-color: #E6E7E8; - margin: 0; - } - .feedback - { - float: none; - position: absolute; - right: 15px; - bottom: 10px; - font: normal 8px/1 Verdana; - color: #B0ADAB; - } - .feedback:hover - { - float: right; - font: normal 8px/1 Verdana; - color: #00732F; - text-decoration: underline; - } - .header:after, .footer:after, .breadcrumb:after, .wrap .content:after, .group:after - { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; - } - #nav-topright - { - height: 70px; - } - - #nav-topright ul - { - list-style-type: none; - float: right; - width: 370px; - margin-top: 11px; - } - - #nav-topright li - { - display: inline-block; - margin-right: 20px; - float: left; - } - - #nav-topright li.nav-topright-last - { - margin-right: 0; - } - - #nav-topright li a - { - background: transparent url(../images/sprites-combined.png) no-repeat; - height: 18px; - display: block; - overflow: hidden; - text-indent: -9999px; - } - - #nav-topright li.nav-topright-home a - { - width: 65px; - background-position: -2px -91px; - } - - #nav-topright li.nav-topright-home a:hover - { - background-position: -2px -117px; - } - - - #nav-topright li.nav-topright-dev a - { - width: 30px; - background-position: -76px -91px; - } - - #nav-topright li.nav-topright-dev a:hover - { - background-position: -76px -117px; - } - - - #nav-topright li.nav-topright-labs a - { - width: 40px; - background-position: -114px -91px; - } - - #nav-topright li.nav-topright-labs a:hover - { - background-position: -114px -117px; - } - - #nav-topright li.nav-topright-doc a - { - width: 32px; - background-position: -162px -91px; - } - - #nav-topright li.nav-topright-doc a:hover, #nav-topright li.nav-topright-doc-active a - { - background-position: -162px -117px; - } - - #nav-topright li.nav-topright-blog a - { - width: 40px; - background-position: -203px -91px; - } - - #nav-topright li.nav-topright-blog a:hover, #nav-topright li.nav-topright-blog-active a - { - background-position: -203px -117px; - } - - #nav-topright li.nav-topright-shop a - { - width: 40px; - background-position: -252px -91px; - } - - #nav-topright li.nav-topright-shop a:hover, #nav-topright li.nav-topright-shop-active a - { - background-position: -252px -117px; - } - - #nav-logo - { - background: transparent url(../images/sprites-combined.png ) no-repeat 0 -225px; - left: -3px; - position: absolute; - width: 75px; - height: 75px; - top: 13px; - } - #nav-logo a - { - width: 75px; - height: 75px; - display: block; - text-indent: -9999px; - overflow: hidden; - } - - - .shortCut-topleft-inactive - { - padding-left: 3px; - background: transparent url( ../images/sprites-combined.png) no-repeat 0px -58px; - height: 20px; - width: 47px; - } - .shortCut-topleft-inactive span - { - font-variant: normal; - } - .shortCut-topleft-inactive span a:hover, .shortCut-topleft-active a:hover - { - text-decoration:none; - } - #shortCut - { - padding-top: 10px; - font-weight: bolder; - color: #b0adab; - } - #shortCut ul - { - list-style-type: none; - float: left; - width: 347px; - margin-left: 100px; - } - #shortCut li - { - display: inline-block; - margin-right: 25px; - float: left; - white-space: nowrap; - } - #shortCut li a - { - color: #b0adab; - } - #shortCut li a:hover - { - color: #44a51c; - } - - hr - { - background-color: #E6E6E6; - border: 1px solid #E6E6E6; - height: 1px; - width: 100%; - text-align: left; - margin: 15px 0px 15px 0px; - } - - .content .alignedsummary - { - margin: 15px; - } - pre - { - border: 1px solid #DDDDDD; - -moz-border-radius: 7px 7px 7px 7px; - margin: 0 20px 10px 10px; - padding: 20px 15px 20px 20px; - overflow-x: auto; - } - table, pre - { - -moz-border-radius: 7px 7px 7px 7px; - background-color: #F6F6F6; - border: 1px solid #E6E6E6; - border-collapse: separate; - font-size: 11px; - /*min-width: 395px;*/ - margin-bottom: 25px; - /* display: inline-block;*/ - } - thead - { - margin-top: 5px; - font:600 12px/1.2 Arial; - } - th - { - padding: 5px 15px 5px 15px; - background-color: #E1E1E1; - /* border-bottom: 1px solid #E6E6E6;*/ - border-left: 1px solid #E6E6E6; - /* border-right: 1px solid #E6E6E6;*/ - } - td - { - padding: 3px 15px 3px 20px; - /* border-left: 1px solid #E6E6E6; - border-right: 1px solid #E6E6E6;*/ - } - tr.odd td:hover, tr.even td:hover - { - /* border-right: 1px solid #C3C3C3; - border-left: 1px solid #C3C3C3;*/ - } - - td.rightAlign - { - padding: 3px 5px 3px 10px; - } - table tr.odd + padding: 0px; + } + .wrap .content ul { - border-left: 1px solid #E6E6E6; - background-color: #F6F6F6; - color: #66666E; + padding-left: 25px; + padding-top: 10px; } - table tr.even + a:hover { - border-left: 1px solid #E6E6E6; - background-color: #ffffff; - color: #66666E; + color: #4c0033; + text-decoration: underline; } - table tr.odd td:hover, table tr.even td:hover + .feedback { - background-color: #E6E6E6; + float: none; + position: absolute; + right: 15px; + bottom: 10px; + font: normal 8px/1 Verdana; + color: #B0ADAB; } - - span.comment + .feedback:hover { - color: #8B0000; - font-style: italic; + float: right; + font: normal 8px/1 Verdana; + color: #00732F; + text-decoration: underline; } - span.string, span.char + .alphaChar{ + width:100%; + background-color:#F6F6F6; + border:1px solid #E6E6E6; + -moz-border-radius: 7px 7px 7px 7px; + font-size:12pt; + padding-left:10px; + margin-top:10px; + margin-bottom:10px; + } + .flowList{ + vertical-align:top; + } + + .flowList dl{ + } + .flowList dd{ + display:inline-block; + margin-left:10px; + width:250px; + } + .wrap .content .flowList p{ + padding:0px; + } + + .content .alignedsummary { - color: #254117; + margin: 15px; } + .qmltype { text-align: center; @@ -854,7 +907,6 @@ *.qmlitem p { } - #feedbackBox { display: none; @@ -936,12 +988,10 @@ } .generic{ - /*max-width:75%;*/ } .generic td{ padding:5px; } - .generic .alphaChar{ margin-top:5px; } @@ -989,6 +1039,16 @@ padding-left: 0px; } + .wrap .content .toc h3{ + border-bottom:0px; + margin-top:0px; + } + + .wrap .content .toc h3 a:hover{ + color:#00732F; + text-decoration:none; + } + .wrap .content .toc .level2 { @@ -1005,7 +1065,6 @@ font: normal 10px/1.2 Verdana; background: url(../images/bullet_dn.png) no-repeat 0 5px; } - .relpage { -moz-border-radius: 7px 7px 7px 7px; @@ -1069,6 +1128,24 @@ .functionIndex a{ display:inline-block; } + +/* end content elements */ +/* footer elements */ + + .footer + { + min-height: 100px; + color: #797775; + font: normal 9px/1 Verdana; + text-align: center; + padding-top: 40px; + background-color: #E6E7E8; + margin: 0; + } +/* end footer elements */ + + + /* start index box */ .indexbox @@ -1080,15 +1157,15 @@ .indexboxcont { display: block; - /* overflow: hidden;*/ + } .indexboxbar { background: transparent url(../images/horBar.png ) repeat-x left bottom; margin-bottom: 25px; - /* background-image: none; - border-bottom: 1px solid #e2e2e2;*/ + + } .indexboxcont .section @@ -1188,87 +1265,285 @@ visibility: hidden; } -.sidebar .search form input.loading -{ - background:url("../images/spinner.gif") no-repeat scroll right center transparent; -} - /* end of screen media */ - -.flowList{ -vertical-align:top; -} -.alphaChar{ -width:100%; -background-color:#F6F6F6; -border:1px solid #E6E6E6; --moz-border-radius: 7px 7px 7px 7px; -font-size:12pt; -padding-left:10px; -margin-top:10px; -margin-bottom:10px; -} -.flowList dl{ -} -.flowList dd{ -display:inline-block; -margin-left:10px; -width:250px; -} -.wrap .content .flowList p{ -padding:0px; -} -pre.highlightedCode { - display: block; - overflow:hidden; -} -.floatingResult{ - z-index:1; - position:relative; - padding-top:0px; - background-color:white; - border:solid 1px black; - height:250px; - width:600px; - overflow-x:hidden; - overflow-y:auto; -} +/* start of offline spec*/ + .offline .wrapper .hd + { + background: url(../images/page.png) no-repeat 0 -15px; + } + .offline .wrapper .bd + { + background: url(../images/bg_l_blank.png) repeat-y 0 0; + } + .offline .wrapper .ft + { + background: url(../images/page.png) no-repeat 0 -90px; + } + .offline .sidebar, + .offline .feedback, + .offline .t_button, + .offline #narrowsearch, + .offline #narrowmenu + { + display: none; + } + .offline .wrap + { + margin: 0 5px 0 5px; + } + .offline .wrap .breadcrumb + { + } - .floatingResult:hover{ - display:block; - } - .floatingResult:hover{ - /*display:none;*/ - } + .offline .wrap .content + { + padding-top: 15px; + } - .wrap .content ol li { - background:none; - font:400 10pt/1 Verdana; - margin-bottom:10px; - margin-left:12px; + +/* end of offline spec*/ + +/* start of creator spec*/ + .creator + { + margin-left:0px; + margin-right:0px; + padding-left:0px; + padding-right:0px; } - .wrap .content ol li { + .creator .wrap .content ol li { list-style-type:decimal; } - .navTop{ - float:right; - display:block; - padding-right:15px; - /*margin-top:10px;*/ + .creator .header .icon, + .creator .feedback, + .creator .t_button, + .creator .feedback, + .creator #feedbackBox, + .creator #feedback, + .creator #blurpage, + .creator .indexbox .indexIcon span, + .creator .wrapper .hd, + .creator .indexbox .indexIcon, + .creator .header #nav-logo, + .creator #offlinemenu, + .creator #offlinesearch, + .creator .header #nav-topright, + .creator .header #shortCut , + .creator .wrapper .hd, + .creator .wrapper .ft, + .creator .sidebar, + .creator .wrap .feedback + { + display:none; + } + + body.creator + { + background: none; + + font: normal 13px/1.2 Verdana; + color: #363534; + background-color: #FFFFFF; + } + + + + .creator .header, .footer, .wrapper + { + max-width: 1500px; + margin: 0px; + } + + .creator .wrapper + { + position:relative; + top:50px; + } + .creator .wrapper .bd + { + + background:#FFFFFF; } + + + .creator .header, .footer + { + display: block; + clear: both; + overflow: hidden; + } + .creator .wrap .content p + + { + line-height: 20px; + padding: 5px; + } + + .creator .header .qtref span + { + background:none; + } + + - .wrap .content .toc h3{ - border-bottom:0px; - margin-top:0px; + .creator .footer + { + border-top:1px solid #E5E5E5; + min-height: 100px; + margin:0px; + } + + .creator .wrap + { + + padding:0 5px 0 5px; + margin: 0px; + } + .creator .wrap .toolbar + { + + + border-bottom:1px solid #E5E5E5; + width:100%, + } + .creator .wrap .breadcrumb ul li a + { + /* color: #363534;*/ + color: #00732F; + } + + .creator .wrap .content + { + padding: 0px; + word-wrap:break-word; + } + + .creator .wrap .content ol li { + background:none; + font: inherit; + padding-left: 0px; + } + + .creator .wrap .content .descr ol li { + margin-left: 45px; + + } + .creator .content .alignedsummary + { + margin: 5px; + width:100%; + } + .creator .generic{ + max-width:75%; + } + .creator .generic td{ + padding:0; } + .creator .indexboxbar + { + border-bottom:1px solid #E5E5E5; + margin-bottom: 25px; + background: none; + } - .wrap .content .toc h3 a:hover{ - color:#00732F; - text-decoration:none; + + + .creator .header + { + width: 100%; + margin: 0; + height: auto; + background-color: #ffffff; + padding: 10px 0 5px 0; + overflow: visible; + border-bottom: solid #E5E5E5 1px; + z-index:1; + + + + + + + + + position:fixed; + } + + + .creator .header .content + { + } + .creator .header .qtref + { + color: #00732F; + position: static; + float: left; + margin-left: 5px; + font: bold 18px/1 Arial; + } + + .creator .header .qtref:visited + { + color: #00732F; + } + .creator .header .qtref:hover + { + color: #00732F; + text-decoration:none; + } + .creator .header .qtref span + { + background-image: none; + text-indent: 0; + text-decoration:none; + } + + + + + + + .creator .wrap .toolbar + { + display:block; + padding-top:0px; + } + + + + .creator .wrap .breadcrumb ul li { + font-weight: normal; + } + + .creator .wrap .breadcrumb ul li a { + /*color: #44a51c;*/ + } + + .creator .wrap .breadcrumb ul li.last a { + /*color: #363534;*/ + } + + .creator #narrowmenu ul + { + border-bottom:solid 1px #E5E5E5; + border-left:solid 1px #E5E5E5; + border-right:solid 1px #E5E5E5; } + + .creator #narrowmenu li ul { + margin-top:-15px; + } + + + .creator .toc { + margin:10px 20px 10px 10px; + } +/* end of creator spec*/ +} + /* end of screen media */ /* start of print media */ diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index c8218dc..fc761e5 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -277,7 +277,7 @@ void HtmlGenerator::initializeGenerator(const Config &config) project = config.getString(CONFIG_PROJECT); offlineDocs = !config.getBool(CONFIG_ONLINE); - creatorDocs = !config.getBool(CONFIG_CREATOR); + creatorDocs = false; //!config.getBool(CONFIG_CREATOR); projectDescription = config.getString(CONFIG_DESCRIPTION); if (projectDescription.isEmpty() && !project.isEmpty()) projectDescription = project + " Reference Documentation"; @@ -1785,7 +1785,7 @@ void HtmlGenerator::generateHeader(const QString& title, { out() << " "; // Only for Qt Creator out() << "\n"; - out() << "\n"; // offline for Creator + out() << "\n"; // offline for Creator } // Setting online doc configuration else diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index 4b52992..8d5fa89 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -17,7 +17,10 @@ qhp.Assistant.namespace = com.trolltech.assistant.470 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual qhp.Assistant.extraFiles = images/bg_l.png \ - images/bg_l_blank.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ images/bg_r.png \ images/box_bg.png \ images/breadcrumb.png \ @@ -25,24 +28,27 @@ qhp.Assistant.extraFiles = images/bg_l.png \ images/bullet_dn.png \ images/bullet_sq.png \ images/bullet_up.png \ + images/arrow_down.png \ images/feedbackground.png \ images/horBar.png \ images/page.png \ images/page_bg.png \ images/sprites-combined.png \ - images/arrow-down.png \ images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ images/coloreditorfactoryimage.png \ images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - style/OfflineStyle.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css + scripts/functions.js \ + scripts/jquery.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/narrow.css \ + style/superfish.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css qhp.Assistant.filterAttributes = qt 4.7.0 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index 140b81f..4ac4f47 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -24,6 +24,9 @@ qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.extraFiles = index.html \ images/bg_l.png \ images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ images/bg_r.png \ images/box_bg.png \ images/breadcrumb.png \ @@ -31,12 +34,12 @@ qhp.Qt.extraFiles = index.html \ images/bullet_dn.png \ images/bullet_sq.png \ images/bullet_up.png \ + images/arrow_down.png \ images/feedbackground.png \ images/horBar.png \ images/page.png \ images/page_bg.png \ images/sprites-combined.png \ - images/arrow-down.png \ images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ @@ -44,17 +47,10 @@ qhp.Qt.extraFiles = index.html \ images/dynamiclayouts-example.png \ scripts/functions.js \ scripts/jquery.js \ - scripts/shBrushCpp.js \ - scripts/shCore.js \ - scripts/shLegacy.js \ scripts/narrow.js \ scripts/superfish.js \ - style/shCore.css \ - style/shThemeDefault.css \ style/narrow.css \ style/superfish.css \ - style/superfish_skin.css \ - style/OfflineStyle.css \ style/style_ie6.css \ style/style_ie7.css \ style/style_ie8.css \ diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index d132771..5575b7b 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -51,17 +51,10 @@ qhp.Qt.extraFiles = index.html \ images/dynamiclayouts-example.png \ scripts/functions.js \ scripts/jquery.js \ - scripts/shBrushCpp.js \ - scripts/shCore.js \ - scripts/shLegacy.js \ scripts/narrow.js \ scripts/superfish.js \ - style/shCore.css \ - style/shThemeDefault.css \ style/narrow.css \ style/superfish.css \ - style/superfish_skin.css \ - style/OfflineStyle.css \ style/style_ie6.css \ style/style_ie7.css \ style/style_ie8.css \ -- cgit v0.12 From 4b6180908a52ada73288021c1380f06ae3f75707 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Wed, 7 Jul 2010 10:37:09 +0200 Subject: Compile fix for bearermonitor example --- examples/network/bearermonitor/sessionwidget.h | 2 +- .../network/bearermonitor/sessionwidget_maemo.ui | 48 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h index 5b5827b..c92db44 100644 --- a/examples/network/bearermonitor/sessionwidget.h +++ b/examples/network/bearermonitor/sessionwidget.h @@ -41,12 +41,12 @@ #ifndef SESSIONWIDGET_H #define SESSIONWIDGET_H +#include #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) #include "ui_sessionwidget_maemo.h" #else #include "ui_sessionwidget.h" #endif -#include QT_USE_NAMESPACE diff --git a/examples/network/bearermonitor/sessionwidget_maemo.ui b/examples/network/bearermonitor/sessionwidget_maemo.ui index ca68246..8867509 100644 --- a/examples/network/bearermonitor/sessionwidget_maemo.ui +++ b/examples/network/bearermonitor/sessionwidget_maemo.ui @@ -214,6 +214,54 @@ + + + + + + 0 + + + Qt::AlignCenter + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + + + + + Active Time: + + + + + + + + 0 + 0 + + + + 0 seconds + + + + + -- cgit v0.12 From 46175e55c8d053b61a45aea89a3e1b8371207dee Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 12 Jul 2010 10:47:00 +0200 Subject: fix build for -no-qt3support QString::lower() is QT3_SUPPORT, the correct method is QString::toLower(). --- src/network/ssl/qsslsocket_openssl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index a5da391..8dc1743 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1106,11 +1106,11 @@ bool QSslSocketBackendPrivate::startHandshake() QString peerName = (verificationPeerName.isEmpty () ? q->peerName() : verificationPeerName); QString commonName = configuration.peerCertificate.subjectInfo(QSslCertificate::CommonName); - if (!isMatchingHostname(commonName.lower(), peerName.lower())) { + if (!isMatchingHostname(commonName.toLower(), peerName.toLower())) { bool matched = false; foreach (const QString &altName, configuration.peerCertificate .alternateSubjectNames().values(QSsl::DnsEntry)) { - if (isMatchingHostname(altName.lower(), peerName.lower())) { + if (isMatchingHostname(altName.toLower(), peerName.toLower())) { matched = true; break; } -- cgit v0.12 From 29dcc069ba9a2c38b4461d5fd19d5fa9a1531595 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 12 Jul 2010 10:44:12 +0200 Subject: syncqt: fix wrong paths in include/ActiveQt/headers.pri Assigning a semicolon separated list of directories to a Qt module does not work correctly. The values of %modules must be split into single values before operating on them. This doesn't happen in all places. ActiveQt is the only module where this feature is used. Also, it is not needed anymore for this particular module. Thus, I'll just remove the semicolon separated list from ActiveQt and replace it with the module directory. Task-number: QTBUG-4586 Reviewed-by: ossi --- bin/syncqt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/syncqt b/bin/syncqt index db6dce6..4f8e343 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -42,7 +42,7 @@ my %modules = ( # path to module name map "QtScript" => "$basedir/src/script", "QtScriptTools" => "$basedir/src/scripttools", "Qt3Support" => "$basedir/src/qt3support", - "ActiveQt" => "$basedir/src/activeqt/container;$basedir/src/activeqt/control;$basedir/src/activeqt/shared", + "ActiveQt" => "$basedir/src/activeqt", "QtTest" => "$basedir/src/testlib", "QtAssistant" => "$basedir/tools/assistant/compat/lib", "QtHelp" => "$basedir/tools/assistant/lib", -- cgit v0.12 From 4ba6646150300feb79af9510c7c5d238d653a98e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 12 Jul 2010 11:10:43 +0200 Subject: syncqt: don't try to split %module's values Using semiconlon separated directory lists in module values is broken and unused. Removing this feature. Task-number: QTBUG-4586 Reviewed-by: ossi --- bin/syncqt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/syncqt b/bin/syncqt index 4f8e343..d665e87 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -960,7 +960,7 @@ if($check_includes) { #iteration info my $lib = $_; my $dir = "$modules{$lib}"; - foreach (split(/;/, $dir)) { + { my $current_dir = "$_"; #calc subdirs my @subdirs = ($current_dir); -- cgit v0.12 From 156193223ee9d58da66817ae6ffc0174bdf34e5b Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Mon, 12 Jul 2010 12:14:45 +0200 Subject: fix indentation Merge-request: 740 Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 952d4e0..0c450f0 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2439,7 +2439,7 @@ void Configure::generateOutputVars() qmakeFormatPlugins += "gif"; if (dictionary[ "TIFF" ] == "no") - qtConfig += "no-tiff"; + qtConfig += "no-tiff"; else if (dictionary[ "TIFF" ] == "plugin") qmakeFormatPlugins += "tiff"; if (dictionary[ "LIBTIFF" ] == "system") -- cgit v0.12 From 80ad34046e2d3d0b8bd5d8346cb1edb0c83c1585 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Mon, 12 Jul 2010 12:14:46 +0200 Subject: fixed built-in jpeg and tiff in configure.exe, QTBUG-12093 Merge-request: 740 Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 0c450f0..d3dec3c 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2440,6 +2440,8 @@ void Configure::generateOutputVars() if (dictionary[ "TIFF" ] == "no") qtConfig += "no-tiff"; + else if (dictionary[ "TIFF" ] == "yes") + qtConfig += "tiff"; else if (dictionary[ "TIFF" ] == "plugin") qmakeFormatPlugins += "tiff"; if (dictionary[ "LIBTIFF" ] == "system") @@ -2447,6 +2449,8 @@ void Configure::generateOutputVars() if (dictionary[ "JPEG" ] == "no") qtConfig += "no-jpeg"; + else if (dictionary[ "JPEG" ] == "yes") + qtConfig += "jpeg"; else if (dictionary[ "JPEG" ] == "plugin") qmakeFormatPlugins += "jpeg"; if (dictionary[ "LIBJPEG" ] == "system") -- cgit v0.12 From 446770c939b8c643c2a3bec73906055238cf3925 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 12 Jul 2010 16:37:36 +0200 Subject: QNAM: Add future enum attribute for Zerocopy QNAM Implementation will follow in 4.7.1 or 4.8, let's see. Reviewed-by: David Boddie Reviewed-by: Simon Hausmann Reviewed-by: Peter Hartmann --- src/network/access/qnetworkrequest.cpp | 8 ++++++++ src/network/access/qnetworkrequest.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index bccfec1..fa592c2 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -230,6 +230,14 @@ QT_BEGIN_NAMESPACE \since 4.7 + \omitvalue MaximumDownloadBufferSizeAttribute + \since 4.7 + \internal + + \omitvalue DownloadBufferAttribute + \since 4.7 + \internal + \value User Special type. Additional information can be passed in QVariants with types ranging from User to UserMax. The default diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h index d2945c4..cdadf0f 100644 --- a/src/network/access/qnetworkrequest.h +++ b/src/network/access/qnetworkrequest.h @@ -82,6 +82,8 @@ public: CookieLoadControlAttribute, AuthenticationReuseAttribute, CookieSaveControlAttribute, + MaximumDownloadBufferSizeAttribute, // internal + DownloadBufferAttribute, // internal User = 1000, UserMax = 32767 -- cgit v0.12 From 1e9348f52f06feb355245a9fffd786562e76e15f Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Mon, 12 Jul 2010 18:02:03 +0200 Subject: Timing fix for slow devices. Although the wait is only specified as 50ms, it might still take longer than that for Qt to deliver the actual mouse release event (especially on embedded devices). The problem here is that in the meantime the auto-repeat on the button might have been triggered. Reviewed-by: Dominik Holland --- tests/auto/qscrollbar/tst_qscrollbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qscrollbar/tst_qscrollbar.cpp b/tests/auto/qscrollbar/tst_qscrollbar.cpp index 735b2dd..16d5b42 100644 --- a/tests/auto/qscrollbar/tst_qscrollbar.cpp +++ b/tests/auto/qscrollbar/tst_qscrollbar.cpp @@ -130,7 +130,7 @@ void tst_QScrollBar::task_209492() QMouseEvent mousePressEvent(QEvent::MouseButtonPress, pressPoint, globalPressPoint, Qt::LeftButton, Qt::LeftButton, 0); QApplication::sendEvent(verticalScrollBar, &mousePressEvent); - QTest::qWait(50); + QTest::qWait(1); QMouseEvent mouseReleaseEvent(QEvent::MouseButtonRelease, pressPoint, globalPressPoint, Qt::LeftButton, Qt::LeftButton, 0); QApplication::sendEvent(verticalScrollBar, &mouseReleaseEvent); -- cgit v0.12 From ca1276ebca0f8fa47116994b97153899116c8b57 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 12 Jul 2010 20:18:37 +0200 Subject: make projects lupdate-friendly lupdate currently doesn't parse .qmake.cache, so it lacks QT_SOURCE_TREE. so use relative paths in include statements and (the relevant) include paths instead. --- tools/assistant/tools/assistant/assistant.pro | 2 +- tools/designer/src/components/lib/lib.pro | 10 +++++----- .../src/components/objectinspector/objectinspector.pri | 2 +- .../designer/src/components/propertyeditor/propertyeditor.pri | 4 ++-- tools/designer/src/designer/designer.pro | 4 ++-- tools/designer/src/lib/shared/shared.pri | 10 +++++----- tools/qvfb/qvfb.pro | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/assistant/tools/assistant/assistant.pro b/tools/assistant/tools/assistant/assistant.pro index eb8cc51..d9aff7a 100644 --- a/tools/assistant/tools/assistant/assistant.pro +++ b/tools/assistant/tools/assistant/assistant.pro @@ -1,4 +1,4 @@ -include($$QT_SOURCE_TREE/tools/shared/fontpanel/fontpanel.pri) +include(../../../shared/fontpanel/fontpanel.pri) TEMPLATE = app LANGUAGE = C++ TARGET = assistant diff --git a/tools/designer/src/components/lib/lib.pro b/tools/designer/src/components/lib/lib.pro index 8d0e692..0ada845 100644 --- a/tools/designer/src/components/lib/lib.pro +++ b/tools/designer/src/components/lib/lib.pro @@ -44,11 +44,11 @@ SOURCES += qdesigner_components.cpp } INCLUDEPATH += . .. \ - $$QT_SOURCE_TREE/tools/designer/src/lib/components \ - $$QT_SOURCE_TREE/tools/designer/src/lib/sdk \ - $$QT_SOURCE_TREE/tools/designer/src/lib/extension \ - $$QT_SOURCE_TREE/tools/designer/src/lib/uilib \ - $$QT_SOURCE_TREE/tools/designer/src/lib/shared + $$PWD/../../lib/components \ + $$PWD/../../lib/sdk \ + $$PWD/../../lib/extension \ + $$PWD/../../lib/uilib \ + $$PWD/../../lib/shared include(../propertyeditor/propertyeditor.pri) include(../objectinspector/objectinspector.pri) diff --git a/tools/designer/src/components/objectinspector/objectinspector.pri b/tools/designer/src/components/objectinspector/objectinspector.pri index 733c4b3..565f78b 100644 --- a/tools/designer/src/components/objectinspector/objectinspector.pri +++ b/tools/designer/src/components/objectinspector/objectinspector.pri @@ -3,7 +3,7 @@ contains(CONFIG, static) { INCLUDEPATH *= $$QT_SOURCE_TREE/tools/shared/findwidget } else { - include($$QT_SOURCE_TREE/tools/shared/findwidget/findwidget.pri) + include(../../../../shared/findwidget/findwidget.pri) } INCLUDEPATH += $$PWD diff --git a/tools/designer/src/components/propertyeditor/propertyeditor.pri b/tools/designer/src/components/propertyeditor/propertyeditor.pri index a8ed37e..7d2e7cb 100644 --- a/tools/designer/src/components/propertyeditor/propertyeditor.pri +++ b/tools/designer/src/components/propertyeditor/propertyeditor.pri @@ -10,8 +10,8 @@ contains(CONFIG, static) { INCLUDEPATH *= $$QT_SOURCE_TREE/tools/shared/qtpropertybrowser INCLUDEPATH *= $$QT_SOURCE_TREE/tools/shared/qtgradienteditor } else { - include($$QT_SOURCE_TREE/tools/shared/qtpropertybrowser/qtpropertybrowser.pri) - include($$QT_SOURCE_TREE/tools/shared/qtgradienteditor/qtcolorbutton.pri) + include(../../../../shared/qtpropertybrowser/qtpropertybrowser.pri) + include(../../../../shared/qtgradienteditor/qtcolorbutton.pri) } FORMS += $$PWD/paletteeditor.ui \ diff --git a/tools/designer/src/designer/designer.pro b/tools/designer/src/designer/designer.pro index 8590c7b..51842c5 100644 --- a/tools/designer/src/designer/designer.pro +++ b/tools/designer/src/designer/designer.pro @@ -25,8 +25,8 @@ contains(CONFIG, static) { TARGET = designer -include($$QT_SOURCE_TREE/tools/shared/fontpanel/fontpanel.pri) -include($$QT_SOURCE_TREE/tools/shared/qttoolbardialog/qttoolbardialog.pri) +include(../../../shared/fontpanel/fontpanel.pri) +include(../../../shared/qttoolbardialog/qttoolbardialog.pri) HEADERS += \ qdesigner.h \ diff --git a/tools/designer/src/lib/shared/shared.pri b/tools/designer/src/lib/shared/shared.pri index 570b208..8286360 100644 --- a/tools/designer/src/lib/shared/shared.pri +++ b/tools/designer/src/lib/shared/shared.pri @@ -2,11 +2,11 @@ INCLUDEPATH += $$PWD contains(QT_CONFIG, script): QT += script -include($$QT_SOURCE_TREE/tools/shared/qtpropertybrowser/qtpropertybrowser.pri) -include($$QT_SOURCE_TREE/tools/shared/deviceskin/deviceskin.pri) -include($$QT_SOURCE_TREE/src/tools/rcc/rcc.pri) -include($$QT_SOURCE_TREE/tools/shared/findwidget/findwidget.pri) -include($$QT_SOURCE_TREE/tools/shared/qtgradienteditor/qtgradienteditor.pri) +include(../../../../shared/qtpropertybrowser/qtpropertybrowser.pri) +include(../../../../shared/deviceskin/deviceskin.pri) +include(../../../../../src/tools/rcc/rcc.pri) +include(../../../../shared/findwidget/findwidget.pri) +include(../../../../shared/qtgradienteditor/qtgradienteditor.pri) # Input FORMS += $$PWD/addlinkdialog.ui \ diff --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro index dde7e8d..c101d00 100644 --- a/tools/qvfb/qvfb.pro +++ b/tools/qvfb/qvfb.pro @@ -35,7 +35,7 @@ SOURCES = qvfb.cpp \ ../../src/gui/embedded/qlock.cpp \ ../../src/gui/embedded/qwssignalhandler.cpp -include($$QT_SOURCE_TREE/tools/shared/deviceskin/deviceskin.pri) +include(../shared/deviceskin/deviceskin.pri) contains(QT_CONFIG, opengl) { QT += opengl -- cgit v0.12 From 30bd9791c06bba8f70bcf129022808fd99be743d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 12 Jul 2010 20:21:31 +0200 Subject: remove redundand translations project files lupdate is now powerful enough to use the real project files. this avoids that the file lists run out of sync (which they did, though not as much as i expected). --- tools/assistant/lib/lib.pro | 13 +++ tools/assistant/tools/assistant/assistant.pro | 13 +++ tools/assistant/translations/qt_help.pro | 53 ---------- tools/assistant/translations/translations.pro | 54 ---------- tools/designer/designer.pro | 13 +++ tools/designer/src/designer/designer.pro | 1 - tools/designer/translations/translations.pro | 141 -------------------------- tools/qtconfig/qtconfig.pro | 8 ++ tools/qtconfig/translations/translations.pro | 16 --- tools/qvfb/qvfb.pro | 8 ++ tools/qvfb/translations/translations.pro | 35 ------- translations/translations.pri | 10 +- 12 files changed, 60 insertions(+), 305 deletions(-) delete mode 100644 tools/assistant/translations/qt_help.pro delete mode 100644 tools/assistant/translations/translations.pro delete mode 100644 tools/designer/translations/translations.pro delete mode 100644 tools/qtconfig/translations/translations.pro delete mode 100644 tools/qvfb/translations/translations.pro diff --git a/tools/assistant/lib/lib.pro b/tools/assistant/lib/lib.pro index 26d3456..e84cf31 100644 --- a/tools/assistant/lib/lib.pro +++ b/tools/assistant/lib/lib.pro @@ -69,3 +69,16 @@ HEADERS += qhelpenginecore.h \ # access to clucene HEADERS += qhelpsearchindexwriter_clucene_p.h \ qhelpsearchindexreader_clucene_p.h + +TR_DIR = $$PWD/../../../translations +TRANSLATIONS = \ + $$TR_DIR/qt_help_cs.ts \ + $$TR_DIR/qt_help_da.ts \ + $$TR_DIR/qt_help_de.ts \ + $$TR_DIR/qt_help_hu.ts \ + $$TR_DIR/qt_help_ja.ts \ + $$TR_DIR/qt_help_pl.ts \ + $$TR_DIR/qt_help_ru.ts \ + $$TR_DIR/qt_help_zh_CN.ts \ + $$TR_DIR/qt_help_zh_TW.ts \ + $$TR_DIR/qt_help_fr.ts diff --git a/tools/assistant/tools/assistant/assistant.pro b/tools/assistant/tools/assistant/assistant.pro index d9aff7a..16a520e 100644 --- a/tools/assistant/tools/assistant/assistant.pro +++ b/tools/assistant/tools/assistant/assistant.pro @@ -108,3 +108,16 @@ contains(CONFIG, static): { DEFINES += USE_STATIC_SQLITE_PLUGIN } } + +TR_DIR = $$PWD/../../../../translations +TRANSLATIONS = \ + $$TR_DIR/assistant_cs.ts \ + $$TR_DIR/assistant_da.ts \ + $$TR_DIR/assistant_de.ts \ + $$TR_DIR/assistant_fr.ts \ + $$TR_DIR/assistant_hu.ts \ + $$TR_DIR/assistant_ja.ts \ + $$TR_DIR/assistant_pl.ts \ + $$TR_DIR/assistant_ru.ts \ + $$TR_DIR/assistant_zh_CN.ts \ + $$TR_DIR/assistant_zh_TW.ts diff --git a/tools/assistant/translations/qt_help.pro b/tools/assistant/translations/qt_help.pro deleted file mode 100644 index 6f66876..0000000 --- a/tools/assistant/translations/qt_help.pro +++ /dev/null @@ -1,53 +0,0 @@ -# Include those manually as they do not contain any directory specification - -SOURCES += ../lib/qhelpcollectionhandler.cpp \ - ../lib/qhelpcontentwidget.cpp \ - ../lib/qhelpdatainterface.cpp \ - ../lib/qhelpdbreader.cpp \ - ../lib/qhelpengine.cpp \ - ../lib/qhelpenginecore.cpp \ - ../lib/qhelpgenerator.cpp \ - ../lib/qhelpindexwidget.cpp \ - ../lib/qhelpprojectdata.cpp \ - ../lib/qhelpsearchengine.cpp \ - ../lib/qhelpsearchindexreader_clucene.cpp \ - ../lib/qhelpsearchindexreader_default.cpp \ - ../lib/qhelpsearchindexwriter_clucene.cpp \ - ../lib/qhelpsearchindexwriter_default.cpp \ - ../lib/qhelpsearchindex_default.cpp \ - ../lib/qhelpsearchquerywidget.cpp \ - ../lib/qhelpsearchresultwidget.cpp - -HEADERS += ../lib/qhelpcollectionhandler_p.h \ - ../lib/qhelpcontentwidget.h \ - ../lib/qhelpdatainterface_p.h \ - ../lib/qhelpdbreader_p.h \ - ../lib/qhelpengine.h \ - ../lib/qhelpenginecore.h \ - ../lib/qhelpengine_p.h \ - ../lib/qhelpgenerator_p.h \ - ../lib/qhelpindexwidget.h \ - ../lib/qhelpprojectdata_p.h \ - ../lib/qhelpsearchengine.h \ - ../lib/qhelpsearchindexreader_clucene_p.h \ - ../lib/qhelpsearchindexreader_default_p.h \ - ../lib/qhelpsearchindexwriter_clucene_p.h \ - ../lib/qhelpsearchindexwriter_default_p.h \ - ../lib/qhelpsearchindex_default_p.h \ - ../lib/qhelpsearchquerywidget.h \ - ../lib/qhelpsearchresultwidget.h \ - ../lib/qhelp_global.h - - -TR_DIR = $$PWD/../../../translations -TRANSLATIONS = \ - $$TR_DIR/qt_help_cs.ts \ - $$TR_DIR/qt_help_da.ts \ - $$TR_DIR/qt_help_de.ts \ - $$TR_DIR/qt_help_hu.ts \ - $$TR_DIR/qt_help_ja.ts \ - $$TR_DIR/qt_help_pl.ts \ - $$TR_DIR/qt_help_ru.ts \ - $$TR_DIR/qt_help_zh_CN.ts \ - $$TR_DIR/qt_help_zh_TW.ts \ - $$TR_DIR/qt_help_fr.ts diff --git a/tools/assistant/translations/translations.pro b/tools/assistant/translations/translations.pro deleted file mode 100644 index c692262..0000000 --- a/tools/assistant/translations/translations.pro +++ /dev/null @@ -1,54 +0,0 @@ -# Include those manually as they do not contain any directory specification - -FORMS += ../tools/assistant/filternamedialog.ui \ - ../tools/assistant/installdialog.ui \ - ../tools/assistant/preferencesdialog.ui \ - ../tools/assistant/topicchooser.ui \ - ../tools/assistant/bookmarkdialog.ui - -SOURCES += ../tools/assistant/aboutdialog.cpp \ - ../tools/assistant/bookmarkmanager.cpp \ - ../tools/assistant/centralwidget.cpp \ - ../tools/assistant/cmdlineparser.cpp \ - ../tools/assistant/contentwindow.cpp \ - ../tools/assistant/filternamedialog.cpp \ - ../tools/assistant/helpviewer.cpp \ - ../tools/assistant/indexwindow.cpp \ - ../tools/assistant/installdialog.cpp \ - ../tools/assistant/main.cpp \ - ../tools/assistant/mainwindow.cpp \ - ../tools/assistant/preferencesdialog.cpp \ - ../tools/assistant/remotecontrol.cpp \ - ../tools/assistant/searchwidget.cpp \ - ../tools/assistant/topicchooser.cpp \ - -SOURCES += ../../shared/fontpanel/fontpanel.cpp - -HEADERS += ../tools/assistant/aboutdialog.h \ - ../tools/assistant/bookmarkmanager.h \ - ../tools/assistant/centralwidget.h \ - ../tools/assistant/cmdlineparser.h \ - ../tools/assistant/contentwindow.h \ - ../tools/assistant/filternamedialog.h \ - ../tools/assistant/helpviewer.h \ - ../tools/assistant/indexwindow.h \ - ../tools/assistant/installdialog.h \ - ../tools/assistant/mainwindow.h \ - ../tools/assistant/preferencesdialog.h \ - ../tools/assistant/remotecontrol.h \ - ../tools/assistant/remotecontrol_win.h \ - ../tools/assistant/searchwidget.h \ - ../tools/assistant/topicchooser.h \ - -TR_DIR = $$PWD/../../../translations -TRANSLATIONS = \ - $$TR_DIR/assistant_cs.ts \ - $$TR_DIR/assistant_da.ts \ - $$TR_DIR/assistant_de.ts \ - $$TR_DIR/assistant_fr.ts \ - $$TR_DIR/assistant_hu.ts \ - $$TR_DIR/assistant_ja.ts \ - $$TR_DIR/assistant_pl.ts \ - $$TR_DIR/assistant_ru.ts \ - $$TR_DIR/assistant_zh_CN.ts \ - $$TR_DIR/assistant_zh_TW.ts diff --git a/tools/designer/designer.pro b/tools/designer/designer.pro index 721c4fc..31c8622 100644 --- a/tools/designer/designer.pro +++ b/tools/designer/designer.pro @@ -3,3 +3,16 @@ TEMPLATE = subdirs CONFIG += qt SUBDIRS = src + +TR_DIR = $$PWD/../../translations +TRANSLATIONS = \ + $$TR_DIR/designer_cs.ts \ + $$TR_DIR/designer_de.ts \ + $$TR_DIR/designer_fr.ts \ + $$TR_DIR/designer_hu.ts \ + $$TR_DIR/designer_ja.ts \ + $$TR_DIR/designer_pl.ts \ + $$TR_DIR/designer_ru.ts \ + $$TR_DIR/designer_sl.ts \ + $$TR_DIR/designer_zh_CN.ts \ + $$TR_DIR/designer_zh_TW.ts diff --git a/tools/designer/src/designer/designer.pro b/tools/designer/src/designer/designer.pro index 51842c5..8564e96 100644 --- a/tools/designer/src/designer/designer.pro +++ b/tools/designer/src/designer/designer.pro @@ -88,4 +88,3 @@ INSTALLS += target include(../sharedcomponents.pri) unix:!mac:LIBS += -lm -TRANSLATIONS = designer_de.ts diff --git a/tools/designer/translations/translations.pro b/tools/designer/translations/translations.pro deleted file mode 100644 index 103c1fe..0000000 --- a/tools/designer/translations/translations.pro +++ /dev/null @@ -1,141 +0,0 @@ -include(../src/components/buddyeditor/buddyeditor.pri) -include(../src/components/component.pri) -include(../src/components/formeditor/formeditor.pri) -include(../src/components/objectinspector/objectinspector.pri) -include(../src/components/propertyeditor/propertyeditor.pri) -include(../src/components/signalsloteditor/signalsloteditor.pri) -include(../src/components/tabordereditor/tabordereditor.pri) -include(../src/components/taskmenu/taskmenu.pri) -include(../src/components/widgetbox/widgetbox.pri) -include(../src/lib/extension/extension.pri) -include(../src/lib/sdk/sdk.pri) -include(../src/lib/shared/shared.pri) -include(../src/lib/uilib/uilib.pri) -include(../../shared/qttoolbardialog/qttoolbardialog.pri) -include(../../shared/qtpropertybrowser/qtpropertybrowser.pri) -include(../../shared/qtgradienteditor/qtgradienteditor.pri) - -# Include ActiveQt plugin -SOURCES += ../src/plugins/activeqt/qaxwidgetextrainfo.cpp \ - ../src/plugins/activeqt/qaxwidgetplugin.cpp \ - ../src/plugins/activeqt/qaxwidgetpropertysheet.cpp \ - ../src/plugins/activeqt/qaxwidgettaskmenu.cpp \ - ../src/plugins/activeqt/qdesigneraxwidget.cpp - -HEADERS += ../src/plugins/activeqt/qaxwidgetextrainfo.h \ - ../src/plugins/activeqt/qaxwidgetplugin.h \ - ../src/plugins/activeqt/qaxwidgetpropertysheet.h \ - ../src/plugins/activeqt/qaxwidgettaskmenu.h \ - ../src/plugins/activeqt/qdesigneraxwidget.h \ - ../../../src/activeqt/shared/qaxtypes.h - - -# Include Qt3Support plugin - -SOURCES += ../src/plugins/widgets/qt3supportwidgets.cpp -HEADERS += ../src/plugins/widgets/q3iconview/q3iconview_extrainfo.h \ - ../src/plugins/widgets/q3iconview/q3iconview_plugin.h \ - ../src/plugins/widgets/q3listview/q3listview_extrainfo.h \ - ../src/plugins/widgets/q3listview/q3listview_plugin.h \ - ../src/plugins/widgets/q3mainwindow/q3mainwindow_container.h \ - ../src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.h \ - ../src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.h \ - ../src/plugins/widgets/q3toolbar/q3toolbar_plugin.h \ - ../src/plugins/widgets/q3widgetstack/q3widgetstack_container.h \ - ../src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.h \ - ../src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack_p.h \ - ../src/plugins/widgets/q3wizard/q3wizard_container.h \ - ../src/plugins/widgets/q3wizard/q3wizard_plugin.h \ - ../src/plugins/widgets/q3listbox/q3listbox_extrainfo.h \ - ../src/plugins/widgets/q3listbox/q3listbox_plugin.h \ - ../src/plugins/widgets/q3table/q3table_extrainfo.h \ - ../src/plugins/widgets/q3table/q3table_plugin.h \ - ../src/plugins/widgets/q3textedit/q3textedit_extrainfo.h \ - ../src/plugins/widgets/q3textedit/q3textedit_plugin.h \ - ../src/plugins/widgets/q3widgets/q3widget_plugins.h - -SOURCES += ../src/plugins/widgets/q3iconview/q3iconview_extrainfo.cpp \ - ../src/plugins/widgets/q3iconview/q3iconview_plugin.cpp \ - ../src/plugins/widgets/q3listview/q3listview_extrainfo.cpp \ - ../src/plugins/widgets/q3listview/q3listview_plugin.cpp \ - ../src/plugins/widgets/q3mainwindow/q3mainwindow_container.cpp \ - ../src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.cpp \ - ../src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.cpp \ - ../src/plugins/widgets/q3toolbar/q3toolbar_plugin.cpp \ - ../src/plugins/widgets/q3widgetstack/q3widgetstack_container.cpp \ - ../src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.cpp \ - ../src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack.cpp \ - ../src/plugins/widgets/q3wizard/q3wizard_container.cpp \ - ../src/plugins/widgets/q3wizard/q3wizard_plugin.cpp \ - ../src/plugins/widgets/q3listbox/q3listbox_extrainfo.cpp \ - ../src/plugins/widgets/q3listbox/q3listbox_plugin.cpp \ - ../src/plugins/widgets/q3table/q3table_extrainfo.cpp \ - ../src/plugins/widgets/q3table/q3table_plugin.cpp \ - ../src/plugins/widgets/q3textedit/q3textedit_extrainfo.cpp \ - ../src/plugins/widgets/q3textedit/q3textedit_plugin.cpp \ - ../src/plugins/widgets/q3widgets/q3widget_plugins.cpp - -# Include those manually as they do not contain any directory specification -APP_DIR=../src/designer -SOURCES += $$APP_DIR/appfontdialog.cpp \ - $$APP_DIR/assistantclient.cpp \ - $$APP_DIR/main.cpp \ - $$APP_DIR/mainwindow.cpp \ - $$APP_DIR/newform.cpp \ - $$APP_DIR/preferencesdialog.cpp \ - $$APP_DIR/qdesigner_actions.cpp \ - $$APP_DIR/qdesigner_appearanceoptions.cpp \ - $$APP_DIR/qdesigner.cpp \ - $$APP_DIR/qdesigner_formwindow.cpp \ - $$APP_DIR/qdesigner_server.cpp \ - $$APP_DIR/qdesigner_settings.cpp \ - $$APP_DIR/qdesigner_toolwindow.cpp \ - $$APP_DIR/qdesigner_workbench.cpp \ - $$APP_DIR/saveformastemplate.cpp \ - $$APP_DIR/versiondialog.cpp - -HEADERS+= $$APP_DIR/appfontdialog.h \ - $$APP_DIR/assistantclient.h \ - $$APP_DIR/designer_enums.h \ - $$APP_DIR/mainwindow.h \ - $$APP_DIR/newform.h \ - $$APP_DIR/preferencesdialog.h \ - $$APP_DIR/qdesigner_actions.h \ - $$APP_DIR/qdesigner_appearanceoptions.h \ - $$APP_DIR/qdesigner_formwindow.h \ - $$APP_DIR/qdesigner.h \ - $$APP_DIR/qdesigner_pch.h \ - $$APP_DIR/qdesigner_server.h \ - $$APP_DIR/qdesigner_settings.h \ - $$APP_DIR/qdesigner_toolwindow.h \ - $$APP_DIR/qdesigner_workbench.h \ - $$APP_DIR/saveformastemplate.h \ - $$APP_DIR/versiondialog.h - -FORMS += $$APP_DIR/preferencesdialog.ui \ - $$APP_DIR/qdesigner_appearanceoptions.ui \ - $$APP_DIR/saveformastemplate.ui - -# Shared solutions -SOURCES += ../../shared/fontpanel/fontpanel.cpp \ - ../../shared/deviceskin/deviceskin.cpp \ - ../../shared/findwidget/abstractfindwidget.cpp \ - ../../shared/findwidget/itemviewfindwidget.cpp \ - ../../shared/findwidget/texteditfindwidget.cpp \ - -HEADERS += ../../shared/findwidget/abstractfindwidget.h \ - ../../shared/findwidget/itemviewfindwidget.h \ - ../../shared/findwidget/texteditfindwidget.h - -TR_DIR = $$PWD/../../../translations -TRANSLATIONS = \ - $$TR_DIR/designer_cs.ts \ - $$TR_DIR/designer_de.ts \ - $$TR_DIR/designer_fr.ts \ - $$TR_DIR/designer_hu.ts \ - $$TR_DIR/designer_ja.ts \ - $$TR_DIR/designer_pl.ts \ - $$TR_DIR/designer_ru.ts \ - $$TR_DIR/designer_sl.ts \ - $$TR_DIR/designer_zh_CN.ts \ - $$TR_DIR/designer_zh_TW.ts diff --git a/tools/qtconfig/qtconfig.pro b/tools/qtconfig/qtconfig.pro index d1fd320..3a24e85 100644 --- a/tools/qtconfig/qtconfig.pro +++ b/tools/qtconfig/qtconfig.pro @@ -29,3 +29,11 @@ target.path=$$[QT_INSTALL_BINS] INSTALLS += target INCLUDEPATH += . DBFILE = qtconfig.db + +TR_DIR = $$PWD/../../translations +TRANSLATIONS = \ + $$TR_DIR/qtconfig_hu.ts \ + $$TR_DIR/qtconfig_pl.ts \ + $$TR_DIR/qtconfig_ru.ts \ + $$TR_DIR/qtconfig_zh_CN.ts \ + $$TR_DIR/qtconfig_zh_TW.ts diff --git a/tools/qtconfig/translations/translations.pro b/tools/qtconfig/translations/translations.pro deleted file mode 100644 index 5d35b6a..0000000 --- a/tools/qtconfig/translations/translations.pro +++ /dev/null @@ -1,16 +0,0 @@ -# Include those manually as they do not contain any directory specification - -SOURCES += ../colorbutton.cpp ../main.cpp ../previewframe.cpp ../previewwidget.cpp ../mainwindow.cpp ../paletteeditoradvanced.cpp \ - ../mainwindowbase.cpp ../paletteeditoradvancedbase.cpp ../previewwidgetbase.cpp -HEADERS += ../colorbutton.h ../previewframe.h ../previewwidget.h ../mainwindow.h ../paletteeditoradvanced.h \ - ../mainwindowbase.h ../paletteeditoradvancedbase.h ../previewwidgetbase.h - -FORMS = ../mainwindowbase.ui ../paletteeditoradvancedbase.ui ../previewwidgetbase.ui - -TR_DIR = $$PWD/../../../translations -TRANSLATIONS = \ - $$TR_DIR/qtconfig_hu.ts \ - $$TR_DIR/qtconfig_pl.ts \ - $$TR_DIR/qtconfig_ru.ts \ - $$TR_DIR/qtconfig_zh_CN.ts \ - $$TR_DIR/qtconfig_zh_TW.ts diff --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro index c101d00..df69817 100644 --- a/tools/qvfb/qvfb.pro +++ b/tools/qvfb/qvfb.pro @@ -62,3 +62,11 @@ unix:x11 { } RESOURCES += qvfb.qrc + +TR_DIR = $$PWD/../../translations +TRANSLATIONS = \ + $$TR_DIR/qvfb_hu.ts \ + $$TR_DIR/qvfb_pl.ts \ + $$TR_DIR/qvfb_ru.ts \ + $$TR_DIR/qvfb_zh_CN.ts \ + $$TR_DIR/qvfb_zh_TW.ts diff --git a/tools/qvfb/translations/translations.pro b/tools/qvfb/translations/translations.pro deleted file mode 100644 index b0b1af4..0000000 --- a/tools/qvfb/translations/translations.pro +++ /dev/null @@ -1,35 +0,0 @@ -# Include those manually as they do not contain any directory specification - -FORMS = ../config.ui -HEADERS = ../qvfb.h \ - ../qvfbview.h \ - ../qvfbratedlg.h \ - ../qanimationwriter.h \ - ../gammaview.h \ - ../qvfbprotocol.h \ - ../qvfbshmem.h \ - ../qvfbmmap.h \ - ../../../src/gui/embedded/qvfbhdr.h \ - ../../../src/gui/embedded/qlock_p.h \ - ../../../src/gui/embedded/qwssignalhandler_p.h \ - ../../shared/deviceskin/deviceskin.h - -SOURCES = ../qvfb.cpp \ - ../qvfbview.cpp \ - ../qvfbratedlg.cpp \ - ../main.cpp \ - ../qanimationwriter.cpp \ - ../qvfbprotocol.cpp \ - ../qvfbshmem.cpp \ - ../qvfbmmap.cpp \ - ../../../src/gui/embedded/qlock.cpp \ - ../../../src/gui/embedded/qwssignalhandler.cpp \ - ../../shared/deviceskin/deviceskin.cpp - -TR_DIR = $$PWD/../../../translations -TRANSLATIONS = \ - $$TR_DIR/qvfb_hu.ts \ - $$TR_DIR/qvfb_pl.ts \ - $$TR_DIR/qvfb_ru.ts \ - $$TR_DIR/qvfb_zh_CN.ts \ - $$TR_DIR/qvfb_zh_TW.ts diff --git a/translations/translations.pri b/translations/translations.pri index 9ab72fc..f5e54ca 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -40,7 +40,7 @@ ts-qt.depends = sub-tools ###### Designer ts-designer.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - ../tools/designer/translations/translations.pro) + ../tools/designer/designer.pro) ts-designer.depends = sub-tools ###### Linguist @@ -52,21 +52,21 @@ ts-linguist.depends = sub-tools ###### Assistant ts-assistant.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - ../tools/assistant/translations/translations.pro \ + ../tools/assistant/tools/assistant/assistant.pro \ && $$LUPDATE \ - ../tools/assistant/translations/qt_help.pro) + ../tools/assistant/lib/lib.pro) ts-assistant.depends = sub-tools ###### Qtconfig ts-qtconfig.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - ../tools/qtconfig/translations/translations.pro) + ../tools/qtconfig/qtconfig.pro) ts-qtconfig.depends = sub-tools ###### Qvfp ts-qvfb.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - ../tools/qvfb/translations/translations.pro) + ../tools/qvfb/qvfb.pro) ts-qvfb.depends = sub-tools ###### Overall Rules -- cgit v0.12 From 69910bc33dc448a9aa81eb00ed45be6d0488e447 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 13 Jul 2010 09:43:08 +0200 Subject: qdoc: Fixed breadcrumbs for QML examples. Task-number: QTBUG-11679 --- tools/qdoc3/htmlgenerator.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index fc761e5..f3a9589 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1702,8 +1702,9 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, } } else if (node->subType() == Node::Page) { - if (fn->name() == QString("examples.html")) { - out() << "
  • Examples
  • "; + if (fn->name() == QString("qdeclarativeexamples.html")) { + out() << "
  • Examples
  • "; + out() << "
  • QML Examples & Demos
  • "; } else if (fn->name().startsWith("examples-")) { out() << "
  • Examples
  • "; @@ -1723,10 +1724,14 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, else if (node->subType() == Node::Example) { out() << "
  • Examples
  • "; QStringList sl = fn->name().split('/'); - QString name = "examples-" + sl.at(0) + ".html"; - QString t = CodeParser::titleFromName(name); - out() << "
  • " - << t << "
  • "; + if (sl.contains("declarative")) + out() << "
  • QML Examples & Demos
  • "; + else { + QString name = "examples-" + sl.at(0) + ".html"; + QString t = CodeParser::titleFromName(name); + out() << "
  • " + << t << "
  • "; + } out() << "
  • " << title << "
  • "; } } -- cgit v0.12 From 2c48de46fdfeb935d1f31ae18f13add52c162ac8 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 13 Jul 2010 10:02:54 +0200 Subject: QSslSocket: fix documentation for QSslSocket::setPeerVerifyMode() --- src/network/ssl/qsslsocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index f85fa84..f73068e 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -574,7 +574,7 @@ void QSslSocket::setProtocol(QSsl::SslProtocol protocol) certificate is valid. The default mode is AutoVerifyPeer, which tells QSslSocket to use - VerifyPeer for clients, QueryPeer for clients. + VerifyPeer for clients and QueryPeer for servers. \sa setPeerVerifyMode(), peerVerifyDepth(), mode() */ @@ -594,7 +594,7 @@ QSslSocket::PeerVerifyMode QSslSocket::peerVerifyMode() const certificate is valid. The default mode is AutoVerifyPeer, which tells QSslSocket to use - VerifyPeer for clients, QueryPeer for clients. + VerifyPeer for clients and QueryPeer for servers. Setting this mode after encryption has started has no effect on the current connection. -- cgit v0.12 From 1d3aa6681423d7a39a8ed375448a9418ef33a1f5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 13 Jul 2010 10:18:39 +0200 Subject: qdoc: Fixed several
    elements that had the "/>" ending. --- tools/qdoc3/htmlgenerator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index f3a9589..8699cb2 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1347,7 +1347,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, if (!inner->doc().isEmpty()) { //out() << "
    \n" - out() << "
    \n" // QTBUG-9504 + out() << "
    \n" // QTBUG-9504 << "

    " << "Detailed Description" << "

    \n"; generateBody(inner, marker); out() << "
    \n"; // QTBUG-9504 @@ -1359,7 +1359,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, while (s != sections.end()) { //out() << "
    \n"; if (!(*s).divClass.isEmpty()) - out() << "
    \n"; // QTBUG-9504 + out() << "
    \n"; // QTBUG-9504 out() << "

    " << protectEnc((*s).name) << "

    \n"; NodeList::ConstIterator m = (*s).members.begin(); @@ -1596,11 +1596,11 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) Text brief = fake->doc().briefText(); if (fake->subType() == Node::Module && !brief.isEmpty()) { out() << "
    \n"; - out() << "
    \n"; // QTBUG-9504 + out() << "
    \n"; // QTBUG-9504 out() << "

    " << "Detailed Description" << "

    \n"; } else - out() << "
    \n"; // QTBUG-9504 + out() << "
    \n"; // QTBUG-9504 generateBody(fake, marker); out() << "
    \n"; // QTBUG-9504 -- cgit v0.12 From a0fffeed6fceb8244328b649a3f6feb520493bc2 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 12 Jul 2010 14:18:29 +0200 Subject: Fix regression in tst_qrand::testqrand() qrand() has seeded with a default value of 1 for quite a long time, and is checked by the test mentioned above. The previous commit to change the default seed value must be reverted to keep compatibility. Change qrand() and qsrand() back to the way they were in 4.5. This fixes the qrand() regression. Change QUuid::createUuid() to seed exactly once per thread, which is a change from 4.5, where QUuid would see only once per application. This solves the original bug, QTBUG-3543, where multiple threads would generate the same UUID sequences. This also fixes the regression reported in QTBUG-11213, where seeding did not happen in certain cases. Reviewed-by: Prasanth Ullattil --- src/corelib/global/qglobal.cpp | 9 +-------- src/corelib/plugin/quuid.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b24ba38..12745e9 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2609,14 +2609,7 @@ int qrand() SeedStorageType *pseed = seedStorage->localData(); if (!pseed) { seedStorage->setLocalData(pseed = new SeedStorageType); - - // Seed the PRNG, but only if it has not already been seeded. The - // default seed is a combination of current time, a stack address - // and a serial counter (since thread stack addresses are re-used). - static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); - *pseed = QDateTime::currentDateTime().toTime_t() - + quintptr(&pseed) - + serial.fetchAndAddRelaxed(1); + *pseed = 1; } return rand_r(pseed); } else { diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index f48cc2e..d0c59a4 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -577,6 +577,7 @@ QUuid QUuid::createUuid() QT_BEGIN_INCLUDE_NAMESPACE #include "qdatetime.h" +#include "qthreadstorage.h" #include // for RAND_MAX QT_END_INCLUDE_NAMESPACE @@ -591,6 +592,19 @@ QUuid QUuid::createUuid() randbits = r; } + static QThreadStorage uuidseed; + if (!uuidseed.hasLocalData()) { + // Seed the PRNG once per thread with a combination of current time, a + // stack address and a serial counter (since thread stack addresses are + // re-used). + int *pseed = new int; + static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); + qsrand(*pseed = QDateTime::currentDateTime().toTime_t() + + quintptr(&pseed) + + serial.fetchAndAddRelaxed(1)); + uuidseed.setLocalData(pseed); + } + QUuid result; uint *data = &(result.data1); int chunks = 16 / sizeof(uint); -- cgit v0.12 From a736d333aab9e2e97fdbb738b3f3f4646afe192e Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Tue, 13 Jul 2010 12:23:05 +0200 Subject: Compile when bootstrapping qmake QThreadStorage is not available when bootstrapping qmake, so fall back to a simple static bool instead. Reviewed-by: TrustMe --- src/corelib/plugin/quuid.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index d0c59a4..e1d4fc0 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -592,11 +592,13 @@ QUuid QUuid::createUuid() randbits = r; } + // Seed the PRNG once per thread with a combination of current time, a + // stack address and a serial counter (since thread stack addresses are + // re-used). +#ifndef QT_BOOTSTRAPPED static QThreadStorage uuidseed; - if (!uuidseed.hasLocalData()) { - // Seed the PRNG once per thread with a combination of current time, a - // stack address and a serial counter (since thread stack addresses are - // re-used). + if (!uuidseed.hasLocalData()) + { int *pseed = new int; static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2); qsrand(*pseed = QDateTime::currentDateTime().toTime_t() @@ -604,6 +606,12 @@ QUuid QUuid::createUuid() + serial.fetchAndAddRelaxed(1)); uuidseed.setLocalData(pseed); } +#else + static bool seeded = false; + if (!seeded) + qsrand(QDateTime::currentDateTime().toTime_t() + + quintptr(&seeded)); +#endif QUuid result; uint *data = &(result.data1); -- cgit v0.12 From c25c7c9bdfade6b906f37ac8bad44f6f0de57597 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 12 Jul 2010 18:32:06 +0200 Subject: QSslSocket: Improve error handling Reviewed-by: Markus Goetz Task-number: QT-3567 --- src/network/ssl/qsslsocket_openssl.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 8dc1743..c297eea 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -971,8 +971,20 @@ void QSslSocketBackendPrivate::transmit() #endif plainSocket->disconnectFromHost(); break; + case SSL_ERROR_SYSCALL: // some IO error + case SSL_ERROR_SSL: // error in the SSL library + // we do not know exactly what the error is, nor whether we can recover from it, + // so just return to prevent an endless loop in the outer "while" statement + q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR())); + q->setSocketError(QAbstractSocket::UnknownSocketError); + emit q->error(QAbstractSocket::UnknownSocketError); + return; default: - // ### Handle errors better. + // SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT: can only happen with a + // BIO_s_connect() or BIO_s_accept(), which we do not call. + // SSL_ERROR_WANT_X509_LOOKUP: can only happen with a + // SSL_CTX_set_client_cert_cb(), which we do not call. + // So this default case should never be triggered. q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR())); q->setSocketError(QAbstractSocket::UnknownSocketError); emit q->error(QAbstractSocket::UnknownSocketError); -- cgit v0.12 From 1199be3aa31bfe1d55799c6362b3e59601f99a8f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 13 Jul 2010 13:07:25 +0200 Subject: doc: Fixed several qdoc warnings. --- src/corelib/global/qnamespace.qdoc | 5 +++-- src/corelib/tools/qstring.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index ed2ae6e..5cd7f0e 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -470,6 +470,7 @@ \value TextIncludeTrailingSpaces Same as IncludeTrailingSpaces \value TextJustificationForced Ensures that text lines are justified. + \omitvalue TextBypassShaping \omitvalue BreakAnywhere \omitvalue DontClip \omitvalue DontPrint @@ -1730,7 +1731,7 @@ \value Key_MediaLast \value Key_unknown - \value Key_Call A key to answer or initiate a call (see \l Key_ToggleCallHangup for a key to toggle current call state) + \value Key_Call A key to answer or initiate a call (see Qt::Key_ToggleCallHangup for a key to toggle current call state) \value Key_Camera A key to activate the camera shutter \value Key_CameraFocus A key to focus the camera \value Key_Context1 @@ -1738,7 +1739,7 @@ \value Key_Context3 \value Key_Context4 \value Key_Flip - \value Key_Hangup A key to end an ongoing call (see \l Key_ToggleCallHangup for a key to toggle current call state) + \value Key_Hangup A key to end an ongoing call (see Qt::Key_ToggleCallHangup for a key to toggle current call state) \value Key_No \value Key_Select \value Key_Yes diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 57f79a0..b2cf49b 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -6954,7 +6954,7 @@ bool QString::isRightToLeft() const /*! \fn bool QString::isRightToLeft() const - \internal + Returns true if the string is read right to left. */ -- cgit v0.12 From f7fe575bc5f628533aeeca3eb564af89a1a1426b Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 12 Jul 2010 18:32:06 +0200 Subject: QSslSocket: Improve error handling Reviewed-by: Markus Goetz Task-number: QT-3567 --- src/network/ssl/qsslsocket_openssl.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index ce2aee1..6f77600 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -680,8 +680,20 @@ void QSslSocketBackendPrivate::transmit() #endif plainSocket->disconnectFromHost(); break; + case SSL_ERROR_SYSCALL: // some IO error + case SSL_ERROR_SSL: // error in the SSL library + // we do not know exactly what the error is, nor whether we can recover from it, + // so just return to prevent an endless loop in the outer "while" statement + q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR())); + q->setSocketError(QAbstractSocket::UnknownSocketError); + emit q->error(QAbstractSocket::UnknownSocketError); + return; default: - // ### Handle errors better. + // SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT: can only happen with a + // BIO_s_connect() or BIO_s_accept(), which we do not call. + // SSL_ERROR_WANT_X509_LOOKUP: can only happen with a + // SSL_CTX_set_client_cert_cb(), which we do not call. + // So this default case should never be triggered. q->setErrorString(QSslSocket::tr("Error while reading: %1").arg(SSL_ERRORSTR())); q->setSocketError(QAbstractSocket::UnknownSocketError); emit q->error(QAbstractSocket::UnknownSocketError); -- cgit v0.12 From b2a4c7f0142a48f60e7ec4fc5866917e3da8b7c3 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Fri, 2 Jul 2010 19:31:51 +0200 Subject: Fix an Assert in QTextTable The problem was caused by the fragment id being inserted in front of a cell spanning over several rows instead of the next logical cell (or fragment_end) in the cells structure. Task-number: QTBUG-11282 Reviewed-by: Simon Hausmann --- src/gui/text/qtexttable.cpp | 28 ++++++++++++++--- tests/auto/qtexttable/tst_qtexttable.cpp | 54 ++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index 5100176..e3985ce 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -754,19 +754,39 @@ void QTextTable::insertColumns(int pos, int num) QTextFormatCollection *c = p->formatCollection(); p->beginEditBlock(); + QList extendedSpans; for (int i = 0; i < d->nRows; ++i) { int cell; if (i == d->nRows - 1 && pos == d->nCols) cell = d->fragment_end; else cell = d->grid[i*d->nCols + pos]; - QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); - QTextCharFormat fmt = c->charFormat(it->format); if (pos > 0 && pos < d->nCols && cell == d->grid[i*d->nCols + pos - 1]) { // cell spans the insertion place, extend it - fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num); - p->setCharFormat(it.position(), 1, fmt); + if (!extendedSpans.contains(cell)) { + QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); + QTextCharFormat fmt = c->charFormat(it->format); + fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num); + p->setCharFormat(it.position(), 1, fmt); + d->dirty = true; + extendedSpans << cell; + } } else { + /* If the next cell is spanned from the row above, we need to find the right position + to insert to */ + if (i > 0 && pos < d->nCols && cell == d->grid[(i-1) * d->nCols + pos]) { + int gridIndex = i*d->nCols + pos; + const int gridEnd = d->nRows * d->nCols - 1; + while (gridIndex < gridEnd && cell == d->grid[gridIndex]) { + ++gridIndex; + } + if (gridIndex == gridEnd) + cell = d->fragment_end; + else + cell = d->grid[gridIndex]; + } + QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); + QTextCharFormat fmt = c->charFormat(it->format); fmt.setTableCellRowSpan(1); fmt.setTableCellColumnSpan(1); Q_ASSERT(fmt.objectIndex() == objectIndex()); diff --git a/tests/auto/qtexttable/tst_qtexttable.cpp b/tests/auto/qtexttable/tst_qtexttable.cpp index 2e6007e..b0cb34d 100644 --- a/tests/auto/qtexttable/tst_qtexttable.cpp +++ b/tests/auto/qtexttable/tst_qtexttable.cpp @@ -48,9 +48,14 @@ #include #include #include +#include +#include //TESTED_FILES= +typedef QList IntList; +Q_DECLARE_METATYPE(IntList) + QT_FORWARD_DECLARE_CLASS(QTextDocument) class tst_QTextTable : public QObject @@ -78,6 +83,7 @@ private slots: void insertRows(); void deleteInTable(); void mergeCells(); + void mergeAndInsert(); void splitCells(); void blocksForTableShouldHaveEmptyFormat(); void removeTableByRemoveRows(); @@ -93,6 +99,8 @@ private slots: void removeColumns3(); void removeColumns4(); void removeColumns5(); + void QTBUG11282_insertBeforeMergedEnding_data(); + void QTBUG11282_insertBeforeMergedEnding(); private: QTextTable *create2x2Table(); @@ -586,6 +594,16 @@ void tst_QTextTable::mergeCells() QVERIFY(table->cellAt(0, 1) == table->cellAt(1, 1)); } +void tst_QTextTable::mergeAndInsert() +{ + QTextTable *table = cursor.insertTable(4,3); + table->mergeCells(0,1,3,2); + table->mergeCells(3,0,1,3); + //Don't crash ! + table->insertColumns(1,2); + QCOMPARE(table->columns(), 5); +} + void tst_QTextTable::splitCells() { QTextTable *table = create4x4Table(); @@ -931,5 +949,41 @@ void tst_QTextTable::removeColumns5() QCOMPARE(table->cellAt(3, 2).firstPosition(), 11); } +void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding_data() +{ + QTest::addColumn("rows"); + QTest::addColumn("columns"); + QTest::addColumn >("merge"); + QTest::addColumn >("insert"); + + QTest::newRow("2x3, merge two, insert one") << 2 << 3 << (QList() << 1 << 2 << 2) + << (QList() << 1 << 1) ; + QTest::newRow("3x4, merge three, insert one") << 3 << 4 << (QList() << 1 << 3 << 3) + << (QList() << 1 << 1) ; + QTest::newRow("4x3, merge two, insert two") << 4 << 3 << (QList() << 1 << 4 << 2) + << (QList() << 1 << 2) ; + QTest::newRow("4x4, merge middle two, insert one") << 4 << 4 << (QList() << 1 << 4 << 2) + << (QList() << 1 << 1) ; +} + +void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding() +{ + QFETCH(int, rows); + QFETCH(int, columns); + QFETCH(QList, merge); + QFETCH(QList, insert); + QTextTable *table = cursor.insertTable(rows, columns); + QTextEdit *textEdit = new QTextEdit; + textEdit->setDocument(doc); + textEdit->show(); + QTest::qWaitForWindowShown(textEdit); + table->mergeCells(0,merge.at(0), merge.at(1), merge.at(2)); + //Don't crash ! + table->insertColumns(insert.at(0), insert.at(1)); + //Check that the final size is what we expected + QCOMPARE(table->rows(), rows); + QCOMPARE(table->columns(), columns + insert.at(1)); +} + QTEST_MAIN(tst_QTextTable) #include "tst_qtexttable.moc" -- cgit v0.12 From 079a4105aff9c63d4107762aec478ade9900c7c2 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 13 Jul 2010 15:28:14 +0200 Subject: doc: Fixed several qdoc warnings. --- doc/src/classes/phonon-api.qdoc | 12 +----------- doc/src/platforms/symbian-introduction.qdoc | 17 +++++++++++++++++ src/corelib/io/qprocess.cpp | 4 ++-- src/gui/text/qtextcursor.cpp | 6 +++--- src/network/socket/qtcpserver.cpp | 2 +- src/opengl/qgl.cpp | 14 ++++++++++---- 6 files changed, 34 insertions(+), 21 deletions(-) diff --git a/doc/src/classes/phonon-api.qdoc b/doc/src/classes/phonon-api.qdoc index 641b936..6fe0223 100644 --- a/doc/src/classes/phonon-api.qdoc +++ b/doc/src/classes/phonon-api.qdoc @@ -1577,7 +1577,6 @@ \since 4.4 \brief The MediaObject class provides an interface for media playback. - The media object manages a \l{Phonon::}{MediaSource}, which supplies the media object with multimedia content, e.g., from a file. A playback in Phonon is always started by calling the @@ -1651,17 +1650,8 @@ playback of the current source, but it is possible to try with a different one. A user readable error message is given by errorString(). - \section1 Symbian Platform Security Requirements - - On Symbian, processes which access media via the network must - have the \c NetworkServices platform security capability. If the client - process lacks this capability, operations will result in errors. - This failure is indicated by a state() of Phonon::ErrorState. - - Platform security capabilities are added via the - \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY} - qmake variable. + \sa {Symbian Platform Security Requirements} \sa Phonon::MediaSource, Phonon::AudioOutput, VideoWidget, {Music Player Example}, {Phonon Overview}, Phonon::VideoPlayer, Phonon::createPlayer(), {Phonon Module} diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 22d858f..afb17c4 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -51,6 +51,7 @@ \o \l {Exception Safety with Symbian} \o \l {Platform Notes - Symbian} {Qt for the Symbian platform - state of support} \o \l {qmake Platform Notes#Symbian platform} {Qt for Symbian extensions for qmake} + \o \l {Symbian Platform Security Requirements} {Symbian Platform Security Requirements} \endlist \o \list @@ -60,6 +61,22 @@ */ /*! + \page symbian-platform-security-requirements.html + + \title Symbian Platform Security Requirements + \ingroup qtsymbian + + On Symbian, processes that access media via the network must + have the \c NetworkServices platform security capability. If the client + process lacks this capability, operations will result in errors. + This failure is indicated by a state() of Phonon::ErrorState. + + Platform security capabilities are added via the + \l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY} + qmake variable. +*/ + +/*! \page symbian-with-qt-introduction.html \title The Symbian platform - Introduction to Qt diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 9bc4063..739ac4d 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1399,10 +1399,10 @@ QString QProcess::nativeArguments() const \since 4.7 \overload - Sets additional native command line arguments for the program. + Sets additional native command line \a arguments for the program. On operating systems where the system API for passing command line - arguments to a subprocess natively uses a single string, one can + \a arguments to a subprocess natively uses a single string, one can conceive command lines which cannot be passed via QProcess's portable list-based API. In such cases this function must be used to set a string which is \e appended to the string composed from the usual diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index daa40a1..769ab2f 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -1283,7 +1283,7 @@ void QTextCursor::setVisualNavigation(bool b) /*! \since 4.7 - Sets the visual x position for vertical cursor movements. + Sets the visual x position for vertical cursor movements to \a x. The vertical movement x position is cleared automatically when the cursor moves horizontally, and kept unchanged when the cursor moves vertically. The mechanism allows the cursor to move up and down on a @@ -1335,8 +1335,8 @@ bool QTextCursor::keepPositionOnInsert() const Defines whether the cursor should keep its current position when text gets inserted at the current position of the cursor. - If \b is true, the cursor keeps its current position when text gets inserted at the positing of the cursor. - If \b is false, the cursor moves along with the inserted text. + If \a b is true, the cursor keeps its current position when text gets inserted at the positing of the cursor. + If \a b is false, the cursor moves along with the inserted text. The default is false. diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp index 55f926d..0640c7c 100644 --- a/src/network/socket/qtcpserver.cpp +++ b/src/network/socket/qtcpserver.cpp @@ -577,7 +577,7 @@ void QTcpServer::incomingConnection(int socketDescriptor) /*! This function is called by QTcpServer::incomingConnection() - to add a socket to the list of pending incoming connections. + to add the \a socket to the list of pending incoming connections. \note Don't forget to call this member from reimplemented incomingConnection() if you do not want to break the diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index fc28a73..2fa33bf 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1334,6 +1334,10 @@ QGLFormat::OpenGLVersionFlags Q_AUTOTEST_EXPORT qOpenGLVersionFlagsFromString(co \value OpenGL_Version_3_2 OpenGL version 3.2 or higher is present. + \value OpenGL_Version_3_3 OpenGL version 3.3 or higher is present. + + \value OpenGL_Version_4_0 OpenGL version 4.0 or higher is present. + \value OpenGL_ES_CommonLite_Version_1_0 OpenGL ES version 1.0 Common Lite or higher is present. \value OpenGL_ES_Common_Version_1_0 OpenGL ES version 1.0 Common or higher is present. @@ -5037,8 +5041,9 @@ void QGLWidget::deleteTexture(QMacCompatGLuint id) /*! \since 4.4 - Calls the corresponding QGLContext::drawTexture() on - this widget's context. + Calls the corresponding QGLContext::drawTexture() with + \a target, \a textureId, and \a textureTarget for this + widget's context. */ void QGLWidget::drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget) { @@ -5058,8 +5063,9 @@ void QGLWidget::drawTexture(const QRectF &target, QMacCompatGLuint textureId, QM /*! \since 4.4 - Calls the corresponding QGLContext::drawTexture() on - this widget's context. + Calls the corresponding QGLContext::drawTexture() with + \a point, \a textureId, and \a textureTarget for this + widget's context. */ void QGLWidget::drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget) { -- cgit v0.12 From b8622b62289474c45d60eba110b201d400492ea3 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 13 Jul 2010 15:33:01 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 038b62085831eef4dee423361c65ecd55b7b9b1d ) Changes in WebKit/qt since the last update: * backport: https://bugs.webkit.org/show_bug.cgi?id=30978 -- [Qt] ASSERT failure while running DRT --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 15 +++++++++++++++ src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp | 8 ++++++++ src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h | 4 +++- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 354e21d..b6178b9 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - fc13f9b396e1448cd71266f56ba7a93de5cf6ed9 + 038b62085831eef4dee423361c65ecd55b7b9b1d diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 8a75d6b..3a9fce0 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,18 @@ +2009-11-14 Yael Aharon + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] ASSERT failure while running DRT + https://bugs.webkit.org/show_bug.cgi?id=30978 + + Add needed Structure typeInfo flags to QtRuntimeObjectImpl and QtRuntimeMethod. + These flags are needed after r49649, where HasDefaultmark was changed to OverrideMarkChildren. + + * bridge/qt/qt_instance.cpp: + (JSC::Bindings::QtRuntimeObjectImp::createStructure): + * bridge/qt/qt_runtime.h: + (JSC::Bindings::QtRuntimeMethod::createStructure): + 2010-06-16 Dawit Alemayehu Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp index ec362ec..c6185e9 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp @@ -58,6 +58,14 @@ public: instance->markAggregate(markStack); } + static PassRefPtr createStructure(JSValue prototype) + { + return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags)); + } + +protected: + static const unsigned StructureFlags = RuntimeObjectImp::StructureFlags | OverridesMarkChildren; + private: virtual const ClassInfo* classInfo() const { return &s_info; } }; diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h index f2ce954..dc55f61 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.h @@ -151,10 +151,12 @@ public: static PassRefPtr createStructure(JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType, OverridesGetOwnPropertySlot | OverridesMarkChildren)); + return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags)); } protected: + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags | OverridesMarkChildren; + QtRuntimeMethodData *d_func() const {return d_ptr;} QtRuntimeMethod(QtRuntimeMethodData *dd, ExecState *exec, const Identifier &n, PassRefPtr inst); QtRuntimeMethodData *d_ptr; -- cgit v0.12 From 5608f5c35dd3f4470f51436ead9a7048d561affa Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 13 Jul 2010 17:04:31 +0200 Subject: Doc: Reviewed Michael's model/view tutorial and overview document. Reviewed-by: Trust Me --- doc/src/tutorials/modelview.qdoc | 791 +++++++++++++-------- examples/tutorials/modelview/1_readonly/main.cpp | 1 + .../tutorials/modelview/1_readonly/modelview.cpp | 5 +- .../tutorials/modelview/1_readonly/modelview.h | 6 +- .../tutorials/modelview/1_readonly/mymodel.cpp | 14 +- examples/tutorials/modelview/1_readonly/mymodel.h | 5 +- .../tutorials/modelview/2_formatting/modelview.cpp | 2 +- .../tutorials/modelview/2_formatting/mymodel.cpp | 22 +- .../modelview/3_changingmodel/modelview.cpp | 2 +- .../modelview/3_changingmodel/mymodel.cpp | 16 +- .../tutorials/modelview/4_headers/modelview.cpp | 2 +- examples/tutorials/modelview/4_headers/mymodel.cpp | 10 +- examples/tutorials/modelview/5_edit/modelview.cpp | 6 +- examples/tutorials/modelview/5_edit/mymodel.cpp | 21 +- examples/tutorials/modelview/5_edit/mymodel.h | 9 +- .../tutorials/modelview/6_treeview/modelview.cpp | 8 +- .../tutorials/modelview/6_treeview/modelview.h | 2 +- .../tutorials/modelview/7_selections/modelview.cpp | 8 +- examples/tutorials/modelview/qmake.pro | 10 - 19 files changed, 564 insertions(+), 376 deletions(-) delete mode 100755 examples/tutorials/modelview/qmake.pro diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index bc03f44..98096a0 100755 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -1,10 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2010 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:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + /*! \page modelview.html \startpage {index.html}{Qt Reference Documentation} - \contentspage {modelview-index.html}{ModelView Contents} \nextpage {modelview-part1.html}{Introduction} - \title ModelView Contents Page + + \title Model/View Contents \brief An introduction to ModelView programming This tutorial gives an introduction to ModelView programming using the Qt @@ -14,17 +41,17 @@ \omit It doesn't cover everything; the emphasis is on teaching the programming - philosophy of ModelView programming, and Qt's features are introduced as needed. - Some commonly used features are never used in this tutorial. + philosophy of Model/View programming, and Qt's features are introduced as + needed. Some commonly used features are never used in this tutorial. \endomit In the process, we will learn about some basic technologies provided by Qt, such as: \list - \o The difference between standard and modelview widgets + \o The difference between standard and model/view widgets \o Adapters betweeen forms and models - \o Developing a simple Model/View application + \o Developing a simple model/view application \o Intermediate topics such as: \list \o Tree views @@ -43,9 +70,9 @@ \list 1 \o \l{modelview-part1.html}{Introduction} - \o \l{modelview-part2.html}{Developing a simple ModelView application} + \o \l{modelview-part2.html}{Developing a Simple Model/View Application} \o \l{modelview-part3.html}{Intermediate Topics} - \o \l{modelview-part4.html}{Good Sources for Additional Information} + \o \l{modelview-part4.html}{Good Sources of Additional Information} \endlist @@ -53,13 +80,18 @@ /*! \page modelview-part1.html + \contentspage {modelview-index.html}{Model/View Contents} + \previouspage {modelview-index.html}{Model/View Contents} + \nextpage {modelview-part2.html}{Developing a Simple Model/View Application} \title An Introduction to Model/View Programming - \raw HTML -
    - \endraw -\section1 1 Introduction -Model/View is a technology used to separate data from views in widgets that handle data sets. Standard Widgets are not designed for separating data from views and this is why Qt 4 has two different types of widgets. Both types of widgets look the same, but they interact with data differently. + \section1 1. Introduction + + Model/View is a technology used to separate data from views in widgets that + handle data sets. Standard widgets are not designed for separating data + from views and this is why Qt 4 has two different types of widgets. Both + types of widgets look the same, but they interact with data differently. + \table \row \o Standard widgets use data that is part of the widget. @@ -68,129 +100,193 @@ Model/View is a technology used to separate data from views in widgets that hand \o View classes operate on external data (the model) \o \image modelview.png \endtable -\section2 1.1 Standard widgets -Let's have a closer look at a standard table widget. A table widget is a 2D array of the data elements that the user can change. The table widget can be integrated into a program flow by reading and writing the data elements that the table widget provides. This method is very intuitive and useful in many applications. -Displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the widget; one inside the widget. The developer needs to know where up-to-date data is so the both copies contain the most recent data. The tight coupling of presentation and data makes it harder to write unit tests. + \section2 1.1 Standard Widgets + + Let's have a closer look at a standard table widget. A table widget is a 2D + array of the data elements that the user can change. The table widget can + be integrated into a program flow by reading and writing the data elements + that the table widget provides. This method is very intuitive and useful in + many applications. + + Displaying and editing a database table with a standard table widget can be + problematic. Two copies of the data have to be coordinated: one outside the + widget; one inside the widget. The developer needs to know where up-to-date + data is so the both copies contain the most recent data. The tight coupling + of presentation and data makes it harder to write unit tests. + + \section2 1.2 Model/View to the Rescue + + Model/view stepped up to provide a solution that uses a more versatile + architecture. Model/view eliminates the data consistency problems that may + occur with standard widgets. Model/view also makes it easier to use more + than one view of the same data because one model can be passed on to many + views. The most important difference is that model/view widgets do not + store data behind the table cells. In fact, they operate directly from your + data. Since view classes do not know your data's structure, you need to + provide a wrapper to make your data conform to the QAbstractItemModel + interface. A view uses this interface to read from and write to your data + and any class that implements QAbstractItemModel is a model. Once the view + receives a pointer to a model, it will read and display its content and be + its editor. + + \section2 1.3 Overview of the Model/View Widgets -\section2 1.2 Model/View to the rescue -Model/View stepped up to provide a solution that uses a more versatile architecture. Model/View eliminates the data consistency problems that may occur with standard widgets. Model/View also makes it easier to use more than one view of the same data because one model can be passed on to many views. The most important difference is that model/view widgets do not store data behind the table cells. In fact, they operate directly from your data. Since view classes do not know your data's structure, you need to provide a wrapper to make your data conform to the \l QAbstractItemModel interface. A view uses this interface to read from and write to your data and any class that implements \l QAbstractItemModel is a model. Once the view receives a pointer to a model, it will read and display its content and be its editor. + Here is an overview of the model/view widgets and their corresponding + standard widgets. -\section2 1.3 Overview of the model/view widgets -Here is an overview of the model/view widgets and their corresponding standard widgets. \table \header \o Widget - \o Standard Widget -(a convenience class with data in the widget) + \o Standard Widget (a convenience class with data in + the widget) \o Model/View View Class (for use with external data) \row - \o \image listview.png + \o \inlineimage listview.png \o \l QListWidget \o \l QListView \row - \o \image tableview.png + \o \inlineimage tableview.png \o \l QTableWidget \o \l QTableView \row - \o \image treeview.png + \o \inlineimage treeview.png \o \l QTreeWidget \o \l QTreeView \row - \o \image columnview.png - \o + \o \inlineimage columnview.png + \o \o \l QColumnView shows a tree as a hierarchy of lists \row - \o \image combobox.png - \o {2, 1} \l QComboBox can work as both a view class and also as a traditional widget + \o \inlineimage combobox.png + \o {2, 1} \l QComboBox can work as both a view class and also + as a traditional widget \endtable -\section2 1.4 Having adapters between forms and models can come in handy. -We often prefer editing data stored in tables (e.g. in database tables) in forms rather than in tables. There is no direct model/view counterpart for separating data and views for widgets that operate on one value instead of a dataset, so we need an adapter in order to connect the form to the source of data. + \section2 1.4 Using Adapters between Forms and Models -\l QDataWidgetMapper is a great solution because it maps form widgets to a table row and it makes it very easy to build forms for database tables. -\image widgetmapper.png + Having adapters between forms and models can come in handy. + We often prefer editing data stored in tables (e.g. in database tables) in + forms rather than in tables. There is no direct model/view counterpart for + separating data and views for widgets that operate on one value instead of + a dataset, so we need an adapter in order to connect the form to the source + of data. -Another example of an adapter is \l QCompleter. Qt has QCompleter for providing auto completions in Qt widgets such as \l QComboBox and, as shown below, \l QLineEdit. \l QCompleter uses a model as its data source, so \l QCompleter, in itself, is a very handy adapter. -\image qcompleter.png + \l QDataWidgetMapper is a great solution because it maps form widgets to a + table row and it makes it very easy to build forms for database tables. + \image widgetmapper.png + Another example of an adapter is QCompleter. Qt has QCompleter for + providing auto-completions in Qt widgets such as QComboBox and, as shown + below, QLineEdit. QCompleter uses a model as its data source, so QCompleter, + in itself, is a very handy adapter. + + \image qcompleter.png */ /*! - - \page modelview-part2-main-cpp.html \title main.cpp \quotefile tutorials/modelview/1_readonly/main.cpp - - */ /*! \page modelview-part2.html - \title ModelView Chapter 2 - A Simple Model/View Application - - \raw HTML -
    - \endraw - -\section1 2 A Simple Model/View Application -If you want to develop a model/view application, where should you start? We recommend starting with a simple example and extending it step-by-step. This makes understanding the architecture a lot easier. Trying to understand the model/view architecture in detail before invoking the IDE has proven to be less convenient for many developers. It is substantially easier to start with a simple model/view application that has demo data. Give it a try! Simply replace the data in the examples below with your own. + \contentspage {modelview-index.html}{Model/View Contents} + \previouspage {modelview-part1.html}{Introduction} + \nextpage {modelview-part3.html}{Intermediate Topics} + \title Model/View Chapter 2 - A Simple Model/View Application + + \section1 2. A Simple Model/View Application + + If you want to develop a model/view application, where should you start? We + recommend starting with a simple example and extending it step-by-step. + This makes understanding the architecture a lot easier. Trying to + understand the model/view architecture in detail before invoking the IDE + has proven to be less convenient for many developers. It is substantially + easier to start with a simple model/view application that has demo data. + Give it a try! Simply replace the data in the examples below with your own. + + Below are 7 very simple and independent applications that show different + sides of model/view programming. The source code can be found inside the + \c{examples/tutorials/modelview} directory. -Below are 7 very simple and independent applications that show different sides of model/view programming. The source code can be downloaded from @todo___________paste link here_________________________ + \section2 2.1 A Read Only Table -\section2 2.1 A read only table -We start with an application that uses a \l QTableView to show data. We will add editing capabilities later. + We start with an application that uses a QTableView to show data. We will + add editing capabilities later. --------------------------------------------------------------main.cpp--------------------- \snippet examples/tutorials/modelview/1_readonly/main.cpp Quoting ModelView Tutorial -We have the usual \l {modelview-part2-main-cpp.html}{main()} function; --------------------------------------------------------------modelview.h--------------------- + We have the usual \l {modelview-part2-main-cpp.html}{main()} function: + \snippet examples/tutorials/modelview/1_readonly/modelview.h Quoting ModelView Tutorial -The application is a \l QMainWindow that holds a \l QTableView. + The application is a \l QMainWindow that holds a \l QTableView. --------------------------------------------------------------modelview.cpp--------------------- \snippet examples/tutorials/modelview/1_readonly/modelview.cpp Quoting ModelView Tutorial -Here is the interesting part: We use \l{QTableView::setModel()}{tableView->setModel(new MyModel(this) );} to instantiate the Model and pass its pointer to \l {QTableView}{tableView()}. \l {QTableView}{tableView} will invoke the methods of the pointer it has received to find out two things: + Here is the interesting part: We use + \l{QTableView::setModel()}{tableView->setModel(new MyModel(this));} to + instantiate the Model and pass its pointer to \l {QTableView}{tableView()}. + \l{QTableView}{tableView} will invoke the methods of the pointer it has + received to find out two things: + \list \o How many rows and columns should be displayed \o What content should be printed into each cell. \endlist -The model needs some code to respond to this. + The model needs some code to respond to this. -We have a table data set, so let's start with QAbstractTableModel since it is easier to use. --------------------------------------------------------------mymodel.h--------------------- - \snippet examples/tutorials/modelview/1_readonly/mymodel.h Quoting ModelView Tutorial + We have a table data set, so let's start with QAbstractTableModel since it + is easier to use. -QAbstractTableModel requires the implementation of three abstract methods. + \snippet examples/tutorials/modelview/1_readonly/mymodel.h Quoting ModelView Tutorial + QAbstractTableModel requires the implementation of three abstract methods. --------------------------------------------------------------mymodel.cpp--------------------- \snippet examples/tutorials/modelview/1_readonly/mymodel.cpp Quoting ModelView Tutorial -The number of rows and columns is set by \l{QAbstractItemModel::rowCount()}{MyModel::rowCount()} and \l{QAbstractItemModel::columnCount()}{MyModel::columnCount()}. -When the view has to know what the cell 's text is, it calls the method. Row and column information is specified with parameter \c index and the role is set to \l{Qt::ItemDataRole}{Qt::DisplayRole}. Other roles are covered in the next section. In our example, the data that should be displayed is generated. In a real application, \c MyModel would have a member called \c MyData, which serves as the target for all reading and writing operations. - -This small example demonstrates the passive nature of a model. The model does not know when it will be used or which data is needed. It simply provides data each time the view requests it. - -What happens when the model 's data needs to be changed? How does the view know when data changes and needs to be read again? The model has to emit a signal that indicates what range of cells has changed. This will be demonstrated in section 2.3. + The number of rows and columns is set by + \l{QAbstractItemModel::rowCount()}{MyModel::rowCount()} and + \l{QAbstractItemModel::columnCount()}{MyModel::columnCount()}. + When the view has to know what the cell's text is, it calls the method. + Row and column information is specified with parameter \c index and the + role is set to \l{Qt::ItemDataRole}{Qt::DisplayRole}. Other roles are + covered in the next section. In our example, the data that should be + displayed is generated. In a real application, \c MyModel would have a + member called \c MyData, which serves as the target for all reading and + writing operations. + + This small example demonstrates the passive nature of a model. The model + does not know when it will be used or which data is needed. It simply + provides data each time the view requests it. + + What happens when the model 's data needs to be changed? How does the view + know when data changes and needs to be read again? The model has to emit a + signal that indicates what range of cells has changed. This will be + demonstrated in section 2.3. + + \section2 2.2 Extending the Read Only Example with Roles + + In addition to controlling what text the view displays, the model also + controls the text's appearance. When we slightly change the model, we get + the following result: \image readonlytable_role.png + + In fact, nothing except for the \l{QAbstractItemModel::}{data()} + method needs to be changed to set fonts, background colour, alignment and a + checkbox. + Here is the \l{QAbstractItemModel::data()}{data()} method that produces the + result shown above: -\section2 2.2 Extending the read only example with roles -In addition to controlling what text the view displays, the model also controls the text's appearance. When we slightly change the model, we get the following result: \image readonlytable_role.png - - -In fact, nothing except for the \l{QAbstractItemModel::data()}{data()} method needs to be changed to set fonts, background colour, alignment and a checkbox. Here is the \l{QAbstractItemModel::data()}{data()} method that produces the result shown above: - --------------------------------------------------------------mymodel.cpp--------------------- \snippet examples/tutorials/modelview/2_formatting/mymodel.cpp Quoting ModelView Tutorial -Each formatting property will be requested from the model with a separate call to the \l{QAbstractItemModel::data()}{data()} method. The \c role parameter is used to let the model know which property is being requested: + Each formatting property will be requested from the model with a separate + call to the \l{QAbstractItemModel::data()}{data()} method. The \c role + parameter is used to let the model know which property is being requested: \table \header @@ -214,114 +310,194 @@ Each formatting property will be requested from the model with a separate call t \o text alignment \o enum Qt::AlignmentFlag \row - \o {1, 3} Qt::CheckStateRole - \o {1, 3} suppresses checkboxes with \l{QVariant}{QVariant()}, sets checkboxes with Qt::Checked or Qt::Unchecked - \o {1, 3} \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} - + \o {1, 3} Qt::CheckStateRole + \o {1, 3} suppresses checkboxes with \l{QVariant}{QVariant()}, + sets checkboxes with Qt::Checked or Qt::Unchecked + \o {1, 3} \l{Qt::ItemDataRole}{enum Qt::ItemDataRole} \endtable -Refer to Qt documentation to learn more about enum Qt::ItemDataRole's capabilities. + Refer to the Qt namespace documentation to learn more about the + Qt::ItemDataRole enum's capabilities. + Now we need to determine how using a seperated model impacts the + application's performance, so let's trace how often the view calls the + \l{QAbstractItemModel::}{data()} method. In order to track how often + the view calls the model, we have put a debug statement in the + \l{QAbstractItemModel::}{data()} method, which logs onto stdio. In + our small example, \l{QAbstractItemModel::}{data()} will be called 42 + times. + Each time you hover the cursor over the field, + \l{QAbstractItemModel::}{data()} will be called again \mdash 7 times for + each cell. That's why it is important to make sure that your data is + available when \l{QAbstractItemModel::}{data()} is invoked and expensive + lookup operations are cached. -Now we need to determine how using a seperated model impacts the application's performance, so let's trace how often the view calls the \l{QAbstractItemModel::data()}{data()} method. In order to track how often the view calls the model, we have put a debug statement in the \l{QAbstractItemModel::data()}{data()} method, which logs onto stdio. In our small example, \l{QAbstractItemModel::data()}{data()} will be called 42 times. Each time you hover the cursor over the field, \l{QAbstractItemModel::data()}{data()} will be called again - 7 times for each cell. That's why it is important to make sure that your data is available when \l{QAbstractItemModel::data()}{data()} is invoked and expensive lookup operations are cached. + \section2 2.3 A Clock inside a Table Cell -\section2 2.3 A clock inside a table cell -\image clock.png + \image clock.png -We still have a read only table, but this time the content changes every second because we are showing the current time. + We still have a read only table, but this time the content changes every + second because we are showing the current time. \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_QVariant -Something is missing to make the clock tick. We need to tell the view every second that the time has changed and that it needs to be read again. We do this with a timer. In the constructor, we set its interval to 1 second and it connect its timeout signal. + Something is missing to make the clock tick. We need to tell the view every + second that the time has changed and that it needs to be read again. We do + this with a timer. In the constructor, we set its interval to 1 second and + connect its timeout signal. \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_a -Here is the corresponding slot: + Here is the corresponding slot: \snippet examples/tutorials/modelview/3_changingmodel/mymodel.cpp quoting mymodel_b -We ask the view to read the data in the top left cell again by emitting the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal. Note that we did not explicitly connect the \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal to the view. This happened automatically when we called \l{QTableView::setModel()}{setModel()}. + We ask the view to read the data in the top left cell again by emitting the + \l{QAbstractItemModel::}{dataChanged()} signal. Note that we did not + explicitly connect the \l{QAbstractItemModel::}{dataChanged()} signal to + the view. This happened automatically when we called + \l{QTableView::}{setModel()}. -\section2 2.4 Setting up Headers for Columns and Rows -Headers can be hidden via a view method. -\c tableView->verticalHeader()->hide(); -\image header.png + \section2 2.4 Setting up Headers for Columns and Rows + Headers can be hidden via a view method: \c{tableView->verticalHeader()->hide();} + \image header.png -The header content, however, is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: + The header content, however, is set via the model, so we reimplement the + \l{QAbstractItemModel::headerData()}{headerData()} method: \snippet examples/tutorials/modelview/4_headers/mymodel.cpp quoting mymodel_c -\section2 2.5 The minimal Editing example -In this example, we are going to build an application that automatically populates a window title with content by repeating values entered into table cells. + \section2 2.5 The Minimal Editing Example + + In this example, we are going to build an application that automatically + populates a window title with content by repeating values entered into + table cells. + + The model decides whether editing capabilities are available . We only have + to modify the model in order for the available editing capabilities to be + enabled. This is done by reimplementing the following virtual methods: + \l{QAbstractItemModel::}{setData()} and \l{QAbstractItemModel::}{flags()}. -The model decides whether editing capabilities are available . We only have to modify the model in order for the available editing capabilities to be enabled. This is done by reimplementing the following virtual methods: \l{QAbstractItemModel::setData()}{setData()} and \l{QAbstractItemModel::flags()}{flags()}. --------------------------------------------------------------mymodel.h--------------------- \snippet examples/tutorials/modelview/5_edit/mymodel.h Quoting ModelView Tutorial -We use \c QStringList m_gridData to store our data. This makes \c m_gridData the core of MyModel. The rest of \c MyModel acts like a wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We have also introduced the \l{QAbstractItemModel::editCompleted()}{editCompleted()} signal, which makes it possible to transfer the modified text to the window title. + We use \c QStringList m_gridData to store our data. This makes + \c m_gridData the core of MyModel. The rest of \c MyModel acts like a + wrapper and adapts \c m_gridData to the QAbstractItemModel interface. We + have also introduced the \c editCompleted() signal, + which makes it possible to transfer the modified text to the window title. \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_d -In the constructor, we fill \c QStringList gridData with 6 items. (one item for every field in the table) + In the constructor, we fill \c QStringList gridData with 6 items (one item + for every field in the table): + \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_e -\l{QAbstractItemModel::setData()}{setData()} will be called each time the user edits a cell. The \c index parameter tells us which field has been edited and \c value provides the result of the editing process. The role will always be set to \c Qt::EditRole because our cells only contain text. If a checkbox were present and user permissions are set to allow the checkbox to be selected, calls would also be made with the role set to \c Qt::CheckStateRole. - \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_f + \l{QAbstractItemModel::setData()}{setData()} will be called each time the + user edits a cell. The \c index parameter tells us which field has been + edited and \c value provides the result of the editing process. The role + will always be set to \c Qt::EditRole because our cells only contain text. + If a checkbox were present and user permissions are set to allow the + checkbox to be selected, calls would also be made with the role set to + \c Qt::CheckStateRole. -Various properties of a cell can be adjusted with \l{QAbstractItemModel::flags()}{flags()}. Returning \c Qt::ItemIsEditable | \c Qt::ItemIsEnabled is enough to show an editor that a cell has been selected. If editing one cell modifies more data than the data in that particular cell, the model must emit a \l{QAbstractItemModel::dataChanged()}{dataChanged()} signal in order for the data that has been changed to be read. + \snippet examples/tutorials/modelview/5_edit/mymodel.cpp quoting mymodel_f + Various properties of a cell can be adjusted with + \l{QAbstractItemModel::flags()}{flags()}. Returning + \c Qt::ItemIsEditable | \c Qt::ItemIsEnabled is enough to show an editor + that a cell has been selected. If editing one cell modifies more data than + the data in that particular cell, the model must emit a + \l{QAbstractItemModel::}{dataChanged()} signal in order for the data that + has been changed to be read. */ /*! \page modelview-part3.html - \title ModelView Chapter 3 - Intermediate Topics - \raw HTML -
    - \endraw -\section1 3 Intermediate Topics - \raw HTML -
    - \endraw -\section2 3.1 TreeView + \contentspage {modelview-index.html}{Model/View Contents} + \previouspage {modelview-part2.html}{Developing a Simple Model/View Application} + \nextpage {modelview-part4.html}{Good Sources of Additional Information} + \title Model/View Chapter 3 - Intermediate Topics + + \section1 3. Intermediate Topics + + \section2 3.1 TreeView -You can convert the example above into an application with a tree view. Simply replace QTableView with QTreeView, which results in a read/write tree. No changes have to be made to the model. The tree won't have any hierarchies because there aren't any hierarchies in the model itself. -\image dummy_tree.png + You can convert the example above into an application with a tree view. + Simply replace QTableView with QTreeView, which results in a read/write + tree. No changes have to be made to the model. The tree won't have any + hierarchies because there aren't any hierarchies in the model itself. + \image dummy_tree.png -QListView, QTableView and QTreeView all use a model abstraction, which is a merged list, table and tree. This makes it possible to use several different types of view classes from the same model. -\image list_table_tree.png + QListView, QTableView and QTreeView all use a model abstraction, which is a + merged list, table and tree. This makes it possible to use several different + types of view classes from the same model. + \image list_table_tree.png -This is how our example model looks so far: -\image example_model.png + This is how our example model looks so far: + \image example_model.png -We want to present a real tree. We have wrapped our data in the examples above in order to make a model. This time we use QStandardItemModel, which is a container for hierarchical data that also implements QAbstractItemModel. To show a tree, QStandardItemModel must be populated with \l{QStandardItem}{QStandardItems}, which are able to hold all the standard properties of items like text, fonts, checkboxes or brushes. \image tree_2_with_algorithm.png --------------------------------------------------------------modelview.cpp--------------------- + We want to present a real tree. We have wrapped our data in the examples + above in order to make a model. This time we use QStandardItemModel, which + is a container for hierarchical data that also implements + QAbstractItemModel. To show a tree, QStandardItemModel must be populated + with \l{QStandardItem}{QStandardItems}, which are able to hold all the + standard properties of items like text, fonts, checkboxes or brushes. + \image tree_2_with_algorithm.png + \snippet examples/tutorials/modelview/6_treeview/modelview.cpp Quoting ModelView Tutorial -We simply instantiate a QStandardItemModel and add a couple of \l{QStandardItem}{QStandardItems} to the constructor. We can then make a hierarchical data structure because a QStandardItem can hold other \l{QStandardItem}{QStandardItems}. Nodes are collapsed and expanded within the view. + We simply instantiate a QStandardItemModel and add a couple of + \l{QStandardItem}{QStandardItems} to the constructor. We can then make a + hierarchical data structure because a QStandardItem can hold other + \l{QStandardItem}{QStandardItems}. Nodes are collapsed and expanded within + the view. -\section2 3.2 Working with selection + \section2 3.2 Working with Selections + We want to access a selected item's content in order to output it into the + window title together with the hierarchy level. + \image selection2.png -We want to access a selected item's content in order to output it into the window title together with the hierarchy level. -\image selection2.png + So let's create a couple of items: -So let's create a couple of items: \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_a -Views manage selections within a separate selection model, which can be retrieved with the \l{QAbstractItemView::selectionModel()}{selectionModel()} method. We retrieve the selection Model in order to connect a slot to its \l{QAbstractItemView::selectionChanged()}{selectionChanged()} signal. - \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_b + Views manage selections within a separate selection model, which can be + retrieved with the \l{QAbstractItemView::}{selectionModel()} + method. We retrieve the selection Model in order to connect a slot to its + \l{QAbstractItemView::}{selectionChanged()} signal. -We get the model index that corresponds to the selection by calling -\l{QItemSelectionModel::currentIndex()}{treeView->selectionModel()->currentIndex()} and we get the the field's string by using the model index. Then we just calculate the item's \c hierarchyLevel. Top level items do not have parents and the \l{QAbstractItemModel::parent()}{parent()} method will return a default constructed \l{QModelIndex}{QModelIndex()}. This is why we use the \l{QAbstractItemModel::parent()}{parent()} method to iterate to the top level while counting the steps performed during iteration. + \snippet examples/tutorials/modelview/7_selections/modelview.cpp quoting modelview_b -The selection model (as shown above) can be retrieved, but it can also be set with \l{QAbstractItemView}{QAbstractItemView::setSelectionModel}. This is how it's possible to have 3 view classes with synchronised selections because only one instance of a selection model is used. The instance of a selection model is retrieved from the first view class with \l{QAbstractItemView::selectionModel()}{selectionModel()} and the result is assigned to the second and third view class with \l{QAbstractItemView::setSelectionModel()}{setSelectionModel()}; -\section2 3.3 Predefined Models -The typical way to use model/view is to wrap specific data to make it usable with view classes. Qt, however, also provides predefined models for common underlying data structures. If one of the available data structures is suitable for your application, a predefined model can be a good choice. + We get the model index that corresponds to the selection by calling + \l{QItemSelectionModel::currentIndex()}{treeView->selectionModel()->currentIndex()} + and we get the the field's string by using the model index. Then we just + calculate the item's \c hierarchyLevel. Top level items do not have + parents and the \l{QAbstractItemModel::}{parent()} method will return a + default constructed \l{QModelIndex}{QModelIndex()}. This is why we use the + \l{QAbstractItemModel::}{parent()} method to iterate to the top level while + counting the steps performed during iteration. + + The selection model (as shown above) can be retrieved, but it can also be + set with \l{QAbstractItemView}{QAbstractItemView::setSelectionModel}. This + is how it's possible to have 3 view classes with synchronised selections + because only one instance of a selection model is used. The instance of a + selection model is retrieved from the first view class with + \l{QAbstractItemView::}{selectionModel()} and the result is assigned to the + second and third view class with \l{QAbstractItemView::}{setSelectionModel()}. + + \section2 3.3 Predefined Models + + The typical way to use model/view is to wrap specific data to make it + usable with view classes. Qt, however, also provides predefined models for + common underlying data structures. If one of the available data structures + is suitable for your application, a predefined model can be a good choice. \table \row @@ -331,11 +507,8 @@ The typical way to use model/view is to wrap specific data to make it usable wit \o QStandardItemModel \o Stores arbitrary hierarchical items \row - \o QFileSystemModel - \raw HTML -
    - \endraw - QDirModel + \o QFileSystemModel\br + QDirModel \o Encapsulate the local file system \row \o QSqlQueryModel @@ -352,108 +525,144 @@ The typical way to use model/view is to wrap specific data to make it usable wit \endtable -\section2 3.4 Delegates -In all examples so far, data is presented as text or a checkbox in a cell and is edited as text or a checkbox. The component that provides these presentation and editing services is called a “delegate.” We are only just beginning to work with the delegate because the view uses a default delegate. But imagine that we want to have a different editor.(e.g. a slider or a drop down list) Or imagine that we want to present data as graphics. Let's take a look at an example called Stardelegate, ( \l{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html}{http://qt.nokia.com/doc/4.6/itemviews-stardelegate.html} ) in which stars are used to show a rating: \image stardelegate.png - -The view has a method that replaces the default delegate and installs a custom delegate. This method is called \l{QAbstractItemView::setItemDelegate()}{setItemDelegate()}. A new delegate can be written by creating a class that inherits from QStyledItemDelegate. In order to write a delegate that displays stars and has no input capabilities, we only need to overwrite 2 methods. - -\code - class StarDelegate : public QStyledItemDelegate - { - Q_OBJECT - public: - StarDelegate(QWidget *parent = 0); - void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const; - QSize sizeHint(const QStyleOptionViewItem &option, + \section2 3.4 Delegates + + In all examples so far, data is presented as text or a checkbox in a cell + and is edited as text or a checkbox. The component that provides these + presentation and editing services is called a \e delegate. We are only just + beginning to work with the delegate because the view uses a default + delegate. But imagine that we want to have a different editor.(e.g. a + slider or a drop down list) Or imagine that we want to present data as + graphics. Let's take a look at an example called + \l{Star Delegate Example}{Star Delegate}, in which stars are used to show + a rating: + \image stardelegate.png + + The view has a method that replaces the default delegate and installs a + custom delegate. This method is called + \l{QAbstractItemView::}{setItemDelegate()}. A new delegate can be written + by creating a class that inherits from QStyledItemDelegate. In order to + write a delegate that displays stars and has no input capabilities, we only + need to overwrite 2 methods. + + \code + class StarDelegate : public QStyledItemDelegate + { + Q_OBJECT + public: + StarDelegate(QWidget *parent = 0); + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; - }; - -\endcode - -\l{QStyledItemDelegate::paint()}{paint()} draws stars depending on the content of the underlying data. The data can be looked up with parameter \l{QModelIndex::data()}{index.data()}. \l{QAbstractItemDelegate::sizeHint()}{sizeHint} specifies the stars dimensions so the the cell will provide enough height and width to accommodate the stars. + QSize sizeHint(const QStyleOptionViewItem &option, + const QModelIndex &index) const; + }; + \endcode -Writing custom delegates is the right choice if you want to show your data with a custom graphical representation inside the grid of the view class. If you want to leave the grid, you can write a custom view class. + \l{QStyledItemDelegate::}{paint()} draws stars depending on the content + of the underlying data. The data can be looked up with parameter + \l{QModelIndex::data()}{index.data()}. + \l{QAbstractItemDelegate::}{sizeHint()} specifies each star's dimensions + so the the cell will provide enough height and width to accommodate the + stars. -\section2 3.5 Debugging with ModelTest -The passive nature of models provides new challenges for programmers. Inconsistencies in the model can cause the application to crash. Since the model is hit by numerous calls from the view, it is hard to find out which call has crashed the application and which operation has introduced the problem. + Writing custom delegates is the right choice if you want to show your data + with a custom graphical representation inside the grid of the view class. + If you want to leave the grid, you can write a custom view class. -Qt provides software called ModelTest, which checks models while your programming is running. Every time the model is changed, ModelTest scans the model and reports errors with an assert. This is especially important for tree models, since their hierarchical nature leaves many possibilities for subtle inconsistencies. \l http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest + \section2 3.5 Debugging with ModelTest -Unlike view classes, ModelTest uses out of range indexes to test the model. This means your application may crash with ModelTest even if it runs perfectly without it. So you also need to handle all of the indexes that are out of range when using ModelTest. + The passive nature of models provides new challenges for programmers. + Inconsistencies in the model can cause the application to crash. Since the + model is hit by numerous calls from the view, it is hard to find out which + call has crashed the application and which operation has introduced the + problem. + Qt provides software called + \l{http://labs.qt.nokia.com/page/Projects/Itemview/Modeltest}{ModelTest}, + which checks models while your programming is running. Every time the model + is changed, ModelTest scans the model and reports errors with an assert. + This is especially important for tree models, since their hierarchical + nature leaves many possibilities for subtle inconsistencies. - -\raw HTML -
    -\endraw + Unlike view classes, ModelTest uses out of range indexes to test the model. + This means your application may crash with ModelTest even if it runs + perfectly without it. So you also need to handle all of the indexes that + are out of range when using ModelTest. + \section2 3.6 Model/View NG + \raw HTML +
    ConstantValue
    ConstantValue

    "; + out() << "

    "; generateFullName(node, relative, marker); out() << "

    "; + out() << "

    "; generateText(brief, node, marker); out() << "

    "; + out() << "

    "; out() << protectEnc(node->doc().briefText().toString()); out() << "

    "; + out() << "

    "; out() << ""; if (!qpn->isWritable()) @@ -4097,7 +4099,7 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << "

    "; + out() << "

    "; out() << ""; generateSynopsis(qsn,relative,marker,CodeMarker::Detailed,false); //generateQmlItem(qsn,relative,marker,false); @@ -4114,7 +4116,7 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << "

    "; + out() << "

    "; out() << ""; generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false); out() << "

    +
    + \endraw + \raw HTML + + \endraw -\section2 3.6 Model/View NG + Model/View was introduced in Qt 4.0 and is a frequently used technology. + Feedback from developers and new development trends have shown that there + is a need to further develop the model/view technology. Therefore a + research project originated at Nokia is looking into ways to go beyond the + current implementation. + + One limitation of model/view is that view classes are basically all fixed + grids. It is possible, but really hard to make a list view with icons + placed on a curve; or cells expanding on mouse over events to show + additional information. + In order to achieve graphically rich view experiences, Model/View NG will + use QGraphicsView to render elements. Nodel/View NG also aims to make + model/view programming more intuitive. One way to achieve this is to have + separate models for lists, tables and trees. The current model abstraction + is complex because it is capable of representing a list, a table or a tree. + + Model/View NG is a research project. You are welcome to checkout the source + code, monitor progress and take part in discussions at the following + address: \l{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG} -\raw HTML - -
    -\endraw + \raw HTML + + \endraw -\raw HTML - -\endraw + \inlineimage path.png -Model/View was introduced in Qt 4.0 and is a frequently used technology. Feedback from clients and new development trends have shown, that there is a need to further develop the model/view technology. Therefore a research project at Nokia is looking into ways to go beyond the current implementation. -\raw HTML -
    -\endraw -One limitation of model/view is that view classes are basically all fixed grids. It is possible, but really hard to make a list view with icons placed on a curve; or cells expanding on mouse over events to show additional information. In order to achieve graphically rich view experiences, Model/View NG will use QGraphicsView to render elements. Nodel/View NG also aims to make model/view programming more intuitive. One way to achieve this is to have separate models for lists, tables and trees. The current model abstraction is complex because it is capable of representing a list, a table or a tree. -\raw HTML -
    -\endraw -Model/View NG is a research project. You are welcome to checkout the source code, monitor progress and take part in discussions at the following address: \l{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG}{http://labs.qt.nokia.com/page/Projects/Itemview/ItemviewsNG} + \raw HTML +
    + \endraw +*/ -\raw HTML -
    -\endraw +/*! + \page modelview-part4.html + \contentspage {modelview-index.html}{Model/View Contents} + \previouspage {modelview-part3.html}{Intermediate Topics} + \title Model/View Chapter 4 - Good Sources of Additional Information -\inlineimage path.png + \section1 4. Good Sources of Additional Information -\raw HTML -
    -\endraw -\raw HTML -
    -\endraw + \section2 4.1 Books -*/ + Model/View programming is covered quite extensively in the documentation of + Qt but also in several good books. -/*! - \page modelview-part4.html - - \title ModelView Chapter 4 - Good Sources for Additional Information - - \raw HTML -
    - \endraw -\section1 4 Good Sources for Additional Information -\raw HTML -
    -\endraw -\section2 4.1 Books -Model/View programming is covered quite extensively in the documentation of Qt but also in several good books. \list 1 - \o C++ GUI Programming with Qt 4 / Jasmin Blanchette, Mark Summerfield, Prentice Hall, 2nd edition, ISBN 0-13-235416-0 -also available in German: C++ GUI Programmierung mit Qt 4: Die offizielle Einführung, Addison-Wesley, ISBN 3-827327-29-6 - \o The Book of Qt4, The Art of Building Qt Applications / Daniel Molkentin, Open Source Press ISBN 1-59327-147-6 -Translated from: Qt 4, Einführung in die Applikationsentwicklung, Open Source Press, ISBN 3-937514-12-0 - \o Foundations of Qt Development / Johan Thelin, Apress, ISBN 1-59059-831-8 + \o \bold{C++ GUI Programming with Qt 4} / Jasmin Blanchette, Mark Summerfield, + \e{Prentice Hall, 2nd edition}, ISBN 0-13-235416-0. Also available in + German: C++ GUI Programmierung mit Qt 4: Die offizielle Einführung, + \e{Addison-Wesley}, ISBN 3-827327-29-6 + \o \bold{The Book of Qt4, The Art of Building Qt Applications} / Daniel Molkentin, + \e{Open Source Press}, ISBN 1-59327-147-6. + Translated from \bold{Qt 4, Einführung in die Applikationsentwicklung}, + \e{Open Source Press}, ISBN 3-937514-12-0. + \o \bold{Foundations of Qt Development} / Johan Thelin, \e{Apress}, ISBN 1-59059-831-8. \endlist -\raw HTML -
    -\endraw -The following list provides an overview of example programs contained in the books above. Some of them make very good templates for developing similar applications. + More information about these books is available on the + \l{Books about Qt Programming}{Qt Web site}. + + The following list provides an overview of example programs contained in the + books above. Some of them make very good templates for developing similar + applications. \table \header @@ -461,45 +670,45 @@ The following list provides an overview of example programs contained in the boo \o view class used \o model used \o aspects touched - \o + \o \row \o Team Leaders \o QListview \o QStringListModel - \o + \o \o Book 1, Chapter 10, Figure 10.6 \row \o Directory Viewer \o QTreeView \o QDirModel - \o + \o \o Book 1, Chapter 10, Figure 10.7 \row \o Color Names \o QListView \o QSortFilterProxyModel -applied to QStringListModel - \o + applied to QStringListModel + \o \o Book 1, Chapter 10, Figure 10.8 \row \o Currencies \o QTableView \o custom model based on -QAbstractTableModel + QAbstractTableModel \o read only \o Book 1, Chapter 10, Figure 10.10 \row \o Cities \o QTableView \o custom model based on -QAbstractTableModel + QAbstractTableModel \o read / write \o Book 1, Chapter 10, Figure 10.12 \row \o Boolean Parser \o QTreeView \o custom model based on -QAbstractItemModel + QAbstractItemModel \o read only \o Book 1, Chapter 10, Figure 10.14 \row @@ -511,141 +720,129 @@ QAbstractItemModel \row \o Four directory views \o QListView -QTableView -QTreeView + QTableView + QTreeView \o QDirModel \o demonstrates the use of multiple views \o Book2, Chapter 8.2 \row \o Address Book \o QListView -QTableView -QTreeView + QTableView + QTreeView \o custom model based on -QAbstractTableModel + QAbstractTableModel \o read / write \o Book2, Chapter 8.4 \row \o Address Book with sorting - \o + \o \o QProxyModel \o introducing sort and filter capabilities \o Book2, Chapter 8.5 \row - \o Address Book -with checkboxes - \o - \o - \o introducing checkboxes -in model/view + \o Address Book + with checkboxes + \o + \o + \o introducing checkboxes in model/view \o Book2, Chapter 8.6 \row - \o Address Book -with transposed grid - \o + \o Address Book with transposed grid + \o \o custom proxy Model based on QAbstractProxyModel \o introducing a custom model \o Book2, Chapter 8.7 \row - \o Address Book -with drag and drop - \o - \o + \o Address Book with drag and drop + \o + \o \o introducing drag and drop support \o Book2, Chapter 8.8 \row \o Address Book with custom editor - \o - \o + \o + \o \o introducing custom delegates \o Book2, Chapter 8.9 \row \o Views \o QListView -QTableView -QTreeView + QTableView + QTreeView \o QStandardItemModel \o read only \o Book 3, Chapter 5, figure 5-3 \row \o Bardelegate \o QTableView - \o + \o \o custom delegate for presentation based on QAbstractItemDelegate \o Book 3, Chapter 5, figure 5-5 \row \o Editdelegate \o QTableView - \o + \o \o custom delegate for editing based on QAbstractItemDelegate \o Book 3, Chapter 5, figure 5-6 \row \o Singleitemview - \o custom view based on -QAbstractItemView - \o + \o custom view based on QAbstractItemView + \o \o custom view \o Book 3, -Chapter 5, -figure 5-7 + Chapter 5, + figure 5-7 \row \o listmodel \o QTableView - \o custom Model based on -QAbstractTableModel + \o custom Model based on QAbstractTableModel \o read only - \o Book 3, -Chapter 5, -Figure 5-8 + \o Book 3, Chapter 5, Figure 5-8 \row \o treemodel \o QTreeView - \o custom Model based on -QAbstractItemModel + \o custom Model based on QAbstractItemModel \o read only - \o Book 3, -Chapter 5, -Figure 5-10 + \o Book 3, Chapter 5, Figure 5-10 \row \o edit integers \o QListView - \o custom Model based on -QAbstractListModel + \o custom Model based on QAbstractListModel \o read / write - \o Book 3, -Chapter 5, -Listing 5-37, Figure 5-11 + \o Book 3, Chapter 5, Listing 5-37, Figure 5-11 \row \o sorting \o QTableView - \o QSortFilterProxyModel -applied to QStringListModel + \o QSortFilterProxyModel applied to QStringListModel \o demonstrates sorting \o Book 3, Chapter 5, Figure 5-12 - \endtable -\section2 4.2 Qt documentation -Qt 4.6 comes with 17 examples and 2 Demonstrations for model/view. The examples can be found here: \l{http://doc.qt.nokia.com/4.6/examples-itemviews.html}{http://doc.qt.nokia.com/4.6/examples-itemviews.html} + \section2 4.2 Qt Documentation + + Qt 4.7 comes with 17 examples and 2 Demonstrations for model/view. + The examples can be found here: \l{Item Views Examples} \table \header - \o example name - \o view class used - \o model used - \o aspects touched + \o Example name + \o View class used + \o Model used + \o Aspects touched \row \o Address Book \o QTableView \o QAbstractTableModel -QSortFilterProxyModel - \o usage of QSortFilterProxyModel to generate different subsets from one data pool + QSortFilterProxyModel + \o usage of QSortFilterProxyModel to generate different + subsets from one data pool \row \o Basic Sort/Filter Model \o QTreeView \o QStandardItemModel -QSortFilterProxyModel - \o + QSortFilterProxyModel + \o \row \o Chart \o custom view @@ -664,9 +861,8 @@ QSortFilterProxyModel \o Custom Sort/Filter Model \o QTreeView \o QStandardItemModel -QSortFilterProxyModel - \o subclass QSortFilterProxyModel -for advanced sorting and filtering + QSortFilterProxyModel + \o subclass QSortFilterProxyModel for advanced sorting and filtering \row \o Dir View \o QTreeView @@ -676,17 +872,19 @@ for advanced sorting and filtering \o Editable Tree Model \o QTreeView \o custom tree model - \o comprehensive example for working with trees, demonstrates editing cells and tree structure with an underlying custom model + \o comprehensive example for working with trees, demonstrates + editing cells and tree structure with an underlying custom + model \row \o Fetch More \o QListView \o custom list model - \o dynamically changing model + \o dynamically changing model \row \o Frozen Column \o QTableView \o QStandardItemModel - \o + \o \row \o Pixelator \o QTableView @@ -723,13 +921,18 @@ for advanced sorting and filtering \o comprehensive custom delegate example. \endtable -Demonstrations are similar to examples except that no walk-through is provided for the code lines. Demonstrations are also sometimes more feature rich. - \l{http://doc.qt.nokia.com/4.6/demos.html}{http://doc.qt.nokia.com/4.6/demos.html} + \l{Qt Demonstrations}{Demonstrations} are similar to examples except + that no walkthrough is provided for the code. Demonstrations are also + sometimes more feature rich. + \list - \o The \bold Interview demonstration shows the same model and selection being shared between three different views. - \o Demonstration \bold Spreadsheet demonstrates the use of a table view as a spreadsheet, using custom delegates to render each item according to the type of data it contains. + \o The \bold Interview demonstration shows the same model and + selection being shared between three different views. + \o Demonstration \bold Spreadsheet demonstrates the use of a + table view as a spreadsheet, using custom delegates to render + each item according to the type of data it contains. \endlist -A reference documentation for model/view technology is also available. \l{http://doc.qt.nokia.com/4.6/model-view-programming.html}{http://doc.qt.nokia.com/4.6/model-view-programming.html} - -*/ \ No newline at end of file + A \l{Model/View Programming}{reference document} for model/view technology + is also available. +*/ diff --git a/examples/tutorials/modelview/1_readonly/main.cpp b/examples/tutorials/modelview/1_readonly/main.cpp index ad11f38..fb4726a 100755 --- a/examples/tutorials/modelview/1_readonly/main.cpp +++ b/examples/tutorials/modelview/1_readonly/main.cpp @@ -39,6 +39,7 @@ ****************************************************************************/ //! [Quoting ModelView Tutorial] +// main.cpp #include #include "modelview.h" diff --git a/examples/tutorials/modelview/1_readonly/modelview.cpp b/examples/tutorials/modelview/1_readonly/modelview.cpp index 027be56..91a97bf 100755 --- a/examples/tutorials/modelview/1_readonly/modelview.cpp +++ b/examples/tutorials/modelview/1_readonly/modelview.cpp @@ -39,6 +39,7 @@ ****************************************************************************/ //! [Quoting ModelView Tutorial] +// modelview.cpp #include #include "modelview.h" #include "mymodel.h" @@ -48,6 +49,6 @@ ModelView::ModelView(QWidget *parent) { tableView = new QTableView(this); setCentralWidget(tableView); - tableView->setModel(new MyModel(this) ); + tableView->setModel(new MyModel(this)); } -//! [Quoting ModelView Tutorial] \ No newline at end of file +//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/1_readonly/modelview.h b/examples/tutorials/modelview/1_readonly/modelview.h index d0f96cd..9307083 100755 --- a/examples/tutorials/modelview/1_readonly/modelview.h +++ b/examples/tutorials/modelview/1_readonly/modelview.h @@ -38,11 +38,11 @@ ** ****************************************************************************/ -//! [Quoting ModelView Tutorial] #ifndef MODELVIEW_H #define MODELVIEW_H - +//! [Quoting ModelView Tutorial] +// modelview.h #include class QTableView; //forward declaration @@ -56,6 +56,6 @@ public: ModelView(QWidget *parent = 0); }; +//! [Quoting ModelView Tutorial] #endif // MODELVIEW_H -//! [Quoting ModelView Tutorial] \ No newline at end of file diff --git a/examples/tutorials/modelview/1_readonly/mymodel.cpp b/examples/tutorials/modelview/1_readonly/mymodel.cpp index c441720..394605a 100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.cpp +++ b/examples/tutorials/modelview/1_readonly/mymodel.cpp @@ -39,6 +39,7 @@ ****************************************************************************/ //! [Quoting ModelView Tutorial] +// mymodel.cpp #include "mymodel.h" MyModel::MyModel(QObject *parent) @@ -46,22 +47,19 @@ MyModel::MyModel(QObject *parent) { } -//------------------------------------------------------- -int MyModel::rowCount(const QModelIndex & /*parent*/ ) const +int MyModel::rowCount(const QModelIndex & /*parent*/) const { return 2; } -//------------------------------------------------------- -int MyModel::columnCount(const QModelIndex & /*parent*/ ) const +int MyModel::columnCount(const QModelIndex & /*parent*/) const { return 3; } -//------------------------------------------------------- -QVariant MyModel::data(const QModelIndex &index, int role ) const +QVariant MyModel::data(const QModelIndex &index, int role) const { - if(role == Qt::DisplayRole) + if (role == Qt::DisplayRole) { return QString("Row%1, Column%2") .arg(index.row() + 1) @@ -69,4 +67,4 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const } return QVariant(); } -//! [Quoting ModelView Tutorial] \ No newline at end of file +//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/1_readonly/mymodel.h b/examples/tutorials/modelview/1_readonly/mymodel.h index c0ddf4ac6..6065f6e 100755 --- a/examples/tutorials/modelview/1_readonly/mymodel.h +++ b/examples/tutorials/modelview/1_readonly/mymodel.h @@ -38,10 +38,11 @@ ** ****************************************************************************/ -//! [Quoting ModelView Tutorial] #ifndef MYMODEL_H #define MYMODEL_H +//! [Quoting ModelView Tutorial] +// mymodel.h #include class MyModel : public QAbstractTableModel @@ -53,6 +54,6 @@ public: int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; }; +//! [Quoting ModelView Tutorial] #endif // MYMODEL_H -//! [Quoting ModelView Tutorial] \ No newline at end of file diff --git a/examples/tutorials/modelview/2_formatting/modelview.cpp b/examples/tutorials/modelview/2_formatting/modelview.cpp index 2b05d4c..9a5ce64 100755 --- a/examples/tutorials/modelview/2_formatting/modelview.cpp +++ b/examples/tutorials/modelview/2_formatting/modelview.cpp @@ -47,6 +47,6 @@ ModelView::ModelView(QWidget *parent) { tableView = new QTableView(this); setCentralWidget(tableView); - tableView->setModel(new MyModel(this) ); + tableView->setModel(new MyModel(this)); } diff --git a/examples/tutorials/modelview/2_formatting/mymodel.cpp b/examples/tutorials/modelview/2_formatting/mymodel.cpp index e9e68de..e34e014 100755 --- a/examples/tutorials/modelview/2_formatting/mymodel.cpp +++ b/examples/tutorials/modelview/2_formatting/mymodel.cpp @@ -44,25 +44,23 @@ #include //! [Quoting ModelView Tutorial] +// mymodel.cpp MyModel::MyModel(QObject *parent) :QAbstractTableModel(parent) { } -//------------------------------------------------------- -int MyModel::rowCount(const QModelIndex & /*parent */ ) const +int MyModel::rowCount(const QModelIndex & /*parent */) const { return 2; } -//------------------------------------------------------- -int MyModel::columnCount(const QModelIndex & /*parent */ ) const +int MyModel::columnCount(const QModelIndex & /*parent */) const { return 3; } -//------------------------------------------------------- -QVariant MyModel::data(const QModelIndex &index, int role ) const +QVariant MyModel::data(const QModelIndex &index, int role) const { int row = index.row(); int col = index.column(); @@ -72,15 +70,15 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const switch(role){ case Qt::DisplayRole: - if(row == 0 && col == 1 )return QString("<--left"); - if(row == 1 && col == 1 )return QString("right-->"); + if (row == 0 && col == 1) return QString("<--left"); + if (row == 1 && col == 1) return QString("right-->"); return QString("Row%1, Column%2") .arg(row + 1) .arg(col +1); break; case Qt::FontRole: - if(row == 0 && col ==0 ) //change font only for cell(0,0) + if (row == 0 && col == 0) //change font only for cell(0,0) { QFont boldFont; boldFont.setBold(true); @@ -89,7 +87,7 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const break; case Qt::BackgroundRole: - if(row == 1 && col ==2 ) //change background only for cell(1,2) + if (row == 1 && col == 2) //change background only for cell(1,2) { QBrush redBackground(QColor(Qt::red)); return redBackground; @@ -97,14 +95,14 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const break; case Qt::TextAlignmentRole: - if(row == 1 && col ==1 ) //change text alignment only for cell(1,1) + if (row == 1 && col == 1) //change text alignment only for cell(1,1) { return Qt::AlignRight + Qt::AlignVCenter; } break; case Qt::CheckStateRole: - if(row == 1 && col ==0 ) //add a checkbox to cell(1,0) + if (row == 1 && col == 0) //add a checkbox to cell(1,0) { return Qt::Checked; } diff --git a/examples/tutorials/modelview/3_changingmodel/modelview.cpp b/examples/tutorials/modelview/3_changingmodel/modelview.cpp index 2b05d4c..9a5ce64 100755 --- a/examples/tutorials/modelview/3_changingmodel/modelview.cpp +++ b/examples/tutorials/modelview/3_changingmodel/modelview.cpp @@ -47,6 +47,6 @@ ModelView::ModelView(QWidget *parent) { tableView = new QTableView(this); setCentralWidget(tableView); - tableView->setModel(new MyModel(this) ); + tableView->setModel(new MyModel(this)); } diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp index d806945..42915b0 100755 --- a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp +++ b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp @@ -50,32 +50,32 @@ MyModel::MyModel(QObject *parent) // selectedCell = 0; timer = new QTimer(this); timer->setInterval(1000); - connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit()) ); + connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit())); timer->start(); } //! [quoting mymodel_a] //------------------------------------------------------- -int MyModel::rowCount(const QModelIndex & /*parent */ ) const +int MyModel::rowCount(const QModelIndex & /*parent */) const { return 2; } //------------------------------------------------------- -int MyModel::columnCount(const QModelIndex & /*parent */ ) const +int MyModel::columnCount(const QModelIndex & /*parent */) const { return 3; } //------------------------------------------------------- //! [quoting mymodel_QVariant ] -QVariant MyModel::data(const QModelIndex &index, int role ) const +QVariant MyModel::data(const QModelIndex &index, int role) const { int row = index.row(); int col = index.column(); - if(role == Qt::DisplayRole) + if (role == Qt::DisplayRole) { - if(row == 0 && col == 0 ) + if (row == 0 && col == 0) { return QTime::currentTime().toString(); } @@ -88,8 +88,8 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const void MyModel::timerHit() { //we identify the top left cell - QModelIndex topLeft = createIndex ( 0,0 ); + QModelIndex topLeft = createIndex(0,0); //emit a signal to make the view reread identified data - emit dataChanged ( topLeft, topLeft ); + emit dataChanged(topLeft, topLeft); } //! [quoting mymodel_b ] diff --git a/examples/tutorials/modelview/4_headers/modelview.cpp b/examples/tutorials/modelview/4_headers/modelview.cpp index f661ab5..449dbbc 100755 --- a/examples/tutorials/modelview/4_headers/modelview.cpp +++ b/examples/tutorials/modelview/4_headers/modelview.cpp @@ -48,7 +48,7 @@ ModelView::ModelView(QWidget *parent) { tableView = new QTableView(this); setCentralWidget(tableView); - tableView->setModel(new MyModel(this) ); + tableView->setModel(new MyModel(this)); tableView->verticalHeader()->hide(); } diff --git a/examples/tutorials/modelview/4_headers/mymodel.cpp b/examples/tutorials/modelview/4_headers/mymodel.cpp index 94fde34..e6f977d 100755 --- a/examples/tutorials/modelview/4_headers/mymodel.cpp +++ b/examples/tutorials/modelview/4_headers/mymodel.cpp @@ -46,21 +46,21 @@ MyModel::MyModel(QObject *parent) } //------------------------------------------------------- -int MyModel::rowCount(const QModelIndex & /*parent*/ ) const +int MyModel::rowCount(const QModelIndex & /*parent*/) const { return 2; } //------------------------------------------------------- -int MyModel::columnCount(const QModelIndex & /*parent*/ ) const +int MyModel::columnCount(const QModelIndex & /*parent*/) const { return 3; } //------------------------------------------------------- -QVariant MyModel::data(const QModelIndex &index, int role ) const +QVariant MyModel::data(const QModelIndex &index, int role) const { - if(role == Qt::DisplayRole) + if (role == Qt::DisplayRole) { return QString("Row%1, Column%2") .arg(index.row() + 1) @@ -88,4 +88,4 @@ QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) } return QVariant(); } -//! [quoting mymodel_c] \ No newline at end of file +//! [quoting mymodel_c] diff --git a/examples/tutorials/modelview/5_edit/modelview.cpp b/examples/tutorials/modelview/5_edit/modelview.cpp index d8853c9..a6c6ef5 100755 --- a/examples/tutorials/modelview/5_edit/modelview.cpp +++ b/examples/tutorials/modelview/5_edit/modelview.cpp @@ -48,13 +48,13 @@ ModelView::ModelView(QWidget *parent) tableView = new QTableView(this); setCentralWidget(tableView); QAbstractTableModel *myModel = new MyModel(this); - tableView->setModel( myModel ); + tableView->setModel(myModel); //transfer changes to the model to the window title - connect(myModel, SIGNAL(editCompleted(const QString &) ), this, SLOT(setWindowTitle(const QString &))); + connect(myModel, SIGNAL(editCompleted(const QString &)), this, SLOT(setWindowTitle(const QString &))); } void ModelView::showWindowTitle(const QString & title) { -setWindowTitle( title ); +setWindowTitle(title); } diff --git a/examples/tutorials/modelview/5_edit/mymodel.cpp b/examples/tutorials/modelview/5_edit/mymodel.cpp index 6007da1..67181ca 100755 --- a/examples/tutorials/modelview/5_edit/mymodel.cpp +++ b/examples/tutorials/modelview/5_edit/mymodel.cpp @@ -53,22 +53,19 @@ MyModel::MyModel(QObject *parent) //! [quoting mymodel_d] //! [quoting mymodel_e] -//------------------------------------------------------- -int MyModel::rowCount(const QModelIndex & /*parent*/ ) const +int MyModel::rowCount(const QModelIndex & /*parent*/) const { return ROWS; } -//------------------------------------------------------- -int MyModel::columnCount(const QModelIndex & /*parent*/ ) const +int MyModel::columnCount(const QModelIndex & /*parent*/) const { return COLS; } -//------------------------------------------------------- -QVariant MyModel::data(const QModelIndex &index, int role ) const +QVariant MyModel::data(const QModelIndex &index, int role) const { - if(role == Qt::DisplayRole) + if (role == Qt::DisplayRole) { return m_gridData[modelIndexToOffset(index)]; } @@ -79,23 +76,21 @@ QVariant MyModel::data(const QModelIndex &index, int role ) const //----------------------------------------------------------------- //! [quoting mymodel_f] -bool MyModel::setData ( const QModelIndex & index, const QVariant & value, int role ) +bool MyModel::setData(const QModelIndex & index, const QVariant & value, int role) { - if(role == Qt::EditRole) + if (role == Qt::EditRole) { m_gridData[modelIndexToOffset(index)] = value.toString(); - emit editCompleted(m_gridData.join(" | ") ); + emit editCompleted(m_gridData.join(" | ")); } return true; } -//----------------------------------------------------------------- -Qt::ItemFlags MyModel::flags ( const QModelIndex & /*index*/ ) const +Qt::ItemFlags MyModel::flags(const QModelIndex & /*index*/) const { return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled ; } -//----------------------------------------------------------------- //convert row and column information to array offset int MyModel::modelIndexToOffset(const QModelIndex & index) const { diff --git a/examples/tutorials/modelview/5_edit/mymodel.h b/examples/tutorials/modelview/5_edit/mymodel.h index 54f2b30..0d2a1b8 100755 --- a/examples/tutorials/modelview/5_edit/mymodel.h +++ b/examples/tutorials/modelview/5_edit/mymodel.h @@ -38,10 +38,11 @@ ** ****************************************************************************/ -//! [Quoting ModelView Tutorial] #ifndef MYMODEL_H #define MYMODEL_H +//! [Quoting ModelView Tutorial] +// mymodel.h #include #include @@ -53,14 +54,14 @@ public: int rowCount(const QModelIndex &parent = QModelIndex()) const ; int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); - Qt::ItemFlags flags ( const QModelIndex & index ) const ; + bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); + Qt::ItemFlags flags(const QModelIndex & index) const ; private: QStringList m_gridData; //holds text entered into QTableView int modelIndexToOffset(const QModelIndex & index) const; signals: void editCompleted(const QString &); }; +//! [Quoting ModelView Tutorial] #endif // MYMODEL_H -//! [Quoting ModelView Tutorial] \ No newline at end of file diff --git a/examples/tutorials/modelview/6_treeview/modelview.cpp b/examples/tutorials/modelview/6_treeview/modelview.cpp index a25e4e9..772dbdd 100755 --- a/examples/tutorials/modelview/6_treeview/modelview.cpp +++ b/examples/tutorials/modelview/6_treeview/modelview.cpp @@ -39,6 +39,7 @@ ****************************************************************************/ //! [Quoting ModelView Tutorial] +// modelview.cpp #include #include #include @@ -64,14 +65,13 @@ ModelView::ModelView(QWidget *parent) // adding a row to an item starts a subtree preparedColumn.first()->appendRow(secondRow); - treeView->setModel( standardModel ); + treeView->setModel(standardModel); treeView->expandAll(); } -//--------------------------------------------------------------------------- QList ModelView::prepareColumn(const QString &first, const QString &second, - const QString &third ) + const QString &third) { QList colItems; colItems << new QStandardItem(first); @@ -79,4 +79,4 @@ QList ModelView::prepareColumn(const QString &first, colItems << new QStandardItem(third); return colItems; } -//! [Quoting ModelView Tutorial] \ No newline at end of file +//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/6_treeview/modelview.h b/examples/tutorials/modelview/6_treeview/modelview.h index 2329e89..a47111c 100755 --- a/examples/tutorials/modelview/6_treeview/modelview.h +++ b/examples/tutorials/modelview/6_treeview/modelview.h @@ -56,7 +56,7 @@ private: QStandardItemModel *standardModel; QList prepareColumn(const QString &first, const QString &second, - const QString &third ); + const QString &third); public: ModelView(QWidget *parent = 0); }; diff --git a/examples/tutorials/modelview/7_selections/modelview.cpp b/examples/tutorials/modelview/7_selections/modelview.cpp index 2ef980d..3b373c6 100755 --- a/examples/tutorials/modelview/7_selections/modelview.cpp +++ b/examples/tutorials/modelview/7_selections/modelview.cpp @@ -74,13 +74,13 @@ ModelView::ModelView(QWidget *parent) italyItem-> appendRow(veronaItem); //register the model - treeView->setModel( standardModel ); + treeView->setModel(standardModel); treeView->expandAll(); //selection changes shall trigger a slot QItemSelectionModel *selectionModel= treeView->selectionModel(); - connect(selectionModel, SIGNAL(selectionChanged ( const QItemSelection & , const QItemSelection & )), - this, SLOT(selectionChangedSlot(const QItemSelection & , const QItemSelection & ))); + connect(selectionModel, SIGNAL(selectionChanged (const QItemSelection &, const QItemSelection &)), + this, SLOT(selectionChangedSlot(const QItemSelection &, const QItemSelection &))); } //! [quoting modelview_a] @@ -93,7 +93,7 @@ void ModelView::selectionChangedSlot(const QItemSelection & /*newSelection*/, co QString selectedText = index.data(Qt::DisplayRole).toString(); int hierarchyLevel=1; QModelIndex seekRoot = index; - while(seekRoot.parent() != QModelIndex() ) + while(seekRoot.parent() != QModelIndex()) { seekRoot = seekRoot.parent(); hierarchyLevel++; diff --git a/examples/tutorials/modelview/qmake.pro b/examples/tutorials/modelview/qmake.pro deleted file mode 100755 index 7f684ba..0000000 --- a/examples/tutorials/modelview/qmake.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS = 1_readonly \ - 2_formatting \ - 3_changingmodel \ - 4_headers \ - 5_edit \ - 6_treeview \ - 7_selections - -- cgit v0.12 From 1404c38ad9d1bf5412ca49da7b2b50295d0ce0fb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 13 Jul 2010 18:19:35 +0200 Subject: fix macx not having UNICODE in DEFINES any more and make the cascade a bit nicer on the way ... --- src/sql/drivers/odbc/qsql_odbc.pri | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.pri b/src/sql/drivers/odbc/qsql_odbc.pri index 8394012..66a8d51 100644 --- a/src/sql/drivers/odbc/qsql_odbc.pri +++ b/src/sql/drivers/odbc/qsql_odbc.pri @@ -1,13 +1,13 @@ HEADERS += $$PWD/qsql_odbc.h SOURCES += $$PWD/qsql_odbc.cpp -mac { - !contains(LIBS, .*odbc.*):LIBS += -liodbc -} else:unix { +unix { DEFINES += UNICODE - !contains(LIBS, .*odbc.*):LIBS += $$QT_LFLAGS_ODBC -} else:win32-borland { - LIBS *= $(BCB)/lib/PSDK/odbc32.lib + !contains(LIBS, .*odbc.*) { + macx:LIBS += -liodbc + else:LIBS += $$QT_LFLAGS_ODBC + } } else { - LIBS *= -lodbc32 + win32-borland:LIBS *= $(BCB)/lib/PSDK/odbc32.lib + else:LIBS *= -lodbc32 } -- cgit v0.12 From 7acf2417bd2ae17c2e3c289c7caed84219e5fecd Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 13 Jul 2010 13:04:36 +0200 Subject: Fix last character being overwritten in password field The temporary cursor position was not being updated after committing the input (changing the cleartext into a *), as a result of which, the next keypress was mistaken for a multitap input which should replace the last character. Task-number: QTBUG-11673 Reviewed-by: axis --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index d081cfd..999edda 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -294,6 +294,10 @@ void QCoeFepInputContext::commitTemporaryPreeditString() return; commitCurrentString(false); + + //update cursor position, now this pre-edit text has been committed. + //this prevents next keypress overwriting it (QTBUG-11673) + m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); } void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event) -- cgit v0.12 From 05971cf88bf03f2cbf563cb194ebee62bb907394 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 14 Jul 2010 13:51:17 +1000 Subject: Attempt to fix build failure with msvc200{5,8} on Windows XP. --- tests/auto/qfileinfo/tst_qfileinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index 4c651bf..93b1891 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -1082,7 +1082,7 @@ void tst_QFileInfo::isHidden_data() #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) QVERIFY(QDir("./hidden-directory").exists() || QDir().mkdir("./hidden-directory")); - QVERIFY(SetFileAttributesW(QString("./hidden-directory").utf16(),FILE_ATTRIBUTE_HIDDEN)); + QVERIFY(SetFileAttributesW(reinterpret_cast(QString("./hidden-directory").utf16()),FILE_ATTRIBUTE_HIDDEN)); QTest::newRow("C:/path/to/hidden-directory") << QDir::currentPath() + QString::fromLatin1("/hidden-directory") << true; QTest::newRow("C:/path/to/hidden-directory/.") << QDir::currentPath() + QString::fromLatin1("/hidden-directory/.") << true; #endif -- cgit v0.12 From b2002d0814e18f7a50bdbf8d17c4bc1662fa70ee Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 14 Jul 2010 13:52:48 +1000 Subject: Revert "Fix an Assert in QTextTable" This reverts commit b2a4c7f0142a48f60e7ec4fc5866917e3da8b7c3. Unit test tst_qtexttable::QTBUG11282_insertBeforeMergedEnding fails on mac and Linux, reverting for now. --- src/gui/text/qtexttable.cpp | 28 +++-------------- tests/auto/qtexttable/tst_qtexttable.cpp | 54 -------------------------------- 2 files changed, 4 insertions(+), 78 deletions(-) diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index e3985ce..5100176 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -754,39 +754,19 @@ void QTextTable::insertColumns(int pos, int num) QTextFormatCollection *c = p->formatCollection(); p->beginEditBlock(); - QList extendedSpans; for (int i = 0; i < d->nRows; ++i) { int cell; if (i == d->nRows - 1 && pos == d->nCols) cell = d->fragment_end; else cell = d->grid[i*d->nCols + pos]; + QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); + QTextCharFormat fmt = c->charFormat(it->format); if (pos > 0 && pos < d->nCols && cell == d->grid[i*d->nCols + pos - 1]) { // cell spans the insertion place, extend it - if (!extendedSpans.contains(cell)) { - QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); - QTextCharFormat fmt = c->charFormat(it->format); - fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num); - p->setCharFormat(it.position(), 1, fmt); - d->dirty = true; - extendedSpans << cell; - } + fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num); + p->setCharFormat(it.position(), 1, fmt); } else { - /* If the next cell is spanned from the row above, we need to find the right position - to insert to */ - if (i > 0 && pos < d->nCols && cell == d->grid[(i-1) * d->nCols + pos]) { - int gridIndex = i*d->nCols + pos; - const int gridEnd = d->nRows * d->nCols - 1; - while (gridIndex < gridEnd && cell == d->grid[gridIndex]) { - ++gridIndex; - } - if (gridIndex == gridEnd) - cell = d->fragment_end; - else - cell = d->grid[gridIndex]; - } - QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); - QTextCharFormat fmt = c->charFormat(it->format); fmt.setTableCellRowSpan(1); fmt.setTableCellColumnSpan(1); Q_ASSERT(fmt.objectIndex() == objectIndex()); diff --git a/tests/auto/qtexttable/tst_qtexttable.cpp b/tests/auto/qtexttable/tst_qtexttable.cpp index b0cb34d..2e6007e 100644 --- a/tests/auto/qtexttable/tst_qtexttable.cpp +++ b/tests/auto/qtexttable/tst_qtexttable.cpp @@ -48,14 +48,9 @@ #include #include #include -#include -#include //TESTED_FILES= -typedef QList IntList; -Q_DECLARE_METATYPE(IntList) - QT_FORWARD_DECLARE_CLASS(QTextDocument) class tst_QTextTable : public QObject @@ -83,7 +78,6 @@ private slots: void insertRows(); void deleteInTable(); void mergeCells(); - void mergeAndInsert(); void splitCells(); void blocksForTableShouldHaveEmptyFormat(); void removeTableByRemoveRows(); @@ -99,8 +93,6 @@ private slots: void removeColumns3(); void removeColumns4(); void removeColumns5(); - void QTBUG11282_insertBeforeMergedEnding_data(); - void QTBUG11282_insertBeforeMergedEnding(); private: QTextTable *create2x2Table(); @@ -594,16 +586,6 @@ void tst_QTextTable::mergeCells() QVERIFY(table->cellAt(0, 1) == table->cellAt(1, 1)); } -void tst_QTextTable::mergeAndInsert() -{ - QTextTable *table = cursor.insertTable(4,3); - table->mergeCells(0,1,3,2); - table->mergeCells(3,0,1,3); - //Don't crash ! - table->insertColumns(1,2); - QCOMPARE(table->columns(), 5); -} - void tst_QTextTable::splitCells() { QTextTable *table = create4x4Table(); @@ -949,41 +931,5 @@ void tst_QTextTable::removeColumns5() QCOMPARE(table->cellAt(3, 2).firstPosition(), 11); } -void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding_data() -{ - QTest::addColumn("rows"); - QTest::addColumn("columns"); - QTest::addColumn >("merge"); - QTest::addColumn >("insert"); - - QTest::newRow("2x3, merge two, insert one") << 2 << 3 << (QList() << 1 << 2 << 2) - << (QList() << 1 << 1) ; - QTest::newRow("3x4, merge three, insert one") << 3 << 4 << (QList() << 1 << 3 << 3) - << (QList() << 1 << 1) ; - QTest::newRow("4x3, merge two, insert two") << 4 << 3 << (QList() << 1 << 4 << 2) - << (QList() << 1 << 2) ; - QTest::newRow("4x4, merge middle two, insert one") << 4 << 4 << (QList() << 1 << 4 << 2) - << (QList() << 1 << 1) ; -} - -void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding() -{ - QFETCH(int, rows); - QFETCH(int, columns); - QFETCH(QList, merge); - QFETCH(QList, insert); - QTextTable *table = cursor.insertTable(rows, columns); - QTextEdit *textEdit = new QTextEdit; - textEdit->setDocument(doc); - textEdit->show(); - QTest::qWaitForWindowShown(textEdit); - table->mergeCells(0,merge.at(0), merge.at(1), merge.at(2)); - //Don't crash ! - table->insertColumns(insert.at(0), insert.at(1)); - //Check that the final size is what we expected - QCOMPARE(table->rows(), rows); - QCOMPARE(table->columns(), columns + insert.at(1)); -} - QTEST_MAIN(tst_QTextTable) #include "tst_qtexttable.moc" -- cgit v0.12 From d3a6f124dde7732311ad9312ebf41997712fc6bb Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Fri, 2 Jul 2010 19:31:51 +0200 Subject: Fix an Assert in QTextTable The problem was caused by the fragment id being inserted in front of a cell spanning over several rows instead of the next logical cell (or fragment_end) in the cells structure. Task-number: QTBUG-11282 Reviewed-by: Simon Hausmann --- src/gui/text/qtexttable.cpp | 28 +++++++++++++--- tests/auto/qtexttable/tst_qtexttable.cpp | 55 ++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index 5100176..e3985ce 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -754,19 +754,39 @@ void QTextTable::insertColumns(int pos, int num) QTextFormatCollection *c = p->formatCollection(); p->beginEditBlock(); + QList extendedSpans; for (int i = 0; i < d->nRows; ++i) { int cell; if (i == d->nRows - 1 && pos == d->nCols) cell = d->fragment_end; else cell = d->grid[i*d->nCols + pos]; - QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); - QTextCharFormat fmt = c->charFormat(it->format); if (pos > 0 && pos < d->nCols && cell == d->grid[i*d->nCols + pos - 1]) { // cell spans the insertion place, extend it - fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num); - p->setCharFormat(it.position(), 1, fmt); + if (!extendedSpans.contains(cell)) { + QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); + QTextCharFormat fmt = c->charFormat(it->format); + fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num); + p->setCharFormat(it.position(), 1, fmt); + d->dirty = true; + extendedSpans << cell; + } } else { + /* If the next cell is spanned from the row above, we need to find the right position + to insert to */ + if (i > 0 && pos < d->nCols && cell == d->grid[(i-1) * d->nCols + pos]) { + int gridIndex = i*d->nCols + pos; + const int gridEnd = d->nRows * d->nCols - 1; + while (gridIndex < gridEnd && cell == d->grid[gridIndex]) { + ++gridIndex; + } + if (gridIndex == gridEnd) + cell = d->fragment_end; + else + cell = d->grid[gridIndex]; + } + QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell); + QTextCharFormat fmt = c->charFormat(it->format); fmt.setTableCellRowSpan(1); fmt.setTableCellColumnSpan(1); Q_ASSERT(fmt.objectIndex() == objectIndex()); diff --git a/tests/auto/qtexttable/tst_qtexttable.cpp b/tests/auto/qtexttable/tst_qtexttable.cpp index 2e6007e..9dcc369 100644 --- a/tests/auto/qtexttable/tst_qtexttable.cpp +++ b/tests/auto/qtexttable/tst_qtexttable.cpp @@ -48,9 +48,14 @@ #include #include #include +#include +#include //TESTED_FILES= +typedef QList IntList; +Q_DECLARE_METATYPE(IntList) + QT_FORWARD_DECLARE_CLASS(QTextDocument) class tst_QTextTable : public QObject @@ -78,6 +83,7 @@ private slots: void insertRows(); void deleteInTable(); void mergeCells(); + void mergeAndInsert(); void splitCells(); void blocksForTableShouldHaveEmptyFormat(); void removeTableByRemoveRows(); @@ -93,6 +99,8 @@ private slots: void removeColumns3(); void removeColumns4(); void removeColumns5(); + void QTBUG11282_insertBeforeMergedEnding_data(); + void QTBUG11282_insertBeforeMergedEnding(); private: QTextTable *create2x2Table(); @@ -586,6 +594,16 @@ void tst_QTextTable::mergeCells() QVERIFY(table->cellAt(0, 1) == table->cellAt(1, 1)); } +void tst_QTextTable::mergeAndInsert() +{ + QTextTable *table = cursor.insertTable(4,3); + table->mergeCells(0,1,3,2); + table->mergeCells(3,0,1,3); + //Don't crash ! + table->insertColumns(1,2); + QCOMPARE(table->columns(), 5); +} + void tst_QTextTable::splitCells() { QTextTable *table = create4x4Table(); @@ -931,5 +949,42 @@ void tst_QTextTable::removeColumns5() QCOMPARE(table->cellAt(3, 2).firstPosition(), 11); } +void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding_data() +{ + QTest::addColumn("rows"); + QTest::addColumn("columns"); + QTest::addColumn >("merge"); + QTest::addColumn >("insert"); + + QTest::newRow("2x3, merge two, insert one") << 2 << 3 << (QList() << 1 << 2 << 2) + << (QList() << 1 << 1) ; + QTest::newRow("3x4, merge three, insert one") << 3 << 4 << (QList() << 1 << 3 << 3) + << (QList() << 1 << 1) ; + QTest::newRow("4x3, merge two, insert two") << 4 << 3 << (QList() << 1 << 4 << 2) + << (QList() << 1 << 2) ; + QTest::newRow("4x4, merge middle two, insert one") << 4 << 4 << (QList() << 1 << 4 << 2) + << (QList() << 1 << 1) ; +} + +void tst_QTextTable::QTBUG11282_insertBeforeMergedEnding() +{ + QFETCH(int, rows); + QFETCH(int, columns); + QFETCH(QList, merge); + QFETCH(QList, insert); + QTextTable *table = cursor.insertTable(rows, columns); + QTextEdit *textEdit = new QTextEdit; + textEdit->setDocument(doc); + textEdit->show(); + QTest::qWaitForWindowShown(textEdit); + table->mergeCells(0,merge.at(0), merge.at(1), merge.at(2)); + //Don't crash ! + table->insertColumns(insert.at(0), insert.at(1)); + //Check that the final size is what we expected + QCOMPARE(table->rows(), rows); + QCOMPARE(table->columns(), columns + insert.at(1)); + delete textEdit; +} + QTEST_MAIN(tst_QTextTable) #include "tst_qtexttable.moc" -- cgit v0.12 From 852ba9a62f65a27e42648d4b28b68c76b1589e75 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 14 Jul 2010 10:46:46 +0200 Subject: Silence warning when building with MSVC 2005 Reviewed-by: Eskil --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index ee49a3d..d3f6a29 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1128,7 +1128,7 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush) d->fill(path); } -extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp +extern Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) -- cgit v0.12 From d3f67bfe7cd1cc39d25e6a7371b2b185591008c4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 14 Jul 2010 10:47:58 +0200 Subject: qdoc: Removed navigation arrow that was causing display problems. Task-number: QTBUG-12157, QTBUG-12148, QTBUG-12146 --- tools/qdoc3/htmlgenerator.cpp | 30 ++++++++++++++++++------------ tools/qdoc3/htmlgenerator.h | 1 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 8699cb2..f281fd4 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -63,6 +63,12 @@ QT_BEGIN_NAMESPACE int HtmlGenerator::id = 0; bool HtmlGenerator::debugging_on = false; +#if 0 +QString HtmlGenerator::divNavTop = "
    "; +#endif + +QString HtmlGenerator::divNavTop = ""; + QString HtmlGenerator::sinceTitles[] = { " New Namespaces", @@ -1055,11 +1061,11 @@ int HtmlGenerator::generateAtom(const Atom *atom, } sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); } - out() << "
    \n"; + out() << "" << divNavTop << "\n"; } #else out() << "
    \n"; + << "\">" << divNavTop << "\n"; #endif break; case Atom::SectionRight: @@ -1307,7 +1313,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, // out() << "
    \n"; out() << "
    \n"; + << "\">" << divNavTop << "\n"; out() << "

    " << protectEnc((*s).name) << "

    \n"; generateSection(s->members, inner, marker, CodeMarker::Summary); } @@ -1316,7 +1322,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, // out() << "
    \n"; out() << "
    \n"; + << "\">" << divNavTop << "\n"; out() << "

    " << protectEnc(name) << "

    \n"; generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); } @@ -1343,7 +1349,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, out() << "\n"; } - out() << "
    \n"; + out() << "" << divNavTop << "\n"; if (!inner->doc().isEmpty()) { //out() << "
    \n" @@ -1483,12 +1489,12 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateStatus(fake, marker); if (moduleNamespaceMap.contains(fake->name())) { - out() << "
    \n"; + out() << "" << divNavTop << "\n"; out() << "

    Namespaces

    \n"; generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); } if (moduleClassMap.contains(fake->name())) { - out() << "
    \n"; + out() << "" << divNavTop << "\n"; out() << "

    Classes

    \n"; generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); } @@ -1551,13 +1557,13 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) sections = marker->qmlSections(qml_cn,CodeMarker::Summary); s = sections.begin(); while (s != sections.end()) { - out() << "
    \n"; + out() << "" << divNavTop << "\n"; out() << "

    " << protectEnc((*s).name) << "

    \n"; generateQmlSummary(*s,fake,marker); ++s; } - out() << "
    \n"; + out() << "" << divNavTop << "\n"; out() << "

    " << "Detailed Description" << "

    \n"; generateBody(fake, marker); if (cn) @@ -1587,7 +1593,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { - out() << "
    \n"; + out() << "" << divNavTop << "\n"; out() << "

    " << protectEnc((*s).name) << "

    \n"; generateSectionList(*s, fake, marker, CodeMarker::Summary); ++s; @@ -1595,7 +1601,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) Text brief = fake->doc().briefText(); if (fake->subType() == Node::Module && !brief.isEmpty()) { - out() << "
    \n"; + out() << "" << divNavTop << "\n"; out() << "
    \n"; // QTBUG-9504 out() << "

    " << "Detailed Description" << "

    \n"; } @@ -3481,7 +3487,7 @@ void HtmlGenerator::generateDetailedMember(const Node *node, out() << "

    "; out() << ""; generateSynopsis(node, relative, marker, CodeMarker::Detailed); - out() << "

    \n"; + out() << "" << divNavTop << "\n"; } generateStatus(node, marker); diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index abfca60..54032d3 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -324,6 +324,7 @@ class HtmlGenerator : public PageGenerator static int id; public: static bool debugging_on; + static QString divNavTop; }; #define HTMLGENERATOR_ADDRESS "address" -- cgit v0.12 From b7f55ac9c1c6b87083c9dca3b5cbca211fdecaef Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 14 Jul 2010 11:53:07 +0200 Subject: fix warning directive on gnuc --- bin/syncqt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/syncqt b/bin/syncqt index 11b1d72..c8cba30 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -843,7 +843,7 @@ foreach (@modules_to_sync) { my $warning_msg = 'Inclusion of header files from include/Qt is deprecated.'; $header_content = "#ifndef QT_NO_QT_INCLUDE_WARN\n" . " #if defined(__GNUC__)\n" . - " #pragma warning \"$warning_msg\"\n" . + " #warning \"$warning_msg\"\n" . " #elif defined(_MSC_VER)\n" . " #pragma message \"WARNING: $warning_msg\"\n" . " #endif\n". -- cgit v0.12 From 74d0482c1690211a20bdfc996aa0ad30fdb9bb28 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 14 Jul 2010 11:55:27 +0200 Subject: fix qconfig.h aliased header creation don't have configure create the forwarding headers (or symlinks on unix) for qconfig.h, but instead have syncqt create forwarding headers for not yet existing files. Reviewed-by: joerg --- bin/syncqt | 2 ++ configure | 5 ----- tools/configure/configureapp.cpp | 10 ---------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/bin/syncqt b/bin/syncqt index c8cba30..fb5c8d8 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -691,6 +691,7 @@ my @ignore_for_qt_begin_header_check = ( "qiconset.h", "qconfig.h", "qconfig-dis my @ignore_for_qt_begin_namespace_check = ( "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qatomic_arch.h", "qatomic_windowsce.h", "qt_windows.h", "qatomic_macosx.h" ); my @ignore_for_qt_module_check = ( "$modules{QtCore}/arch", "$modules{QtCore}/global", "$modules{QtSql}/drivers", "$modules{QtTest}", "$modules{QtDesigner}", "$modules{QtUiTools}", "$modules{QtDBus}", "$modules{phonon}" ); my %colliding_headers = (); +my %inject_headers = ( "$basedir/src/corelib/global" => ( "qconfig.h" ) ); foreach (@modules_to_sync) { #iteration info @@ -800,6 +801,7 @@ foreach (@modules_to_sync) { foreach (@subdirs) { my $subdir = "$_"; my @headers = findFiles("$subdir", "^[-a-z0-9_]*\\.h\$" , 0); + push @headers, $inject_headers{$subdir} if (defined $inject_headers{$subdir}); foreach (@headers) { my $header = "$_"; $header = 0 if("$header" =~ /^ui_.*.h/); diff --git a/configure b/configure index 166f201..62e0863 100755 --- a/configure +++ b/configure @@ -4481,11 +4481,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; fi mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H" - for conf in "$outpath/include/QtCore/qconfig.h" "$outpath/include/Qt/qconfig.h"; do - if [ '!' -f "$conf" ]; then - ln -s "$QCONFIG_H" "$conf" - fi - done #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured rm -f mkspecs/default diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index d3dec3c..7f2d53b 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3164,16 +3164,6 @@ void Configure::generateConfigfiles() QFile::remove(outName); tmpFile.copy(outName); tmpFile.close(); - - if (!QFile::exists(buildPath + "/include/QtCore/qconfig.h")) { - if (!writeToFile("#include \"../../src/corelib/global/qconfig.h\"\n", - buildPath + "/include/QtCore/qconfig.h") - || !writeToFile("#include \"../../src/corelib/global/qconfig.h\"\n", - buildPath + "/include/Qt/qconfig.h")) { - dictionary["DONE"] = "error"; - return; - } - } } // Copy configured mkspec to default directory, but remove the old one first, if there is any -- cgit v0.12 From 56e24c99ee7a1b5b127b93cbab98f88e008ec9b8 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 14 Jul 2010 13:03:48 +0200 Subject: Crash while runnig tst_QMdiSubWindow::emittingOfSignals test on Cocoa We were assuming that the native windows we create will always have a corresponding QWidget. This is not the case for qt_root_win. Reviewed-by: Carlos Duclos --- src/gui/kernel/qcocoasharedwindowmethods_mac_p.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h index 8652816..6795149 100644 --- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h +++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h @@ -85,6 +85,8 @@ QT_END_NAMESPACE - (BOOL)canBecomeKeyWindow { QWidget *widget = [self QT_MANGLE_NAMESPACE(qt_qwidget)]; + if (!widget) + return NO; // This should happen only for qt_root_win bool isToolTip = (widget->windowType() == Qt::ToolTip); bool isPopup = (widget->windowType() == Qt::Popup); @@ -94,6 +96,8 @@ QT_END_NAMESPACE - (BOOL)canBecomeMainWindow { QWidget *widget = [self QT_MANGLE_NAMESPACE(qt_qwidget)]; + if (!widget) + return NO; // This should happen only for qt_root_win bool isToolTip = (widget->windowType() == Qt::ToolTip); bool isPopup = (widget->windowType() == Qt::Popup); -- cgit v0.12 From 247e3637c41cc14d174a1170957274fb8a9400b4 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 14 Jul 2010 13:52:39 +0200 Subject: Drag and drop cursor doesnot change on invalid drop areas (Cocoa) Previos versions of Mac OS X (< 10.6) didn't have support for such 'Not Allowed' cursors. 10.6 introduced a new method for NSCursor called operationNotAllowedCursor. This fix uses the new cusor on available platforms. Task-number: QTBUG-5186 Reviewed-by: Denis --- src/gui/kernel/qcocoaview_mac.mm | 38 +++++++++++++++++++++++++++++++++++--- src/gui/kernel/qcocoaview_mac_p.h | 1 + 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 5c90e2e..1935531 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -269,6 +269,28 @@ static int qCocoaViewCount = 0; dropData = new QCocoaDropData(dropPasteboard); } +- (void)changeDraggingCursor:(NSDragOperation)newOperation +{ + static SEL action = nil; + static bool operationSupported = false; + if (action == nil) { + action = NSSelectorFromString(@"operationNotAllowedCursor"); + if ([NSCursor respondsToSelector:action]) { + operationSupported = true; + } + } + if (operationSupported) { + NSCursor *notAllowedCursor = [NSCursor performSelector:action]; + bool isNotAllowedCursor = ([NSCursor currentCursor] == notAllowedCursor); + if (newOperation == NSDragOperationNone && !isNotAllowedCursor) { + [notAllowedCursor push]; + } else if (newOperation != NSDragOperationNone && isNotAllowedCursor) { + [notAllowedCursor pop]; + } + + } +} + - (NSDragOperation)draggingEntered:(id )sender { // NB: This function is called from QCoocaWindow/QCocoaPanel rather than directly @@ -300,6 +322,7 @@ static int qCocoaViewCount = 0; if (!qDEEvent.isAccepted()) { // widget is not interested in this drag, so ignore this drop data. [self removeDropData]; + [self changeDraggingCursor:NSDragOperationNone]; return NSDragOperationNone; } else { // save the mouse position, used by draggingExited handler. @@ -321,6 +344,7 @@ static int qCocoaViewCount = 0; nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDMEvent.dropAction()); } QT_PREPEND_NAMESPACE(qt_mac_copy_answer_rect)(qDMEvent); + [self changeDraggingCursor:nsActions]; return nsActions; } } @@ -335,16 +359,21 @@ static int qCocoaViewCount = 0; if (dragEnterSequence != [sender draggingSequenceNumber]) [self draggingEntered:sender]; // drag enter event was rejected, so ignore the move event. - if (dropData == 0) + if (dropData == 0) { + [self changeDraggingCursor:NSDragOperationNone]; return NSDragOperationNone; + } // return last value, if we are still in the answerRect. NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; NSDragOperation nsActions = [sender draggingSourceOperationMask]; QPoint posDrag(localPoint.x, localPoint.y); if (qt_mac_mouse_inside_answer_rect(posDrag) - && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) == nsActions) - return QT_PREPEND_NAMESPACE(qt_mac_mapDropActions)(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastAction)); + && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) == nsActions) { + NSDragOperation operation = QT_PREPEND_NAMESPACE(qt_mac_mapDropActions)(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastAction)); + [self changeDraggingCursor:operation]; + return operation; + } // send drag move event to the widget QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions; Qt::DropActions qtAllowed = QT_PREPEND_NAMESPACE(qt_mac_mapNSDragOperations)(nsActions); @@ -373,6 +402,7 @@ static int qCocoaViewCount = 0; qDMEvent.setDropAction(Qt::IgnoreAction); } qt_mac_copy_answer_rect(qDMEvent); + [self changeDraggingCursor:operation]; return operation; } @@ -388,6 +418,8 @@ static int qCocoaViewCount = 0; QApplication::sendEvent(qwidget, &de); [self removeDropData]; } + [self changeDraggingCursor:NSDragOperationEvery]; + } - (BOOL)performDragOperation:(id )sender diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h index 33aaa24..b6b63ca 100644 --- a/src/gui/kernel/qcocoaview_mac_p.h +++ b/src/gui/kernel/qcocoaview_mac_p.h @@ -106,6 +106,7 @@ Q_GUI_EXPORT - (void) qt_clearQWidget; - (BOOL)qt_leftButtonIsRightButton; - (void)qt_setLeftButtonIsRightButton:(BOOL)isSwapped; +- (void)changeDraggingCursor:(NSDragOperation)newOperation; + (DnDParams*)currentMouseEvent; @end -- cgit v0.12 From 00b7befbc003682a351c18d90436010efd26ece5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 14 Jul 2010 16:26:19 +0200 Subject: fix qconfig.h reference for shadow builds Reviewed-by: joerg --- bin/syncqt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/syncqt b/bin/syncqt index fb5c8d8..03659d3 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -691,7 +691,7 @@ my @ignore_for_qt_begin_header_check = ( "qiconset.h", "qconfig.h", "qconfig-dis my @ignore_for_qt_begin_namespace_check = ( "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qatomic_arch.h", "qatomic_windowsce.h", "qt_windows.h", "qatomic_macosx.h" ); my @ignore_for_qt_module_check = ( "$modules{QtCore}/arch", "$modules{QtCore}/global", "$modules{QtSql}/drivers", "$modules{QtTest}", "$modules{QtDesigner}", "$modules{QtUiTools}", "$modules{QtDBus}", "$modules{phonon}" ); my %colliding_headers = (); -my %inject_headers = ( "$basedir/src/corelib/global" => ( "qconfig.h" ) ); +my %inject_headers = ( "$basedir/src/corelib/global" => ( "*qconfig.h" ) ); foreach (@modules_to_sync) { #iteration info @@ -804,6 +804,7 @@ foreach (@modules_to_sync) { push @headers, $inject_headers{$subdir} if (defined $inject_headers{$subdir}); foreach (@headers) { my $header = "$_"; + my $shadow = ($header =~ s/^\*//); $header = 0 if("$header" =~ /^ui_.*.h/); foreach (@ignore_headers) { $header = 0 if("$header" eq "$_"); @@ -821,6 +822,7 @@ foreach (@modules_to_sync) { } my $iheader = $subdir . "/" . $header; + $iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow); my @classes = $public_header ? classNames($iheader) : (); if($showonly) { print "$header [$lib]\n"; -- cgit v0.12 From 6536b6f16ff26579f191543e5d468a6382211a29 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 14 Jul 2010 23:43:58 +0200 Subject: Add unit tests for QMimeData. Merge-request: 2428 Reviewed-by: Andreas Kling --- tests/auto/gui.pro | 1 + tests/auto/qmimedata/qmimedata.pro | 4 + tests/auto/qmimedata/tst_qmimedata.cpp | 343 +++++++++++++++++++++++++++++++++ 3 files changed, 348 insertions(+) create mode 100644 tests/auto/qmimedata/qmimedata.pro create mode 100644 tests/auto/qmimedata/tst_qmimedata.cpp diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro index cfaa3fa..2d9ea93 100644 --- a/tests/auto/gui.pro +++ b/tests/auto/gui.pro @@ -112,6 +112,7 @@ SUBDIRS=\ qmdisubwindow \ qmessagebox \ qmetaobject \ + qmimedata \ qmouseevent_modal \ qmovie \ qnetworkaccessmanager_and_qprogressdialog \ diff --git a/tests/auto/qmimedata/qmimedata.pro b/tests/auto/qmimedata/qmimedata.pro new file mode 100644 index 0000000..13fbe65 --- /dev/null +++ b/tests/auto/qmimedata/qmimedata.pro @@ -0,0 +1,4 @@ +load(qttest_p4) +SOURCES += tst_qmimedata.cpp + + diff --git a/tests/auto/qmimedata/tst_qmimedata.cpp b/tests/auto/qmimedata/tst_qmimedata.cpp new file mode 100644 index 0000000..be7a654 --- /dev/null +++ b/tests/auto/qmimedata/tst_qmimedata.cpp @@ -0,0 +1,343 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite 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$ +** +****************************************************************************/ + + +#include + +#include + +class tst_QMimeData : public QObject +{ + Q_OBJECT +public: + tst_QMimeData() + { + } + +private slots: + void clear() const; + void colorData() const; + void data() const; + void formats() const; + void hasColor() const; + void hasFormat() const; + void hasHtml() const; + void hasImage() const; + // hasText() covered by setText() + // hasUrls() covered by setUrls() + // html() covered by setHtml() + void imageData() const; + void removeFormat() const; + // setColorData() covered by hasColor() + // setData() covered in a few different tests + void setHtml() const; + // setImageData() covered in a few tests + void setText() const; + void setUrls() const; + // text() covered in setText() + // urls() covered by setUrls() +}; + +void tst_QMimeData::clear() const +{ + QMimeData mimeData; + + // set, clear, verify empty + mimeData.setData("text/plain", "pirates"); + QVERIFY(mimeData.hasText()); + mimeData.clear(); + QVERIFY(mimeData.hasText() == false); + + // repopulate, verify not empty + mimeData.setData("text/plain", "pirates"); + QVERIFY(mimeData.hasText()); +} + +void tst_QMimeData::colorData() const +{ + QMimeData mimeData; + QColor red = Qt::red; + QColor blue = Qt::blue; + + // set, verify + mimeData.setColorData(red); + QVERIFY(mimeData.hasColor()); + QCOMPARE(qvariant_cast(mimeData.colorData()), red); + + // change, verify + mimeData.setColorData(Qt::blue); + QVERIFY(mimeData.hasColor()); + QCOMPARE(qvariant_cast(mimeData.colorData()), blue); +} + +void tst_QMimeData::data() const +{ + QMimeData mimeData; + + // set text, verify + mimeData.setData("text/plain", "pirates"); + QCOMPARE(mimeData.data("text/plain"), QByteArray("pirates")); + QVERIFY(mimeData.data("text/html").length() == 0); + + // html time + mimeData.setData("text/html", "ninjas"); + QCOMPARE(mimeData.data("text/html"), QByteArray("ninjas")); + QCOMPARE(mimeData.data("text/plain"), QByteArray("pirates")); // make sure text not damaged + QCOMPARE(mimeData.data("text/html"), mimeData.html().toLatin1()); +} + +void tst_QMimeData::formats() const +{ + QMimeData mimeData; + + // set text, verify + mimeData.setData("text/plain", "pirates"); + QCOMPARE(mimeData.formats(), QStringList() << "text/plain"); + + // set html, verify + mimeData.setData("text/html", "ninjas"); + QCOMPARE(mimeData.formats(), QStringList() << "text/plain" << "text/html"); + + // clear, verify + mimeData.clear(); + QCOMPARE(mimeData.formats(), QStringList()); + + // set an odd format, verify + mimeData.setData("foo/bar", "somevalue"); + QCOMPARE(mimeData.formats(), QStringList() << "foo/bar"); +} + +void tst_QMimeData::hasColor() const +{ + QMimeData mimeData; + + // initial state + QVERIFY(mimeData.hasColor() == false); + + // set, verify + mimeData.setColorData(QColor(Qt::red)); + QVERIFY(mimeData.hasColor()); + + // clear, verify + mimeData.clear(); + QVERIFY(mimeData.hasColor() == false); + + // set something else, verify + mimeData.setData("text/plain", "pirates"); + QVERIFY(mimeData.hasColor() == false); +} + +void tst_QMimeData::hasFormat() const +{ + QMimeData mimeData; + + // initial state + QVERIFY(mimeData.hasFormat("text/plain") == false); + + // add, verify + mimeData.setData("text/plain", "pirates"); + QVERIFY(mimeData.hasFormat("text/plain")); + QVERIFY(mimeData.hasFormat("text/html") == false); + + // clear, verify + mimeData.clear(); + QVERIFY(mimeData.hasFormat("text/plain") == false); + QVERIFY(mimeData.hasFormat("text/html") == false); +} + +void tst_QMimeData::hasHtml() const +{ + QMimeData mimeData; + + // initial state + QVERIFY(mimeData.hasHtml() == false); + + // add plain, verify false + mimeData.setData("text/plain", "pirates"); + QVERIFY(mimeData.hasHtml() == false); + + // add html, verify + mimeData.setData("text/html", "ninjas"); + QVERIFY(mimeData.hasHtml()); + + // clear, verify + mimeData.clear(); + QVERIFY(mimeData.hasHtml() == false); + + // readd, verify + mimeData.setData("text/html", "ninjas"); + QVERIFY(mimeData.hasHtml()); +} + +void tst_QMimeData::hasImage() const +{ + QMimeData mimeData; + + // initial state + QVERIFY(mimeData.hasImage() == false); + + // add text, verify false + mimeData.setData("text/plain", "pirates"); + QVERIFY(mimeData.hasImage() == false); + + // add image + mimeData.setImageData(QImage()); + QVERIFY(mimeData.hasImage()); + + // clear, verify + mimeData.clear(); + QVERIFY(mimeData.hasImage() == false); +} + +void tst_QMimeData::imageData() const +{ + QMimeData mimeData; + + // initial state + QCOMPARE(mimeData.imageData(), QVariant()); + + // set, test + mimeData.setImageData(QImage()); + QVERIFY(mimeData.hasImage()); + QCOMPARE(mimeData.imageData(), QVariant(QImage())); + + // clear, verify + mimeData.clear(); + QCOMPARE(mimeData.imageData(), QVariant()); +} + +void tst_QMimeData::removeFormat() const +{ + QMimeData mimeData; + + // add, verify + mimeData.setData("text/plain", "pirates"); + QVERIFY(mimeData.hasFormat("text/plain")); + + // add another, verify + mimeData.setData("text/html", "ninjas"); + QVERIFY(mimeData.hasFormat("text/html")); + + // remove, verify + mimeData.removeFormat("text/plain"); + QVERIFY(mimeData.hasFormat("text/plain") == false); + QVERIFY(mimeData.hasFormat("text/html")); + + // remove, verify + mimeData.removeFormat("text/html"); + QVERIFY(mimeData.hasFormat("text/plain") == false); + QVERIFY(mimeData.hasFormat("text/html") == false); +} + +void tst_QMimeData::setHtml() const +{ + QMimeData mimeData; + + // initial state + QVERIFY(mimeData.hasHtml() == false); + + // add html, verify + mimeData.setHtml("ninjas"); + QVERIFY(mimeData.hasHtml()); + QCOMPARE(mimeData.html(), QLatin1String("ninjas")); + + // reset html + mimeData.setHtml("pirates"); + QVERIFY(mimeData.hasHtml()); + QCOMPARE(mimeData.html(), QLatin1String("pirates")); +} + +void tst_QMimeData::setText() const +{ + QMimeData mimeData; + + // verify initial state + QCOMPARE(mimeData.text(), QLatin1String("")); + QVERIFY(mimeData.hasText() == false); + + // set, verify + mimeData.setText("pirates"); + QVERIFY(mimeData.hasText()); + QCOMPARE(mimeData.text(), QLatin1String("pirates")); + QCOMPARE(mimeData.text().toLatin1(), mimeData.data("text/plain")); + + // reset, verify + mimeData.setText("ninjas"); + QVERIFY(mimeData.hasText()); + QCOMPARE(mimeData.text(), QLatin1String("ninjas")); + QCOMPARE(mimeData.text().toLatin1(), mimeData.data("text/plain")); + + // clear, verify + mimeData.clear(); + QCOMPARE(mimeData.text(), QLatin1String("")); + QVERIFY(mimeData.hasText() == false); +} + +void tst_QMimeData::setUrls() const +{ + QMimeData mimeData; + QList shortUrlList; + QList longUrlList; + + // set up + shortUrlList += QUrl("http://qt.nokia.com"); + longUrlList = shortUrlList; + longUrlList += QUrl("http://www.google.com"); + + // verify initial state + QVERIFY(mimeData.hasUrls() == false); + + // set a few, verify + mimeData.setUrls(shortUrlList); + QCOMPARE(mimeData.urls(), shortUrlList); + + // change them, verify + mimeData.setUrls(longUrlList); + QCOMPARE(mimeData.urls(), longUrlList); + + // clear, verify + mimeData.clear(); + QVERIFY(mimeData.hasUrls() == false); +} + + +QTEST_MAIN(tst_QMimeData) +#include "tst_qmimedata.moc" -- cgit v0.12 From 6d29bcc28c4ee9b7583a62d23a931b9389004966 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 14 Jul 2010 16:12:04 +0200 Subject: Avoid a crash in the OpenVG paint engine when clipping to an empty path The convertToPainterPath() function assumes that the QVectorPath contains at least one path element when creating the QPainterPath. This is not necessarily the case here though because if QVG_SCISSOR_CLIP is defined and setClipPath() is called with an empty QPainterPath, this is then converted to an empty QVectorPath in QPaintEngineEx::clip() which then calls QVGPaintEngine::clip(). This function then goes on to convert the QVectorPath back into a QPainterPath using the aforementioned function which crashes when attempting to access the first element of the path. In case you are wondering why this seemingly redundant conversion happens at all, it happens because when QVG_SCISSOR_CLIP is defined, we attempt to convert the path to a series of rects for scissor clipping and this conversion function operates on QPainterPath instead of QVectorPath which is what this clip() function was designed to deal with. The fix is to skip over the path conversion for empty paths and go directly to an empty QRegion. Reviewed-by: Alessandro Portale --- src/openvg/qpaintengine_vg.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 7a050f6..7de09ce 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1632,7 +1632,10 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) // Try converting the path into a QRegion that tightly follows // the outline of the path we want to clip with. - QRegion region(path.convertToPainterPath().toFillPolygon(QTransform()).toPolygon()); + QRegion region; + if (!path.isEmpty()) + region = QRegion(path.convertToPainterPath().toFillPolygon(QTransform()).toPolygon()); + switch (op) { case Qt::NoClip: { -- cgit v0.12 From 511985fa173daa9b8462dbb72c45a74626e8cba4 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 15 Jul 2010 10:18:02 +0200 Subject: Fix for tst_qmdisubwindow::fixedMinMaxSize failure on Cocoa We need to respect the size restrictions for all QWidgets. Previously this was only applied to top levels. Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qwidget_mac.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index e57ec77..c788711 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4389,6 +4389,13 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM data.window_state = data.window_state & ~Qt::WindowMaximized; const bool visible = q->isVisible(); + // Apply size restrictions, applicable for Windows & Widgets. + if (QWExtra *extra = extraData()) { + w = qMin(w, extra->maxw); + h = qMin(h, extra->maxh); + w = qMax(w, extra->minw); + h = qMax(h, extra->minh); + } data.crect = QRect(x, y, w, h); if (realWindow) { -- cgit v0.12 From 73473634b706548d603dafe22c9424a007d1bf3b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Jul 2010 11:20:07 +0200 Subject: Revert BIC change "Build Qt with option -Zc:wchar_t under MSVC" This reverts commit a9c8decc741d8c2b340f38d7a854ef206672ab3e. Postponed for Qt5. Or different makespecs. --- mkspecs/win32-msvc2005/qmake.conf | 2 +- mkspecs/win32-msvc2008/qmake.conf | 2 +- mkspecs/win32-msvc2010/qmake.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mkspecs/win32-msvc2005/qmake.conf b/mkspecs/win32-msvc2005/qmake.conf index a5999cc..0406fd0 100644 --- a/mkspecs/win32-msvc2005/qmake.conf +++ b/mkspecs/win32-msvc2005/qmake.conf @@ -16,7 +16,7 @@ QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = byacc QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t +QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD diff --git a/mkspecs/win32-msvc2008/qmake.conf b/mkspecs/win32-msvc2008/qmake.conf index 1aab8e1..9805e90 100644 --- a/mkspecs/win32-msvc2008/qmake.conf +++ b/mkspecs/win32-msvc2008/qmake.conf @@ -16,7 +16,7 @@ QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = byacc QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t +QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD diff --git a/mkspecs/win32-msvc2010/qmake.conf b/mkspecs/win32-msvc2010/qmake.conf index 34a7782..28d4d3c 100644 --- a/mkspecs/win32-msvc2010/qmake.conf +++ b/mkspecs/win32-msvc2010/qmake.conf @@ -16,7 +16,7 @@ QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = byacc QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t +QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD -- cgit v0.12 From d52e3d553664f0fe9a5313908eeb10104f539249 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Mon, 10 May 2010 16:45:05 +0100 Subject: Remove test cases which cause stack overflow These test cases are not considered reasonable for a small screen device (625 widgets). Patching the QWidget code to use iteration rather than recursion is considered too risky, as the code is performance critical. Task-number: QTBUG-8512 Reviewed-by: Bjoern Erik Nilsen --- tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp index 8c30be4..7015bd1 100644 --- a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp +++ b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp @@ -159,12 +159,17 @@ void tst_QWidget::update_data() QTest::newRow("10x10x1 opaque") << 10 << 10 << 1 << true; QTest::newRow("10x10x10 opaque") << 10 << 10 << 10 << true; QTest::newRow("10x10x100 opaque") << 10 << 10 << 100 << true; +#ifndef Q_OS_SYMBIAN + //These test cases cause stack overflow in QWidgetPrivate::paintSiblingsRecursive + //see http://bugreports.qt.nokia.com/browse/QTBUG-8512 + //Symbian threads have a hard limit of 80kB user stack QTest::newRow("25x25x1 transparent ") << 25 << 25 << 1 << false; QTest::newRow("25x25x10 transparent") << 25 << 25 << 10 << false; QTest::newRow("25x25x100 transparent") << 25 << 25 << 100 << false; QTest::newRow("25x25x1 opaque") << 25 << 25 << 1 << true; QTest::newRow("25x25x10 opaque") << 25 << 25 << 10 << true; QTest::newRow("25x25x100 opaque") << 25 << 25 << 100 << true; +#endif } void tst_QWidget::update() -- cgit v0.12 From 367aa34cbcfa109926087e89d49f9223c1409d44 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jul 2010 13:23:56 +0200 Subject: Add a QAuthenticatorPrivate parsing for the headers without QHttpResponseHeader Reviewed-by: Markus Goetz --- src/network/access/qhttpnetworkconnection.cpp | 9 ++----- src/network/kernel/qauthenticator.cpp | 39 ++++++++++++++++++--------- src/network/kernel/qauthenticator_p.h | 1 + 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 1afabec..9e2b85e 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -286,13 +286,8 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket resend = false; //create the response header to be used with QAuthenticatorPrivate. - QHttpResponseHeader responseHeader; QList > fields = reply->header(); - QList >::const_iterator it = fields.constBegin(); - while (it != fields.constEnd()) { - responseHeader.addValue(QString::fromLatin1(it->first), QString::fromUtf8(it->second)); - it++; - } + //find out the type of authentication protocol requested. QAuthenticatorPrivate::Method authMethod = reply->d_func()->authenticationMethod(isProxy); if (authMethod != QAuthenticatorPrivate::None) { @@ -310,7 +305,7 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket if (auth->isNull()) auth->detach(); QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(*auth); - priv->parseHttpResponse(responseHeader, isProxy); + priv->parseHttpResponse(fields, isProxy); if (priv->phase == QAuthenticatorPrivate::Done) { if ((isProxy && pendingProxyAuthSignal) ||(!isProxy && pendingAuthSignal)) { diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index e7442c0..0ea4fd4 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -241,7 +241,20 @@ QAuthenticatorPrivate::QAuthenticatorPrivate() #ifndef QT_NO_HTTP void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header, bool isProxy) { - QList > values = header.values(); + const QList > values = header.values(); + QList > rawValues; + + QList >::const_iterator it, end; + for (it = values.constBegin(), end = values.constEnd(); it != end; ++it) + rawValues.append(qMakePair(it->first.toLatin1(), it->second.toUtf8())); + + // continue in byte array form + parseHttpResponse(rawValues, isProxy); +} +#endif + +void QAuthenticatorPrivate::parseHttpResponse(const QList > &values, bool isProxy) +{ const char *search = isProxy ? "proxy-authenticate" : "www-authenticate"; method = None; @@ -255,24 +268,25 @@ void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header, authentication parameters. */ - QString headerVal; + QByteArray headerVal; for (int i = 0; i < values.size(); ++i) { - const QPair ¤t = values.at(i); - if (current.first.toLower() != QLatin1String(search)) + const QPair ¤t = values.at(i); + if (current.first.toLower() != search) continue; - QString str = current.second; - if (method < Basic && str.startsWith(QLatin1String("Basic"), Qt::CaseInsensitive)) { - method = Basic; headerVal = str.mid(6); - } else if (method < Ntlm && str.startsWith(QLatin1String("NTLM"), Qt::CaseInsensitive)) { + QByteArray str = current.second.toLower(); + if (method < Basic && str.startsWith("basic")) { + method = Basic; + headerVal = current.second.mid(6); + } else if (method < Ntlm && str.startsWith("ntlm")) { method = Ntlm; - headerVal = str.mid(5); - } else if (method < DigestMd5 && str.startsWith(QLatin1String("Digest"), Qt::CaseInsensitive)) { + headerVal = current.second.mid(5); + } else if (method < DigestMd5 && str.startsWith("digest")) { method = DigestMd5; - headerVal = str.mid(7); + headerVal = current.second.mid(7); } } - challenge = headerVal.trimmed().toLatin1(); + challenge = headerVal.trimmed(); QHash options = parseDigestAuthenticationChallenge(challenge); switch(method) { @@ -300,7 +314,6 @@ void QAuthenticatorPrivate::parseHttpResponse(const QHttpResponseHeader &header, phase = Invalid; } } -#endif QByteArray QAuthenticatorPrivate::calculateResponse(const QByteArray &requestMethod, const QByteArray &path) { diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h index e9ce9ac..abb1cda 100644 --- a/src/network/kernel/qauthenticator_p.h +++ b/src/network/kernel/qauthenticator_p.h @@ -102,6 +102,7 @@ public: #ifndef QT_NO_HTTP void parseHttpResponse(const QHttpResponseHeader &, bool isProxy); #endif + void parseHttpResponse(const QList >&, bool isProxy); }; -- cgit v0.12 From 69027cdb2ab9b89673edf29d5034bed33e614a05 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jul 2010 12:58:04 +0200 Subject: Expose the QAuthenticator map of options in the API. Task-number: QT-3573 Reviewed-By: Markus Goetz --- src/network/kernel/qauthenticator.cpp | 45 +++++++++++++++++++++++++++++++++-- src/network/kernel/qauthenticator.h | 5 ++++ src/network/kernel/qauthenticator_p.h | 3 ++- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 0ea4fd4..ca8ec1c 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -140,7 +140,8 @@ bool QAuthenticator::operator==(const QAuthenticator &other) const return d->user == other.d->user && d->password == other.d->password && d->realm == other.d->realm - && d->method == other.d->method; + && d->method == other.d->method + && d->options == other.d->options; } /*! @@ -218,9 +219,49 @@ QString QAuthenticator::realm() const return d ? d->realm : QString(); } +/*! + \since 4.7 + Returns the value related to option \a opt if it was set by the server. + See \l{QAuthenticator#Options} for more information on incoming options. + If option \a opt isn't found, an invalid QVariant will be returned. + + \sa options(), QAuthenticator#Options +*/ +QVariant QAuthenticator::option(const QString &opt) const +{ + return d ? d->options.value(opt) : QVariant(); +} + +/*! + \since 4.7 + Returns all incoming options set in this QAuthenticator object by parsing + the server reply. See \l{QAuthenticator#Options} for more information + on incoming options. + + \sa option(), QAuthenticator#Options +*/ +QVariantHash QAuthenticator::options() const +{ + return d ? d->options : QVariantHash(); +} + +/*! + \since 4.7 + + Sets the outgoing option \a opt to value \a value. + See \l{QAuthenticator#Options} for more information on outgoing options. + + \sa options(), option(), QAuthenticator#Options +*/ +void QAuthenticator::setOption(const QString &opt, const QVariant &value) +{ + detach(); + d->options.insert(opt, value); +} + /*! - returns true if the authenticator is null. + Returns true if the authenticator is null. */ bool QAuthenticator::isNull() const { diff --git a/src/network/kernel/qauthenticator.h b/src/network/kernel/qauthenticator.h index 13ce593..983b7c0 100644 --- a/src/network/kernel/qauthenticator.h +++ b/src/network/kernel/qauthenticator.h @@ -43,6 +43,7 @@ #define QAUTHENTICATOR_H #include +#include QT_BEGIN_HEADER @@ -73,6 +74,10 @@ public: QString realm() const; + QVariant option(const QString &opt) const; + QVariantHash options() const; + void setOption(const QString &opt, const QVariant &value); + bool isNull() const; void detach(); private: diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h index abb1cda..665afef 100644 --- a/src/network/kernel/qauthenticator_p.h +++ b/src/network/kernel/qauthenticator_p.h @@ -57,6 +57,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -71,7 +72,7 @@ public: QAtomicInt ref; QString user; QString password; - QHash options; + QVariantHash options; Method method; QString realm; QByteArray challenge; -- cgit v0.12 From 1af3362a321dd055798173737d3aede367a1d30c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jul 2010 13:01:33 +0200 Subject: Add documentation for the QAuthenticator options. Task-number: QT-3573 Reviewed-by: Markus Goetz --- src/network/kernel/qauthenticator.cpp | 42 +++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index ca8ec1c..d61c686 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -85,6 +85,44 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas Note that, in particular, NTLM version 2 is not supported. + \section1 Options + + In addition to the username and password required for authentication, a + QAuthenticator object can also contain additional options. The + options() function can be used to query incoming options sent by + the server; the setOption() function can + be used to set outgoing options, to be processed by the authenticator + calculation. The options accepted and provided depend on the authentication + type (see method()). + + The following tables list known incoming options as well as accepted + outgoing options. The list of incoming options is not exhaustive, since + servers may include additional information at any time. The list of + outgoing options is exhaustive, however, and no unknown options will be + treated or sent back to the server. + + \section2 Basic + + \table + \header \o Option \o Direction \o Description + \row \o \tt{realm} \o Incoming \o Contains the realm of the authentication, the same as realm() + \endtable + + The Basic authentication mechanism supports no outgoing options. + + \section2 NTLM version 1 + + The NTLM authentication mechanism currently supports no incoming or outgoing options. + + \section2 Digest-MD5 + + \table + \header \o Option \o Direction \o Description + \row \o \tt{realm} \o Incoming \o Contains the realm of the authentication, the same as realm() + \endtable + + The Digest-MD5 authentication mechanism supports no outgoing options. + \sa QSslSocket */ @@ -333,7 +371,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QListoptions[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm")); if (user.isEmpty()) phase = Done; break; @@ -342,7 +380,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QListoptions[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm")); if (options.value("stale").toLower() == "true") phase = Start; if (user.isEmpty()) -- cgit v0.12 From 648f8a05abac5fbf851fff18d1c34ff7c4a7a027 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jul 2010 17:21:25 +0200 Subject: Autotest: add a small, boring test for QAuthenticator --- src/network/kernel/qauthenticator_p.h | 2 +- tests/auto/qauthenticator/qauthenticator.pro | 5 + tests/auto/qauthenticator/tst_qauthenticator.cpp | 155 +++++++++++++++++++++++ 3 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 tests/auto/qauthenticator/qauthenticator.pro create mode 100644 tests/auto/qauthenticator/tst_qauthenticator.cpp diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h index 665afef..1096601 100644 --- a/src/network/kernel/qauthenticator_p.h +++ b/src/network/kernel/qauthenticator_p.h @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE class QHttpResponseHeader; -class QAuthenticatorPrivate +class Q_AUTOTEST_EXPORT QAuthenticatorPrivate { public: enum Method { None, Basic, Plain, Login, Ntlm, CramMd5, DigestMd5 }; diff --git a/tests/auto/qauthenticator/qauthenticator.pro b/tests/auto/qauthenticator/qauthenticator.pro new file mode 100644 index 0000000..05f83bc --- /dev/null +++ b/tests/auto/qauthenticator/qauthenticator.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +requires(contains(QT_CONFIG,private_tests)) +QT = core network +SOURCES += tst_qauthenticator.cpp +DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/qauthenticator/tst_qauthenticator.cpp b/tests/auto/qauthenticator/tst_qauthenticator.cpp new file mode 100644 index 0000000..37d6774 --- /dev/null +++ b/tests/auto/qauthenticator/tst_qauthenticator.cpp @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the FOO module 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$ +** +****************************************************************************/ + + +#include +#include +#include +#include + +#include + +class tst_QAuthenticator : public QObject +{ + Q_OBJECT + +public: + tst_QAuthenticator(); + +private Q_SLOTS: + void basicAuth(); + void basicAuth_data(); + + void ntlmAuth_data(); + void ntlmAuth(); +}; + +tst_QAuthenticator::tst_QAuthenticator() +{ +} + +void tst_QAuthenticator::basicAuth_data() +{ + QTest::addColumn("data"); + QTest::addColumn("realm"); + QTest::addColumn("user"); + QTest::addColumn("password"); + QTest::addColumn("expectedReply"); + + QTest::newRow("just-user") << "" << "" << "foo" << "" << QByteArray("foo:").toBase64(); + QTest::newRow("user-password") << "" << "" << "foo" << "bar" << QByteArray("foo:bar").toBase64(); + QTest::newRow("user-password-realm") << "realm=\"secure area\"" << "secure area" << "foo" << "bar" << QByteArray("foo:bar").toBase64(); +} + +void tst_QAuthenticator::basicAuth() +{ + QFETCH(QString, data); + QFETCH(QString, realm); + QFETCH(QString, user); + QFETCH(QString, password); + QFETCH(QByteArray, expectedReply); + + QAuthenticator auth; + auth.detach(); + QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(auth); + QVERIFY(priv->phase == QAuthenticatorPrivate::Start); + + QList > headers; + headers << qMakePair(QByteArray("WWW-Authenticate"), "Basic " + data.toUtf8()); + priv->parseHttpResponse(headers, /*isProxy = */ false); + + QCOMPARE(auth.realm(), realm); + QCOMPARE(auth.option("realm").toString(), realm); + + auth.setUser(user); + auth.setPassword(password); + + QVERIFY(priv->phase == QAuthenticatorPrivate::Start); + + QCOMPARE(priv->calculateResponse("GET", "/").constData(), ("Basic " + expectedReply).constData()); +} + +void tst_QAuthenticator::ntlmAuth_data() +{ + QTest::addColumn("data"); + QTest::addColumn("realm"); + + QTest::newRow("no-realm") << "TlRMTVNTUAACAAAAHAAcADAAAAAFAoEATFZ3OLRQADIAAAAAAAAAAJYAlgBMAAAAUQBUAC0AVABFAFMAVAAtAEQATwBNAEEASQBOAAIAHABRAFQALQBUAEUAUwBUAC0ARABPAE0AQQBJAE4AAQAcAFEAVAAtAFQARQBTAFQALQBTAEUAUgBWAEUAUgAEABYAcQB0AC0AdABlAHMAdAAtAG4AZQB0AAMANABxAHQALQB0AGUAcwB0AC0AcwBlAHIAdgBlAHIALgBxAHQALQB0AGUAcwB0AC0AbgBlAHQAAAAAAA==" << ""; + QTest::newRow("with-realm") << "TlRMTVNTUAACAAAADAAMADgAAAAFAoECWCZkccFFAzwAAAAAAAAAAL4AvgBEAAAABQLODgAAAA9NAEcARABOAE8ASwACAAwATQBHAEQATgBPAEsAAQAcAE4ATwBLAC0AQQBNAFMAUwBTAEYARQAtADAAMQAEACAAbQBnAGQAbgBvAGsALgBuAG8AawBpAGEALgBjAG8AbQADAD4AbgBvAGsALQBhAG0AcwBzAHMAZgBlAC0AMAAxAC4AbQBnAGQAbgBvAGsALgBuAG8AawBpAGEALgBjAG8AbQAFACAAbQBnAGQAbgBvAGsALgBuAG8AawBpAGEALgBjAG8AbQAAAAAA" << "NOE"; +} + +void tst_QAuthenticator::ntlmAuth() +{ + QFETCH(QString, data); + QFETCH(QString, realm); + + QAuthenticator auth; + auth.detach(); + QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(auth); + QVERIFY(priv->phase == QAuthenticatorPrivate::Start); + + QList > headers; + + // NTLM phase 1: negotiate + // This phase of NTLM contains no information, other than what we're willing to negotiate + // Current implementation uses flags: + // NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_REQUEST_TARGET + headers << qMakePair("WWW-Authenticate", "NTLM"); + priv->parseHttpResponse(headers, /*isProxy = */ false); + QCOMPARE(priv->calculateResponse("GET", "/").constData(), "NTLM TlRMTVNTUAABAAAABQIAAAAAAAAAAAAAAAAAAAAAAAA="); + + // NTLM phase 2: challenge + headers.clear(); + headers << qMakePair(QByteArray("WWW-Authenticate"), "NTLM " + data.toUtf8()); + priv->parseHttpResponse(headers, /*isProxy = */ false); + + QEXPECT_FAIL("with-realm", "NTLM authentication code doesn't extract the realm", Continue); + QCOMPARE(auth.realm(), realm); + + auth.setUser("unimportant"); + auth.setPassword("unimportant"); + + QVERIFY(!priv->calculateResponse("GET", "/").isEmpty()); +} + +QTEST_MAIN(tst_QAuthenticator); + +#include "tst_qauthenticator.moc" -- cgit v0.12 From 01978218333aab792e32d7c69bbaea849b3b8d15 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jul 2010 17:19:27 +0200 Subject: Autotest: reenable the NTLM proxy test on tst_QTcpSocket --- tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 31cae40..e3b2ca5 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -275,7 +275,7 @@ void tst_QTcpSocket::initTestCase_data() QTest::newRow("WithHttpProxy") << true << int(HttpProxy) << false; QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic) << false; -// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm) << false; + QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm) << false; #ifndef QT_NO_OPENSSL QTest::newRow("WithoutProxy SSL") << false << 0 << true; @@ -284,7 +284,7 @@ void tst_QTcpSocket::initTestCase_data() QTest::newRow("WithHttpProxy SSL") << true << int(HttpProxy) << true; QTest::newRow("WithHttpProxyBasicAuth SSL") << true << int(HttpProxy | AuthBasic) << true; -// QTest::newRow("WithHttpProxyNtlmAuth SSL") << true << int(HttpProxy | AuthNtlm) << true; + QTest::newRow("WithHttpProxyNtlmAuth SSL") << true << int(HttpProxy | AuthNtlm) << true; #endif } -- cgit v0.12 From b9c2853a0fd1876f30a410fe8dac5c477cef9d0e Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Thu, 15 Jul 2010 14:08:20 +0200 Subject: Add a testcase for QTBUG-11213 to prevent future regressions. Merge-request: 2427 Reviewed-by: Bradley T. Hughes --- tests/auto/quuid/quuid.pro | 9 ++-- tests/auto/quuid/test/test.pro | 29 ++++++++++ tests/auto/quuid/testProcessUniqueness/main.cpp | 62 ++++++++++++++++++++++ .../testProcessUniqueness.pro | 8 +++ tests/auto/quuid/tst_quuid.cpp | 29 ++++++++++ 5 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 tests/auto/quuid/test/test.pro create mode 100644 tests/auto/quuid/testProcessUniqueness/main.cpp create mode 100644 tests/auto/quuid/testProcessUniqueness/testProcessUniqueness.pro diff --git a/tests/auto/quuid/quuid.pro b/tests/auto/quuid/quuid.pro index f7608fa..25e2456 100644 --- a/tests/auto/quuid/quuid.pro +++ b/tests/auto/quuid/quuid.pro @@ -1,3 +1,6 @@ -load(qttest_p4) -QT = core -SOURCES += tst_quuid.cpp +TEMPLATE = subdirs + +SUBDIRS = testProcessUniqueness + +SUBDIRS += test + diff --git a/tests/auto/quuid/test/test.pro b/tests/auto/quuid/test/test.pro new file mode 100644 index 0000000..123aa50 --- /dev/null +++ b/tests/auto/quuid/test/test.pro @@ -0,0 +1,29 @@ +load(qttest_p4) + +QT = core +SOURCES += ../tst_quuid.cpp +TARGET = tst_quuid + +CONFIG(debug_and_release_target) { + CONFIG(debug, debug|release) { + DESTDIR = ../debug + } else { + DESTDIR = ../release + } +} else { + DESTDIR = .. +} + +wince* { + addFile_processUniqueness.sources = $$OUT_PWD/../testProcessUniqueness/testProcessUniqueness.exe + addFile_processUniqueness.path = testProcessUniqueness + + DEPLOYMENT += addFile_processUniqueness +} + +symbian { + binDep.sources = testProcessUniqueness.exe + binDep.path = \\sys\\bin + + DEPLOYMENT += binDep +} diff --git a/tests/auto/quuid/testProcessUniqueness/main.cpp b/tests/auto/quuid/testProcessUniqueness/main.cpp new file mode 100644 index 0000000..4d33c84 --- /dev/null +++ b/tests/auto/quuid/testProcessUniqueness/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite 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$ +** +****************************************************************************/ + +#include +#include + +// This is a testcase for QTBUG-11213 +int main(int argc, char **argv) +{ + Q_UNUSED(argc) + Q_UNUSED(argv) + + // First, break QUuid. + qrand(); + + // Now print a few uuids. + printf("%s", qPrintable(QUuid::createUuid().toString())); + printf("%s", qPrintable(QUuid::createUuid().toString())); + printf("%s", qPrintable(QUuid::createUuid().toString())); + + // Done + return 0; +} + diff --git a/tests/auto/quuid/testProcessUniqueness/testProcessUniqueness.pro b/tests/auto/quuid/testProcessUniqueness/testProcessUniqueness.pro new file mode 100644 index 0000000..88df1a2 --- /dev/null +++ b/tests/auto/quuid/testProcessUniqueness/testProcessUniqueness.pro @@ -0,0 +1,8 @@ +SOURCES = main.cpp +CONFIG += console + +DESTDIR = ./ + +# no install rule for application used by test +INSTALLS = + diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/quuid/tst_quuid.cpp index 47f356a..409d8cf 100644 --- a/tests/auto/quuid/tst_quuid.cpp +++ b/tests/auto/quuid/tst_quuid.cpp @@ -73,6 +73,7 @@ private slots: void versions(); void threadUniqueness(); + void processUniqueness(); public: // Variables @@ -196,5 +197,33 @@ void tst_QUuid::threadUniqueness() qDeleteAll(threads); } +void tst_QUuid::processUniqueness() +{ + QProcess process; + QString processOneOutput; + QString processTwoOutput; + + // Start it once +#ifdef Q_OS_MAC + process.start("testProcessUniqueness/testProcessUniqueness.app"); +#else + process.start("testProcessUniqueness/testProcessUniqueness"); +#endif + QVERIFY(process.waitForFinished()); + processOneOutput = process.readAllStandardOutput(); + + // Start it twice +#ifdef Q_OS_MAC + process.start("testProcessUniqueness/testProcessUniqueness.app"); +#else + process.start("testProcessUniqueness/testProcessUniqueness"); +#endif + QVERIFY(process.waitForFinished()); + processTwoOutput = process.readAllStandardOutput(); + + // They should be *different*! + QVERIFY(processOneOutput != processTwoOutput); +} + QTEST_MAIN(tst_QUuid) #include "tst_quuid.moc" -- cgit v0.12 From 1c34bf050da3c4d6c303e1dd1dad9eb99e7ccbf4 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 15 Jul 2010 14:56:54 +0200 Subject: QNAM HTTP: Fix problem with cached files and metaDataChanged() Reviewed-by: Peter Hartmann --- src/network/access/qnetworkaccesshttpbackend.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index a6c5c02..f617244 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -944,10 +944,10 @@ bool QNetworkAccessHttpBackend::sendCacheContents(const QNetworkCacheMetaData &m checkForRedirect(status); - emit metaDataChanged(); - - // invoke this asynchronously, else Arora/QtDemoBrowser don't like cached downloads - // see task 250221 / 251801 + // This needs to be emitted in the event loop because it can be reached at + // the direct code path of qnam.get(...) before the user has a chance + // to connect any signals. + QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection); qRegisterMetaType("QIODevice*"); QMetaObject::invokeMethod(this, "writeDownstreamData", Qt::QueuedConnection, Q_ARG(QIODevice*, contents)); -- cgit v0.12 From 30630cf2bf8c7604efc3a52f74983c2237f309c3 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 15 Jul 2010 16:50:28 +0200 Subject: Unbreak the Maemo 5 build after the Symbian fix Reviewed-by: Robert Griebl --- tools/qml/qml.pri | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri index fcd0c33..80afb45 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -17,16 +17,16 @@ SOURCES += $$PWD/qmlruntime.cpp \ $$PWD/loggerwidget.cpp RESOURCES = $$PWD/qmlruntime.qrc -maemo5 { +symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { + SOURCES += $$PWD/deviceorientation_symbian.cpp + FORMS = $$PWD/recopts.ui \ + $$PWD/proxysettings.ui +} else:maemo5 { QT += dbus HEADERS += $$PWD/texteditautoresizer_maemo5.h SOURCES += $$PWD/deviceorientation_maemo5.cpp FORMS = $$PWD/recopts_maemo5.ui \ $$PWD/proxysettings_maemo5.ui -} symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { - SOURCES += $$PWD/deviceorientation_symbian.cpp - FORMS = $$PWD/recopts.ui \ - $$PWD/proxysettings.ui } else { SOURCES += $$PWD/deviceorientation.cpp FORMS = $$PWD/recopts.ui \ -- cgit v0.12 From b863daec96868731412bd8f89b960bc7395911ae Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 13 Jul 2010 11:34:44 +0200 Subject: split qt_help out into an own ts target the combined target would be too hard to transform in the next commit --- translations/translations.pri | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/translations/translations.pri b/translations/translations.pri index f5e54ca..6a13dff 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -52,11 +52,15 @@ ts-linguist.depends = sub-tools ###### Assistant ts-assistant.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - ../tools/assistant/tools/assistant/assistant.pro \ - && $$LUPDATE \ - ../tools/assistant/lib/lib.pro) + ../tools/assistant/tools/assistant/assistant.pro) ts-assistant.depends = sub-tools +###### Qt Help Lib + +ts-qt_help.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ + ../tools/assistant/lib/lib.pro) +ts-qt_help.depends = sub-tools + ###### Qtconfig ts-qtconfig.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ @@ -71,10 +75,10 @@ ts-qvfb.depends = sub-tools ###### Overall Rules -ts.depends = ts-qt ts-designer ts-linguist ts-assistant ts-qtconfig ts-qvfb +ts.depends = ts-qt ts-designer ts-linguist ts-assistant ts-qt_help ts-qtconfig ts-qvfb check-ts.commands = (cd $$PWD && perl check-ts.pl) check-ts.depends = ts -QMAKE_EXTRA_TARGETS += ts-qt ts-designer ts-linguist ts-assistant ts-qtconfig ts-qvfb \ +QMAKE_EXTRA_TARGETS += ts-qt ts-designer ts-linguist ts-assistant ts-qt_help ts-qtconfig ts-qvfb \ ts check-ts -- cgit v0.12 From 807bc3aca8a0b07ee1dfe1e398044d32756e5de0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 13 Jul 2010 12:55:31 +0200 Subject: more fine-grained ts targets there are now per-language ts-- and ts- targets to update only the files relevant for a given language. there is also a ts-all target which does what the old ts target did. the ts- targets are now named ts--all and should not be used manually - they exist for the convenience of the ts-all target. the ts target is now only a help blurb. --- tools/assistant/lib/lib.pro | 13 --- tools/assistant/tools/assistant/assistant.pro | 13 --- tools/designer/designer.pro | 13 --- tools/linguist/linguist/linguist.pro | 12 --- tools/qtconfig/qtconfig.pro | 8 -- tools/qvfb/qvfb.pro | 8 -- translations/translations.pri | 132 +++++++++++--------------- 7 files changed, 56 insertions(+), 143 deletions(-) diff --git a/tools/assistant/lib/lib.pro b/tools/assistant/lib/lib.pro index e84cf31..26d3456 100644 --- a/tools/assistant/lib/lib.pro +++ b/tools/assistant/lib/lib.pro @@ -69,16 +69,3 @@ HEADERS += qhelpenginecore.h \ # access to clucene HEADERS += qhelpsearchindexwriter_clucene_p.h \ qhelpsearchindexreader_clucene_p.h - -TR_DIR = $$PWD/../../../translations -TRANSLATIONS = \ - $$TR_DIR/qt_help_cs.ts \ - $$TR_DIR/qt_help_da.ts \ - $$TR_DIR/qt_help_de.ts \ - $$TR_DIR/qt_help_hu.ts \ - $$TR_DIR/qt_help_ja.ts \ - $$TR_DIR/qt_help_pl.ts \ - $$TR_DIR/qt_help_ru.ts \ - $$TR_DIR/qt_help_zh_CN.ts \ - $$TR_DIR/qt_help_zh_TW.ts \ - $$TR_DIR/qt_help_fr.ts diff --git a/tools/assistant/tools/assistant/assistant.pro b/tools/assistant/tools/assistant/assistant.pro index 16a520e..d9aff7a 100644 --- a/tools/assistant/tools/assistant/assistant.pro +++ b/tools/assistant/tools/assistant/assistant.pro @@ -108,16 +108,3 @@ contains(CONFIG, static): { DEFINES += USE_STATIC_SQLITE_PLUGIN } } - -TR_DIR = $$PWD/../../../../translations -TRANSLATIONS = \ - $$TR_DIR/assistant_cs.ts \ - $$TR_DIR/assistant_da.ts \ - $$TR_DIR/assistant_de.ts \ - $$TR_DIR/assistant_fr.ts \ - $$TR_DIR/assistant_hu.ts \ - $$TR_DIR/assistant_ja.ts \ - $$TR_DIR/assistant_pl.ts \ - $$TR_DIR/assistant_ru.ts \ - $$TR_DIR/assistant_zh_CN.ts \ - $$TR_DIR/assistant_zh_TW.ts diff --git a/tools/designer/designer.pro b/tools/designer/designer.pro index 31c8622..721c4fc 100644 --- a/tools/designer/designer.pro +++ b/tools/designer/designer.pro @@ -3,16 +3,3 @@ TEMPLATE = subdirs CONFIG += qt SUBDIRS = src - -TR_DIR = $$PWD/../../translations -TRANSLATIONS = \ - $$TR_DIR/designer_cs.ts \ - $$TR_DIR/designer_de.ts \ - $$TR_DIR/designer_fr.ts \ - $$TR_DIR/designer_hu.ts \ - $$TR_DIR/designer_ja.ts \ - $$TR_DIR/designer_pl.ts \ - $$TR_DIR/designer_ru.ts \ - $$TR_DIR/designer_sl.ts \ - $$TR_DIR/designer_zh_CN.ts \ - $$TR_DIR/designer_zh_TW.ts diff --git a/tools/linguist/linguist/linguist.pro b/tools/linguist/linguist/linguist.pro index 4f7ed8a..ce8d585 100644 --- a/tools/linguist/linguist/linguist.pro +++ b/tools/linguist/linguist/linguist.pro @@ -94,15 +94,3 @@ FORMS += statistics.ui \ translationsettings.ui \ finddialog.ui RESOURCES += linguist.qrc - -TR_DIR = $$PWD/../../../translations -TRANSLATIONS = \ - $$TR_DIR/linguist_cs.ts \ - $$TR_DIR/linguist_de.ts \ - $$TR_DIR/linguist_fr.ts \ - $$TR_DIR/linguist_hu.ts \ - $$TR_DIR/linguist_ja.ts \ - $$TR_DIR/linguist_pl.ts \ - $$TR_DIR/linguist_ru.ts \ - $$TR_DIR/linguist_zh_CN.ts \ - $$TR_DIR/linguist_zh_TW.ts diff --git a/tools/qtconfig/qtconfig.pro b/tools/qtconfig/qtconfig.pro index 3a24e85..d1fd320 100644 --- a/tools/qtconfig/qtconfig.pro +++ b/tools/qtconfig/qtconfig.pro @@ -29,11 +29,3 @@ target.path=$$[QT_INSTALL_BINS] INSTALLS += target INCLUDEPATH += . DBFILE = qtconfig.db - -TR_DIR = $$PWD/../../translations -TRANSLATIONS = \ - $$TR_DIR/qtconfig_hu.ts \ - $$TR_DIR/qtconfig_pl.ts \ - $$TR_DIR/qtconfig_ru.ts \ - $$TR_DIR/qtconfig_zh_CN.ts \ - $$TR_DIR/qtconfig_zh_TW.ts diff --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro index df69817..c101d00 100644 --- a/tools/qvfb/qvfb.pro +++ b/tools/qvfb/qvfb.pro @@ -62,11 +62,3 @@ unix:x11 { } RESOURCES += qvfb.qrc - -TR_DIR = $$PWD/../../translations -TRANSLATIONS = \ - $$TR_DIR/qvfb_hu.ts \ - $$TR_DIR/qvfb_pl.ts \ - $$TR_DIR/qvfb_ru.ts \ - $$TR_DIR/qvfb_zh_CN.ts \ - $$TR_DIR/qvfb_zh_TW.ts diff --git a/translations/translations.pri b/translations/translations.pri index 6a13dff..b41f2a0 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -1,84 +1,64 @@ -defineReplace(prependAll) { - prepend = $$1 - arglist = $$2 - append = $$3 - for(a,arglist) { - result += $${prepend}$${a}$${append} - } - return ($$result) -} - qtPrepareTool(LUPDATE, lupdate) LUPDATE += -locations relative -no-ui-lines -###### Qt Libraries - -QT_TS = ar cs da de es fr he hu ja pl pt ru sk sl sv uk zh_CN zh_TW - -ts-qt.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - -I../include -I../include/Qt \ - 3rdparty/phonon \ - 3rdparty/webkit \ - activeqt \ - corelib \ - declarative \ - gui \ - multimedia \ - network \ - opengl \ - plugins \ - qt3support \ - script \ - scripttools \ - sql \ - svg \ - xml \ - xmlpatterns \ - -ts $$prependAll($$QT_SOURCE_TREE/translations/qt_,$$QT_TS,.ts)) -ts-qt.depends = sub-tools - -###### Designer - -ts-designer.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - ../tools/designer/designer.pro) -ts-designer.depends = sub-tools - -###### Linguist - -ts-linguist.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - ../tools/linguist/linguist/linguist.pro) -ts-linguist.depends = sub-tools - -###### Assistant - -ts-assistant.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - ../tools/assistant/tools/assistant/assistant.pro) -ts-assistant.depends = sub-tools - -###### Qt Help Lib - -ts-qt_help.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - ../tools/assistant/lib/lib.pro) -ts-qt_help.depends = sub-tools - -###### Qtconfig - -ts-qtconfig.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - ../tools/qtconfig/qtconfig.pro) -ts-qtconfig.depends = sub-tools - -###### Qvfp - -ts-qvfb.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ - ../tools/qvfb/qvfb.pro) -ts-qvfb.depends = sub-tools +TS_TARGETS = + +# meta target name, target name, lupdate base options, files +defineTest(addTsTarget) { + cv = $${2}.commands + dv = $${2}.depends + $$cv = cd $$QT_SOURCE_TREE/src && $$LUPDATE $$3 -ts $$4 + $$dv = sub-tools + export($$cv) + export($$dv) + dv = $${1}.depends + $$dv += $$2 + export($$dv) + TS_TARGETS += $$1 $$2 + export(TS_TARGETS) +} -###### Overall Rules +# target basename, lupdate base options +defineTest(addTsTargets) { + files = $$files($$PWD/$${1}_??.ts) $$files($$PWD/$${1}_??_??.ts) + for(file, files) { + lang = $$replace(file, .*_((.._)?..)\\.ts$, \\1) + addTsTarget(ts-$$lang, ts-$$1-$$lang, $$2, $$file) + } + addTsTarget(ts-all, ts-$$1-all, $$2, $$files) +} -ts.depends = ts-qt ts-designer ts-linguist ts-assistant ts-qt_help ts-qtconfig ts-qvfb +addTsTargets(qt, -I../include -I../include/Qt \ + 3rdparty/phonon \ + 3rdparty/webkit \ + activeqt \ + corelib \ + declarative \ + gui \ + multimedia \ + network \ + opengl \ + plugins \ + qt3support \ + script \ + scripttools \ + sql \ + svg \ + xml \ + xmlpatterns \ +) +addTsTargets(designer, ../tools/designer/designer.pro) +addTsTargets(linguist, ../tools/linguist/linguist/linguist.pro) +addTsTargets(assistant, ../tools/assistant/tools/assistant/assistant.pro) +addTsTargets(qt_help, ../tools/assistant/lib/lib.pro) +addTsTargets(qtconfig, ../tools/qtconfig/qtconfig.pro) +addTsTargets(qvfb, ../tools/qvfb/qvfb.pro) check-ts.commands = (cd $$PWD && perl check-ts.pl) -check-ts.depends = ts +check-ts.depends = ts-all + +ts.commands = \ + @echo \"The \'ts\' target has been removed in favor of more fine-grained targets.\" && \ + echo \"Use \'ts--\' or \'ts-\' instead.\" -QMAKE_EXTRA_TARGETS += ts-qt ts-designer ts-linguist ts-assistant ts-qt_help ts-qtconfig ts-qvfb \ - ts check-ts +QMAKE_EXTRA_TARGETS += $$unique(TS_TARGETS) ts check-ts -- cgit v0.12 From 511a838afdb1d028bf184bb56c9ead39312987ca Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 13 Jul 2010 12:57:07 +0200 Subject: (re-)add 'untranslated' ts targets these files are not meant for commit, but it's good to have a quick way to create templates. --- .gitignore | 1 + translations/check-ts.pl | 2 +- translations/translations.pri | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index fdb6843..4d5aa9b 100644 --- a/.gitignore +++ b/.gitignore @@ -114,6 +114,7 @@ tools/qtestlib/chart/chart* tools/qtestlib/updater/updater* tools/activeqt/testcon/testcon.tlb translations/*.qm +translations/*_untranslated.ts qrc_*.cpp # xemacs temporary files diff --git a/translations/check-ts.pl b/translations/check-ts.pl index 5f38703..0ff9d17 100755 --- a/translations/check-ts.pl +++ b/translations/check-ts.pl @@ -49,7 +49,7 @@ my @groups = ("assistant", "designer", "linguist", "qt_help", "qtconfig", "qvfb" my %scores = (); my %langs = (); -my $files = join("\n", <*.ts>); +my $files = join("\n", <*_??.ts>); my $res = `xmlpatterns -param files=\"$files\" check-ts.xq`; for my $i (split(/ /, $res)) { $i =~ /^([^.]+).ts:(.*)$/; diff --git a/translations/translations.pri b/translations/translations.pri index b41f2a0..735411e 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -25,7 +25,8 @@ defineTest(addTsTargets) { lang = $$replace(file, .*_((.._)?..)\\.ts$, \\1) addTsTarget(ts-$$lang, ts-$$1-$$lang, $$2, $$file) } - addTsTarget(ts-all, ts-$$1-all, $$2, $$files) + addTsTarget(ts-untranslated, ts-$$1-untranslated, $$2, $$PWD/$${1}_untranslated.ts) + addTsTarget(ts-all, ts-$$1-all, $$2, $$PWD/$${1}_untranslated.ts $$files) } addTsTargets(qt, -I../include -I../include/Qt \ @@ -59,6 +60,7 @@ check-ts.depends = ts-all ts.commands = \ @echo \"The \'ts\' target has been removed in favor of more fine-grained targets.\" && \ - echo \"Use \'ts--\' or \'ts-\' instead.\" + echo \"Use \'ts--\' or \'ts-\' instead. To add a language,\" && \ + echo \"use \'untranslated\' for , rename the files and re-run \'qmake\'.\" QMAKE_EXTRA_TARGETS += $$unique(TS_TARGETS) ts check-ts -- cgit v0.12 From 468eb186427067549191f3b921c9f9d75a6947ef Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 13 Jul 2010 20:39:37 +0200 Subject: add commit-ts target to commit ts files without line number info it is pretty pointless to commit the extracted line number information, as it needs to be refreshed after pulling source code changes anyway. on top of it, it bloats the repository. --- translations/translations.pri | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/translations/translations.pri b/translations/translations.pri index 735411e..c27e955 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -1,3 +1,4 @@ +qtPrepareTool(LCONVERT, lconvert) qtPrepareTool(LUPDATE, lupdate) LUPDATE += -locations relative -no-ui-lines @@ -58,9 +59,25 @@ addTsTargets(qvfb, ../tools/qvfb/qvfb.pro) check-ts.commands = (cd $$PWD && perl check-ts.pl) check-ts.depends = ts-all +isEqual(QMAKE_DIR_SEP, /) { + commit-ts.commands = \ + cd $$PWD/..; \ + for f in `git diff-files --name-only translations/*_??.ts`; do \ + $$LCONVERT -locations none -i \$\$f -o \$\$f; \ + done; \ + git add translations/*_??.ts && git commit +} else { + wd = $$replace(PWD, /, \\)\\.. + commit-ts.commands = \ + cd $$wd && \ + for /f usebackq %%f in (`git diff-files --name-only translations/*_??.ts`) do \ + $$LCONVERT -locations none -i %%f -o %%f $$escape_expand(\\n\\t) \ + cd $$wd && git add translations/*_??.ts && git commit +} + ts.commands = \ @echo \"The \'ts\' target has been removed in favor of more fine-grained targets.\" && \ echo \"Use \'ts--\' or \'ts-\' instead. To add a language,\" && \ echo \"use \'untranslated\' for , rename the files and re-run \'qmake\'.\" -QMAKE_EXTRA_TARGETS += $$unique(TS_TARGETS) ts check-ts +QMAKE_EXTRA_TARGETS += $$unique(TS_TARGETS) ts commit-ts check-ts -- cgit v0.12 From 63f1fc5e7aac3b9b088b90577a2c5208be571183 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 14 Jul 2010 11:21:11 +0200 Subject: remove dependency of ts targets on sub-tools it is pretty pointless, really. these are manual targets, so if they fail because of missing tools, the user can just make sub-tools manually. way better than wasting time waiting for make to run through the whole qt tree each time. --- translations/translations.pri | 3 --- 1 file changed, 3 deletions(-) diff --git a/translations/translations.pri b/translations/translations.pri index c27e955..fbc1596 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -7,11 +7,8 @@ TS_TARGETS = # meta target name, target name, lupdate base options, files defineTest(addTsTarget) { cv = $${2}.commands - dv = $${2}.depends $$cv = cd $$QT_SOURCE_TREE/src && $$LUPDATE $$3 -ts $$4 - $$dv = sub-tools export($$cv) - export($$dv) dv = $${1}.depends $$dv += $$2 export($$dv) -- cgit v0.12 From 4fc1008163907459d921c4089512268495245976 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Jul 2010 18:42:28 +0200 Subject: cosmetics: quote the dot in the regexp --- translations/check-ts.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations/check-ts.pl b/translations/check-ts.pl index 0ff9d17..500be15 100755 --- a/translations/check-ts.pl +++ b/translations/check-ts.pl @@ -52,7 +52,7 @@ my %langs = (); my $files = join("\n", <*_??.ts>); my $res = `xmlpatterns -param files=\"$files\" check-ts.xq`; for my $i (split(/ /, $res)) { - $i =~ /^([^.]+).ts:(.*)$/; + $i =~ /^([^.]+)\.ts:(.*)$/; my ($fn, $pc) = ($1, $2); for my $g (@groups) { if ($fn =~ /^${g}_(.*)$/) { -- cgit v0.12 From 40d2b2e30a526b46b17072ba8bdc38f30cd3c624 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Jul 2010 18:44:18 +0200 Subject: remove nasty hack by using a stricter regexp (for language codes) --- translations/check-ts.pl | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/translations/check-ts.pl b/translations/check-ts.pl index 500be15..067cad8 100755 --- a/translations/check-ts.pl +++ b/translations/check-ts.pl @@ -43,8 +43,7 @@ use strict; -# "qt" must come last to avoid prefix matching. -my @groups = ("assistant", "designer", "linguist", "qt_help", "qtconfig", "qvfb", "qt"); +my @groups = ("qt", "assistant", "designer", "linguist", "qt_help", "qtconfig", "qvfb"); my %scores = (); my %langs = (); @@ -55,7 +54,7 @@ for my $i (split(/ /, $res)) { $i =~ /^([^.]+)\.ts:(.*)$/; my ($fn, $pc) = ($1, $2); for my $g (@groups) { - if ($fn =~ /^${g}_(.*)$/) { + if ($fn =~ /^${g}_((.._)?..)$/) { my $lang = $1; $scores{$g}{$lang} = $pc; $langs{$lang} = 1; @@ -64,10 +63,6 @@ for my $i (split(/ /, $res)) { } } -# now we move "qt" to the front, as it should be the first column. -pop @groups; -unshift @groups, "qt"; - my $code = ""; print "L10n "; -- cgit v0.12 From 062a504010534d5e899f042b27c8ace82b556426 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 16 Jul 2010 09:56:19 +1000 Subject: Fixed tst_maketestselftest::tests_pro_files failure Add qauthenticator to tests/auto/network.pro --- tests/auto/network.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/network.pro b/tests/auto/network.pro index 4f205fe..e1898f1 100644 --- a/tests/auto/network.pro +++ b/tests/auto/network.pro @@ -7,6 +7,7 @@ SUBDIRS=\ networkselftest \ qabstractnetworkcache \ qabstractsocket \ + qauthenticator \ qeventloop \ qftp \ qhostaddress \ @@ -36,6 +37,7 @@ SUBDIRS=\ qsslsocket \ contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qauthenticator \ qhttpnetworkconnection \ qhttpnetworkreply \ qnativesocketengine \ -- cgit v0.12 From f90ce20ad1c7feec9b72fdeda42ab56fe7c079c5 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 16 Jul 2010 10:03:17 +1000 Subject: Fixed some network tests never being run. This logic for private_tests was the opposite of what it should be, meaning that network tests which use Q_AUTOTEST_EXPORTs have not been run for some time :-( --- tests/auto/network.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/network.pro b/tests/auto/network.pro index bda03d3..c3ca58a 100644 --- a/tests/auto/network.pro +++ b/tests/auto/network.pro @@ -31,7 +31,7 @@ SUBDIRS=\ qsslkey \ qsslsocket \ -contains(QT_CONFIG, private_tests): SUBDIRS -= \ +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ qhttpnetworkconnection \ qhttpnetworkreply \ qnativesocketengine \ -- cgit v0.12 From 3a51462bfb3cca8c90e1c690cf045b371d2ab393 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Fri, 16 Jul 2010 11:17:02 +1000 Subject: Fixes the Oracle invalid date bug when date is greater or equal to 2800 By converting the char into unsigned char to avoid the overflow when getting the century from a char for years greater or equal to 2800. Task-number: QTBUG-8210 Reviewed-by: Michael Goddard --- src/sql/drivers/oci/qsql_oci.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index 2f0cfdc..c56b995 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -648,7 +648,7 @@ QByteArray qMakeOraDate(const QDateTime& dt) QDateTime qMakeDate(const char* oraDate) { - int century = oraDate[0]; + int century = uchar(oraDate[0]); if(century >= 100){ int year = uchar(oraDate[1]); year = ((century-100)*100) + (year-100); -- cgit v0.12 From 6771ce532f8b61499c998a502ea8c73e8e42262b Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Fri, 16 Jul 2010 14:06:03 +1000 Subject: Added a QPixmap based QAbstractVideoBuffer HandleType. It can be used for example when the hw video decoder can use X11 pixmaps as a rendering target. Reviewed-by: Justin McPherson --- src/multimedia/video/qabstractvideobuffer.cpp | 1 + src/multimedia/video/qabstractvideobuffer.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/multimedia/video/qabstractvideobuffer.cpp b/src/multimedia/video/qabstractvideobuffer.cpp index e9d30d0..db05ee5 100644 --- a/src/multimedia/video/qabstractvideobuffer.cpp +++ b/src/multimedia/video/qabstractvideobuffer.cpp @@ -73,6 +73,7 @@ QT_BEGIN_NAMESPACE \value GLTextureHandle The handle of the buffer is an OpenGL texture ID. \value XvShmImageHandle The handle contains pointer to shared memory XVideo image. \value CoreImageHandle The handle contains pointer to Mac OS X CIImage. + \value QPixmapHandle The handle of the buffer is a QPixmap. \value UserHandle Start value for user defined handle types. \sa handleType() diff --git a/src/multimedia/video/qabstractvideobuffer.h b/src/multimedia/video/qabstractvideobuffer.h index a8389db..98e12da 100644 --- a/src/multimedia/video/qabstractvideobuffer.h +++ b/src/multimedia/video/qabstractvideobuffer.h @@ -63,6 +63,7 @@ public: GLTextureHandle, XvShmImageHandle, CoreImageHandle, + QPixmapHandle, UserHandle = 1000 }; -- cgit v0.12 From 6d5d19b5d92868ed1cd53ea9e6bf8b1119d0da10 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 16 Jul 2010 16:32:27 +1000 Subject: Allow test to pass on smaller screens (eg. 480 high). --- .../qdeclarativeviewer/tst_qdeclarativeviewer.cpp | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp index b08da0f..de8d222 100644 --- a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp +++ b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp @@ -152,16 +152,16 @@ void tst_QDeclarativeViewer::loading() TEST_INITIAL_SIZES(viewer); - viewer->resize(QSize(400, 500)); + viewer->resize(QSize(250, 350)); qApp->processEvents(); // window resized - QTRY_COMPARE(rootItem->width(), 400.0); - QTRY_COMPARE(rootItem->height(), 500.0 - MENUBAR_HEIGHT(viewer)); - QCOMPARE(viewer->view()->size(), QSize(400, 500 - MENUBAR_HEIGHT(viewer))); + QTRY_COMPARE(rootItem->width(), 250.0); + QTRY_COMPARE(rootItem->height(), 350.0 - MENUBAR_HEIGHT(viewer)); + QCOMPARE(viewer->view()->size(), QSize(250, 350 - MENUBAR_HEIGHT(viewer))); QCOMPARE(viewer->view()->initialSize(), QSize(200, 300)); - QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(400, 500 - MENUBAR_HEIGHT(viewer))); - QCOMPARE(viewer->size(), QSize(400, 500)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(250, 350 - MENUBAR_HEIGHT(viewer))); + QCOMPARE(viewer->size(), QSize(250, 350)); QCOMPARE(viewer->size(), viewer->sizeHint()); viewer->reload(); @@ -177,16 +177,16 @@ void tst_QDeclarativeViewer::loading() QCOMPARE(viewer->size(), QSize(200, 300 + MENUBAR_HEIGHT(viewer))); QCOMPARE(viewer->size(), viewer->sizeHint()); - viewer->resize(QSize(400, 500)); + viewer->resize(QSize(250, 350)); qApp->processEvents(); // window resized again - QTRY_COMPARE(rootItem->width(), 400.0); - QTRY_COMPARE(rootItem->height(), 500.0 - MENUBAR_HEIGHT(viewer)); - QCOMPARE(viewer->view()->size(), QSize(400, 500 - MENUBAR_HEIGHT(viewer))); + QTRY_COMPARE(rootItem->width(), 250.0); + QTRY_COMPARE(rootItem->height(), 350.0 - MENUBAR_HEIGHT(viewer)); + QCOMPARE(viewer->view()->size(), QSize(250, 350 - MENUBAR_HEIGHT(viewer))); QCOMPARE(viewer->view()->initialSize(), QSize(200, 300)); - QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(400, 500 - MENUBAR_HEIGHT(viewer))); - QCOMPARE(viewer->size(), QSize(400, 500)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(250, 350 - MENUBAR_HEIGHT(viewer))); + QCOMPARE(viewer->size(), QSize(250, 350)); QCOMPARE(viewer->size(), viewer->sizeHint()); viewer->open(SRCDIR "/data/orientation.qml"); -- cgit v0.12 From 571b85896ee3663479b4a10d2418e2e19b3639f3 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 16 Jul 2010 08:58:04 +0200 Subject: Fix compilation after merge Reviewed-by: TrustMe --- src/gui/dialogs/qfontdialog.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index 5859e63..b159fa7 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -334,7 +334,6 @@ void QFontDialogPrivate::init() familyList->setFocus(); retranslateStrings(); - nativeDialogInUse = false; } /*! -- cgit v0.12 From ae39a510f86fd13d6d41bc85d4f5c243eca45eab Mon Sep 17 00:00:00 2001 From: Lasse Holmstedt Date: Wed, 14 Jul 2010 15:17:35 +0200 Subject: Fixed debugger's evaluation of dynamic properties in context Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarativeenginedebug.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 001da46..008d054 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -495,7 +495,7 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression); } else { QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context); - QDeclarativeProperty property(object, propertyName); + QDeclarativeProperty property(object, propertyName, context); binding->setTarget(property); binding->setNotifyOnValueChanged(true); QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::setBinding(property, binding); -- cgit v0.12 From bca7646d81d8c580820cf5f6e52122da6d984c6b Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 16 Jul 2010 09:34:51 +0200 Subject: Network Proxy Query: Fix memleak on OS X Task-number: QTBUG-12106 --- src/network/kernel/qnetworkproxy_mac.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index 1e22212..4139a7e 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -157,8 +157,10 @@ QList macQueryInternal(const QNetworkProxyQuery &query) return result; // failed } - if (isHostExcluded(dict, query.peerHostName())) + if (isHostExcluded(dict, query.peerHostName())) { + CFRelease(dict); return result; // no proxy for this host + } // is there a PAC enabled? If so, use it first. CFNumberRef pacEnabled; @@ -222,6 +224,7 @@ QList macQueryInternal(const QNetworkProxyQuery &query) result << https; } + CFRelease(dict); return result; } -- cgit v0.12 From 1ea53e6055a7c4e9677a5003725785ad503bb242 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 16 Jul 2010 18:11:36 +1000 Subject: fixes, improvements for various docs and example code --- doc/src/declarative/qdeclarativemodels.qdoc | 16 +- doc/src/snippets/declarative/coloranimation.qml | 52 +++++++ doc/src/snippets/declarative/numberanimation.qml | 52 +++++++ doc/src/snippets/declarative/propertyanimation.qml | 101 +++++++++++++ doc/src/snippets/declarative/smoothedanimation.qml | 69 +++++++++ doc/src/snippets/declarative/springanimation.qml | 65 ++++++++ doc/src/snippets/declarative/state.qml | 23 +-- .../snippets/declarative/transition-from-to.qml | 62 ++++++++ .../snippets/declarative/transition-reversible.qml | 65 ++++++++ doc/src/snippets/declarative/transition.qml | 59 ++++++++ .../modelviews/abstractitemmodel/model.cpp | 2 + .../graphicsitems/qdeclarativeborderimage.cpp | 2 + src/declarative/util/qdeclarativeanimation.cpp | 163 ++++++++++++++------- .../util/qdeclarativesmoothedanimation.cpp | 44 ++---- .../util/qdeclarativespringanimation.cpp | 32 +++- src/declarative/util/qdeclarativestate.cpp | 24 ++- src/declarative/util/qdeclarativetransition.cpp | 96 ++++++++++-- 17 files changed, 805 insertions(+), 122 deletions(-) create mode 100644 doc/src/snippets/declarative/coloranimation.qml create mode 100644 doc/src/snippets/declarative/numberanimation.qml create mode 100644 doc/src/snippets/declarative/propertyanimation.qml create mode 100644 doc/src/snippets/declarative/smoothedanimation.qml create mode 100644 doc/src/snippets/declarative/springanimation.qml create mode 100644 doc/src/snippets/declarative/transition-from-to.qml create mode 100644 doc/src/snippets/declarative/transition-reversible.qml create mode 100644 doc/src/snippets/declarative/transition.qml diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index b44e6f2..e02575d 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -208,7 +208,10 @@ Models can be defined in C++ and then made available to QML. This is useful for exposing existing C++ data models or otherwise complex datasets to QML. A C++ model class can be defined as a QStringList, a QList or a -QAbstractItemModel. +QAbstractItemModel. The first two are useful for exposing simpler datasets, +while QAbstractItemModel provides a more flexible solution for more complex +models. + \section2 QStringList @@ -268,7 +271,10 @@ the model by calling QDeclarativeContext::setContextProperty() again. \section2 QAbstractItemModel -A model can be defined by subclassing QAbstractItemModel. +A model can be defined by subclassing QAbstractItemModel. This is the +best approach if you have a more complex model that cannot be supported +by the other approaches. A QAbstractItemModel can also automatically +notify a QML view when the model data has changed. The roles of a QAbstractItemModel subclass can be exposed to QML by calling QAbstractItemModel::setRoleNames(). The default role names set by Qt are: @@ -305,6 +311,12 @@ roles: \snippet examples/declarative/modelviews/abstractitemmodel/view.qml 0 +QML views are automatically updated when the model changes. Remember the model +must follow the standard rules for model changes and notify the view when +the model has changed by using QAbstractItemModel::dataChanged(), +QAbstractItemModel::beginInsertRows(), etc. See the \l {Model subclassing reference} for +more information. + The complete example is available in Qt's \l {declarative/modelviews/abstractitemmodel}{examples/declarative/modelviews/abstractitemmodel} directory. QAbstractItemModel presents a hierarchy of tables, but the views currently provided by QML diff --git a/doc/src/snippets/declarative/coloranimation.qml b/doc/src/snippets/declarative/coloranimation.qml new file mode 100644 index 0000000..4e35f22 --- /dev/null +++ b/doc/src/snippets/declarative/coloranimation.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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] +import Qt 4.7 + +Rectangle { + width: 100; height: 100 + color: "red" + + ColorAnimation on color { to: "yellow"; duration: 1000 } +} +//![0] + diff --git a/doc/src/snippets/declarative/numberanimation.qml b/doc/src/snippets/declarative/numberanimation.qml new file mode 100644 index 0000000..57d23b1 --- /dev/null +++ b/doc/src/snippets/declarative/numberanimation.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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] +import Qt 4.7 + +Rectangle { + width: 100; height: 100 + color: "red" + + NumberAnimation on x { to: 50; duration: 1000 } +} +//![0] + diff --git a/doc/src/snippets/declarative/propertyanimation.qml b/doc/src/snippets/declarative/propertyanimation.qml new file mode 100644 index 0000000..059cde5 --- /dev/null +++ b/doc/src/snippets/declarative/propertyanimation.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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$ +** +****************************************************************************/ + +import Qt 4.7 + +Row { + +//![transition] +Rectangle { + id: rect + width: 100; height: 100 + color: "red" + + states: State { + name: "moved" + PropertyChanges { target: rect; x: 50 } + } + + transitions: Transition { + PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad } + } +} +//![transition] + +//![behavior] +Rectangle { + width: 100; height: 100 + color: "red" + + Behavior on x { PropertyAnimation {} } + + MouseArea { anchors.fill: parent; onClicked: parent.x = 50 } +} +//![behavior] + +//![propertyvaluesource] +Rectangle { + width: 100; height: 100 + color: "red" + + SequentialAnimation on x { + loops: Animation.Infinite + PropertyAnimation { to: 50 } + PropertyAnimation { to: 0 } + } +} +//![propertyvaluesource] + +//![standalone] +Rectangle { + id: theRect + width: 100; height: 100 + color: "red" + + // this is a standalone animation, it's not running by default + PropertyAnimation { id: animation; target: theRect; property: "width"; to: 30; duration: 500 } + + MouseArea { anchors.fill: parent; onClicked: animation.running = true } +} +//![standalone] + + +} diff --git a/doc/src/snippets/declarative/smoothedanimation.qml b/doc/src/snippets/declarative/smoothedanimation.qml new file mode 100644 index 0000000..20c90b5 --- /dev/null +++ b/doc/src/snippets/declarative/smoothedanimation.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative 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] +import Qt 4.7 + +Rectangle { + width: 800; height: 600 + color: "blue" + + Rectangle { + width: 60; height: 60 + x: rect1.x - 5; y: rect1.y - 5 + color: "green" + + Behavior on x { SmoothedAnimation { velocity: 200 } } + Behavior on y { SmoothedAnimation { velocity: 200 } } + } + + Rectangle { + id: rect1 + width: 50; height: 50 + color: "red" + } + + focus: true + Keys.onRightPressed: rect1.x = rect1.x + 100 + Keys.onLeftPressed: rect1.x = rect1.x - 100 + Keys.onUpPressed: rect1.y = rect1.y - 100 + Keys.onDownPressed: rect1.y = rect1.y + 100 +} +//![0] diff --git a/doc/src/snippets/declarative/springanimation.qml b/doc/src/snippets/declarative/springanimation.qml new file mode 100644 index 0000000..b73a9d2 --- /dev/null +++ b/doc/src/snippets/declarative/springanimation.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative 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] +import Qt 4.7 + +Rectangle { + width: 300; height: 300 + + Rectangle { + id: rect + width: 50; height: 50 + color: "red" + + Behavior on x { SpringAnimation { spring: 2; damping: 0.2 } } + Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } } + } + + MouseArea { + anchors.fill: parent + onClicked: { + rect.x = mouse.x + rect.y = mouse.y + } + } +} +//![0] + diff --git a/doc/src/snippets/declarative/state.qml b/doc/src/snippets/declarative/state.qml index a99c2e2..af6b103 100644 --- a/doc/src/snippets/declarative/state.qml +++ b/doc/src/snippets/declarative/state.qml @@ -44,26 +44,13 @@ import Qt 4.7 Rectangle { id: myRect width: 100; height: 100 - color: "black" + color: "red" - states: [ - State { - name: "clicked" - PropertyChanges { - target: myRect - color: "red" - } - } - ] + MouseArea { id: mouseArea; anchors.fill: parent } - MouseArea { - anchors.fill: parent - onClicked: { - if (myRect.state == "") // i.e. the default state - myRect.state = "clicked"; - else - myRect.state = ""; - } + states: State { + name: "hidden"; when: mouseArea.pressed + PropertyChanges { target: myRect; opacity: 0 } } } //![0] diff --git a/doc/src/snippets/declarative/transition-from-to.qml b/doc/src/snippets/declarative/transition-from-to.qml new file mode 100644 index 0000000..615de17 --- /dev/null +++ b/doc/src/snippets/declarative/transition-from-to.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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$ +** +****************************************************************************/ +import Qt 4.7 + +//![0] +Rectangle { + id: rect + width: 100; height: 100 + color: "red" + + MouseArea { id: mouseArea; anchors.fill: parent } + + states: State { + name: "brighter"; when: mouseArea.pressed + PropertyChanges { target: rect; color: "yellow" } + } + + transitions: Transition { + ColorAnimation { duration: 1000 } + } +} +//![0] + + diff --git a/doc/src/snippets/declarative/transition-reversible.qml b/doc/src/snippets/declarative/transition-reversible.qml new file mode 100644 index 0000000..8a7b69a --- /dev/null +++ b/doc/src/snippets/declarative/transition-reversible.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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$ +** +****************************************************************************/ +import Qt 4.7 + +//![0] +Rectangle { + id: rect + width: 100; height: 100 + color: "red" + + MouseArea { id: mouseArea; anchors.fill: parent } + + states: State { + name: "brighter" + when: mouseArea.pressed + PropertyChanges { target: rect; color: "yellow"; x: 50 } + } + + transitions: Transition { + SequentialAnimation { + PropertyAnimation { property: "x"; duration: 1000 } + ColorAnimation { duration: 1000 } + } + } +} +//![0] + diff --git a/doc/src/snippets/declarative/transition.qml b/doc/src/snippets/declarative/transition.qml new file mode 100644 index 0000000..b884750 --- /dev/null +++ b/doc/src/snippets/declarative/transition.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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] +import Qt 4.7 + +Rectangle { + id: rect + width: 100; height: 100 + color: "red" + + states: State { + name: "moved" + PropertyChanges { target: rect; x: 50; y: 50 } + } + + transitions: Transition { + PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad } + } +} +//![0] + diff --git a/examples/declarative/modelviews/abstractitemmodel/model.cpp b/examples/declarative/modelviews/abstractitemmodel/model.cpp index d0e0971..940a44d 100644 --- a/examples/declarative/modelviews/abstractitemmodel/model.cpp +++ b/examples/declarative/modelviews/abstractitemmodel/model.cpp @@ -67,7 +67,9 @@ AnimalModel::AnimalModel(QObject *parent) void AnimalModel::addAnimal(const Animal &animal) { + beginInsertRows(QModelIndex(), rowCount(), rowCount()); m_animals << animal; + endInsertRows(); } int AnimalModel::rowCount(const QModelIndex & parent) const { diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 44c206b..4881248 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -149,6 +149,8 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() \endqml The URL may be absolute, or relative to the URL of the component. + + \sa QDeclarativeImageProvider */ void QDeclarativeBorderImage::setSource(const QUrl &url) { diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 5005746..88ec5ba 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -634,13 +634,23 @@ QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation() \inherits PropertyAnimation \brief The ColorAnimation element allows you to animate color changes. - \code - ColorAnimation { from: "white"; to: "#c0c0c0"; duration: 100 } - \endcode + ColorAnimation defines an animation to be applied when a color value + changes. + + Here is a ColorAnimation applied to the \c color property of a \l Rectangle + as a property value source: + + \snippet doc/src/snippets/declarative/coloranimation.qml 0 + + Like any other animation element, a NumberAnimation can be applied in a + number of ways, including transitions, behaviors and property value + sources. The \l PropertyAnimation documentation shows a variety of methods + for creating animations. When used in a transition, ColorAnimation will by default animate - all properties of type color that are changing. If a property or properties - are explicitly set for the animation, then those will be used instead. + all properties of type color that have changed. If a \l{PropertyAnimation::}{property} + or \l{PropertyAnimation::}{properties} are explicitly set for the animation, + then those are used instead. \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ @@ -665,6 +675,17 @@ QDeclarativeColorAnimation::~QDeclarativeColorAnimation() /*! \qmlproperty color ColorAnimation::from This property holds the starting color. + + For example, the following animation is not applied until a color value + has reached "#c0c0c0": + + Item { + states: [ ... ] + + transition: Transition { + NumberAnimation { from: "#c0c0c0"; duration: 2000 } + } + } */ QColor QDeclarativeColorAnimation::from() const { @@ -1098,11 +1119,22 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions, \inherits PropertyAnimation \brief The NumberAnimation element allows you to animate changes in properties of type qreal. - For example, to animate a set of properties over 200ms, from their values in the start state to - their values in the end state of the transition: - \code - NumberAnimation { properties: "x,y,scale"; duration: 200 } - \endcode + NumberAnimation defines an animation to be applied when a numerical value + changes. + + Here is a NumberAnimation applied to the \c x property of a \l Rectangle + as a property value source: + + \snippet doc/src/snippets/declarative/numberanimation.qml 0 + + Like any other animation element, a NumberAnimation can be applied in a + number of ways, including transitions, behaviors and property value + sources. The \l PropertyAnimation documentation shows a variety of methods + for creating animations. + + Note that NumberAnimation may not animate smoothly if there are irregular + changes in the number value that it is tracking. If this is the case, use + SmoothedAnimation instead. \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ @@ -1137,9 +1169,23 @@ void QDeclarativeNumberAnimation::init() /*! \qmlproperty real NumberAnimation::from - This property holds the starting value. - If not set, then the value defined in the start state of the transition. + This property holds the starting number value. + + For example, the following animation is not applied until the \c x value + has reached 100: + + Item { + states: [ ... ] + + transition: Transition { + NumberAnimation { properties: "x"; from: 100; duration: 200 } + } + } + + If this value is not set, it defaults to the value defined in the start + state of the \l Transition. */ + qreal QDeclarativeNumberAnimation::from() const { Q_D(const QDeclarativePropertyAnimation); @@ -1153,8 +1199,10 @@ void QDeclarativeNumberAnimation::setFrom(qreal f) /*! \qmlproperty real NumberAnimation::to - This property holds the ending value. - If not set, then the value defined in the end state of the transition or Behavior. + This property holds the ending number value. + + If this value is not set, it defaults to the value defined in the end + state of the \l Transition or \l Behavior. */ qreal QDeclarativeNumberAnimation::to() const { @@ -1199,7 +1247,9 @@ QDeclarativeVector3dAnimation::~QDeclarativeVector3dAnimation() /*! \qmlproperty real Vector3dAnimation::from This property holds the starting value. - If not set, then the value defined in the start state of the transition. + + If this value is not set, it defaults to the value defined in the start + state of the \l Transition. */ QVector3D QDeclarativeVector3dAnimation::from() const { @@ -1215,7 +1265,9 @@ void QDeclarativeVector3dAnimation::setFrom(QVector3D f) /*! \qmlproperty real Vector3dAnimation::to This property holds the ending value. - If not set, then the value defined in the end state of the transition or Behavior. + + If this value is not set, it defaults to the value defined in the end + state of the \l Transition or \l Behavior. */ QVector3D QDeclarativeVector3dAnimation::to() const { @@ -1320,8 +1372,21 @@ QDeclarativeRotationAnimation::~QDeclarativeRotationAnimation() /*! \qmlproperty real RotationAnimation::from - This property holds the starting value. - If not set, then the value defined in the start state of the transition. + This property holds the starting number value. + + For example, the following animation is not applied until the \c angle value + has reached 100: + + Item { + states: [ ... ] + + transition: Transition { + RotationAnimation { properties: "angle"; from: 100; duration: 2000 } + } + } + + If this value is not set, it defaults to the value defined in the start + state of the \l Transition. */ qreal QDeclarativeRotationAnimation::from() const { @@ -1337,7 +1402,9 @@ void QDeclarativeRotationAnimation::setFrom(qreal f) /*! \qmlproperty real RotationAnimation::to This property holds the ending value. - If not set, then the value defined in the end state of the transition or Behavior. + + If this value is not set, it defaults to the value defined in the end + state of the \l Transition or \l Behavior. */ qreal QDeclarativeRotationAnimation::to() const { @@ -1620,51 +1687,49 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int \inherits Animation \brief The PropertyAnimation element allows you to animate property changes. - PropertyAnimation provides a way to animate changes to a property's value. It can - be used in many different situations: + PropertyAnimation provides a way to animate changes to a property's value. + + It can be used to define animations in a number of ways: + \list - \o In a Transition + \o In a \l Transition + + For example, to animate any objects that have changed their \c x or \c y properties + as a result of a state change, using an \c InOutQuad easing curve: + + \snippet doc/src/snippets/declarative/propertyanimation.qml transition + + + \o In a \l Behavior + + For example, to animate all changes to a rectangle's \c x property: + + \snippet doc/src/snippets/declarative/propertyanimation.qml behavior - Animate any objects that have changed their x or y properties in the target state using - an InOutQuad easing curve: - \qml - Transition { PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad } } - \endqml - \o In a Behavior - Animate all changes to a rectangle's x property. - \qml - Rectangle { - Behavior on x { PropertyAnimation {} } - } - \endqml \o As a property value source - Repeatedly animate the rectangle's x property. - \qml - Rectangle { - SequentialAnimation on x { - loops: Animation.Infinite - PropertyAnimation { to: 50 } - PropertyAnimation { to: 0 } - } - } - \endqml + For example, to repeatedly animate the rectangle's \c x property: + + \snippet doc/src/snippets/declarative/propertyanimation.qml propertyvaluesource + + \o In a signal handler - Fade out \c theObject when clicked: + For example, to fade out \c theObject when clicked: \qml MouseArea { anchors.fill: theObject onClicked: PropertyAnimation { target: theObject; property: "opacity"; to: 0 } } \endqml + \o Standalone - Animate \c theObject's size property over 200ms, from its current size to 20-by-20: - \qml - PropertyAnimation { target: theObject; property: "size"; to: "20x20"; duration: 200 } - \endqml + For example, to animate \c rect's \c width property over 500ms, from its current width to 30: + + \snippet doc/src/snippets/declarative/propertyanimation.qml standalone + \endlist Depending on how the animation is used, the set of properties normally used will be diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index 5d47c30..e0d1097 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -272,33 +272,8 @@ void QSmoothedAnimation::init() with both a velocity of 200 and a duration of 8000 set. The follow example shows one rectangle tracking the position of another. -\code -import Qt 4.7 - -Rectangle { - width: 800; height: 600; color: "blue" - - Rectangle { - color: "green" - width: 60; height: 60; - x: rect1.x - 5; y: rect1.y - 5; - Behavior on x { SmoothedAnimation { velocity: 200 } } - Behavior on y { SmoothedAnimation { velocity: 200 } } - } - - Rectangle { - id: rect1 - color: "red" - width: 50; height: 50; - } - focus: true - Keys.onRightPressed: rect1.x = rect1.x + 100 - Keys.onLeftPressed: rect1.x = rect1.x - 100 - Keys.onUpPressed: rect1.y = rect1.y - 100 - Keys.onDownPressed: rect1.y = rect1.y + 100 -} -\endcode + \snippet doc/src/snippets/declarative/smoothedanimation.qml 0 The default velocity of SmoothedAnimation is 200 units/second. Note that if the range of the value being animated is small, then the velocity will need to be adjusted @@ -307,6 +282,11 @@ Rectangle { set to a value such as 0.5 units/second. Animating from 0 to 1.0 with a velocity of 0.5 will take 2000 ms to complete. + Like any other animation element, a SmoothedAnimation can be applied in a + number of ways, including transitions, behaviors and property value + sources. The \l PropertyAnimation documentation shows a variety of methods + for creating animations. + \sa {QML Animation}, {declarative/animation/basics}{Animation basics example} */ @@ -388,11 +368,13 @@ void QDeclarativeSmoothedAnimation::transition(QDeclarativeStateActions &actions Sets how the SmoothedAnimation behaves if an animation direction is reversed. - If reversing mode is \c SmoothedAnimation.Eased, the animation will smoothly decelerate, and - then reverse direction. If the reversing mode is \c SmoothedAnimation.Immediate, the - animation will immediately begin accelerating in the reverse direction, - begining with a velocity of 0. If the reversing mode is \c SmoothedAnimation.Sync, the - property is immediately set to the target value. + Possible values are: + + \list + \o SmoothedAnimation.Eased (default) - the animation will smoothly decelerate, and then reverse direction + \o SmoothedAnimation.Immediate - the animation will immediately begin accelerating in the reverse direction, begining with a velocity of 0 + \o SmoothedAnimation.Sync - the property is immediately set to the target value + \endlist */ QDeclarativeSmoothedAnimation::ReversingMode QDeclarativeSmoothedAnimation::reversingMode() const { diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp index 4cf2fc0..be0af6d 100644 --- a/src/declarative/util/qdeclarativespringanimation.cpp +++ b/src/declarative/util/qdeclarativespringanimation.cpp @@ -207,14 +207,24 @@ void QDeclarativeSpringAnimationPrivate::updateMode() \qmlclass SpringAnimation QDeclarativeSpringAnimation \since 4.7 - \brief The SpringAnimation element allows a property to track a value in a spring-like motion + \brief The SpringAnimation element allows a property to track a value in a spring-like motion. SpringAnimation mimics the oscillatory behavior of a spring, with the appropriate \l spring constant to control the acceleration and the \l damping to control how quickly the effect dies away. You can also limit the maximum \l velocity of the animation. + The following \l Rectangle moves to the position of the mouse using a + SpringAnimation when the mouse is clicked: + \snippet doc/src/snippets/declarative/springanimation.qml 0 + + Like any other animation element, a SpringAnimation can be applied in a + number of ways, including transitions, behaviors and property value + sources. The \l PropertyAnimation documentation shows a variety of methods + for creating animations. + + \sa {QML Animation}, {declarative/animation/basics}{Animation basics example}, {declarative/toys/clocks}{Clocks example} */ QDeclarativeSpringAnimation::QDeclarativeSpringAnimation(QObject *parent) @@ -244,6 +254,11 @@ qreal QDeclarativeSpringAnimation::to() const /*! \qmlproperty real SpringAnimation::to + + This property holds the value at which the animation will end. + + If not set, the animation will continue until it reaches the + value that is being tracked. */ void QDeclarativeSpringAnimation::setTo(qreal value) @@ -266,6 +281,11 @@ qreal QDeclarativeSpringAnimation::from() const /*! \qmlproperty real SpringAnimation::from + + This property holds the value from which the animation will begin. + + If not set, the animation will start regardless of the + value being tracked. */ void QDeclarativeSpringAnimation::setFrom(qreal value) @@ -325,10 +345,12 @@ void QDeclarativeSpringAnimation::setSpring(qreal spring) /*! \qmlproperty real SpringAnimation::damping - This property holds the spring damping constant + This property holds the spring damping value. + + This value describes how quickly a sprung follower comes to rest. - The damping constant describes how quickly a sprung follower comes to rest. - Useful range is 0 - 1.0 + The useful range is 0 - 1.0. The lower the value, the faster the + follower comes to rest. */ qreal QDeclarativeSpringAnimation::damping() const { @@ -348,7 +370,7 @@ void QDeclarativeSpringAnimation::setDamping(qreal damping) /*! \qmlproperty real SpringAnimation::epsilon - This property holds the spring epsilon + This property holds the spring epsilon. The epsilon is the rate and amount of change in the value which is close enough to 0 to be considered equal to zero. This will depend on the usage of the value. diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index ae19a9c..9f4cc39 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -144,7 +144,7 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje can, for example, be used to apply different sets of property values or execute different scripts. - The following example displays a single Rectangle. In the default state, the rectangle + The following example displays a single \l Rectangle. In the default state, the rectangle is colored black. In the "clicked" state, a PropertyChanges element changes the rectangle's color to red. Clicking within the MouseArea toggles the rectangle's state between the default state and the "clicked" state, thus toggling the color of the @@ -157,7 +157,7 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje States are commonly used together with \l {state-transitions}{Transitions} to provide animations when state changes occur. - \note setting the state of an object from within another state of the same object is + \note Setting the state of an object from within another state of the same object is not allowed. \sa {declarative/animation/states}{states example}, {qmlstates}{States}, {state-transitions}{Transitions}, QtDeclarative @@ -194,7 +194,7 @@ QDeclarativeState::~QDeclarativeState() \qmlproperty string State::name This property holds the name of the state. - Each state should have a unique name. + Each state should have a unique name within its item. */ QString QDeclarativeState::name() const { @@ -226,7 +226,23 @@ bool QDeclarativeState::isWhenKnown() const This property holds when the state should be applied. This should be set to an expression that evaluates to \c true when you want the state to - be applied. + be applied. For example, the following \l Rectangle changes in and out of the "hidden" + state when the \l MouseArea is pressed: + + \qml + Rectangle { + id: myRect + width: 100; height: 100 + color: "red" + + MouseArea { id: mouseArea; anchors.fill: parent } + + states: State { + name: "hidden"; when: mouseArea.pressed + PropertyChanges { target: myRect; opacity: 0 } + } + } + \endqml If multiple states in a group have \c when clauses that evaluate to \c true at the same time, the first matching state will be applied. For example, in the following snippet diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index 38ed97e..34e1e2b 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -56,6 +56,30 @@ QT_BEGIN_NAMESPACE \since 4.7 \brief The Transition element defines animated transitions that occur on state changes. + A Transition defines the animations to be applied when a \l State change occurs. + + For example, the following \l Rectangle has two states: the default state, and + an added "moved" state. In the "moved state, the rectangle's position changes + to (50, 50). The added \l Transition specifies that when the rectangle + changes between the default and the "moved" state, any changes + to the \c x and \c y properties should be animated, using an \c Easing.InOutQuad. + + \snippet doc/src/snippets/declarative/transition.qml 0 + + Items can have multiple transitions, if + + To specify multiple transitions, specify \l Item::transitions as a list: + + \qml + Item { + ... + transitions: [ + Transition { ... } + Transition { ... } + ] + } + |endqml + \sa {declarative/animation/states}{states example}, {qmlstates}{States}, {state-transitions}{Transitions}, {QtDeclarative} */ @@ -171,18 +195,31 @@ void QDeclarativeTransition::prepare(QDeclarativeStateOperation::ActionList &act /*! \qmlproperty string Transition::from \qmlproperty string Transition::to - These properties are selectors indicating which state changes should trigger the transition. - from is used in conjunction with to to determine when a transition should - be applied. By default from and to are both "*" (any state). In the following example, - the transition is applied when changing from state1 to state2. - \code - Transition { - from: "state1" - to: "state2" - ... + These properties indicate the state changes that trigger the transition. + + The default values for these properties is "*" (that is, any state). + + For example, the following transition has not set the \c to and \c from + properties, so the animation is always applied when changing between + the two states (i.e. when the mouse is pressed and released). + + \snippet doc/src/snippets/declarative/transition-from-to.qml 0 + + If the transition was changed to this: + + \qml + transitions: Transition { + to: "brighter" + ColorAnimation { duration: 1000 } + } } - \endcode + \endqml + + The animation would only be applied when changing from the default state to + the "brighter" state (i.e. when the mouse is pressed, but not on release). + + \sa reversible */ QString QDeclarativeTransition::fromState() const { @@ -205,6 +242,24 @@ void QDeclarativeTransition::setFromState(const QString &f) This property holds whether the transition should be automatically reversed when the conditions that triggered this transition are reversed. The default value is false. + + By default, transitions run in parallel and are applied to all state + changes if the \l from and \l to states have not been set. In this + situation, the transition is automatically applied when a state change + is reversed, and it is not necessary to set this property to reverse + the transition. + + However, if a SequentialAnimation is used, or if the \l from or \l to + properties have been set, this property will need to be set to reverse + a transition when a state change is reverted. For example, the following + transition applies a sequential animation when the mouse is pressed, + and reverses the sequence of the animation when the mouse is released: + + \snippet doc/src/snippets/declarative/transition-reversible.qml 0 + + If the transition did not set the \c to and \c reversible values, then + on the mouse release, the transition would play the PropertyAnimation + before the ColorAnimation instead of reversing the sequence. */ bool QDeclarativeTransition::reversible() const { @@ -241,12 +296,27 @@ void QDeclarativeTransition::setToState(const QString &t) /*! \qmlproperty list Transition::animations \default + This property holds a list of the animations to be run for this transition. + \qml + Transition { + PropertyAnimation { ... } + NumberAnimation { ... } + } + \endqml + The top-level animations are run in parallel. To run them sequentially, - you can create a single SequentialAnimation which contains all the animations, - and assign that to animations the animations property. - \default + define them within a SequentialAnimation: + + \qml + Transition { + SequentialAnimation { + PropertyAnimation { ... } + NumberAnimation { ... } + } + } + \endqml */ QDeclarativeListProperty QDeclarativeTransition::animations() { -- cgit v0.12 From 11f5b578e398c99570215facb905f1d82f6d6817 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 16 Jul 2010 10:33:26 +0200 Subject: update def files for 69027cdb2ab9b89673edf29d5034bed33e614a05 Reviewed-by: Trust Me --- src/s60installs/bwins/QtNetworku.def | 3 +++ src/s60installs/eabi/QtNetworku.def | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/s60installs/bwins/QtNetworku.def b/src/s60installs/bwins/QtNetworku.def index 9d4507b..9911b36 100644 --- a/src/s60installs/bwins/QtNetworku.def +++ b/src/s60installs/bwins/QtNetworku.def @@ -1144,4 +1144,7 @@ EXPORTS ?startPolling@QNetworkConfigurationManagerPrivate@@QAEXXZ @ 1143 NONAME ; void QNetworkConfigurationManagerPrivate::startPolling(void) ?capabilities@QNetworkConfigurationManagerPrivate@@QAE?AV?$QFlags@W4Capability@QNetworkConfigurationManager@@@@XZ @ 1144 NONAME ; class QFlags QNetworkConfigurationManagerPrivate::capabilities(void) ?addPendingConnection@QTcpServer@@IAEXPAVQTcpSocket@@@Z @ 1145 NONAME ; void QTcpServer::addPendingConnection(class QTcpSocket *) + ?option@QAuthenticator@@QBE?AVQVariant@@ABVQString@@@Z @ 1146 NONAME ; class QVariant QAuthenticator::option(class QString const &) const + ?options@QAuthenticator@@QBE?AV?$QHash@VQString@@VQVariant@@@@XZ @ 1147 NONAME ; class QHash QAuthenticator::options(void) const + ?setOption@QAuthenticator@@QAEXABVQString@@ABVQVariant@@@Z @ 1148 NONAME ; void QAuthenticator::setOption(class QString const &, class QVariant const &) diff --git a/src/s60installs/eabi/QtNetworku.def b/src/s60installs/eabi/QtNetworku.def index 3cc3644..eb30832 100644 --- a/src/s60installs/eabi/QtNetworku.def +++ b/src/s60installs/eabi/QtNetworku.def @@ -1164,4 +1164,7 @@ EXPORTS _ZTV35QNetworkConfigurationManagerPrivate @ 1163 NONAME _ZThn8_N19QBearerEnginePluginD0Ev @ 1164 NONAME _ZThn8_N19QBearerEnginePluginD1Ev @ 1165 NONAME + _ZN14QAuthenticator9setOptionERK7QStringRK8QVariant @ 1166 NONAME + _ZNK14QAuthenticator6optionERK7QString @ 1167 NONAME + _ZNK14QAuthenticator7optionsEv @ 1168 NONAME -- cgit v0.12 From 70ffe96013dcf7b4be11d1fbe850b9bbcf37c741 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 16 Jul 2010 10:40:55 +0200 Subject: Added LatinAmericaAndTheCaribbean country to the doc. Task-number: QTBUG-12063 Reviewed-by: trustme --- src/corelib/tools/qlocale.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index a51ee81..6b1de5e 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2096,6 +2096,7 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l) \value Serbia \value SaintBarthelemy \value SaintMartin + \value LatinAmericaAndTheCaribbean \omitvalue LastCountry \sa country() -- cgit v0.12 From 4942890f85e5fa74bf8c37cf7f53f6f3eaf40596 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Mon, 31 May 2010 11:03:24 +0200 Subject: Revert the change in applicationShouldTerminate(). It used to fix an issue during logout but it seems to be fine now. Related issue: QTBUG-6296 Task-number: QTBUG-10993 Reviewed-by: Morten Sorvig --- src/gui/kernel/qcocoaapplicationdelegate_mac.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm index 5dcf613..7a9dc70 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm @@ -196,7 +196,6 @@ static void cleanupCocoaApplicationDelegate() qAppInstance()->quit(); startedQuit = false; } - return NSTerminateNow; } if (qtPrivate->threadData->eventLoops.size() == 0) { -- cgit v0.12 From 7a0b487ec10abd71bda6053021749740dc0ac545 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 16 Jul 2010 10:15:49 +0200 Subject: unused struct DIBINFO removed from qguifunctions_wince.cpp Reviewed-by: Martin Petersson --- src/gui/kernel/qguifunctions_wince.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp index f5004b0..cafddbf 100644 --- a/src/gui/kernel/qguifunctions_wince.cpp +++ b/src/gui/kernel/qguifunctions_wince.cpp @@ -131,15 +131,6 @@ static void resolveAygLibs() } } -struct DIBINFO : public BITMAPINFO -{ - RGBQUAD arColors[255]; - - operator LPBITMAPINFO() { return (LPBITMAPINFO) this; } - operator LPBITMAPINFOHEADER() { return &bmiHeader; } - RGBQUAD* ColorTable() { return bmiColors; } -}; - int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID lpvBits, LPBITMAPINFO, uint) { if (!lpvBits) { -- cgit v0.12 From 5f76c2b168ded91835d5d161b738a5dc03556cf6 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 16 Jul 2010 10:17:32 +0200 Subject: Windows mobile: show the [X] button in the taskbar when maximizing We're now showing the cancel button explicitly in the taskbar on maximize, if the widget does not have the widget flags CancelButtonHint and OKButtonHint. Task-number: QTBUG-8408 Reviewed-by: Martin Petersson --- src/gui/kernel/qguifunctions_wince.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp index cafddbf..bdaed65 100644 --- a/src/gui/kernel/qguifunctions_wince.cpp +++ b/src/gui/kernel/qguifunctions_wince.cpp @@ -314,6 +314,8 @@ void qt_wince_maximize(QWidget *widget) shidi.dwFlags |= SHIDIF_CANCELBUTTON; if (widget->windowFlags() & Qt::WindowOkButtonHint) shidi.dwFlags |= SHIDIF_DONEBUTTON; + if (!(widget->windowFlags() & (Qt::WindowCancelButtonHint | Qt::WindowOkButtonHint))) + shidi.dwFlags |= SHIDIF_CANCELBUTTON; resolveAygLibs(); if (ptrAygInitDialog) ptrAygInitDialog(&shidi); -- cgit v0.12 From 2c1aafa47b8915ea8aae8da229d65086e42543b3 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 16 Jul 2010 10:37:58 +0200 Subject: Windows mobile: the [X] button in the taskbar minimizes the widget The [X] or cancel button in the task bar shall just "minimize" the widget on Windows mobile. A press on this button results in a WM_COMMAND, IDCANCEL message. Before this patch we just sent a QCloseEvent to the widget, which had basically no effect. Now, we're calling showMinimzed(), which is the desired behaviour. Task-number: QTBUG-8408 Reviewed-by: Martin Petersson --- src/gui/kernel/qapplication_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 9e8a128..ec26e81 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -2485,7 +2485,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa if (OkCommand) QApplication::postEvent(widget, new QEvent(QEvent::OkRequest)); if (CancelCommand) - QApplication::postEvent(widget, new QEvent(QEvent::Close)); + widget->showMinimized(); else #ifndef QT_NO_MENUBAR QMenuBar::wceCommands(LOWORD(wParam)); -- cgit v0.12 From ad4aff6e2d188d88a2c6b4b692932adb08491d22 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 16 Jul 2010 10:43:14 +0200 Subject: Windows mobile: hide [X] button in task bar on unmaximize When calling showNormal on a window that was maximized, we must remove the [X] button from the task bar. But only if it was added by qt_wince_maximize. Task-number: QTBUG-8408 Reviewed-by: Martin Petersson --- src/gui/kernel/qguifunctions_wince.cpp | 17 +++++++++++++++++ src/gui/kernel/qwidget_win.cpp | 1 + src/gui/kernel/qwidget_wince.cpp | 1 + 3 files changed, 19 insertions(+) diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp index bdaed65..377dfe3 100644 --- a/src/gui/kernel/qguifunctions_wince.cpp +++ b/src/gui/kernel/qguifunctions_wince.cpp @@ -76,6 +76,10 @@ struct AygSIPINFO #define SHIDIF_SIZEDLGFULLSCREEN 0x0004 #endif +#ifndef SHDB_HIDE +#define SHDB_HIDE 0x0002 +#endif + #ifndef SHFS_SHOWTASKBAR #define SHFS_SHOWTASKBAR 0x0001 #endif @@ -112,10 +116,12 @@ struct AygSIPINFO typedef BOOL (*AygInitDialog)(AygSHINITDLGINFO*); typedef BOOL (*AygFullScreen)(HWND, DWORD); typedef BOOL (*AygSHSipInfo)(UINT, UINT, PVOID, UINT); +typedef BOOL (*AygSHDoneButton)(HWND, DWORD); static AygInitDialog ptrAygInitDialog = 0; static AygFullScreen ptrAygFullScreen = 0; static AygSHSipInfo ptrAygSHSipInfo = 0; +static AygSHDoneButton ptrAygSHDoneButton = 0; static bool aygResolved = false; static void resolveAygLibs() @@ -128,6 +134,7 @@ static void resolveAygLibs() ptrAygInitDialog = (AygInitDialog) ayglib.resolve("SHInitDialog"); ptrAygFullScreen = (AygFullScreen) ayglib.resolve("SHFullScreen"); ptrAygSHSipInfo = (AygSHSipInfo) ayglib.resolve("SHSipInfo"); + ptrAygSHDoneButton = (AygSHDoneButton) ayglib.resolve("SHDoneButton"); } } @@ -327,6 +334,16 @@ void qt_wince_maximize(QWidget *widget) } } +void qt_wince_unmaximize(QWidget *widget) +{ + if (ptrAygSHDoneButton && qt_wince_is_mobile() + && !(widget->windowFlags() & (Qt::WindowCancelButtonHint | Qt::WindowOkButtonHint))) + { + // Hide the [X] button, we've added in qt_wince_maximize. + ptrAygSHDoneButton(widget->winId(), SHDB_HIDE); + } +} + void qt_wince_minimize(HWND hwnd) { #ifdef Q_OS_WINCE_WM diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 0f05c6b..23f57da 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -70,6 +70,7 @@ #include "qguifunctions_wince.h" QT_USE_NAMESPACE extern void qt_wince_maximize(QWidget *widget); //defined in qguifunctions_wince.cpp +extern void qt_wince_unmaximize(QWidget *widget); //defined in qguifunctions_wince.cpp extern void qt_wince_minimize(HWND hwnd); //defined in qguifunctions_wince.cpp extern void qt_wince_full_screen(HWND hwnd, bool fullScreen, UINT swpf); //defined in qguifunctions_wince.cpp extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp index fc1e52c..76532ed 100644 --- a/src/gui/kernel/qwidget_wince.cpp +++ b/src/gui/kernel/qwidget_wince.cpp @@ -498,6 +498,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) int style = GetWindowLong(internalWinId(), GWL_STYLE) | WS_BORDER | WS_POPUP | WS_CAPTION; SetWindowLong(internalWinId(), GWL_STYLE, style); SetWindowLong(internalWinId(), GWL_EXSTYLE, GetWindowLong (internalWinId(), GWL_EXSTYLE) & ~ WS_EX_NODRAG); + qt_wince_unmaximize(this); } if (isVisible() && newstate & Qt::WindowMaximized) qt_wince_maximize(this); -- cgit v0.12 From 975b1913e44128a3e9b9055f9bf2ff40d86adf2a Mon Sep 17 00:00:00 2001 From: mae Date: Fri, 16 Jul 2010 11:42:16 +0200 Subject: Fix RightBearing confusion in text layout Negative RightBearing was wrongly taken into account when calculating the line wrap Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index d6535ea..674064e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1935,7 +1935,7 @@ void QTextLine::layout_helper(int maxGlyphs) // We ignore the right bearing if the minimum negative bearing is too little to // expand the text beyond the edge. if (sb_or_ws|breakany) { - if (lbh.calculateNewWidth(line) + lbh.minimumRightBearing > line.width) + if (lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width) lbh.adjustRightBearing(); if (lbh.checkFullOtherwiseExtend(line)) { if (!breakany) { -- cgit v0.12 From 0f4dc1226bcc1204a2b11d737fbcb4b58acfaf08 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 14 Jul 2010 14:07:33 +0200 Subject: QDeclarativeDebugTrace: Do not send message if the client did not enabled CanvasFrameRate This silents a lot of warnings in creator. Reviewed-by: Aaron Kennedy --- src/declarative/debugger/qdeclarativedebugtrace.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/declarative/debugger/qdeclarativedebugtrace.cpp b/src/declarative/debugger/qdeclarativedebugtrace.cpp index 5e6d5e7..b2b0c8a 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace.cpp +++ b/src/declarative/debugger/qdeclarativedebugtrace.cpp @@ -78,6 +78,9 @@ void QDeclarativeDebugTrace::endRange(RangeType t) void QDeclarativeDebugTrace::addEventImpl(EventType event) { + if (!isEnabled()) + return; + QByteArray data; QDataStream ds(&data, QIODevice::WriteOnly); ds << m_timer.elapsed() << (int)Event << (int)event; @@ -86,6 +89,9 @@ void QDeclarativeDebugTrace::addEventImpl(EventType event) void QDeclarativeDebugTrace::startRangeImpl(RangeType range) { + if (!isEnabled()) + return; + QByteArray data; QDataStream ds(&data, QIODevice::WriteOnly); ds << m_timer.elapsed() << (int)RangeStart << (int)range; @@ -94,6 +100,9 @@ void QDeclarativeDebugTrace::startRangeImpl(RangeType range) void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &u) { + if (!isEnabled()) + return; + QByteArray data; QDataStream ds(&data, QIODevice::WriteOnly); ds << m_timer.elapsed() << (int)RangeData << (int)range << (QString)u.toString(); @@ -102,6 +111,9 @@ void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &u) void QDeclarativeDebugTrace::endRangeImpl(RangeType range) { + if (!isEnabled()) + return; + QByteArray data; QDataStream ds(&data, QIODevice::WriteOnly); ds << m_timer.elapsed() << (int)RangeEnd << (int)range; -- cgit v0.12 From 790417ac69cd4fa780d6e298567908fc3d7ef6d0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 16 Jul 2010 15:33:59 +0200 Subject: Doc: Fixed whitespace issues. Reviewed-by: Trust Me --- examples/itemviews/addressbook/addresswidget.cpp | 2 +- examples/itemviews/addressbook/tablemodel.cpp | 48 ++++++++++++------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/examples/itemviews/addressbook/addresswidget.cpp b/examples/itemviews/addressbook/addresswidget.cpp index e226643..22dfae3 100644 --- a/examples/itemviews/addressbook/addresswidget.cpp +++ b/examples/itemviews/addressbook/addresswidget.cpp @@ -230,7 +230,7 @@ void AddressWidget::writeToFile(QString fileName) return; } - QList< QPair > pairs = table->getList(); + QList< QPair > pairs = table->getList(); QDataStream out(&file); out << pairs; } diff --git a/examples/itemviews/addressbook/tablemodel.cpp b/examples/itemviews/addressbook/tablemodel.cpp index 603c926..e9a08f0 100644 --- a/examples/itemviews/addressbook/tablemodel.cpp +++ b/examples/itemviews/addressbook/tablemodel.cpp @@ -72,13 +72,13 @@ QVariant TableModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); - + if (index.row() >= listOfPairs.size() || index.row() < 0) return QVariant(); - + if (role == Qt::DisplayRole) { QPair pair = listOfPairs.at(index.row()); - + if (index.column() == 0) return pair.first; else if (index.column() == 1) @@ -93,15 +93,15 @@ QVariant TableModel::headerData(int section, Qt::Orientation orientation, int ro { if (role != Qt::DisplayRole) return QVariant(); - + if (orientation == Qt::Horizontal) { switch (section) { case 0: return tr("Name"); - + case 1: return tr("Address"); - + default: return QVariant(); } @@ -115,7 +115,7 @@ bool TableModel::insertRows(int position, int rows, const QModelIndex &index) { Q_UNUSED(index); beginInsertRows(QModelIndex(), position, position+rows-1); - + for (int row=0; row < rows; row++) { QPair pair(" ", " "); listOfPairs.insert(position, pair); @@ -129,9 +129,9 @@ bool TableModel::insertRows(int position, int rows, const QModelIndex &index) //! [5] bool TableModel::removeRows(int position, int rows, const QModelIndex &index) { - Q_UNUSED(index); + Q_UNUSED(index); beginRemoveRows(QModelIndex(), position, position+rows-1); - + for (int row=0; row < rows; ++row) { listOfPairs.removeAt(position); } @@ -144,25 +144,25 @@ bool TableModel::removeRows(int position, int rows, const QModelIndex &index) //! [6] bool TableModel::setData(const QModelIndex &index, const QVariant &value, int role) { - if (index.isValid() && role == Qt::EditRole) { - int row = index.row(); - - QPair p = listOfPairs.value(row); - - if (index.column() == 0) - p.first = value.toString(); - else if (index.column() == 1) - p.second = value.toString(); + if (index.isValid() && role == Qt::EditRole) { + int row = index.row(); + + QPair p = listOfPairs.value(row); + + if (index.column() == 0) + p.first = value.toString(); + else if (index.column() == 1) + p.second = value.toString(); else return false; - + listOfPairs.replace(row, p); - emit(dataChanged(index, index)); - + emit(dataChanged(index, index)); + return true; - } + } - return false; + return false; } //! [6] @@ -171,7 +171,7 @@ Qt::ItemFlags TableModel::flags(const QModelIndex &index) const { if (!index.isValid()) return Qt::ItemIsEnabled; - + return QAbstractTableModel::flags(index) | Qt::ItemIsEditable; } //! [7] -- cgit v0.12 From 3db1408bb63ada82fb9d5adb4c082e5525d46ab0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 16 Jul 2010 15:36:27 +0200 Subject: Doc: Whitespace fixes. Reviewed-by: Trust Me --- doc/src/index.qdoc | 32 ++++++++--------- tools/qdoc3/test/qt.qdocconf | 82 ++++++++++++++++++++++---------------------- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 42fd4fc..ca7fef5 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -56,29 +56,29 @@ @@ -103,7 +103,7 @@
    - + \endraw */ diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index d132771..e4ed1bc 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -9,7 +9,7 @@ versionsym = version = %VERSION% description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.7 -online = true +online = true sourceencoding = UTF-8 outputencoding = UTF-8 @@ -26,46 +26,46 @@ qhp.Qt.indexRoot = # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ + images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/shBrushCpp.js \ - scripts/shCore.js \ - scripts/shLegacy.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/shCore.css \ - style/shThemeDefault.css \ - style/narrow.css \ - style/superfish.css \ - style/superfish_skin.css \ - style/OfflineStyle.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/arrow_down.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + scripts/shBrushCpp.js \ + scripts/shCore.js \ + scripts/shLegacy.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/shCore.css \ + style/shThemeDefault.css \ + style/narrow.css \ + style/superfish.css \ + style/superfish_skin.css \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc qhp.Qt.customFilters.Qt.name = Qt 4.7.0 @@ -146,7 +146,7 @@ exampledirs = $QTDIR/doc/src \ imagedirs = $QTDIR/doc/src/images \ $QTDIR/examples \ $QTDIR/doc/src/declarative/pics \ - $QTDIR/doc/src/template/images + $QTDIR/doc/src/template/images outputdir = $QTDIR/doc/html tagfile = $QTDIR/doc/html/qt.tags base = file:$QTDIR/doc/html -- cgit v0.12 From eef1d13743baddf41bd135d98fc2ad12944b8477 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 16 Jul 2010 16:09:20 +0200 Subject: Doc: Excluded the QML documentation from the Qt-only set. Reviewed-by: Trust Me --- tools/qdoc3/test/qt-api-only.qdocconf | 7 +++++++ tools/qdoc3/test/qt-api-only_ja_JP.qdocconf | 7 +++++++ tools/qdoc3/test/qt-api-only_zh_CN.qdocconf | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/tools/qdoc3/test/qt-api-only.qdocconf b/tools/qdoc3/test/qt-api-only.qdocconf index 10b7be5..bf6c0dc 100644 --- a/tools/qdoc3/test/qt-api-only.qdocconf +++ b/tools/qdoc3/test/qt-api-only.qdocconf @@ -25,6 +25,13 @@ qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \ $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc +# Remove the QML documentation from the Qt-only documentation. + +excludedirs += $QT_SOURCE_TREE/src/declarative \ + $QT_SOURCE_TREE/src/imports \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/declarative \ + $QT_SOURCE_TREE/doc/src/declarative + outputdir = $QT_BUILD_TREE/doc-build/html-qt tagfile = $QT_BUILD_TREE/doc-build/html-qt/qt.tags base = file:$QT_BUILD_TREE/doc-build/html-qt diff --git a/tools/qdoc3/test/qt-api-only_ja_JP.qdocconf b/tools/qdoc3/test/qt-api-only_ja_JP.qdocconf index aa3ab01..70e0235 100644 --- a/tools/qdoc3/test/qt-api-only_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-api-only_ja_JP.qdocconf @@ -25,6 +25,13 @@ qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \ $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc +# Remove the QML documentation from the Qt-only documentation. + +excludedirs += $QT_SOURCE_TREE/src/declarative \ + $QT_SOURCE_TREE/src/imports \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/declarative \ + $QT_SOURCE_TREE/doc/src/declarative + outputdir = $QT_BUILD_TREE/doc-build/html-qt_ja_JP tagfile = $QT_BUILD_TREE/doc-build/html-qt_ja_JP/qt.tags base = file:$QT_BUILD_TREE/doc-build/html-qt_ja_JP diff --git a/tools/qdoc3/test/qt-api-only_zh_CN.qdocconf b/tools/qdoc3/test/qt-api-only_zh_CN.qdocconf index c722ee8..d6bf410 100644 --- a/tools/qdoc3/test/qt-api-only_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-api-only_zh_CN.qdocconf @@ -25,6 +25,13 @@ qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \ $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc +# Remove the QML documentation from the Qt-only documentation. + +excludedirs += $QT_SOURCE_TREE/src/declarative \ + $QT_SOURCE_TREE/src/imports \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/declarative \ + $QT_SOURCE_TREE/doc/src/declarative + outputdir = $QT_BUILD_TREE/doc-build/html-qt_zh_CN tagfile = $QT_BUILD_TREE/doc-build/html-qt_zh_CN/qt.tags base = file:$QT_BUILD_TREE/doc-build/html-qt_zh_CN -- cgit v0.12 From f231bd03007484d239cb5456db9e20a1f9ab7a63 Mon Sep 17 00:00:00 2001 From: Petri Latvala Date: Wed, 7 Jul 2010 16:30:14 +0300 Subject: Link to the unsinstalled libraries first. Task-number: QT-3371 Reviewed-by: Harald Fernengel --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 62e0863..fb544bd 100755 --- a/configure +++ b/configure @@ -7746,7 +7746,7 @@ EOF # Ensure we can link to uninistalled libraries if [ "$XPLATFORM_MINGW" != "yes" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then - echo "QMAKE_LFLAGS += -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib" >> "$CACHEFILE.tmp" + echo "QMAKE_LFLAGS = -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib \$\$QMAKE_LFLAGS" >> "$CACHEFILE.tmp" fi if [ -n "$QT_CFLAGS_PSQL" ]; then -- cgit v0.12 From ab4dde176cfa314522964e5e5fbf9f2d388f8fdf Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Tue, 29 Jun 2010 09:29:29 +0300 Subject: Do not crash if addrinfo signal does not contain ip address information. Fixes: NB#176643 - Segmentation fault occurs while using networking Reviewed-by: Adrian Constantin --- src/plugins/bearer/icd/qnetworksession_impl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index e375b4f..aeac620 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -620,6 +620,9 @@ static QString get_network_interface() return iface; } + if (addr_results.first().ip_info.isEmpty()) + return QString(); + const char *address = addr_results.first().ip_info.first().address.toAscii().constData(); struct in_addr addr; if (inet_aton(address, &addr) == 0) { -- cgit v0.12 From bba06aacb84b5ae9fc286345e721cab639db35c8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 16 Jul 2010 18:20:49 +0200 Subject: Doc: Added license documentation for 3rd party code and data. Task-number: QT-3585 Pre-approved-by: Legal Reviewed-by: Trust Me --- doc/src/legal/3rdparty.qdoc | 234 +++++++++++++++++++++++++++++++++++++++++--- doc/src/legal/licenses.qdoc | 49 +++++++++- 2 files changed, 267 insertions(+), 16 deletions(-) diff --git a/doc/src/legal/3rdparty.qdoc b/doc/src/legal/3rdparty.qdoc index 110dac7..e7133e3 100644 --- a/doc/src/legal/3rdparty.qdoc +++ b/doc/src/legal/3rdparty.qdoc @@ -194,16 +194,16 @@ \hr copyright (C) 1999 by Willem van Schaik - + version 1.0 - 1999.10.15 - First version. - + Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty. - + \hr Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. @@ -293,7 +293,7 @@ Copyright (c) 1987, 1993, 1994\br The Regents of the University of California. All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\br @@ -305,7 +305,7 @@ 3. Neither the name of the University 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 REGENTS 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 @@ -336,7 +336,7 @@ Copyright (C) 2004, Andrey Kiselev \br Copyright (c( 1996 USAF Phillips Laboratory\br Additions (c) Richard Nolde 2006-2009 - + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in @@ -344,11 +344,11 @@ Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Sam Leffler and Silicon Graphics. - + THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - + IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, @@ -360,11 +360,11 @@ Copyright (c) 1985, 1986 The Regents of the University of California.\br All rights reserved. - + This code is derived from software contributed to Berkeley by James A. Woods, derived from original work by Spencer Thomas and Joseph Orost. - + Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation, @@ -381,7 +381,7 @@ Copyright (c) 1996-1997 Sam Leffler\br Copyright (c) 1996 Pixar - + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in @@ -389,11 +389,11 @@ Pixar, Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Pixar, Sam Leffler and Silicon Graphics. - + THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - + IN NO EVENT SHALL PIXAR, SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, @@ -423,8 +423,6 @@ \section1 JavaScriptCore - \hr - Copyright (c) 1991, 2000, 2001 by Lucent Technologies.\br Copyright (C) 2002, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. @@ -441,6 +439,60 @@ See \c src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp for license details. + \hr + + Copyright (C) 2009 Company 100, Inc. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met:\br + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer.\br + 2. 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. + + THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. + + \hr + + Copyright (C) 2009 Apple Inc. All rights reserved.\br + Copyright (C) 2009 University of Szeged\br + All rights reserved.\br + Copyright (C) 2010 MIPS Technologies, Inc. All rights reserved.\br + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met:\br + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer.\br + 2. 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. + + THIS SOFTWARE IS PROVIDED BY MIPS TECHNOLOGIES, INC. ``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 MIPS TECHNOLOGIES, INC. 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. + + \section1 Pixman (\c pixman) version 0.17.11 \e{pixman is a library that provides low-level pixel manipulation @@ -479,4 +531,156 @@ See \c src/3rdparty/pixman/pixman-arm-neon-asm.h and \c src/3rdparty/pixman/pixman-arm-neon-asm.S + + \section1 WebCore (WebKit) + + Copyright (C) 2009 Ericsson AB\br + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer.\br + 2. 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.\br + 3. Neither the name of Ericsson 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. + + \hr + + Copyright (C) 2004, Apple Computer, Inc. and The Mozilla Foundation.\br + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer.\br + 2. 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.\br + 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla + Foundation ("Mozilla") nor the names of their contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR 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 APPLE, MOZILLA OR + THEIR 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. + + \hr + + Copyright (C) 2009 Igalia S.L.\br + Copyright (C) 2009 Antonio Gomes \br + Copyright (C) 2008 Christian Dywan \br + Copyright (C) 2007 Nicholas Shanks \br + Copyright (C) 2006 Charles Samuels \br + Copyright (C) 2009 Dominik Röttsches \br + Copyright (C) 2009 Brent Fulgham\br + Copyright (C) 2009 Girish Ramakrishnan \br + Copyright (C) 2006 Alexander Kellett \br + Copyright (C) 2009 Cameron McCormack \br + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met:\br + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer.\br + 2. 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. + + THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. + + \hr + + Copyright (C) 2007, 2008 Apple Inc. All rights reserved.\br + Copyright (C) IBM Corp. 2009 All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer.\br + 2. 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.\br + 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission.\br + + THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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. + + \hr + + Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved.\br + Copyright (C) 2010 François Sausset (sausset@gmail.com). All rights reserved\br + Copyright (C) 2007 Marius Renn All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met:\br + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer.\br + 2. 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. + + 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. */ diff --git a/doc/src/legal/licenses.qdoc b/doc/src/legal/licenses.qdoc index 96d5d29..a04a256 100644 --- a/doc/src/legal/licenses.qdoc +++ b/doc/src/legal/licenses.qdoc @@ -328,7 +328,7 @@ 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. - + \list \o Parts of WebKit used by the QtWebKit module \endlist @@ -716,6 +716,53 @@ \list \o Parts of WebKit used by the QtWebKit module \endlist + + \hr + + Copyright (c) 1991-2009 Unicode, Inc. All rights reserved. + Distributed under the Terms of Use in + http://www.unicode.org/copyright.html. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of the Unicode data files and any associated + documentation (the "Data Files") or Unicode software and any + associated documentation (the "Software") to deal in the Data + Files or Software without restriction, including without + limitation the rights to use, copy, modify, merge, publish, + distribute, and/or sell copies of the Data Files or Software, + and to permit persons to whom the Data Files or Software are + furnished to do so, provided that (a) the above copyright + notice(s) and this permission notice appear with all copies + of the Data Files or Software, (b) both the above copyright + notice(s) and this permission notice appear in associated + documentation, and (c) there is clear notice in each modified + Data File or in the Software as well as in the documentation + associated with the Data File(s) or Software that the data or + software has been modified. + + THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT + WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT + LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED + IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING + FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES + OR SOFTWARE. + + Except as contained in this notice, the name of a copyright + holder shall not be used in advertising or otherwise to promote + the sale, use or other dealings in these Data Files or Software + without prior written authorization of the copyright holder. + + \list + \o Included in \c{util/unicode/data}, + \c{tests/auto/qtextboundaryfinder/data} and + \c{tests/auto/qchar} + \o Parts of the \l makeqpf tool + \endlist */ /*! -- cgit v0.12 From 3c11c0a8f2a99cb3734a24d9d6c43977807471d7 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Fri, 16 Jul 2010 20:32:38 +0200 Subject: Used aligned load and store when possible for the blending of ARGB32 Unaligned load and store can be costly. This patch mitigate the problem by aligning the destination before using SSE2. The destination is aligned because it is used by load and store, while the source is only use by load. On Atom, the blending test is 7% faster for ARGB32. Reviewed-by: Andreas Kling --- src/gui/painting/qdrawingprimitive_sse2_p.h | 34 ++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h index 3c96946..65292bc 100644 --- a/src/gui/painting/qdrawingprimitive_sse2_p.h +++ b/src/gui/painting/qdrawingprimitive_sse2_p.h @@ -43,6 +43,7 @@ #define QDRAWINGPRIMITIVE_SSE2_P_H #include +#include #ifdef QT_HAVE_SSE2 @@ -141,12 +142,24 @@ QT_BEGIN_NAMESPACE // with shortcuts if fully opaque or fully transparent. #define BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \ int x = 0; \ +\ + /* First, get dst aligned. */ \ + const int offsetToAlignOn16Bytes = (4 - (reinterpret_cast(dst) >> 2 & 0x3)) & 0x3;\ + const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ + for (; x < prologLength; ++x) { \ + uint s = src[x]; \ + if (s >= 0xff000000) \ + dst[x] = s; \ + else if (s != 0) \ + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \ + } \ +\ for (; x < length-3; x += 4) { \ const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \ /* all opaque */ \ - _mm_storeu_si128((__m128i *)&dst[x], srcVector); \ + _mm_store_si128((__m128i *)&dst[x], srcVector); \ } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \ /* not fully transparent */ \ /* extract the alpha channel on 2 x 16 bits */ \ @@ -157,13 +170,13 @@ QT_BEGIN_NAMESPACE alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \ alphaChannel = _mm_sub_epi16(one, alphaChannel); \ \ - const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \ + const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \ __m128i destMultipliedByOneMinusAlpha; \ BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ \ /* result = s + d * (1-alpha) */\ const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ - _mm_storeu_si128((__m128i *)&dst[x], result); \ + _mm_store_si128((__m128i *)&dst[x], result); \ } \ } \ for (; x < length; ++x) { \ @@ -189,6 +202,17 @@ QT_BEGIN_NAMESPACE #define BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, length, nullVector, half, one, colorMask, constAlphaVector) \ { \ int x = 0; \ +\ + const int offsetToAlignOn16Bytes = (4 - (reinterpret_cast(dst) >> 2 & 0x3)) & 0x3;\ + const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ + for (; x < prologLength; ++x) { \ + uint s = src[x]; \ + if (s >= 0xff000000) \ + dst[x] = s; \ + else if (s != 0) \ + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \ + } \ +\ for (; x < length-3; x += 4) { \ __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { \ @@ -198,12 +222,12 @@ QT_BEGIN_NAMESPACE alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \ alphaChannel = _mm_sub_epi16(one, alphaChannel); \ \ - const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \ + const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \ __m128i destMultipliedByOneMinusAlpha; \ BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ \ const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ - _mm_storeu_si128((__m128i *)&dst[x], result); \ + _mm_store_si128((__m128i *)&dst[x], result); \ } \ } \ for (; x < length; ++x) { \ -- cgit v0.12 From 956081702b5701ec570085174878a264c86c136b Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Sat, 17 Jul 2010 12:08:52 +1000 Subject: Rebuild configure.exe. --- configure.exe | Bin 1318912 -> 1318400 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/configure.exe b/configure.exe index 6817331..0863ecc 100755 Binary files a/configure.exe and b/configure.exe differ -- cgit v0.12 From 0e74ba543228b541394b95b477008aaea89549c1 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Sat, 17 Jul 2010 12:49:42 +1000 Subject: Revert "Used aligned load and store when possible for the blending of ARGB32" This reverts commit 3c11c0a8f2a99cb3734a24d9d6c43977807471d7, which breaks compilation on some platforms. --- src/gui/painting/qdrawingprimitive_sse2_p.h | 34 +++++------------------------ 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h index 65292bc..3c96946 100644 --- a/src/gui/painting/qdrawingprimitive_sse2_p.h +++ b/src/gui/painting/qdrawingprimitive_sse2_p.h @@ -43,7 +43,6 @@ #define QDRAWINGPRIMITIVE_SSE2_P_H #include -#include #ifdef QT_HAVE_SSE2 @@ -142,24 +141,12 @@ QT_BEGIN_NAMESPACE // with shortcuts if fully opaque or fully transparent. #define BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \ int x = 0; \ -\ - /* First, get dst aligned. */ \ - const int offsetToAlignOn16Bytes = (4 - (reinterpret_cast(dst) >> 2 & 0x3)) & 0x3;\ - const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ - for (; x < prologLength; ++x) { \ - uint s = src[x]; \ - if (s >= 0xff000000) \ - dst[x] = s; \ - else if (s != 0) \ - dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \ - } \ -\ for (; x < length-3; x += 4) { \ const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \ /* all opaque */ \ - _mm_store_si128((__m128i *)&dst[x], srcVector); \ + _mm_storeu_si128((__m128i *)&dst[x], srcVector); \ } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \ /* not fully transparent */ \ /* extract the alpha channel on 2 x 16 bits */ \ @@ -170,13 +157,13 @@ QT_BEGIN_NAMESPACE alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \ alphaChannel = _mm_sub_epi16(one, alphaChannel); \ \ - const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \ + const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \ __m128i destMultipliedByOneMinusAlpha; \ BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ \ /* result = s + d * (1-alpha) */\ const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ - _mm_store_si128((__m128i *)&dst[x], result); \ + _mm_storeu_si128((__m128i *)&dst[x], result); \ } \ } \ for (; x < length; ++x) { \ @@ -202,17 +189,6 @@ QT_BEGIN_NAMESPACE #define BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, length, nullVector, half, one, colorMask, constAlphaVector) \ { \ int x = 0; \ -\ - const int offsetToAlignOn16Bytes = (4 - (reinterpret_cast(dst) >> 2 & 0x3)) & 0x3;\ - const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ - for (; x < prologLength; ++x) { \ - uint s = src[x]; \ - if (s >= 0xff000000) \ - dst[x] = s; \ - else if (s != 0) \ - dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \ - } \ -\ for (; x < length-3; x += 4) { \ __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { \ @@ -222,12 +198,12 @@ QT_BEGIN_NAMESPACE alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \ alphaChannel = _mm_sub_epi16(one, alphaChannel); \ \ - const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \ + const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \ __m128i destMultipliedByOneMinusAlpha; \ BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ \ const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ - _mm_store_si128((__m128i *)&dst[x], result); \ + _mm_storeu_si128((__m128i *)&dst[x], result); \ } \ } \ for (; x < length; ++x) { \ -- cgit v0.12 From 11c80193772b51575a8c59d59215a8b9523647ea Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Sat, 17 Jul 2010 16:50:25 +1000 Subject: Remove license headers from .pro files in new modelview examples. This commit attempts to fix the latest staging failure. According to Nokia Legal, .pro files are not copyrightable and thus need not carry license headers. In any case, C-style comments aren't valid for .pro files and broke the build. --- .../tutorials/modelview/1_readonly/1_readonly.pro | 40 ---------------------- .../modelview/2_formatting/2_formatting.pro | 40 ---------------------- .../modelview/3_changingmodel/3_changingmodel.pro | 40 ---------------------- .../tutorials/modelview/4_headers/4_headers.pro | 40 ---------------------- examples/tutorials/modelview/5_edit/5_edit.pro | 40 ---------------------- .../tutorials/modelview/6_treeview/6_treeview.pro | 40 ---------------------- .../modelview/7_selections/7_selections.pro | 40 ---------------------- 7 files changed, 280 deletions(-) diff --git a/examples/tutorials/modelview/1_readonly/1_readonly.pro b/examples/tutorials/modelview/1_readonly/1_readonly.pro index 8528cde..1162d5a 100755 --- a/examples/tutorials/modelview/1_readonly/1_readonly.pro +++ b/examples/tutorials/modelview/1_readonly/1_readonly.pro @@ -1,43 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples 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$ -** -****************************************************************************/ - TARGET = mv_readonly TEMPLATE = app diff --git a/examples/tutorials/modelview/2_formatting/2_formatting.pro b/examples/tutorials/modelview/2_formatting/2_formatting.pro index cdf72bf..7e70d81 100755 --- a/examples/tutorials/modelview/2_formatting/2_formatting.pro +++ b/examples/tutorials/modelview/2_formatting/2_formatting.pro @@ -1,43 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples 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$ -** -****************************************************************************/ - TARGET = mv_formatting TEMPLATE = app diff --git a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro index 8b217cb..d61ee4c 100755 --- a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro +++ b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro @@ -1,43 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples 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$ -** -****************************************************************************/ - TARGET = mv_changingmodel TEMPLATE = app diff --git a/examples/tutorials/modelview/4_headers/4_headers.pro b/examples/tutorials/modelview/4_headers/4_headers.pro index 13b0b1d..d6f8d23 100755 --- a/examples/tutorials/modelview/4_headers/4_headers.pro +++ b/examples/tutorials/modelview/4_headers/4_headers.pro @@ -1,43 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples 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$ -** -****************************************************************************/ - TARGET = mv_headers TEMPLATE = app diff --git a/examples/tutorials/modelview/5_edit/5_edit.pro b/examples/tutorials/modelview/5_edit/5_edit.pro index d0a2571..e18c596 100755 --- a/examples/tutorials/modelview/5_edit/5_edit.pro +++ b/examples/tutorials/modelview/5_edit/5_edit.pro @@ -1,43 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples 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$ -** -****************************************************************************/ - TARGET = mv_edit TEMPLATE = app diff --git a/examples/tutorials/modelview/6_treeview/6_treeview.pro b/examples/tutorials/modelview/6_treeview/6_treeview.pro index fa27c3a..6d078be 100755 --- a/examples/tutorials/modelview/6_treeview/6_treeview.pro +++ b/examples/tutorials/modelview/6_treeview/6_treeview.pro @@ -1,43 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples 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$ -** -****************************************************************************/ - TARGET = mv_tree TEMPLATE = app SOURCES += main.cpp \ diff --git a/examples/tutorials/modelview/7_selections/7_selections.pro b/examples/tutorials/modelview/7_selections/7_selections.pro index 671dc24..952641c6 100755 --- a/examples/tutorials/modelview/7_selections/7_selections.pro +++ b/examples/tutorials/modelview/7_selections/7_selections.pro @@ -1,43 +1,3 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples 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$ -** -****************************************************************************/ - TARGET = mv_selections TEMPLATE = app SOURCES += main.cpp \ -- cgit v0.12