/tests/auto/qtextlist/

eaders[] = { {320,240,1,19,"QVGA Portrait"}, {360,640,1,19,"NHD Landscape"}, {640,360,1,19,"NHD Portrait"}, -{352,800,1,12,"E90 Landscape"} +{352,800,1,12,"E90 Landscape"}, +{480,640,1,19,"VGA Landscape"} // *** End of generated data *** }; const int QS60StylePrivate::m_numberOfLayouts = @@ -109,6 +110,7 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { {7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106} +{9,0,-909,0,0,2,0,5,-1,34,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,19,19,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184} // *** End of generated data *** }; -- cgit v0.12 From 19b6e2b944a0d1eeef0fb707a00f567e4ee870e6 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 10 Jan 2011 11:32:15 +0200 Subject: Build failure fix (related to QT-4079) Change d281cea3a445aa244901decceffd7d653ed829c8 caused build failure, due to missing comma (one line missing from commit). Fixed by adding the missing change. Task-number: QT-4079 Reviewed-by: Miikka Heikkinen --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 3ba8887..4a4095d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -109,7 +109,7 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { {5,0,-909,0,0,1,0,2,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106}, {7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106} +{7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106}, {9,0,-909,0,0,2,0,5,-1,34,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,19,19,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184} // *** End of generated data *** }; -- cgit v0.12 From 3c5eb8766e73c855782552f7c6472801e8ae820c Mon Sep 17 00:00:00 2001 From: Jyrki Jaakkola Date: Wed, 12 Jan 2011 18:23:10 +0100 Subject: QNetworkProxyFactory::systemProxyForQuery() for Symbian --- src/network/kernel/kernel.pri | 2 + src/network/kernel/qnetworkproxy_symbian.cpp | 267 +++++++++++++++++++++ tests/auto/network.pro | 1 + tests/auto/qnetworkproxyfactory/.gitignore | 1 + .../qnetworkproxyfactory/qnetworkproxyfactory.pro | 11 + .../tst_qnetworkproxyfactory_symbian.cpp | 101 ++++++++ 6 files changed, 383 insertions(+) create mode 100644 src/network/kernel/qnetworkproxy_symbian.cpp create mode 100644 tests/auto/qnetworkproxyfactory/.gitignore create mode 100644 tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro create mode 100644 tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory_symbian.cpp diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index 6145c43..66e87c9 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -27,5 +27,7 @@ win32:SOURCES += kernel/qhostinfo_win.cpp kernel/qnetworkinterface_win.cpp mac:LIBS_PRIVATE += -framework SystemConfiguration -framework CoreFoundation mac:SOURCES += kernel/qnetworkproxy_mac.cpp else:win32:SOURCES += kernel/qnetworkproxy_win.cpp +else:symbian:SOURCES += kernel/qnetworkproxy_symbian.cpp else:SOURCES += kernel/qnetworkproxy_generic.cpp +symbian: LIBS += -lcommsdat diff --git a/src/network/kernel/qnetworkproxy_symbian.cpp b/src/network/kernel/qnetworkproxy_symbian.cpp new file mode 100644 index 0000000..c1f9c1d --- /dev/null +++ b/src/network/kernel/qnetworkproxy_symbian.cpp @@ -0,0 +1,267 @@ +/**************************************************************************** +** +** 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 QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/** + * Some notes about the code: + * + * ** It is assumed that the system proxies are for url based requests + * ie. HTTP/HTTPS based. + * ** It is assumed that proxies don't use authentication. + * ** It is assumed that there is no exceptions to proxy use (Symbian side + * does have the field for it but it is not user modifiable by default). + * ** There is no checking for protocol name. + */ + +#include + +#ifndef QT_NO_NETWORKPROXY + +#include // CMDBSession +#include // CCDIAPRecord, CCDProxiesRecord +#include // KCDTIdIAPRecord, KCDTIdProxiesRecord +#include +#include + +using namespace CommsDat; + +QT_BEGIN_NAMESPACE + +class SymbianIapId +{ +public: + enum State{ + NotValid, + Valid + }; + Q_DECLARE_FLAGS(States, State) + SymbianIapId() {} + ~SymbianIapId() {} + void setIapId(TUint32 iapId) { iapState |= Valid; id = iapId; } + bool isValid() { return iapState == Valid; } + TUint32 iapId() { return id; } +private: + QFlags iapState; + TUint32 id; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(SymbianIapId::States) + +class SymbianProxyQuery +{ +public: + static QNetworkConfiguration findCurrentConfiguration(QNetworkConfigurationManager& configurationManager); + static SymbianIapId getIapId(QNetworkConfigurationManager& configurationManager); + static CCDIAPRecord *getIapRecordLC(TUint32 aIAPId, CMDBSession &aDb); + static CMDBRecordSet *prepareQueryLC(TUint32 serviceId, TDesC& serviceType); + static QList proxyQueryL(TUint32 aIAPId, const QNetworkProxyQuery &query); +}; + +QNetworkConfiguration SymbianProxyQuery::findCurrentConfiguration(QNetworkConfigurationManager& configurationManager) +{ + QList activeConfigurations = configurationManager.allConfigurations( + QNetworkConfiguration::Active); + QNetworkConfiguration currentConfig; + if (activeConfigurations.count() > 0) { + currentConfig = activeConfigurations.at(0); + } else { + // No active configurations, try default one + QNetworkConfiguration defaultConfiguration = configurationManager.defaultConfiguration(); + if (defaultConfiguration.isValid()) { + switch (defaultConfiguration.type()) { + case QNetworkConfiguration::InternetAccessPoint: + currentConfig = defaultConfiguration; + break; + case QNetworkConfiguration::ServiceNetwork: + { + // Note: This code assumes that the only unambigious way to + // find current proxy config is if there is only one access point + // or if the found access point is immediately usable. + QList childConfigurations = defaultConfiguration.children(); + if (childConfigurations.count() == 1) { + currentConfig = childConfigurations.at(0); + } else { + for (int index = 0; index < childConfigurations.count(); index++) { + QNetworkConfiguration childConfig = childConfigurations.at(index); + if (childConfig.isValid() && childConfig.state() == QNetworkConfiguration::Discovered) { + currentConfig = childConfig; + break; + } + } + } + } + break; + case QNetworkConfiguration::UserChoice: + // User choice is not a valid configuration for proxy discovery + break; + } + } + } + return currentConfig; +} + +SymbianIapId SymbianProxyQuery::getIapId(QNetworkConfigurationManager& configurationManager) +{ + SymbianIapId iapId; + + QNetworkConfiguration currentConfig = findCurrentConfiguration(configurationManager); + if (currentConfig.isValid()) { + // Note: the following code assumes that the identifier is in format + // I_xxxx where xxxx is the identifier of IAP. This is meant as a + // temporary solution until there is a support for returning + // implementation specific identifier. + const int generalPartLength = 2; + const int identifierNumberLength = currentConfig.identifier().length() - generalPartLength; + QString idString(currentConfig.identifier().right(identifierNumberLength)); + bool success; + uint id = idString.toUInt(&success); + if (success) + iapId.setIapId(id); + else + qWarning() << "Failed to convert identifier to access point identifier: " + << currentConfig.identifier(); + } + + return iapId; +} + +CCDIAPRecord *SymbianProxyQuery::getIapRecordLC(TUint32 aIAPId, CMDBSession &aDb) +{ + CCDIAPRecord *iap = static_cast (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); + CleanupStack::PushL(iap); + iap->SetRecordId(aIAPId); + iap->LoadL(aDb); + return iap; +} + +CMDBRecordSet *SymbianProxyQuery::prepareQueryLC(TUint32 serviceId, TDesC& serviceType) +{ + // Create a recordset of type CCDProxiesRecord + // for priming search. + // This will ultimately contain record(s) + // matching the priming record attributes + CMDBRecordSet *proxyRecords = new (ELeave) CMDBRecordSet ( + KCDTIdProxiesRecord); + CleanupStack::PushL(proxyRecords); + + CCDProxiesRecord *primingProxyRecord = + static_cast (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord)); + CleanupStack::PushL(primingProxyRecord); + + primingProxyRecord->iServiceType.SetMaxLengthL(serviceType.Length()); + primingProxyRecord->iServiceType = serviceType; + primingProxyRecord->iService = serviceId; + primingProxyRecord->iUseProxyServer = ETrue; + + proxyRecords->iRecords.AppendL(primingProxyRecord); + // Ownership of primingProxyRecord is transferred to + // proxyRecords, just remove it from the CleanupStack + CleanupStack::Pop(primingProxyRecord); + return proxyRecords; +} + +QList SymbianProxyQuery::proxyQueryL(TUint32 aIAPId, const QNetworkProxyQuery &query) +{ + QList foundProxies; + if (query.queryType() != QNetworkProxyQuery::UrlRequest) { + return foundProxies; + } + + CMDBSession *iDb = CMDBSession::NewLC(KCDVersion1_1); + CCDIAPRecord *iap = getIapRecordLC(aIAPId, *iDb); + + // Read service table id and service type + // from the IAP record found + TUint32 serviceId = iap->iService; + RBuf serviceType; + serviceType.CreateL(iap->iServiceType); + CleanupStack::PopAndDestroy(iap); + CleanupClosePushL(serviceType); + + CMDBRecordSet *proxyRecords = prepareQueryLC(serviceId, serviceType); + + // Now to find a proxy table matching our criteria + if (proxyRecords->FindL(*iDb)) { + TInt count = proxyRecords->iRecords.Count(); + for(TInt index = 0; index < count; index++) { + CCDProxiesRecord *proxyRecord = static_cast (proxyRecords->iRecords[index]); + RBuf serverName; + serverName.CreateL(proxyRecord->iServerName); + CleanupClosePushL(serverName); + if (serverName.Length() == 0) + User::Leave(KErrNotFound); + QString serverNameQt((const QChar*)serverName.Ptr(), serverName.Length()); + CleanupStack::Pop(); // serverName + TUint32 port = proxyRecord->iPortNumber; + + QNetworkProxy proxy(QNetworkProxy::HttpProxy, serverNameQt, port); + foundProxies.append(proxy); + } + } + + CleanupStack::PopAndDestroy(proxyRecords); + CleanupStack::Pop(); // serviceType + CleanupStack::PopAndDestroy(iDb); + + return foundProxies; +} + +QList QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query) +{ + QList proxies; + SymbianIapId iapId; + TInt error; + QNetworkConfigurationManager manager; + iapId = SymbianProxyQuery::getIapId(manager); + if (iapId.isValid()) { + TRAP(error, proxies = SymbianProxyQuery::proxyQueryL(iapId.iapId(), query)) + if (error != KErrNone) { + qWarning() << "Error while retrieving proxies: '" << error << '"'; + proxies.clear(); + } + } + proxies << QNetworkProxy::NoProxy; + + return proxies; +} + +QT_END_NAMESPACE + +#endif diff --git a/tests/auto/network.pro b/tests/auto/network.pro index 31c754c..2e3b5cd 100644 --- a/tests/auto/network.pro +++ b/tests/auto/network.pro @@ -25,6 +25,7 @@ SUBDIRS=\ qnetworkcookiejar \ qnetworkinterface \ qnetworkproxy \ + qnetworkproxyfactory \ qnetworkrequest \ qnetworksession \ qobjectperformance \ diff --git a/tests/auto/qnetworkproxyfactory/.gitignore b/tests/auto/qnetworkproxyfactory/.gitignore new file mode 100644 index 0000000..9be26bb --- /dev/null +++ b/tests/auto/qnetworkproxyfactory/.gitignore @@ -0,0 +1 @@ +tst_qnetworkproxyfactory_symbian diff --git a/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro b/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro new file mode 100644 index 0000000..81460a1 --- /dev/null +++ b/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro @@ -0,0 +1,11 @@ +############################################################ +# Project file for autotest for file qnetworkproxy.h (proxy factory part) +############################################################ + +load(qttest_p4) +QT = core network + +SOURCES += tst_qnetworkproxyfactory_symbian.cpp + +symbian: TARGET.CAPABILITY = NetworkServices + diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory_symbian.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory_symbian.cpp new file mode 100644 index 0000000..6a8ea79 --- /dev/null +++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory_symbian.cpp @@ -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 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 +#include +#include + +class tst_QNetworkProxyFactory_symbian : public QObject { + Q_OBJECT +private slots: + void systemProxyForQuery() const; + +private: + QString formatProxyName(const QNetworkProxy & proxy) const; +}; + +QString tst_QNetworkProxyFactory_symbian::formatProxyName(const QNetworkProxy & proxy) const +{ + QString proxyName; + if (!proxy.user().isNull()) + proxyName.append("%1:%2@").arg(proxy.user(), proxy.password()); + proxyName.append("%1:%2").arg(proxy.hostName(), proxy.port()); + proxyName.append(" (type=%1, capabilities=%2)").arg(proxy.type(), proxy.capabilities()); + + return proxyName; +} + +void tst_QNetworkProxyFactory_symbian::systemProxyForQuery() const +{ + QNetworkProxyFactory proxyFactory; + QNetworkProxyQuery query(QUrl(QString("http://www.abc.com")), QNetworkProxyQuery::UrlRequest); + QList systemProxyList = proxyFactory.systemProxyForQuery(query); + bool pass = true; + QNetworkProxy proxy; + + QList nativeProxyList; + nativeProxyList << QNetworkProxy(QNetworkProxy::HttpProxy, QString("http://test.proxy.com"), 8080) << QNetworkProxy::NoProxy; + + foreach (proxy, systemProxyList) { + if (!nativeProxyList.contains(proxy)) { + qWarning() << "System proxy not found in native proxy list: " << + formatProxyName(proxy); + pass = false; + } + } + + foreach (proxy, nativeProxyList) { + if (!systemProxyList.contains(proxy)) { + qWarning() << "Native proxy not found in system proxy list: " << + formatProxyName(proxy); + pass = false; + } + } + + if (!pass) + QFAIL("One or more system proxy lookup failures occured."); +} + +QTEST_MAIN(tst_QNetworkProxyFactory_symbian) +#include "tst_qnetworkproxyfactory_symbian.moc" -- cgit v0.12 From 271c790e020b82be88e421611bef169334ea0a4f Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 13 Jan 2011 10:49:13 +1000 Subject: Consistent Docs Example contradicted later docs. Fixed example. Task-number: QTBUG-16596 --- doc/src/snippets/declarative/codingconventions/photo.qml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/src/snippets/declarative/codingconventions/photo.qml b/doc/src/snippets/declarative/codingconventions/photo.qml index 61e7eb7..78c5068 100644 --- a/doc/src/snippets/declarative/codingconventions/photo.qml +++ b/doc/src/snippets/declarative/codingconventions/photo.qml @@ -49,12 +49,20 @@ Rectangle { signal clicked // signal declarations - function doSomething(x) { // javascript functions + function doSomething(x) // javascript functions + { return x + photoImage.width } - x: 20; y: 20; width: 200; height: 150 // object properties - color: "gray" // try to group related properties together + color: "gray" // object properties + x: 20; y: 20; height: 150 // try to group related properties together + width: { // large bindings + if(photoImage.width > 200){ + photoImage.width; + }else{ + 200; + } + } Rectangle { // child objects id: border -- cgit v0.12 From 3526db3b8832c357b368014e6c8ebab63d4071da Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 13 Jan 2011 14:40:31 +1000 Subject: Don't crash Qt Creator when debugging an object alias Task-number: QTBUG-16131 --- src/declarative/qml/qdeclarativeproperty.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index e7dae98..8210314 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -665,7 +665,7 @@ QDeclarativePropertyPrivate::binding(QObject *object, int coreIndex, int valueTy static_cast(metaObjectForProperty(object->metaObject(), coreIndex)); QObject *aObject = 0; int aCoreIndex = -1; int aValueTypeIndex = -1; - if (!vme->aliasTarget(coreIndex, &aObject, &aCoreIndex, &aValueTypeIndex)) + if (!vme->aliasTarget(coreIndex, &aObject, &aCoreIndex, &aValueTypeIndex) || aCoreIndex == -1) return 0; // This will either be a value type sub-reference or an alias to a value-type sub-reference not both -- cgit v0.12 From 72942b7dab497b656fad8eeb6240fe310a31be29 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 13 Jan 2011 14:59:30 +1000 Subject: Add an autotest for QVariant method params --- .../auto/declarative/qdeclarativeecmascript/testtypes.h | 2 ++ .../tst_qdeclarativeecmascript.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 7724335..6c6ad1f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -624,6 +624,8 @@ public: Q_INVOKABLE int method_default(int a, int b = 19) { invoke(20); m_actuals << a << b; return b; } + Q_INVOKABLE void method_QVariant(QVariant a, QVariant b = QVariant()) { invoke(21); m_actuals << a << b; } + private: friend class MyInvokableBaseObject; void invoke(int idx) { if (m_invoked != -1) m_invokedError = true; m_invoked = idx;} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 90006a9..034adf7 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -1786,6 +1786,22 @@ void tst_qdeclarativeecmascript::callQtInvokables() QCOMPARE(o.invoked(), -3); QCOMPARE(o.actuals().count(), 1); QCOMPARE(o.actuals().at(0), QVariant(9)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QVariant(9)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 21); + QCOMPARE(o.actuals().count(), 2); + QCOMPARE(o.actuals().at(0), QVariant(9)); + QCOMPARE(o.actuals().at(1), QVariant()); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QVariant(\"Hello\", \"World\")").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 21); + QCOMPARE(o.actuals().count(), 2); + QCOMPARE(o.actuals().at(0), QVariant(QString("Hello"))); + QCOMPARE(o.actuals().at(1), QVariant(QString("World"))); } // QTBUG-13047 (check that you can pass registered object types as args) -- cgit v0.12 From 56bc3e3a40ab694ca5e1b2887c5887e8aa05de04 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 13 Jan 2011 15:11:33 +1000 Subject: Document level of support for QGraphicsObject properties In the context of QML, they are not officially supported as public API unless otherwise documented in QDeclarativeItem. This commit mentions that somewhere. Task-number: QTBUG-15797 Reviewed-by: Martin Jones --- doc/src/declarative/qtbinding.qdoc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 4213f66..b1de3e4 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -235,6 +235,10 @@ defined by C++ classes; in fact, many of the core \l {QML Elements} are implemen C++ classes. When you create a QML object using one of these elements, you are simply creating an instance of a QObject-based C++ class and setting its properties. +To create a visual item that fits in with the Qt Quick elements, base your class off \l QDeclarativeItem instead of QObject directly. +You can then implement your own painting and functionality like any other QGraphicsObject. Note that QGraphicsItem::ItemHasNoContents is set by default on QDeclarativeItem because +it does not paint anything; you will need to clear this if your item is supposed to paint anything (as opposed to being solely for input handling or logical grouping). + For example, here is an \c ImageViewer class with an \c image URL property: \snippet doc/src/snippets/declarative/qtbinding/newelements/imageviewer.h 0 @@ -249,6 +253,11 @@ Then, any QML code loaded by your C++ application or \l{QDeclarativeExtensionPlu \snippet doc/src/snippets/declarative/qtbinding/newelements/standalone.qml 0 + +It is advised that you avoid using QGraphicsItem functionality beyond the properties documented in QDeclarativeItem. +This is because the GraphicsView backend is an implementation detail for QML, so the QtQuick items can be moved to faster backends as they become available with no change from a QML perspective. +To minimize any porting requirements for custom visual items, try to stick to the documented properties in QDeclarative item where possible as properties it inherits but doesn't document are classed as implementation details and may disappear. + Note that custom C++ types do not have to inherit from QDeclarativeItem; this is only necessary if it is a displayable item. If the item is not displayable, it can simply inherit from QObject. -- cgit v0.12 From 7b8c7462dde454c25e92e401292e973da04f2189 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 13 Jan 2011 15:17:47 +1000 Subject: Document centerIn and fill in the anchors docs Task-number: QTBUG-16467 --- doc/src/declarative/anchor-layout.qdoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc index f03d9ee..941acfe 100644 --- a/doc/src/declarative/anchor-layout.qdoc +++ b/doc/src/declarative/anchor-layout.qdoc @@ -78,6 +78,9 @@ Rectangle { id: rect3; x: 150; ... } \image edge4.png +There are also some convenience anchors. anchors.fill is a convenience that is the same as setting the left,right,top and bottom anchors +to the left,right,top and bottom of the target item. anchors.centerIn is another convenience anchor, and is the same as setting the verticalCenter +and horizontalCenter anchors to the verticalCenter and horizontalCenter of the target item. \section1 Anchor Margins and Offsets -- cgit v0.12 From b034416ab293a71fcedd744d503a30365b664049 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 13 Jan 2011 16:21:58 +1000 Subject: Fix doc typo Tidy up that section a little, while I'm at it. --- doc/src/declarative/qtbinding.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index b1de3e4..03290aa 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -255,8 +255,8 @@ Then, any QML code loaded by your C++ application or \l{QDeclarativeExtensionPlu It is advised that you avoid using QGraphicsItem functionality beyond the properties documented in QDeclarativeItem. -This is because the GraphicsView backend is an implementation detail for QML, so the QtQuick items can be moved to faster backends as they become available with no change from a QML perspective. -To minimize any porting requirements for custom visual items, try to stick to the documented properties in QDeclarative item where possible as properties it inherits but doesn't document are classed as implementation details and may disappear. +This is because the GraphicsView backend is intended to be an implementation detail for QML, so the QtQuick items can be moved to faster backends as they become available with no change from a QML perspective. +To minimize any porting requirements for custom visual items, try to stick to the documented properties in QDeclarativeItem where possible. Properties QDeclarativeItem inherits but doesn't document are classed as implementation details; they are not officially supported and may disappear between releases. Note that custom C++ types do not have to inherit from QDeclarativeItem; this is only necessary if it is a displayable item. If the item is not displayable, it can simply inherit from QObject. -- cgit v0.12 From 7fbf1829e11504eca6a55f1e5dbddf2f658b5302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Fri, 17 Dec 2010 14:41:43 +0100 Subject: Fix a bug that got revealed by 604c51f1fc5c79b7fad12cda911b06b9e6e5005f The bug has been around for a while, but change 604c51f1fc5c7 made it emerge. The problem was that stretches were combined by always *maxing* them. The values of 'stretch' can be interpreted as this: -1: (the default) it means that the items should be stretched with the stretch factor dervived from the size hints. (In practice this means that they are distributed fairly). 0: Means that the item should not be stretched >0: Means that the item should be stretch with that number as a factor. This meant that combining one item with a fixed size(0) and another item with a default stretch (-1) the combined row stretch would end up being fixed. This also fixes how stretches are combined for spanning items too. Task-number: QTBUG-13551 Reviewed-by: John Tapsell --- src/gui/graphicsview/qgridlayoutengine.cpp | 5 +++-- .../tst_qgraphicslinearlayout.cpp | 26 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index f1055ba..a3c7ff5 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -194,7 +194,8 @@ void QGridLayoutRowData::distributeMultiCells(const QGridLayoutRowInfo &rowInfo) for (int k = 0; k < span; ++k) { boxes[start + k].combine(extras[k]); - stretches[start + k] = qMax(stretches[start + k], stretch); + if (stretch != 0) + stretches[start + k] = qMax(stretches[start + k], stretch); } } multiCellMap.clear(); @@ -1472,7 +1473,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt QGridLayoutBox *box; if (effectiveRowSpan == 1) { box = &rowBox; - if (!userRowStretch) + if (!userRowStretch && itemStretch != 0) rowStretch = qMax(rowStretch, itemStretch); } else { QGridLayoutMultiCellData &multiCell = diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 965e340..48dea0c 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -106,6 +106,7 @@ private slots: void testAlignmentInLargerLayout(); void testOffByOneInLargerLayout(); void testDefaultAlignment(); + void combineSizePolicies(); // Task specific tests void task218400_insertStretchCrash(); @@ -1583,6 +1584,31 @@ void tst_QGraphicsLinearLayout::testDefaultAlignment() QCOMPARE(w2->geometry(), QRectF(0,50,100,100)); } +void tst_QGraphicsLinearLayout::combineSizePolicies() +{ + QGraphicsWidget *widget = new QGraphicsWidget; + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal, widget); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + + QGraphicsWidget *w1 = new QGraphicsWidget; + w1->setMaximumSize(200,200); + w1->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + layout->addItem(w1); + + QGraphicsWidget *w2 = new QGraphicsWidget; + w2->setPreferredSize(50,50); + w2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + layout->addItem(w2); + QCOMPARE(layout->maximumHeight(), qreal(200)); + + // now remove the fixed vertical size policy, and set instead the maximum height to 50 + // this should in effect give the same maximumHeight + w2->setMaximumHeight(50); + w2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + QCOMPARE(layout->maximumHeight(), qreal(200)); +} + QTEST_MAIN(tst_QGraphicsLinearLayout) #include "tst_qgraphicslinearlayout.moc" -- cgit v0.12 From 7cc615479a8abdf8b4056850daa8cdb5143f3782 Mon Sep 17 00:00:00 2001 From: John Tapsell Date: Mon, 20 Dec 2010 09:52:22 +0000 Subject: Some unit tests for layout explosion thingy Adds more tests for commit 7fbf1829e11504eca6a55f1e5dbddf2f658b5302 Task-number: QTBUG-13551 --- .../tst_qgraphicsgridlayout.cpp | 158 +++++++++++++++++++++ 1 file changed, 158 insertions(+) diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 35ea059..baea906 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -120,6 +120,11 @@ private slots: void avoidRecursionInInsertItem(); void styleInfoLeak(); void task236367_maxSizeHint(); + void spanningItem2x2_data(); + void spanningItem2x2(); + void spanningItem2x3_data(); + void spanningItem2x3(); + void spanningItem(); void heightForWidth(); void heightForWidthWithSpanning(); void stretchAndHeightForWidth(); @@ -2860,6 +2865,159 @@ void tst_QGraphicsGridLayout::heightForWidthWithSpanning() QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(200, -1)), QSizeF(200, 10000)); } +Q_DECLARE_METATYPE(QSizePolicy::Policy) +void tst_QGraphicsGridLayout::spanningItem2x2_data() +{ + QTest::addColumn("sizePolicy"); + QTest::addColumn("itemHeight"); + QTest::addColumn("expectedHeight"); + + QTest::newRow("A larger spanning item with 2 widgets with fixed policy") << QSizePolicy::Fixed << 39 << 80; + QTest::newRow("A larger spanning item with 2 widgets with preferred policy") << QSizePolicy::Preferred << 39 << 80; + QTest::newRow("An equally-sized spanning item with 2 widgets with fixed policy") << QSizePolicy::Fixed << 40 << 80; + QTest::newRow("An equally-sized spanning item with 2 widgets with preferred policy") << QSizePolicy::Preferred << 40 << 80; + QTest::newRow("A smaller spanning item with 2 widgets with fixed policy") << QSizePolicy::Fixed << 41 << 82; + QTest::newRow("A smaller spanning item with 2 widgets with preferred policy") << QSizePolicy::Preferred << 41 << 82; +} + +void tst_QGraphicsGridLayout::spanningItem2x2() +{ + QFETCH(QSizePolicy::Policy, sizePolicy); + QFETCH(int, itemHeight); + QFETCH(int, expectedHeight); + QGraphicsWidget *form = new QGraphicsWidget(0, Qt::Window); + QGraphicsGridLayout *layout = new QGraphicsGridLayout(form); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + + QGraphicsWidget *w1 = new QGraphicsWidget; + w1->setMinimumSize(80,80); + w1->setMaximumSize(80,80); + + QGraphicsWidget *w2 = new QGraphicsWidget; + w2->setMinimumSize(80,itemHeight); + w2->setPreferredSize(80,itemHeight); + w2->setSizePolicy(QSizePolicy::Fixed, sizePolicy); + + QGraphicsWidget *w3 = new QGraphicsWidget; + w3->setMinimumSize(80,itemHeight); + w3->setPreferredSize(80,itemHeight); + w3->setSizePolicy(QSizePolicy::Fixed, sizePolicy); + + layout->addItem(w1, 0, 0, 2, 1); + layout->addItem(w2, 0, 1); + layout->addItem(w3, 1, 1); + + QCOMPARE(layout->minimumSize(), QSizeF(160,expectedHeight)); + if(sizePolicy == QSizePolicy::Fixed) + QCOMPARE(layout->maximumSize(), QSizeF(160,expectedHeight)); + else + QCOMPARE(layout->maximumSize(), QSizeF(160,QWIDGETSIZE_MAX)); +} + +void tst_QGraphicsGridLayout::spanningItem2x3_data() +{ + QTest::addColumn("w1_fixed"); + QTest::addColumn("w2_fixed"); + QTest::addColumn("w3_fixed"); + QTest::addColumn("w4_fixed"); + QTest::addColumn("w5_fixed"); + + for(int w1 = 0; w1 < 2; w1++) + for(int w2 = 0; w2 < 2; w2++) + for(int w3 = 0; w3 < 2; w3++) + for(int w4 = 0; w4 < 2; w4++) + for(int w5 = 0; w5 < 2; w5++) { + QString description = QString("Fixed sizes:") + (w1?" w1":"") + (w2?" w2":"") + (w3?" w3":"") + (w4?" w4":"") + (w5?" w5":""); + QTest::newRow(description.toLatin1()) << (bool)w1 << (bool)w2 << (bool)w3 << (bool)w4 << (bool)w5; + } +} + +void tst_QGraphicsGridLayout::spanningItem2x3() +{ + QFETCH(bool, w1_fixed); + QFETCH(bool, w2_fixed); + QFETCH(bool, w3_fixed); + QFETCH(bool, w4_fixed); + QFETCH(bool, w5_fixed); + QGraphicsGridLayout *layout = new QGraphicsGridLayout; + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + + QGraphicsWidget *w1 = new QGraphicsWidget; + w1->setMinimumSize(80,80); + w1->setMaximumSize(80,80); + if (w1_fixed) + w1->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + QGraphicsWidget *w2 = new QGraphicsWidget; + w2->setMinimumSize(80,48); + w2->setPreferredSize(80,48); + if (w2_fixed) + w2->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + QGraphicsWidget *w3 = new QGraphicsWidget; + w3->setMinimumSize(80,30); + w3->setPreferredSize(80,30); + if (w3_fixed) + w3->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + QGraphicsWidget *w4 = new QGraphicsWidget; + w4->setMinimumSize(80,30); + w4->setMaximumSize(80,30); + if (w4_fixed) + w4->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + QGraphicsWidget *w5 = new QGraphicsWidget; + w5->setMinimumSize(40,24); + w5->setMaximumSize(40,24); + if (w5_fixed) + w5->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + layout->addItem(w1, 0, 0, 2, 1); + layout->addItem(w2, 0, 1); + layout->addItem(w3, 1, 1); + layout->addItem(w4, 0, 2); + layout->addItem(w5, 1, 2); + + QCOMPARE(layout->minimumSize(), QSizeF(240,80)); + // Only w2 and w3 grow vertically, so when they have a fixed vertical size policy, + // the whole layout cannot grow vertically. + if (w2_fixed && w3_fixed) + QCOMPARE(layout->maximumSize(), QSizeF(QWIDGETSIZE_MAX,80)); + else + QCOMPARE(layout->maximumSize(), QSizeF(QWIDGETSIZE_MAX,QWIDGETSIZE_MAX)); +} + +void tst_QGraphicsGridLayout::spanningItem() +{ + QGraphicsWidget *form = new QGraphicsWidget(0, Qt::Window); + QGraphicsGridLayout *layout = new QGraphicsGridLayout(form); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + + QGraphicsWidget *w1 = new QGraphicsWidget; + w1->setMinimumSize(80,80); + w1->setMaximumSize(80,80); + + QGraphicsWidget *w2 = new QGraphicsWidget; + w2->setMinimumSize(80,38); + w2->setPreferredSize(80,38); + w2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + + QGraphicsWidget *w3 = new QGraphicsWidget; + w3->setMinimumSize(80,38); + w3->setPreferredSize(80,38); + w3->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + + layout->addItem(w1, 0, 0, 2, 1); + layout->addItem(w2, 0, 1); + layout->addItem(w3, 1, 1); + + QCOMPARE(layout->minimumSize(), QSizeF(160,80)); + QCOMPARE(layout->maximumSize(), QSizeF(160,80)); +} + void tst_QGraphicsGridLayout::stretchAndHeightForWidth() { QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); -- cgit v0.12 From 570e7b38487455d394b5b74a59edc639f3dc416f Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 13 Jan 2011 15:52:17 +0200 Subject: Fix QSystemSemaphore handle management issues in Symbian QSystemSemaphore native RSemaphore handle was unnecessarily created again on each acquire. The creation logic was also susceptible for random failures when two or more threads tried simultaneously acquire the semaphore. Task-number: QTBUG-16615 Reviewed-by: Janne Koskinen --- src/corelib/kernel/qsystemsemaphore_symbian.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qsystemsemaphore_symbian.cpp b/src/corelib/kernel/qsystemsemaphore_symbian.cpp index a25a119..07cfffc 100644 --- a/src/corelib/kernel/qsystemsemaphore_symbian.cpp +++ b/src/corelib/kernel/qsystemsemaphore_symbian.cpp @@ -73,6 +73,9 @@ void QSystemSemaphorePrivate::setErrorString(const QString &function, int err) case KErrInUse: errorString = QCoreApplication::tr("%1: out of resources", "QSystemSemaphore").arg(function); error = QSystemSemaphore::OutOfResources; + case KErrPermissionDenied: + errorString = QCoreApplication::tr("%1: permission denied", "QSystemSemaphore").arg(function); + error = QSystemSemaphore::PermissionDenied; break; default: errorString = QCoreApplication::tr("%1: unknown error %2", "QSystemSemaphore").arg(function).arg(err); @@ -86,15 +89,24 @@ default: int QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode) { + if (semaphore.Handle()) { + return semaphore.Handle(); + } + // don't allow making handles on empty keys if (key.isEmpty()) return 0; + QString safeName = makeKeyFileName(); TPtrC name(qt_QString2TPtrC(safeName)); - int err; - err = semaphore.OpenGlobal(name,EOwnerProcess); - if (err == KErrNotFound){ - err = semaphore.CreateGlobal(name,initialValue, EOwnerProcess); + int err = KErrAlreadyExists; + int tryCount = 10; + // Sort out race conditions by retrying several times until existing handle is acquired. + // Sometimes opening can fail inexplicably with KErrPermissionDenied many times in a row. + while (err != KErrNoMemory && err != KErrNone && tryCount-- >= 0) { + err = semaphore.CreateGlobal(name, initialValue, EOwnerProcess); + if (err != KErrNoMemory && err != KErrNone) + err = semaphore.OpenGlobal(name,EOwnerProcess); } if (err){ setErrorString(QLatin1String("QSystemSemaphore::handle"),err); -- cgit v0.12 From c67b4cda2f5a7afd401ec3106e3a7b018fd9881d Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 13 Jan 2011 16:08:42 +0200 Subject: Fix QSharedMemory and QSystemSemaphore autotests for Symbian Reviewed-by: Janne Koskinen --- tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp | 10 +++++----- tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp index 5825524..50205bc 100644 --- a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp +++ b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp @@ -51,7 +51,7 @@ #define EXISTING_SIZE 1024 #ifdef Q_OS_SYMBIAN -#define SRCDIR "c:/data/qsharedmemorytemp/" +#define SRCDIR "c:/data/qsharedmemorytemp/lackey/" #define LACKEYDIR SRCDIR "lackey" #elif defined(Q_OS_WINCE) #define LACKEYDIR SRCDIR @@ -624,6 +624,10 @@ public: QVERIFY(producer.isAttached()); char *memory = (char*)producer.data(); memory[1] = '0'; +#if defined(Q_OS_SYMBIAN) + // Sleep a while to ensure that consumers start properly + QTest::qSleep(1000); +#endif QTime timer; timer.start(); int i = 0; @@ -645,10 +649,6 @@ public: memory[0] = 'E'; QVERIFY(producer.unlock()); -#if defined(Q_OS_SYMBIAN) - // Sleep a while to ensure that consumers start properly - QTest::qSleep(1000); -#endif } private: diff --git a/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro b/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro index 8a5f8b2..e21e5df 100644 --- a/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro +++ b/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro @@ -1,4 +1,4 @@ -CONFIG += qttest_p4 +load(qttest_p4) #QT = core include(../qsharedmemory/src/src.pri) @@ -31,5 +31,8 @@ QT += script lackey.sources = ../lackey/lackey.exe lackey.path = /sys/bin DEPLOYMENT += lackey + +# PowerMgmt capability needed to kill lackey process +TARGET.CAPABILITY = PowerMgmt } -- cgit v0.12 From 46ede046a34c822c612c55fdb1dc93dffe3fc6b6 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 13 Jan 2011 15:16:03 +0100 Subject: Proper fix for QGraphicsItem crash. See 8ffb49a4ac68b1c243b25343053e6e99f97ec2e7 Task-number: QTBUG-16374 Reviewed-by: TrustMe --- src/gui/graphicsview/qgraphicsitem.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index a892094..52e4d79 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -5592,9 +5592,8 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem, QGraphicsItem if (parent->d_ptr->subFocusItem != q_ptr) break; parent->d_ptr->subFocusItem = 0; - if (parent == stopItem) - break; - parent->d_ptr->subFocusItemChange(); + if (parent != stopItem && !parent->isAncestorOf(stopItem)) + parent->d_ptr->subFocusItemChange(); } while (!parent->isPanel() && (parent = parent->d_ptr->parent)); } -- cgit v0.12 From 4d0cd05e98c3e83a4d1871c139cd8b4a2a86e988 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Thu, 13 Jan 2011 13:43:56 +0100 Subject: Fix system proxy test: QNetworkProxyFactory::systemProxyForQuery() is static The test failed to build because QNetworkProxyFactory can't be instantiated (pure virtual member queryProxy()), but doing so isn't necessary. The test has also been removed from the network tests because it relies on a static configuration, but can not guarantee that the configuration exists. --- tests/auto/network.pro | 1 - tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro | 2 +- tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory_symbian.cpp | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/auto/network.pro b/tests/auto/network.pro index 2e3b5cd..31c754c 100644 --- a/tests/auto/network.pro +++ b/tests/auto/network.pro @@ -25,7 +25,6 @@ SUBDIRS=\ qnetworkcookiejar \ qnetworkinterface \ qnetworkproxy \ - qnetworkproxyfactory \ qnetworkrequest \ qnetworksession \ qobjectperformance \ diff --git a/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro b/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro index 81460a1..369b5fa 100644 --- a/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro +++ b/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro @@ -5,7 +5,7 @@ load(qttest_p4) QT = core network -SOURCES += tst_qnetworkproxyfactory_symbian.cpp +symbian: SOURCES += tst_qnetworkproxyfactory_symbian.cpp symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory_symbian.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory_symbian.cpp index 6a8ea79..31521c3 100644 --- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory_symbian.cpp +++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory_symbian.cpp @@ -68,9 +68,8 @@ QString tst_QNetworkProxyFactory_symbian::formatProxyName(const QNetworkProxy & void tst_QNetworkProxyFactory_symbian::systemProxyForQuery() const { - QNetworkProxyFactory proxyFactory; QNetworkProxyQuery query(QUrl(QString("http://www.abc.com")), QNetworkProxyQuery::UrlRequest); - QList systemProxyList = proxyFactory.systemProxyForQuery(query); + QList systemProxyList = QNetworkProxyFactory::systemProxyForQuery(query); bool pass = true; QNetworkProxy proxy; -- cgit v0.12 From 5207e48e469e279fe20304914e92edd73c5c641f Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 14 Jan 2011 10:51:53 +1000 Subject: Clarify Component.createObject(null) behavior. Setting the parent of the returned item does not affect its object ownership so care must be taken to ensure it is not garbage collected. Task-number: QTBUG-16630 Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarativecomponent.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index e2cbdcf..f716f85 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -627,6 +627,10 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent} property, or else the object will not be visible. + If a \a parent is not provided to createObject(), a reference to the returned object must be held so that + it is not destroyed by the garbage collector. This is regardless of Item.parent being set afterwards, + since setting the Item parent does not change object ownership; only the graphical parent is changed. + Dynamically created instances can be deleted with the \c destroy() method. See \l {Dynamic Object Management in QML} for more information. */ -- cgit v0.12 From 4f9c026a02c2ecf0d19e7aee4ecae82e64cbaee8 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 14 Jan 2011 10:57:21 +1000 Subject: Fix memory leak Task-number: QTBUG-16526 --- src/declarative/qml/qdeclarativevme.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 6d49625..fb07bef 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -938,8 +938,13 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, if (bindValues.count) ep->bindValues << bindValues; + else if (bindValues.values) + bindValues.clear(); + if (parserStatus.count) ep->parserStatus << parserStatus; + else if (parserStatus.values) + parserStatus.clear(); Q_ASSERT(stack.count() == 1); return stack.top(); -- cgit v0.12 From 22a00ee975545704cd0d70314f45f3b3ecf7ab01 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 14 Jan 2011 16:14:17 +1000 Subject: Autotest for QVariant value types --- .../qdeclarativevaluetypes/data/variant_read.qml | 9 +++++++++ tests/auto/declarative/qdeclarativevaluetypes/testtypes.h | 3 +++ .../qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp | 14 ++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativevaluetypes/data/variant_read.qml diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/variant_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/variant_read.qml new file mode 100644 index 0000000..a08f3db --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/variant_read.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + property real s_width: variant.width + property real s_height: variant.height + property variant copy: variant +} + + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h index 86cbaa5..104d22f 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h @@ -76,6 +76,7 @@ class MyTypeObject : public QObject Q_PROPERTY(QQuaternion quaternion READ quaternion WRITE setQuaternion NOTIFY changed) Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY changed) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed) + Q_PROPERTY(QVariant variant READ variant NOTIFY changed) public: MyTypeObject() : @@ -152,6 +153,8 @@ public: QFont font() c