From 87fb186c553d0875c92938a6fd5a9aaf8d69a057 Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Mon, 9 Nov 2009 13:56:46 +1000 Subject: Don't reset view if a query fails. The view of a table gets reset if for example a query fails. However this also resets and removes the Header views of the table. A better solution visually is to keep them displayed. Task-number: QTBUG-3162 --- src/sql/models/qsqlquerymodel.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp index 1719239..319055e 100644 --- a/src/sql/models/qsqlquerymodel.cpp +++ b/src/sql/models/qsqlquerymodel.cpp @@ -314,6 +314,7 @@ void QSqlQueryModel::setQuery(const QSqlQuery &query) QSqlRecord newRec = query.record(); bool columnsChanged = (newRec != d->rec); bool hasQuerySize = query.driver()->hasFeature(QSqlDriver::QuerySize); + bool hasNewData = (newRec != QSqlRecord()) || !query.lastError().isValid(); if (d->colOffsets.size() != newRec.count() || columnsChanged) d->initColOffsets(newRec.count()); @@ -328,13 +329,13 @@ void QSqlQueryModel::setQuery(const QSqlQuery &query) d->error = QSqlError(); d->query = query; d->rec = newRec; - + if (mustClearModel) endRemoveRows(); - - d->atEnd = false; - if (columnsChanged) + d->atEnd = false; + + if (columnsChanged && hasNewData) reset(); if (!query.isActive() || query.isForwardOnly()) { -- cgit v0.12 From a5fd2b16e292546d9113fe1bdf844e7acfc21cd7 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 18 Nov 2009 11:02:21 +0100 Subject: Complement Phonon for Symbian documentation. Reviewed-by: Gareth Stockwell --- doc/src/platforms/platform-notes.qdoc | 8 ++++++-- src/plugins/phonon/phonon.pro | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index 9896b08..c7477bc 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -416,7 +416,7 @@ \section1 Multimedia and Phonon Support - Qt provides a backend for Qt's multimedia module, Phonon, which supports + Qt provides a backend for Qt's Phonon module, which supports video and sound playback through Symbian's Multimedia Framework, MMF. In this release the support is experimental. Video playback may have @@ -429,7 +429,11 @@ In addition, there exists a backend for the Helix framework. However, due to it not shipping with Qt, its availability depends on the Symbian - platform in use. If available, it is loaded instead of the MMF plugin. + platform in use. If available, it is loaded in preference over the MMF + plugin. The Helix plugin requires Symbian signed capabilities. If the + application does not have those capabilities, the MMF plugin, if present on + the device, will be loaded instead. The capabilities the Helix backend + requires are AllFiles, DiskAdmin and MultimediaDD. */ diff --git a/src/plugins/phonon/phonon.pro b/src/plugins/phonon/phonon.pro index 814a062..803d8f9 100644 --- a/src/plugins/phonon/phonon.pro +++ b/src/plugins/phonon/phonon.pro @@ -7,4 +7,8 @@ mac:contains(QT_CONFIG, phonon-backend): SUBDIRS *= qt7 win32:!wince*:contains(QT_CONFIG, phonon-backend): SUBDIRS *= ds9 wince*:contains(QT_CONFIG, phonon-backend): SUBDIRS *= waveout wince*:contains(QT_CONFIG, directshow): SUBDIRS *= ds9 + +# Note that the MMF backend is in some scenarios an important complement to the +# Helix backend: the latter requires Symbian signed capabilities, hence MMF +# provides multimedia for self signed scenarios. symbian:contains(QT_CONFIG, phonon-backend): SUBDIRS *= mmf -- cgit v0.12 From 6be49367ad4a975a50c0407e768e098b56d317cd Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 18 Nov 2009 12:59:55 +0100 Subject: Symbian support: incorporate feedback from Lars. Reviewed-by: Espen Riskedal Reviewed-by: Frans Englich --- doc/src/platforms/symbian-support.qdoc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/doc/src/platforms/symbian-support.qdoc b/doc/src/platforms/symbian-support.qdoc index 916eda5..3c2bbf1 100644 --- a/doc/src/platforms/symbian-support.qdoc +++ b/doc/src/platforms/symbian-support.qdoc @@ -60,11 +60,11 @@ As with every supported platform, we will strive to maintain application behavior and binary compatibility throughout the lifetime of - the Qt 4.x series. However, due to the fact that Symbian support is - newly added in 4.6.0, it is possible that minor corrections to the - behavior and to the ABI in 4.6.1 will be required in order to ensure - compatibility going forward. If we break the binary compatiblity promise, - we will document such changes in the 4.6.1 release. + the Qt 4.x series. However, due to the fact that Symbian support is newly + added in 4.6.0, there is a slight possibility that minor corrections to the + ABI might be required in 4.6.1, in order to ensure compatibility going + forward. Any such change will be clearly documented in the release notes + for 4.6.1. \section1 Supported Devices @@ -99,11 +99,11 @@ \header \o Technology \o Note \row \o QtConcurrent - \o + \o Planned for some future release \row \o QtDBus \o No current plans to support this feature. - \row \o QtOpenGL - \o Support for OpenGL ES planned for a future release. + \row \o QtOpenGL ES + \o Planned for some future release \row \o Printing support \o No current plans to support this feature. \row \o Qt3Support @@ -119,7 +119,8 @@ \o The only driver supported is SQLite. \row \o QtMultimedia \o Although the module itself is supported, no backend for Symbian - is available. However, there is a backend available for Phonon. + is currently available. However, there is a backend available + for Phonon. \endtable \section1 Known Issues -- cgit v0.12 From 70b121ca310c99269bb08161000215f09b41a84b Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 18 Nov 2009 13:14:35 +0100 Subject: Incorporate feedback from marketing. --- doc/src/platforms/platform-notes.qdoc | 104 ++++++++++++++++++++++++++------- doc/src/platforms/symbian-support.qdoc | 90 ---------------------------- 2 files changed, 83 insertions(+), 111 deletions(-) diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index c7477bc..eaccad8 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -406,34 +406,96 @@ \page platform-notes-symbian.html \title Platform Notes - Symbian \contentspage Platform Notes + \ingroup platform-specific + \brief Information about the state of support for the Symbian platform. - This page contains information about the Symbian platforms Qt is currently known - to run on. More information about the combinations of platforms and compilers - supported by Qt can be found on the \l{Supported Platforms} page. + As with any port, the maturity for Qt for Symbian has not yet reached the + same level as other established Qt ports. This page documents the current + notes for the Symbian port. + + \section1 Source Compatibility + + Qt for Symbian provides the same level of source compatibility guarantee as + given for other platforms.  That is, a program which compiles against a given + version of Qt for Symbian will also compile against all future versions of the + same major release. + + \section1 Binary Compatibility + + As with every supported platform, we will strive to maintain + application behavior and binary compatibility throughout the lifetime of + the Qt 4.x series. However, due to the fact that Symbian support is newly + added in 4.6.0, there is a slight possibility that minor corrections to the + application binary interface (ABI) might be required in 4.6.1, in order to + ensure compatibility going forward. Any such change will be clearly + documented in the release notes for 4.6.1. - For information about mixing exceptions with Symbian leaves, - see \l{Exception Safety with Symbian} + \section1 Supported Devices - \section1 Multimedia and Phonon Support + Qt is designed to work on any device which runs one of the following + versions of Symbian: - Qt provides a backend for Qt's Phonon module, which supports - video and sound playback through Symbian's Multimedia Framework, MMF. + \table + \header \o Symbian Version + \row \o S60 3.1 + \row \o S60 3.2 + \row \o S60 5.0 (Symbian ^1) + \endtable + + Qt has received \l{Tier 1 Platforms}{Tier 1} testing on the following phone models: + + \table + \header \o Phone + \row \o Nokia 5800 + \row \o Nokia E71 + \row \o Nokia E72 + \row \o Nokia N78 + \row \o Nokia N95 + \row \o Nokia N97 + \row \o Samsung i8910 + \endtable + + \section1 Supported Functionality + + The following technologies and classes are not currently supported: + + \table + \header \o Technology + \o Note + \row \o QtConcurrent + \o Planned for future release. + \row \o QtDBus + \o No current plans to support this feature. + \row \o QtOpenGL ES + \o Planned for future release. + \row \o Printing support + \o No current plans to support this feature. + \row \o Qt3Support + \o No current plans to support this feature. + \endtable + + The following technologies have limited support: + + \table + \header \o Technology + \o Note + \row \o QtSql + \o The only driver supported is SQLite. + \row \o QtMultimedia + \o Although the module itself is supported, no backend for Symbian + is currently available. However, there is a backend available + for Phonon. + \endtable - In this release the support is experimental. Video playback may have - flickering issues, and support for effects and playback queueing is - incomplete. + \section1 Known Issues - The audio and video formats that Phonon supports depends on what support - the platform provides for MMF. The emulator is known to have limited - codec support. + Known issues can be found by visiting the + \l{http://qt.gitorious.org/qt/pages/Qt460KnownIssues}{wiki page} with an + up-to-date list of known issues, and the list of bugs can be found by + \l{http://bugreports.qt.nokia.com/browse/QTBUG/component/19171}{browsing} the + S60 component in Qt's public task tracker, located at + \l{http://bugreports.qt.nokia.com/}{http://bugreports.qt.nokia.com/}. - In addition, there exists a backend for the Helix framework. However, due - to it not shipping with Qt, its availability depends on the Symbian - platform in use. If available, it is loaded in preference over the MMF - plugin. The Helix plugin requires Symbian signed capabilities. If the - application does not have those capabilities, the MMF plugin, if present on - the device, will be loaded instead. The capabilities the Helix backend - requires are AllFiles, DiskAdmin and MultimediaDD. */ diff --git a/doc/src/platforms/symbian-support.qdoc b/doc/src/platforms/symbian-support.qdoc index 3c2bbf1..0247bdb 100644 --- a/doc/src/platforms/symbian-support.qdoc +++ b/doc/src/platforms/symbian-support.qdoc @@ -42,95 +42,5 @@ /*! \page symbian-support.html \title Qt for Symbian - \ingroup platform-specific - \brief Information about the state of support for the Symbian platform. - - Qt for Symbian is not yet fully on a par with other platforms with respect - to stability and feature support. This page documents the current shortcomings - of the Symbian port. - - \section1 Source Compatibility - - Qt for Symbian provides the same level of source compatibility guarantee as - given for other platforms.  That is, a program which compiles against a given - version of Qt for Symbian will also compile against all future versions of the - same major release. - - \section1 Binary Compatibility - - As with every supported platform, we will strive to maintain - application behavior and binary compatibility throughout the lifetime of - the Qt 4.x series. However, due to the fact that Symbian support is newly - added in 4.6.0, there is a slight possibility that minor corrections to the - ABI might be required in 4.6.1, in order to ensure compatibility going - forward. Any such change will be clearly documented in the release notes - for 4.6.1. - - \section1 Supported Devices - - Qt should generally work on any device which runs one of the following - versions of Symbian: - - \table - \header \o Symbian Version - \row \o S60 3.1 - \row \o S60 3.2 - \row \o S60 5.0 (Symbian ^1) - \endtable - - Qt has received Tier 1 testing on the following phone models: - - \table - \header \o Phone - \row \o Nokia 5800 - \row \o Nokia E71 - \row \o Nokia E72 - \row \o Nokia N78 - \row \o Nokia N95 - \row \o Nokia N97 - \row \o Samsung i8910 - \endtable - - \section1 Supported Functionality - - The following technologies and classes are not currently supported: - - \table - \header \o Technology - \o Note - \row \o QtConcurrent - \o Planned for some future release - \row \o QtDBus - \o No current plans to support this feature. - \row \o QtOpenGL ES - \o Planned for some future release - \row \o Printing support - \o No current plans to support this feature. - \row \o Qt3Support - \o No current plans to support this feature. - \endtable - - The following technologies have limited support: - - \table - \header \o Technology - \o Note - \row \o QtSql - \o The only driver supported is SQLite. - \row \o QtMultimedia - \o Although the module itself is supported, no backend for Symbian - is currently available. However, there is a backend available - for Phonon. - \endtable - - \section1 Known Issues - - Known issues can be found by visiting the - \l{http://qt.gitorious.org/qt/pages/Qt460KnownIssues}{wiki page} with an - up-to-date list of known issues, and the list of bugs can be found by - \l{http://bugreports.qt.nokia.com/browse/QTBUG/component/19171}{browsing} the - S60 component in Qt's public task tracker, located at - \l{http://bugreports.qt.nokia.com/}{http://bugreports.qt.nokia.com/}. - */ -- cgit v0.12 From 952f0ca3f371b040bd8b8a007cdf87bf0e4843ad Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 18 Nov 2009 14:47:42 +0200 Subject: Changed MIF filename from UID to target name in Symbian. This change makes it possible to define ICON keyword in pro file without UID3. It is safe to use target as an icon name since Symbian devices cannot have two different binaries with the same name as all binaries are located in \sys\bin. This means there cannot be also two mif files with same target name. Also all native S60 apps use target name as an MIF basename. Target name is also much easier to associate with app than UID. Task-number: QTBUG-4677 Reviewed-by: Miikka Heikkinen --- mkspecs/features/symbian/application_icon.prf | 30 ++++++++++++++++++--------- qmake/generators/symbian/symmake.cpp | 21 ++++++++++--------- qmake/generators/symbian/symmake.h | 4 ++-- qmake/generators/symbian/symmake_abld.cpp | 3 ++- qmake/generators/symbian/symmake_abld.h | 2 +- qmake/generators/symbian/symmake_sbsv2.cpp | 7 +++++-- qmake/generators/symbian/symmake_sbsv2.h | 2 +- 7 files changed, 42 insertions(+), 27 deletions(-) diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index b0c1bb1..62fd018 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -3,38 +3,48 @@ load(data_caging_paths) # If no_icon keyword exist, the S60 UI app is just made hidden. This because S60 app FW # requires the registration resource file to exist always contains( CONFIG, no_icon ) { - symbian:RSS_RULES ="hidden = KAppIsHidden;" + symbian:RSS_RULES ="hidden = KAppIsHidden;" CONFIG -= no_icon } else { # There is no point in compiling the MIF icon if no_icon CONFIGS is set !isEmpty(ICON) { - + !count(ICON, $$size(TRANSLATIONS)):!count(ICON, 1) { message("ICON keyword must have one or the same amout of items as in TRANSLATIONS keyword") } - # MIF files will have UID in their names, if TARGET.UID3 is not set, remind the user - isEmpty(TARGET.UID3):error("TARGET.UID3 must be explicitly defined for ICON generation") + # Try to produce indentical string to fixedTarget in SymbianMakefileGenerator, replaced chars taken + # from SymbianMakefileGenerator::removeSpecialCharacters. + # + # Note: it is not a major problem even baseTarget is not 100% identical to fixedTarget since qmake + # only uses filename from RSS_RULES.icon_file when referring to icon file name. + baseTarget = $$basename(TARGET) + baseTarget = $$replace(baseTarget, /,_) + baseTarget = $$replace(baseTarget, \\,_) + baseTarget = $$replace(baseTarget, -,_) + baseTarget = $$replace(baseTarget, :,_) + baseTarget = $$replace(baseTarget, \.,_) + baseTarget = $$replace(baseTarget, " ",_) # Note: symbian-sbsv2 builds can't utilize extra compiler for mifconv, so ICON handling is done in code - symbian-abld { - #Makefile: requires paths with backslash + symbian-abld { + #Makefile: requires paths with backslash ICON = $$replace( ICON, /, \\) # Extra compiler rules for mifconv - mifconv.output = ${ZDIR}$$APP_RESOURCE_DIR/$${TARGET.UID3}.mif + mifconv.output = ${ZDIR}$$APP_RESOURCE_DIR/$${baseTarget}.mif # Based on: http://www.forum.nokia.com/document/Cpp_Developers_Library # svg-t icons should always use /c32 depth - mifconv.commands = mifconv ${QMAKE_FILE_OUT} $$join(ICON, " /c32 ", "/c32 ",) + mifconv.commands = mifconv ${QMAKE_FILE_OUT} $$join(ICON, " /c32 ", "/c32 ",) mifconv.input = ICON mifconv.CONFIG = no_link combine # target_predeps together with combine seems not to work correctly, lets define it by ourselves PRE_TARGETDEPS += $$mifconv.output QMAKE_EXTRA_COMPILERS += mifconv - } + } # Rules to use generated MIF file from symbian resources RSS_RULES.number_of_icons = $$size(ICON) - RSS_RULES.icon_file = $$replace( APP_RESOURCE_DIR, /, \\\\ )\\\\$${TARGET.UID3}.mif + RSS_RULES.icon_file = $$APP_RESOURCE_DIR/$${baseTarget}.mif } } diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 1326a49..afaf338 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -209,7 +209,7 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) generatePkgFile(iconFile); } - writeBldInfContent(t, generatePkg); + writeBldInfContent(t, generatePkg, iconFile); // Generate empty wrapper makefile here, because wrapper makefile must exist before writeMkFile, // but all required data is not yet available. @@ -378,14 +378,11 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile) .arg(installPathRegResource) .arg(fixedTarget + "_reg.rsc") << endl; - QString myIconFile = iconFile; - myIconFile = myIconFile.replace("\\\\", "\\"); - if (!iconFile.isEmpty()) { t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"") .arg(epocRoot()) - .arg(QString(myIconFile).replace('\\','/')) - .arg(myIconFile) << endl << endl; + .arg(iconFile) + .arg(QDir::toNativeSeparators(iconFile)) << endl << endl; } } } @@ -1120,7 +1117,7 @@ void SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) } } -void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension) +void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension, const QString &iconFile) { // Read user defined bld inf rules @@ -1242,7 +1239,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy // Generate extension rules - writeBldInfExtensionRulesPart(t); + writeBldInfExtensionRulesPart(t, iconFile); userItems = userBldInfRules.value(BLD_INF_TAG_EXTENSIONS); foreach(QString item, userItems) @@ -1320,14 +1317,17 @@ void SymbianMakefileGenerator::writeRssFile(QString &numberOfIcons, QString &ico t << "\t\t{" << endl; t << "\t\tcaption = STRING_r_caption;" << endl; - if (numberOfIcons.isEmpty() || iconFile.isEmpty()) { + QString rssIconFile = iconFile; + rssIconFile = rssIconFile.replace("/", "\\\\"); + + if (numberOfIcons.isEmpty() || rssIconFile.isEmpty()) { // There can be maximum one item in this tag, validated when parsed t << "\t\tnumber_of_icons = 0;" << endl; t << "\t\ticon_file = \"\";" << endl; } else { // There can be maximum one item in this tag, validated when parsed t << "\t\tnumber_of_icons = " << numberOfIcons << ";" << endl; - t << "\t\ticon_file = \"" << iconFile << "\";" << endl; + t << "\t\ticon_file = \"" << rssIconFile << "\";" << endl; } t << "\t\t};" << endl; t << "\t}" << endl; @@ -1697,6 +1697,7 @@ void SymbianMakefileGenerator::generateCleanCommands(QTextStream& t, void SymbianMakefileGenerator::removeSpecialCharacters(QString& str) { + // When modifying this method check also application_icon.prf str.replace(QString("/"), QString("_")); str.replace(QString("\\"), QString("_")); str.replace(QString("-"), QString("_")); diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index a3e2c17..2e78c46 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -99,7 +99,7 @@ protected: void checkOverridability(QStringList &overridableKeywords, QString &checkString); void writeHeader(QTextStream &t); - void writeBldInfContent(QTextStream& t, bool addDeploymentExtension); + void writeBldInfContent(QTextStream& t, bool addDeploymentExtension, const QString &iconFile); static bool removeDuplicatedStrings(QStringList& stringList); @@ -143,7 +143,7 @@ protected: void generateDistcleanTargets(QTextStream& t); // Subclass implements - virtual void writeBldInfExtensionRulesPart(QTextStream& t) = 0; + virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) = 0; virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) = 0; virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0; virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) = 0; diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 1b5464f..6225720 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -379,10 +379,11 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool } } -void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) +void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) { // We don't use extensions for anything in abld Q_UNUSED(t); + Q_UNUSED(iconTargetFile); } bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t) diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h index 11b9cd1..56d31e1 100644 --- a/qmake/generators/symbian/symmake_abld.h +++ b/qmake/generators/symbian/symmake_abld.h @@ -51,7 +51,7 @@ class SymbianAbldMakefileGenerator : public SymbianMakefileGenerator protected: // Inherited from parent - virtual void writeBldInfExtensionRulesPart(QTextStream& t); + virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile); virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly); virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 5e624de..4fd5833 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -238,7 +238,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo } } -void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) +void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile) { // Makes sure we have needed FLMs in place. exportFlm(); @@ -379,9 +379,12 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t QString iconPath = iconInfo.path(); QString iconFile = iconInfo.baseName(); + QFileInfo iconTargetInfo = fileInfo(iconTargetFile); + QString iconTarget = iconTargetInfo.fileName(); + t << "OPTION SOURCES -c32 " << iconFile << endl; t << "OPTION SOURCEDIR " << iconPath << endl; - t << "OPTION TARGETFILE " << uid3 << ".mif" << endl; + t << "OPTION TARGETFILE " << iconTarget << endl; t << "OPTION SVGENCODINGVERSION 3" << endl; // Compatibility with S60 3.1 devices and up t << "END" << endl; } diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h index 9472b68..3394908 100644 --- a/qmake/generators/symbian/symmake_sbsv2.h +++ b/qmake/generators/symbian/symmake_sbsv2.h @@ -51,7 +51,7 @@ class SymbianSbsv2MakefileGenerator : public SymbianMakefileGenerator protected: // Inherited from parent - virtual void writeBldInfExtensionRulesPart(QTextStream& t); + virtual void writeBldInfExtensionRulesPart(QTextStream& t, const QString &iconTargetFile); virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly); virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); -- cgit v0.12 From 9a4995711746103286ea3fb9cc576e133fd29e4e Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 18 Nov 2009 15:36:35 +0100 Subject: Symbian docs: Repair some documentation damage, remove obsolete file. Reviewed-by: TrustMe --- doc/src/platforms/platform-notes.qdoc | 23 +++++++++++++++ doc/src/platforms/supported-platforms.qdoc | 2 +- doc/src/platforms/symbian-support.qdoc | 46 ------------------------------ 3 files changed, 24 insertions(+), 47 deletions(-) delete mode 100644 doc/src/platforms/symbian-support.qdoc diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index eaccad8..68015a6 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -496,6 +496,29 @@ S60 component in Qt's public task tracker, located at \l{http://bugreports.qt.nokia.com/}{http://bugreports.qt.nokia.com/}. + For information about mixing exceptions with Symbian leaves, see + \l{Exception Safety with Symbian}. + + \section1 Multimedia and Phonon Support + + Qt provides a backend for Qt's Phonon module, which supports + video and sound playback through Symbian's Multimedia Framework, MMF. + + In this release the support is experimental. Video playback may have + flickering issues, and support for effects and playback queueing is + incomplete. + + The audio and video formats that Phonon supports depends on what support + the platform provides for MMF. The emulator is known to have limited + codec support. + + In addition, there exists a backend for the Helix framework. However, due + to it not shipping with Qt, its availability depends on the Symbian + platform in use. If available, it is loaded in preference over the MMF + plugin. The Helix plugin requires Symbian signed capabilities. If the + application does not have those capabilities, the MMF plugin, if present on + the device, will be loaded instead. The capabilities the Helix backend + requires are AllFiles, DiskAdmin and MultimediaDD. */ diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index 2b4792f..560ddfe 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -89,7 +89,7 @@ \o gcc (\l{http://www.codesourcery.com/}{Codesourcery version)} \row \o Windows CE 5.0 (ARMv4i, x86, MIPS) \o MSVC 2005 WinCE 5.0 Standard (x86, pocket, smart, mipsii) - \row \o \l {Qt for Symbian} {Symbian (S60 3.1, 3.2 and 5.0)} + \row \o Symbian (S60 3.1, 3.2 and 5.0) \o RVCT, GCCE, WINSCW \endtable diff --git a/doc/src/platforms/symbian-support.qdoc b/doc/src/platforms/symbian-support.qdoc deleted file mode 100644 index 0247bdb..0000000 --- a/doc/src/platforms/symbian-support.qdoc +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page symbian-support.html - \title Qt for Symbian -*/ - -- cgit v0.12 From 0f9c96ead0ae5d52827ae0f0b277178cd2103e46 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 18 Nov 2009 18:44:51 +0100 Subject: Fix tst_QTextLayout::testTabDPIScale on Symbian hardware Increased the sample positions of the tabs a bit in order to pass also un high DPI devices such as the XpressMusic 5800. The former positions were too narrow under high DPI, and overlapped by the text. Reviewed-By: Liang Qi --- tests/auto/qtextlayout/tst_qtextlayout.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 7c3f4f2..1df26b8 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -1115,14 +1115,14 @@ void tst_QTextLayout::testTabDPIScale() QTextOption option = layout.textOption(); QList tabs; QTextOption::Tab tab; - tab.position = 200; + tab.position = 300; tabs.append(tab); - tab.position = 400; + tab.position = 600; tab.type = QTextOption::RightTab; tabs.append(tab); - tab.position = 600; + tab.position = 800; tab.type = QTextOption::CenterTab; tabs.append(tab); option.setTabs(tabs); -- cgit v0.12 From 6340cf327515252ffbb21e98486e9abfc713149e Mon Sep 17 00:00:00 2001 From: Iain Date: Wed, 18 Nov 2009 22:33:30 +0100 Subject: Disable linker warning 6780 in RVCT builds for Symbian OS The linker warning that indicates symbol visibility changes is not useful as it is an expected change to symbol visibility and produces lots of clutter in the build logs. (It is not desirable to follow the ELF spec when it comes to symbol visibility in this case, which is why the linker warns and we ignore it) This is likely to be a Raptor-only issue - I believe abld suppresses the warning by default (at least in ABIv1 mode) Also update gui.pro to use LFLAGS rather than MMP_RULES to alter the arguments to ARMCC toolchain. qmake ought to detect this (incorrect) usage of MMP_RULES and abort MMP file generation - raised QTBU-5961 to look at this. Reviewed-by: Shane Kearns --- mkspecs/features/symbian/armcc_warnings.prf | 3 +++ src/gui/gui.pro | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/symbian/armcc_warnings.prf b/mkspecs/features/symbian/armcc_warnings.prf index 95b3bc0..72bc996 100644 --- a/mkspecs/features/symbian/armcc_warnings.prf +++ b/mkspecs/features/symbian/armcc_warnings.prf @@ -8,3 +8,6 @@ # 2874: may be used before being set (this one sounds useful, but # it's output also for class instances, making it useless in practice) QMAKE_CFLAGS.ARMCC += --diag_suppress 111,185,191,368,1293,1294,2874 + +# 6780: visibility removed from symbol '' through +QMAKE_LFLAGS.ARMCC += --diag_suppress 6780 diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 7c24002..4215f97 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -54,4 +54,4 @@ DEFINES += Q_INTERNAL_QAPP_SRC symbian:TARGET.UID3=0x2001B2DD # ro-section in gui can exceed default allocated space, so more rw-section little further -symbian-sbsv2: MMP_RULES += "LINKEROPTION armcc --rw-base 0x800000" +symbian-sbsv2: QMAKE_LFLAGS.ARMCC += --rw-base 0x800000" -- cgit v0.12 From 48a65c01f219afa1aa49f341083422c718c088ca Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 19 Nov 2009 09:38:43 +0100 Subject: Fixed effects.pro after customshader demo removal Fixes commit 9a0f7a1ef Reviewed-by: Olivier --- examples/effects/effects.pro | 6 ------ 1 file changed, 6 deletions(-) diff --git a/examples/effects/effects.pro b/examples/effects/effects.pro index 2dec8d5..0f062ee 100644 --- a/examples/effects/effects.pro +++ b/examples/effects/effects.pro @@ -5,12 +5,6 @@ SUBDIRS = \ lighting \ fademessage -!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles1cl) { - contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { - SUBDIRS += customshader - } -} - # install target.path = $$[QT_INSTALL_EXAMPLES]/effects sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS effects.pro README -- cgit v0.12 From d2c337d33d02f91b02dfb6f378a3cd42a33d01cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Thu, 19 Nov 2009 10:39:03 +0100 Subject: Convert pointer to string properly on 64 bit systems too. --- tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index bca59c3..baa1ba1 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -167,7 +167,7 @@ public: { setContentsMargins( 0,0,0,0 ); if (name.isEmpty()) - setData(0, QString::fromAscii("w%1").arg(int(this))); + setData(0, QString::fromAscii("w%1").arg(quintptr(this))); else setData(0, name); } -- cgit v0.12 From 16220ada80b5131bfc0017ea5a600d9e36c4a469 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 19 Nov 2009 10:39:12 +0100 Subject: Mark QGraphicsItemAnimation as deprecated Task-number: QTBUG-5968 --- doc/src/frameworks-technologies/graphicsview.qdoc | 14 ++++---------- src/gui/graphicsview/qgraphicsitemanimation.cpp | 1 + 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/doc/src/frameworks-technologies/graphicsview.qdoc b/doc/src/frameworks-technologies/graphicsview.qdoc index 1503f53..ba89c7d 100644 --- a/doc/src/frameworks-technologies/graphicsview.qdoc +++ b/doc/src/frameworks-technologies/graphicsview.qdoc @@ -437,13 +437,10 @@ \section2 Animation Graphics View supports animation at several levels. You can easily - assemble animation paths by associating a QGraphicsItemAnimation with - your item. This allows timeline controlled animations that operate at - a steady speed on all platforms (although the frame rate may vary - depending on the platform's performance). QGraphicsItemAnimation - allows you to create a path for an item's position, rotation, scale, - shear and translation. The animation can be controlled by a QSlider, - or more commonly by QTimeLine. + assemble animation by using the Animation Framework. For that you'll + need your items to inherit from QGraphicsObject and associate + QPropertyAnimation with them. QPropertyAnimation allows to animate any + QObject property. Another option is to create a custom item that inherits from QObject and QGraphicsItem. The item can the set up its own timers, and control @@ -454,9 +451,6 @@ QGraphicsScene::advance(), which in turn calls QGraphicsItem::advance(). - See also the \l{Drag and Drop Robot Example}{Drag and Drop Robot} - example for an illustration of timeline-based animation techniques. - \section2 OpenGL Rendering To enable OpenGL rendering, you simply set a new QGLWidget as the diff --git a/src/gui/graphicsview/qgraphicsitemanimation.cpp b/src/gui/graphicsview/qgraphicsitemanimation.cpp index be2f300..b67ee2e 100644 --- a/src/gui/graphicsview/qgraphicsitemanimation.cpp +++ b/src/gui/graphicsview/qgraphicsitemanimation.cpp @@ -45,6 +45,7 @@ support for QGraphicsItem. \since 4.2 \ingroup graphicsview-api + \deprecated The QGraphicsItemAnimation class animates a QGraphicsItem. You can schedule changes to the item's transformation matrix at -- cgit v0.12 From 132a42c28e35ac69a5af8c2b7d478b86e92b87e4 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 19 Nov 2009 11:08:50 +0100 Subject: Complete QVariantAnimation doc to mention qRegisterAnimationInterpolator Task-number: QTBUG-5970 --- src/corelib/animation/qvariantanimation.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index c735778..d529f67 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -104,15 +104,32 @@ QT_BEGIN_NAMESPACE \o \l{QMetaType::}{QLine} \o \l{QMetaType::}{QLineF} \o \l{QMetaType::}{QPoint} + \o \l{QMetaType::}{QPointF} \o \l{QMetaType::}{QSize} \o \l{QMetaType::}{QSizeF} \o \l{QMetaType::}{QRect} \o \l{QMetaType::}{QRectF} + \o \l{QMetaType::}{QColor} \endlist If you need to interpolate other variant types, including custom types, you have to implement interpolation for these yourself. - You do this by reimplementing interpolated(), which returns + To do this, you can register an interpolator function for a given + type. This function takes 3 parameters: the start value, the end value + and the current progress. + + Example: + \code + QVariant myColorInterpolator(const QColor &start, const QColor &end, qreal progress) + { + ... + return QColor(...); + } + ... + qRegisterAnimationInterpolator(myColorInterpolator); + \endcode + + Another option is to reimplement interpolated(), which returns interpolation values for the value being interpolated. \omit We need some snippets around here. \endomit -- cgit v0.12 From 52ddc754b2426806fe9fa8737ce942dd234c76a5 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 19 Nov 2009 13:12:14 +0100 Subject: Fixes: QCommandLinkButton crop large icons. Task-number: QTBUG-1976 Reviewed-by: Gabi --- src/gui/widgets/qcommandlinkbutton.cpp | 3 +- .../qcommandlinkbutton/tst_qcommandlinkbutton.cpp | 44 ++++++++++++++++++---- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp index 9adf280..8f47f25 100644 --- a/src/gui/widgets/qcommandlinkbutton.cpp +++ b/src/gui/widgets/qcommandlinkbutton.cpp @@ -326,7 +326,8 @@ int QCommandLinkButton::heightForWidth(int width) const Q_D(const QCommandLinkButton); int heightWithoutDescription = d->descriptionOffset() + d->bottomMargin(); // find the width available for the description area - return heightWithoutDescription + d->descriptionHeight(width); + return qMax(heightWithoutDescription + d->descriptionHeight(width), + iconSize().height() + d->topMargin() + d->bottomMargin()); } /*! \reimp */ diff --git a/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp b/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp index 33226bf..f833196 100644 --- a/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp +++ b/tests/auto/qcommandlinkbutton/tst_qcommandlinkbutton.cpp @@ -51,6 +51,7 @@ #include #include #include +#include Q_DECLARE_METATYPE(QCommandLinkButton*) @@ -83,7 +84,8 @@ private slots: void clicked(); void toggled(); void defaultAndAutoDefault(); - void setAutoRepeat(); + void setAutoRepeat(); + void heightForWithWithIcon(); protected slots: void resetCounters(); @@ -106,17 +108,17 @@ private: void tst_QCommandLinkButton::getSetCheck() { QCommandLinkButton obj1; - + QString text("mytext"); QVERIFY(obj1.description().isEmpty()); obj1.setDescription(text); QVERIFY(obj1.description() == text); - + QVERIFY(obj1.text().isEmpty()); obj1.setText(text); QVERIFY(obj1.text() == text); - - + + QMenu *var1 = new QMenu; obj1.setMenu(var1); QCOMPARE(var1, obj1.menu()); @@ -393,8 +395,8 @@ void tst_QCommandLinkButton::setAccel() QTest::qWait(100); } - QVERIFY(testWidget->isActiveWindow()); - + QVERIFY(testWidget->isActiveWindow()); + QTest::keyClick( testWidget, 'A', Qt::AltModifier ); QTest::qWait( 500 ); QVERIFY( click_count == 1 ); @@ -556,5 +558,33 @@ void tst_QCommandLinkButton::defaultAndAutoDefault() } } +void tst_QCommandLinkButton::heightForWithWithIcon() +{ + QWidget mainWin; + + QPixmap pixmap(64, 64); + { + pixmap.fill(Qt::white); + QPainter painter(&pixmap); + painter.setBrush(Qt::black); + painter.drawEllipse(0, 0, 63, 63); + } + + QCommandLinkButton *largeIconButton = new QCommandLinkButton(QString("Large Icon"), + QString("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris nibh lectus, adipiscing eu."), + &mainWin); + largeIconButton->setIconSize(QSize(64, 64)); + largeIconButton->setIcon(pixmap); + + QVBoxLayout *layout = new QVBoxLayout(); + layout->addWidget(largeIconButton); + layout->addStretch(); + mainWin.setLayout(layout); + mainWin.showMaximized(); + QTest::qWaitForWindowShown(&mainWin); + QVERIFY(largeIconButton->height() > 68); //enough room for the icon + +} + QTEST_MAIN(tst_QCommandLinkButton) #include "tst_qcommandlinkbutton.moc" -- cgit v0.12 From 6c6661041fa3dfe7a8915ee1d27443b2ced179de Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 19 Nov 2009 14:09:50 +0200 Subject: Unified ICON keyword handling for ABLD and SBSv2 toolchains. With SBSv2 toolchain only first file from ICON keyword is used and it is actually the right behaviour. Originally support for multiple files in ICON keyword was introduced to support localized application icons. However, in that case the different localized icons should not go to same MIF file since it is not possible to define in .rss file which icon number should be used for which language. To support a localized application icons separate MIF for each locale should be created and installation of ICON should depend on selected language. Implementing proper support for localized icons is left for another task. Task-number: QTBUG-4745 Reviewed-by: Miikka Heikkinen --- mkspecs/features/symbian/application_icon.prf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index 62fd018..4685c08 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -9,8 +9,9 @@ contains( CONFIG, no_icon ) { # There is no point in compiling the MIF icon if no_icon CONFIGS is set !isEmpty(ICON) { - !count(ICON, $$size(TRANSLATIONS)):!count(ICON, 1) { - message("ICON keyword must have one or the same amout of items as in TRANSLATIONS keyword") + !count(ICON, 1) { + ICON = $$first(ICON) + warning("Only first icon specified in ICON variable is used: $$ICON") } # Try to produce indentical string to fixedTarget in SymbianMakefileGenerator, replaced chars taken -- cgit v0.12 From 745db3d1b9a149910dcaa3c65aabab020eefa027 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 19 Nov 2009 14:25:59 +0200 Subject: Use relative paths when invoking mifconv. Some S60 SDK has a bug which make mifconv to crash with absolute paths. Switched to use QMAKE_FILE_IN variable in mifconv.commands instead of using join of ICON keywords. Joining is not needed anymore since ICON keyword supports only one filename. Using input variable (QMAKE_FILE_IN) also esnures that absolute path is converted to relative before invoking mifconv. Task-number: QTBUG-4745 Reviewed-by: Miikka Heikkinen --- mkspecs/features/symbian/application_icon.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index 4685c08..1edbe14 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -36,7 +36,7 @@ contains( CONFIG, no_icon ) { mifconv.output = ${ZDIR}$$APP_RESOURCE_DIR/$${baseTarget}.mif # Based on: http://www.forum.nokia.com/document/Cpp_Developers_Library # svg-t icons should always use /c32 depth - mifconv.commands = mifconv ${QMAKE_FILE_OUT} $$join(ICON, " /c32 ", "/c32 ",) + mifconv.commands = mifconv ${QMAKE_FILE_OUT} /c32 ${QMAKE_FILE_IN} mifconv.input = ICON mifconv.CONFIG = no_link combine # target_predeps together with combine seems not to work correctly, lets define it by ourselves -- cgit v0.12 From 10221602edb39b7c7ed9e0c9608f64a539adcdec Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 19 Nov 2009 13:56:16 +0100 Subject: On main window, the sizegrip visibility was not correctly updated Task-number: QTBUG-4334 Reviewed-by: ogoffart --- src/gui/widgets/qsizegrip.cpp | 29 +++++++++++++++++++++-------- tests/auto/qstatusbar/tst_qstatusbar.cpp | 14 ++++++++++++++ 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/qsizegrip.cpp b/src/gui/widgets/qsizegrip.cpp index cf193dc..6575dbb 100644 --- a/src/gui/widgets/qsizegrip.cpp +++ b/src/gui/widgets/qsizegrip.cpp @@ -99,6 +99,7 @@ public: int dyMax; Qt::Corner m_corner; bool gotMousePress; + QWidget *tlw; #ifdef Q_WS_MAC void updateMacSizer(bool hide) const; #endif @@ -113,6 +114,19 @@ public: return m_corner == Qt::BottomLeftCorner || m_corner == Qt::TopLeftCorner; } + void updateTopLevelWidget() + { + Q_Q(QSizeGrip); + QWidget *w = qt_sizegrip_topLevelWidget(q); + if (tlw == w) + return; + if (tlw) + tlw->removeEventFilter(q); + tlw = w; + if (tlw) + tlw->installEventFilter(q); + } + // This slot is invoked by QLayout when the size grip is added to // a layout or reparented after the tlw is shown. This re-implementation is basically // the same as QWidgetPrivate::_q_showIfNotHidden except that it checks @@ -121,7 +135,7 @@ public: { Q_Q(QSizeGrip); bool showSizeGrip = !(q->isHidden() && q->testAttribute(Qt::WA_WState_ExplicitShowHide)); - QWidget *tlw = qt_sizegrip_topLevelWidget(q); + updateTopLevelWidget(); if (tlw && showSizeGrip) { Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen; #ifndef Q_WS_MAC @@ -232,6 +246,7 @@ void QSizeGripPrivate::init() Q_Q(QSizeGrip); dxMax = 0; dyMax = 0; + tlw = 0; m_corner = q->isLeftToRight() ? Qt::BottomRightCorner : Qt::BottomLeftCorner; gotMousePress = false; @@ -240,8 +255,7 @@ void QSizeGripPrivate::init() ? Qt::SizeFDiagCursor : Qt::SizeBDiagCursor); #endif q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); - QWidget *tlw = qt_sizegrip_topLevelWidget(q); - tlw->installEventFilter(q); + updateTopLevelWidget(); } @@ -524,19 +538,18 @@ void QSizeGrip::setVisible(bool visible) /*! \reimp */ bool QSizeGrip::eventFilter(QObject *o, QEvent *e) { + Q_D(QSizeGrip); if ((isHidden() && testAttribute(Qt::WA_WState_ExplicitShowHide)) - || e->type() != QEvent::WindowStateChange) { + || e->type() != QEvent::WindowStateChange + || o != d->tlw) { return QWidget::eventFilter(o, e); } - QWidget *tlw = qt_sizegrip_topLevelWidget(this); - if (o != tlw) - return QWidget::eventFilter(o, e); Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen; #ifndef Q_WS_MAC sizeGripNotVisibleState |= Qt::WindowMaximized; #endif // Don't show the size grip if the tlw is maximized or in full screen mode. - setVisible(!(tlw->windowState() & sizeGripNotVisibleState)); + setVisible(!(d->tlw->windowState() & sizeGripNotVisibleState)); setAttribute(Qt::WA_WState_ExplicitShowHide, false); return QWidget::eventFilter(o, e); } diff --git a/tests/auto/qstatusbar/tst_qstatusbar.cpp b/tests/auto/qstatusbar/tst_qstatusbar.cpp index 9774559..92d9185 100644 --- a/tests/auto/qstatusbar/tst_qstatusbar.cpp +++ b/tests/auto/qstatusbar/tst_qstatusbar.cpp @@ -77,6 +77,7 @@ private slots: void insertPermanentWidget(); void setSizeGripEnabled(); void task194017_hiddenWidget(); + void QTBUG4334_hiddenOnMaximizedWindow(); private: QStatusBar *testWidget; @@ -257,6 +258,19 @@ void tst_QStatusBar::task194017_hiddenWidget() QVERIFY(!label->isVisible()); } +void tst_QStatusBar::QTBUG4334_hiddenOnMaximizedWindow() +{ + QMainWindow main; + QStatusBar statusbar; + statusbar.setSizeGripEnabled(true); + main.setStatusBar(&statusbar); + main.showMaximized(); + QTest::qWaitForWindowShown(&main); + QVERIFY(!statusbar.findChild()->isVisible()); + main.showNormal(); + QTest::qWaitForWindowShown(&main); + QVERIFY(statusbar.findChild()->isVisible()); +} QTEST_MAIN(tst_QStatusBar) #include "tst_qstatusbar.moc" -- cgit v0.12 From 5bd71902f97ba75dc93ccf709dbfdd2ffeb361b2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 19 Nov 2009 14:48:35 +0100 Subject: Doc: Added placeholder documentation for missing demos and examples. Reviewed-by: Trust Me --- doc/src/demos/anomaly.qdoc | 47 ++++++++++++++ doc/src/demos/desktopservices.qdoc | 47 ++++++++++++++ doc/src/demos/digiflip.qdoc | 45 +++++++++++++ doc/src/demos/embeddedsvgviewer.qdoc | 47 ++++++++++++++ doc/src/demos/flickable.qdoc | 47 ++++++++++++++ doc/src/demos/flightinfo.qdoc | 47 ++++++++++++++ doc/src/demos/fluidlauncher.qdoc | 47 ++++++++++++++ doc/src/demos/lightmaps.qdoc | 47 ++++++++++++++ doc/src/demos/raycasting.qdoc | 47 ++++++++++++++ doc/src/demos/styledemo.qdoc | 47 ++++++++++++++ doc/src/demos/weatherinfo.qdoc | 47 ++++++++++++++ doc/src/getting-started/demos.qdoc | 27 ++++++++ doc/src/getting-started/examples.qdoc | 81 ++++++++++++++++++++---- doc/src/images/anomaly-demo.png | Bin 0 -> 23350 bytes doc/src/images/embeddeddesktopservices-demo.png | Bin 0 -> 9733 bytes doc/src/images/embeddedsvgviewer-demo.png | Bin 0 -> 7928 bytes doc/src/images/flickable-demo.png | Bin 0 -> 21799 bytes doc/src/images/flightinfo-demo.png | Bin 0 -> 34030 bytes doc/src/images/fluidlauncher-demo.png | Bin 0 -> 54636 bytes doc/src/images/lightmaps-demo.png | Bin 0 -> 130788 bytes doc/src/images/multitouch-dials-example.png | Bin 0 -> 17676 bytes doc/src/images/multitouch-examples.png | Bin 0 -> 6691 bytes doc/src/images/raycasting-demo.png | Bin 0 -> 34975 bytes doc/src/images/styledemo-demo.png | Bin 0 -> 180145 bytes doc/src/images/weatherinfo-demo.png | Bin 0 -> 49688 bytes 25 files changed, 609 insertions(+), 14 deletions(-) create mode 100644 doc/src/demos/anomaly.qdoc create mode 100644 doc/src/demos/desktopservices.qdoc create mode 100644 doc/src/demos/digiflip.qdoc create mode 100644 doc/src/demos/embeddedsvgviewer.qdoc create mode 100644 doc/src/demos/flickable.qdoc create mode 100644 doc/src/demos/flightinfo.qdoc create mode 100644 doc/src/demos/fluidlauncher.qdoc create mode 100644 doc/src/demos/lightmaps.qdoc create mode 100644 doc/src/demos/raycasting.qdoc create mode 100644 doc/src/demos/styledemo.qdoc create mode 100644 doc/src/demos/weatherinfo.qdoc create mode 100644 doc/src/images/anomaly-demo.png create mode 100644 doc/src/images/embeddeddesktopservices-demo.png create mode 100644 doc/src/images/embeddedsvgviewer-demo.png create mode 100644 doc/src/images/flickable-demo.png create mode 100644 doc/src/images/flightinfo-demo.png create mode 100644 doc/src/images/fluidlauncher-demo.png create mode 100644 doc/src/images/lightmaps-demo.png create mode 100644 doc/src/images/multitouch-dials-example.png create mode 100644 doc/src/images/multitouch-examples.png create mode 100644 doc/src/images/raycasting-demo.png create mode 100644 doc/src/images/styledemo-demo.png create mode 100644 doc/src/images/weatherinfo-demo.png diff --git a/doc/src/demos/anomaly.qdoc b/doc/src/demos/anomaly.qdoc new file mode 100644 index 0000000..a2ea677 --- /dev/null +++ b/doc/src/demos/anomaly.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/embedded/anomaly + \title Anomaly Demonstration + + \image anomaly-demo.png +*/ diff --git a/doc/src/demos/desktopservices.qdoc b/doc/src/demos/desktopservices.qdoc new file mode 100644 index 0000000..2eed37b --- /dev/null +++ b/doc/src/demos/desktopservices.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/embedded/desktopservices + \title Embedded Desktop Services Demonstration + + \image embeddeddesktopservices-demo.png +*/ diff --git a/doc/src/demos/digiflip.qdoc b/doc/src/demos/digiflip.qdoc new file mode 100644 index 0000000..553b11b --- /dev/null +++ b/doc/src/demos/digiflip.qdoc @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/embedded/digiflip + \title Digiflip Demonstration +*/ diff --git a/doc/src/demos/embeddedsvgviewer.qdoc b/doc/src/demos/embeddedsvgviewer.qdoc new file mode 100644 index 0000000..c09b4f0 --- /dev/null +++ b/doc/src/demos/embeddedsvgviewer.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/embedded/embeddedsvgviewer + \title Embedded SVG Viewer Demonstration + + \image embeddedsvgviewer-demo.png +*/ diff --git a/doc/src/demos/flickable.qdoc b/doc/src/demos/flickable.qdoc new file mode 100644 index 0000000..03ccc48 --- /dev/null +++ b/doc/src/demos/flickable.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/embedded/flickable + \title Flickable List Demonstration + + \image flickable-demo.png +*/ diff --git a/doc/src/demos/flightinfo.qdoc b/doc/src/demos/flightinfo.qdoc new file mode 100644 index 0000000..efe658a --- /dev/null +++ b/doc/src/demos/flightinfo.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/embedded/flightinfo + \title Flight Info Demonstration + + \image flightinfo-demo.png +*/ diff --git a/doc/src/demos/fluidlauncher.qdoc b/doc/src/demos/fluidlauncher.qdoc new file mode 100644 index 0000000..20012a4 --- /dev/null +++ b/doc/src/demos/fluidlauncher.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/embedded/fluidlauncher + \title Fluid Launcher Demonstration + + \image fluidlauncher-demo.png +*/ diff --git a/doc/src/demos/lightmaps.qdoc b/doc/src/demos/lightmaps.qdoc new file mode 100644 index 0000000..04fde15 --- /dev/null +++ b/doc/src/demos/lightmaps.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/embedded/lightmaps + \title Light Maps Demonstration + + \image lightmaps-demo.png +*/ diff --git a/doc/src/demos/raycasting.qdoc b/doc/src/demos/raycasting.qdoc new file mode 100644 index 0000000..36c61f0 --- /dev/null +++ b/doc/src/demos/raycasting.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/embedded/raycasting + \title Ray Casting Demonstration + + \image raycasting-demo.png +*/ diff --git a/doc/src/demos/styledemo.qdoc b/doc/src/demos/styledemo.qdoc new file mode 100644 index 0000000..44745c9 --- /dev/null +++ b/doc/src/demos/styledemo.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/embedded/styledemo + \title Embedded Styles Demonstration + + \image styledemo-demo.png +*/ diff --git a/doc/src/demos/weatherinfo.qdoc b/doc/src/demos/weatherinfo.qdoc new file mode 100644 index 0000000..54b2734 --- /dev/null +++ b/doc/src/demos/weatherinfo.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example demos/embedded/weatherinfo + \title Weather Info Demonstration + + \image weatherinfo-demo.png +*/ diff --git a/doc/src/getting-started/demos.qdoc b/doc/src/getting-started/demos.qdoc index 8f2829a..524f27c 100644 --- a/doc/src/getting-started/demos.qdoc +++ b/doc/src/getting-started/demos.qdoc @@ -163,4 +163,31 @@ \note The Phonon demos are currently not available for the MinGW platform. + \section1 Animation + + \list + \o \l{demos/sub-attaq}{Sub-Attaq} demonstrates the features of the + \l{The Animation Framework}{animation framework} and + \l{The State Machine Framework}{state machine framework} in the production of + a simple game. + \endlist + + \section1 Embedded Platforms + + \list + \o \l{demos/embedded/anomaly}{Anomaly} is a small screen browser with kinetic scrolling. + \o \l{demos/embedded/desktopservices}{Embedded Desktop Services} shows how to open + documents using the applications associated with their file types. + \o \l{demos/embedded/digiflip}{Digiflip} is a digital watch with transition effects. + \o \l{demos/embedded/embeddedsvgviewer}{Embedded SVG Viewer} shows how to display SVG + drawings on embedded devices. + \o \l{demos/embedded/flickable}{Flickable List} shows how to display a list with kinetic scrolling. + \o \l{demos/embedded/flightinfo}{Flight Info} fetches information about aircraft flights from the Web. + \o \l{demos/embedded/fluidlauncher}{Fluid Launcher} demo application launcher for embedded screens + \o \l{demos/embedded/lightmaps}{Light Maps} demonstrates OpenStreetMap integration with WebKit. + \o \l{demos/embedded/raycasting}{Ray Casting} demonstrates the use of ray casting with the + \l{The Graphics View Framework}{Graphics View} framework. + \o \l{demos/embedded/styledemo}{Embedded Styles} demonstrates the use of styles. + \o \l{demos/embedded/weatherinfo}{Weather Info} fetches weather information from the Web. + \endlist */ diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index eec0492..40b2f89 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -206,7 +206,7 @@ \o \row - \o{2,1} \l{OpenGL Examples}{\bold OpenGL} + \o{2,1} \l{OpenGL Examples}{\bold{OpenGL}}\bold{ and }\l{OpenVG Examples}{\bold{OpenVG}}\bold{ Examples} \o{2,1} \l{Multimedia Examples}{\bold{Multimedia Framework}} \row \o \image opengl-examples.png OpenGL @@ -215,6 +215,9 @@ platforms, giving developers the opportunity to display hardware accelerated 3D graphics alongside a more conventional user interface. + Qt provides support for integration with OpenVG implementations on + platforms with suitable drivers. + \o \image phonon-examples.png \o Qt provides low-level audio support on linux,windows and mac platforms by default and @@ -299,37 +302,47 @@ to build highly animated, high-performance GUIs. \row + \o{2,1} \l{Multi-Touch Examples}{\bold{Multi-Touch Framework}} \o{2,1} \l{Gestures Examples}{\bold{Gestures}} - \o{2,1} \l{D-Bus Examples}{\bold{D-Bus}} + \row + \o \image multitouch-examples.png + \o + Support for multi-touch input makes it possible for developers to create + extensible and intuitive user interfaces. + \o \image gestures-examples.png \o Applications can be written to respond to gestures as a natural input method. These examples show how to enable support for standard and custom gestures in applications. - \o \image dbus-examples.png D-Bus - \o - D-Bus is an inter-process communication protocol for Unix/Linux systems. - These examples demonstrate how to write application that communicate with - each other. \row + \o{2,1} \l{D-Bus Examples}{\bold{D-Bus}} \o{2,1} \l{Qt for Embedded Linux Examples}{\bold{Qt for Embedded Linux}} - \o{2,1} \l{ActiveQt Examples}{\bold ActiveQt} + \row \o \image qt-embedded-examples.png \o Systems with limited resources, specialized hardware, and small screens require special attention. - \o \image activeqt-examples.png ActiveQt + \o \image dbus-examples.png D-Bus \o - These examples demonstrate how to write ActiveX controls and control servers - with Qt, and how to use ActiveX controls and COM objects in a Qt application. + D-Bus is an inter-process communication protocol for Unix/Linux systems. + These examples demonstrate how to write application that communicate with + each other. \row + \o{2,1} \l{ActiveQt Examples}{\bold ActiveQt} \o{2,1} \l{Qt Quarterly}{\bold{Qt Quarterly}} + \row + \o \image activeqt-examples.png ActiveQt + \o + These examples demonstrate how to write ActiveX controls and control servers + with Qt, and how to use ActiveX controls and COM objects in a Qt application. + \o \image qq-thumbnail.png QtQuarterly \o One more valuable source for examples and explanations of Qt @@ -776,7 +789,7 @@ \previouspage Inter-Process Communication Examples \contentspage Qt Examples - \nextpage Multimedia Examples + \nextpage OpenVG Examples \image opengl-examples.png @@ -804,6 +817,27 @@ */ /*! + \page examples-openvg.html + \title OpenVG Examples + + \previouspage OpenGL Examples + \contentspage Qt Examples + \nextpage Multimedia Examples + + \image openvg-examples.png + + Qt provides support for integration with OpenVG implementations on + platforms with suitable drivers. + + These examples demonstrate the basic techniques used to take advantage of + OpenVG in Qt applications. + + \list + \o \l{openvg/star}{OpenVG Star} + \endlist +*/ + +/*! \page examples-multimedia.html \title Multimedia Examples @@ -1094,7 +1128,7 @@ \previouspage State Machine Examples \contentspage Qt Examples - \nextpage Gestures Examples + \nextpage Multi-Touch Examples \image animation-examples.png Animation @@ -1111,10 +1145,29 @@ */ /*! + \page examples-multitouch.html + \title Multi-Touch Examples + + \previouspage Animation Framework Examples + \contentspage Qt Examples + \nextpage Gestures Examples + + Support for multi-touch input makes it possible for developers to create + extensible and intuitive user interfaces. + + \list + \o \l{multitouch/dials}{Multi-Touch Dials} + \o \l{multitouch/fingerpaint}{Finger Paint} + \o \l{multitouch/knobs}{Multi-Touch Knobs} + \o \l{multitouch/pinchzoom}{Pinch Zoom} + \endlist +*/ + +/*! \page examples-gestures.html \title Gestures Examples - \previouspage Animation Framework Examples + \previouspage Multi-Touch Examples \contentspage Qt Examples \nextpage D-Bus Examples diff --git a/doc/src/images/anomaly-demo.png b/doc/src/images/anomaly-demo.png new file mode 100644 index 0000000..a26e705 Binary files /dev/null and b/doc/src/images/anomaly-demo.png differ diff --git a/doc/src/images/embeddeddesktopservices-demo.png b/doc/src/images/embeddeddesktopservices-demo.png new file mode 100644 index 0000000..c1408c1 Binary files /dev/null and b/doc/src/images/embeddeddesktopservices-demo.png differ diff --git a/doc/src/images/embeddedsvgviewer-demo.png b/doc/src/images/embeddedsvgviewer-demo.png new file mode 100644 index 0000000..0b806d6 Binary files /dev/null and b/doc/src/images/embeddedsvgviewer-demo.png differ diff --git a/doc/src/images/flickable-demo.png b/doc/src/images/flickable-demo.png new file mode 100644 index 0000000..98f3a69 Binary files /dev/null and b/doc/src/images/flickable-demo.png differ diff --git a/doc/src/images/flightinfo-demo.png b/doc/src/images/flightinfo-demo.png new file mode 100644 index 0000000..4e9a4b2 Binary files /dev/null and b/doc/src/images/flightinfo-demo.png differ diff --git a/doc/src/images/fluidlauncher-demo.png b/doc/src/images/fluidlauncher-demo.png new file mode 100644 index 0000000..1720890 Binary files /dev/null and b/doc/src/images/fluidlauncher-demo.png differ diff --git a/doc/src/images/lightmaps-demo.png b/doc/src/images/lightmaps-demo.png new file mode 100644 index 0000000..f066f93 Binary files /dev/null and b/doc/src/images/lightmaps-demo.png differ diff --git a/doc/src/images/multitouch-dials-example.png b/doc/src/images/multitouch-dials-example.png new file mode 100644 index 0000000..60e1776 Binary files /dev/null and b/doc/src/images/multitouch-dials-example.png differ diff --git a/doc/src/images/multitouch-examples.png b/doc/src/images/multitouch-examples.png new file mode 100644 index 0000000..b053cf3 Binary files /dev/null and b/doc/src/images/multitouch-examples.png differ diff --git a/doc/src/images/raycasting-demo.png b/doc/src/images/raycasting-demo.png new file mode 100644 index 0000000..53c5253 Binary files /dev/null and b/doc/src/images/raycasting-demo.png differ diff --git a/doc/src/images/styledemo-demo.png b/doc/src/images/styledemo-demo.png new file mode 100644 index 0000000..8e4ec90 Binary files /dev/null and b/doc/src/images/styledemo-demo.png differ diff --git a/doc/src/images/weatherinfo-demo.png b/doc/src/images/weatherinfo-demo.png new file mode 100644 index 0000000..3183aa4 Binary files /dev/null and b/doc/src/images/weatherinfo-demo.png differ -- cgit v0.12 From 4e4a800574a28a441858f95021d9092aa3001491 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 19 Nov 2009 15:07:29 +0200 Subject: Added default Qt icon back for Qt demos/examples in Symbian. This commit basically reverts fa35247d31bd35d72c307f4a6a231400aade0c0. It can be reverted now since mifconv invoking is changed to use relative paths instead of absolute one. Task-number: QTBUG-4745 Reviewed-by: TrustMe --- demos/embedded/fluidlauncher/fluidlauncher.pro | 42 ++++++++++++++++++++------ demos/symbianpkgrules.pri | 2 ++ examples/symbianpkgrules.pri | 2 ++ 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/demos/embedded/fluidlauncher/fluidlauncher.pro b/demos/embedded/fluidlauncher/fluidlauncher.pro index 30f59c3..b47f6a0 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.pro +++ b/demos/embedded/fluidlauncher/fluidlauncher.pro @@ -59,7 +59,7 @@ symbian { load(data_caging_paths) TARGET.UID3 = 0xA000A641 - ICON = ../../../src/s60installs/qt.svg + ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg executables.sources = \ styledemo.exe \ @@ -118,42 +118,66 @@ symbian { $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/lightmaps.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/flightinfo.rsc - + resource.path = $$APP_RESOURCE_DIR mifs.sources = \ - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000A641.mif \ #fluidlauncher - $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/0xA000C611.mif #desktopservices + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/fluidlauncher.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/styledemo.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/deform.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/pathstroke.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/wiggly.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/qftp.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/saxbookmarks.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/desktopservices.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/fridgemagnets.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/softkeys.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/raycasting.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/flickable.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/digiflip.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/lightmaps.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/flightinfo.mif mifs.path = $$APP_RESOURCE_DIR - contains(QT_CONFIG, svg) { - executables.sources += \ + contains(QT_CONFIG, svg) { + executables.sources += \ embeddedsvgviewer.exe \ weatherinfo.exe - + reg_resource.sources += \ $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/embeddedsvgviewer_reg.rsc \ $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/weatherinfo_reg.rsc - + resource.sources += \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/embeddedsvgviewer.rsc \ $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/weatherinfo.rsc + + mifs.sources += \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/embeddedsvgviewer.mif \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/weatherinfo.mif + } contains(QT_CONFIG, webkit) { executables.sources += anomaly.exe reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/anomaly_reg.rsc resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/anomaly.rsc + mifs.sources += \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/anomaly.mif } contains(QT_CONFIG, phonon) { executables.sources += qmediaplayer.exe resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/qmediaplayer.rsc + mifs.sources += \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/qmediaplayer.mif } contains(QT_CONFIG, script) { - executables.sources += context2d.exe + executables.sources += context2d.exe reg_resource.sources += $${EPOCROOT}$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR/context2d_reg.rsc resource.sources += $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/context2d.rsc + mifs.sources += \ + $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/context2d.mif } files.sources = $$PWD/screenshots $$PWD/slides diff --git a/demos/symbianpkgrules.pri b/demos/symbianpkgrules.pri index 7e6852b..cf52cb3 100644 --- a/demos/symbianpkgrules.pri +++ b/demos/symbianpkgrules.pri @@ -11,3 +11,5 @@ vendorinfo = \ " " default_deployment.pkg_prerules += vendorinfo + +!isEmpty(TARGET.UID3):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg diff --git a/examples/symbianpkgrules.pri b/examples/symbianpkgrules.pri index 59c5480..069a16e 100644 --- a/examples/symbianpkgrules.pri +++ b/examples/symbianpkgrules.pri @@ -11,3 +11,5 @@ vendorinfo = \ " " default_deployment.pkg_prerules += vendorinfo + +!isEmpty(TARGET.UID3):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg -- cgit v0.12 From 05e956d5c7d5c39bee332972ce54fea71c15d24b Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 19 Nov 2009 16:02:36 +0200 Subject: Enabled Qt icon in Symbian also for demos/examples without UID3. ICON keyword can be used without UID, since .mif filename is generated based on target instead of UID3 nowadays Task-number: QTBUG-4677 Reviewed-by: Miikka Heikkinen --- demos/symbianpkgrules.pri | 2 +- examples/symbianpkgrules.pri | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demos/symbianpkgrules.pri b/demos/symbianpkgrules.pri index cf52cb3..c511836 100644 --- a/demos/symbianpkgrules.pri +++ b/demos/symbianpkgrules.pri @@ -12,4 +12,4 @@ vendorinfo = \ default_deployment.pkg_prerules += vendorinfo -!isEmpty(TARGET.UID3):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg +isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg diff --git a/examples/symbianpkgrules.pri b/examples/symbianpkgrules.pri index 069a16e..35edbfb 100644 --- a/examples/symbianpkgrules.pri +++ b/examples/symbianpkgrules.pri @@ -12,4 +12,4 @@ vendorinfo = \ default_deployment.pkg_prerules += vendorinfo -!isEmpty(TARGET.UID3):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg +isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg -- cgit v0.12 From c48ba6b516b46775439dc3c86b21bf9ce9c7f23a Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 19 Nov 2009 15:44:26 +0100 Subject: Add a QTest::qWaitForWindowShown for a failing qlistview autotest Reviewed-by: trustme --- tests/auto/qlistview/tst_qlistview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 596ac9b..605b3e3 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1895,6 +1895,8 @@ void tst_QListView::taskQTBUG_5877_skippingItemInPageDownUp() vu.setModel(&model); vu.show(); + QTest::qWaitForWindowShown(&vu); + int itemHeight = vu.visualRect(model.index(0, 0)).height(); int visibleRowCount = vu.height() / itemHeight; int scrolledRowCount = visibleRowCount - 1; -- cgit v0.12 From 73153fa5288e22d27f26d0e1045e82698c9a6343 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 19 Nov 2009 16:24:10 +0100 Subject: Fixes regression in QListView: Selection would not expend to the full viewport Commit ecc202c introduced the regression while fixing another regression (QTBUG-5854) The selection would not expend to the whole viewport. Reviewed-by: Robert Griebl --- src/gui/itemviews/qlistview.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 052308c..d03cdd3 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -966,15 +966,19 @@ void QListView::paintEvent(QPaintEvent *e) bool alternateBase = false; int previousRow = -2; // trigger the alternateBase adjustment on first pass + int maxSize = (flow() == TopToBottom) + ? qMax(viewport()->size().width(), d->contentsSize().width()) - 2 * d->spacing() + : qMax(viewport()->size().height(), d->contentsSize().height()) - 2 * d->spacing(); + QVector::const_iterator end = toBeRendered.constEnd(); for (QVector::const_iterator it = toBeRendered.constBegin(); it != end; ++it) { Q_ASSERT((*it).isValid()); option.rect = visualRect(*it); if (flow() == TopToBottom) - option.rect.setWidth(qMin(d->contentsSize().width() - 2 * d->spacing(), option.rect.width())); + option.rect.setWidth(qMin(maxSize, option.rect.width())); else - option.rect.setHeight(qMin(d->contentsSize().height() - 2 * d->spacing(), option.rect.height())); + option.rect.setHeight(qMin(maxSize, option.rect.height())); option.state = state; if (selections && selections->isSelected(*it)) -- cgit v0.12 From 6fd6879564929a672e9f0a5b59d9d42612e51c5a Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 19 Nov 2009 16:24:20 +0100 Subject: Item views: make sure the hovered item is updated when scrolling Reviewed-by: leo --- src/gui/itemviews/qabstractitemview.cpp | 35 ++++++++++++++++++--------------- src/gui/itemviews/qabstractitemview_p.h | 2 ++ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 23bef12..c691fe2 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -138,10 +138,22 @@ void QAbstractItemViewPrivate::init() #endif } +void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index) +{ + Q_Q(QAbstractItemView); + if (hover == index) + return; + + q->update(hover); //update the old one + hover = index; + q->update(hover); //update the new one +} + void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index) { //we take a persistent model index because the model might change by emitting signals Q_Q(QAbstractItemView); + setHoverIndex(index); if (viewportEnteredNeeded || enteredIndex != index) { viewportEnteredNeeded = false; @@ -1536,22 +1548,13 @@ bool QAbstractItemView::viewportEvent(QEvent *event) { Q_D(QAbstractItemView); switch (event->type()) { - case QEvent::HoverEnter: { - QHoverEvent *he = static_cast(event); - d->hover = indexAt(he->pos()); - update(d->hover); - break; } - case QEvent::HoverLeave: { - update(d->hover); // update old - d->hover = QModelIndex(); - break; } - case QEvent::HoverMove: { - QHoverEvent *he = static_cast(event); - QModelIndex old = d->hover; - d->hover = indexAt(he->pos()); - if (d->hover != old) - d->viewport->update(visualRect(old)|visualRect(d->hover)); - break; } + case QEvent::HoverMove: + case QEvent::HoverEnter: + d->setHoverIndex(indexAt(static_cast(event)->pos())); + break; + case QEvent::HoverLeave: + d->setHoverIndex(QModelIndex()); + break; case QEvent::Enter: d->viewportEnteredNeeded = true; break; diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index c691f61..f1ba874 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -152,6 +152,8 @@ public: const QEvent *event) const; virtual void selectAll(QItemSelectionModel::SelectionFlags command); + void setHoverIndex(const QPersistentModelIndex &index); + void checkMouseMove(const QPersistentModelIndex &index); inline void checkMouseMove(const QPoint &pos) { checkMouseMove(q_func()->indexAt(pos)); } -- cgit v0.12 From e9767c66ac5998a3365d925a1138f19c09440696 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 19 Nov 2009 16:46:48 +0100 Subject: Item views: make sure the model is connected/disconnected correctly Reviewed-by: ogoffart --- src/gui/itemviews/qtableview.cpp | 31 +++++++++++++++++++++++-------- src/gui/itemviews/qtreeview.cpp | 7 +++++++ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 02e5fff..a3877b7 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -1064,14 +1064,29 @@ QTableView::~QTableView() void QTableView::setModel(QAbstractItemModel *model) { Q_D(QTableView); - connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(_q_updateSpanInsertedRows(QModelIndex,int,int))); - connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)), - this, SLOT(_q_updateSpanInsertedColumns(QModelIndex,int,int))); - connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SLOT(_q_updateSpanRemovedRows(QModelIndex,int,int))); - connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)), - this, SLOT(_q_updateSpanRemovedColumns(QModelIndex,int,int))); + if (model == d->model) + return; + //let's disconnect from the old model + if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) { + disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(_q_updateSpanInsertedRows(QModelIndex,int,int))); + disconnect(d->model, SIGNAL(columnsInserted(QModelIndex,int,int)), + this, SLOT(_q_updateSpanInsertedColumns(QModelIndex,int,int))); + disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(_q_updateSpanRemovedRows(QModelIndex,int,int))); + disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)), + this, SLOT(_q_updateSpanRemovedColumns(QModelIndex,int,int))); + } + if (model) { //and connect to the new one + connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(_q_updateSpanInsertedRows(QModelIndex,int,int))); + connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)), + this, SLOT(_q_updateSpanInsertedColumns(QModelIndex,int,int))); + connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(_q_updateSpanRemovedRows(QModelIndex,int,int))); + connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)), + this, SLOT(_q_updateSpanRemovedColumns(QModelIndex,int,int))); + } d->verticalHeader->setModel(model); d->horizontalHeader->setModel(model); QAbstractItemView::setModel(model); diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 8d50870b..3ad9fbb 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -215,6 +215,13 @@ void QTreeView::setModel(QAbstractItemModel *model) Q_D(QTreeView); if (model == d->model) return; + if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) { + disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(rowsRemoved(QModelIndex,int,int))); + + disconnect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_modelAboutToBeReset())); + } + if (d->selectionModel) { // support row editing disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), d->model, SLOT(submit())); -- cgit v0.12 From 1f6aa19209a7d22bb15bf0a0afb2d62200c0d3fa Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 19 Nov 2009 17:12:13 +0100 Subject: Freeze def files against 4.6.0 Reviewed-By: Trust Me --- src/s60installs/bwins/QtCoreu.def | 11 +++++++++++ src/s60installs/bwins/QtGuiu.def | 3 +++ src/s60installs/bwins/QtWebKitu.def | 9 +++++---- src/s60installs/eabi/QtCoreu.def | 14 ++++++++++++++ src/s60installs/eabi/QtGuiu.def | 2 ++ src/s60installs/eabi/QtWebKitu.def | 9 +++++---- 6 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index 1218b75..49c4361 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -4387,4 +4387,15 @@ EXPORTS ?QBasicAtomicPointer_isFetchAndAddNative@@YA_NXZ @ 4386 NONAME ; bool QBasicAtomicPointer_isFetchAndAddNative(void) ?QBasicAtomicPointer_isFetchAndStoreNative@@YA_NXZ @ 4387 NONAME ; bool QBasicAtomicPointer_isFetchAndStoreNative(void) ?QBasicAtomicPointer_isTestAndSetNative@@YA_NXZ @ 4388 NONAME ; bool QBasicAtomicPointer_isTestAndSetNative(void) + ??0SignalEvent@QStateMachine@@QAE@PAVQObject@@HABV?$QList@VQVariant@@@@@Z @ 4389 NONAME ; QStateMachine::SignalEvent::SignalEvent(class QObject *, int, class QList const &) + ??0WrappedEvent@QStateMachine@@QAE@PAVQObject@@PAVQEvent@@@Z @ 4390 NONAME ; QStateMachine::WrappedEvent::WrappedEvent(class QObject *, class QEvent *) + ??1SignalEvent@QStateMachine@@UAE@XZ @ 4391 NONAME ; QStateMachine::SignalEvent::~SignalEvent(void) + ??1WrappedEvent@QStateMachine@@UAE@XZ @ 4392 NONAME ; QStateMachine::WrappedEvent::~WrappedEvent(void) + ??_ESignalEvent@QStateMachine@@UAE@I@Z @ 4393 NONAME ; QStateMachine::SignalEvent::~SignalEvent(unsigned int) + ??_EWrappedEvent@QStateMachine@@UAE@I@Z @ 4394 NONAME ; QStateMachine::WrappedEvent::~WrappedEvent(unsigned int) + ?arguments@SignalEvent@QStateMachine@@QBE?AV?$QList@VQVariant@@@@XZ @ 4395 NONAME ; class QList QStateMachine::SignalEvent::arguments(void) const + ?event@WrappedEvent@QStateMachine@@QBEPAVQEvent@@XZ @ 4396 NONAME ; class QEvent * QStateMachine::WrappedEvent::event(void) const + ?object@WrappedEvent@QStateMachine@@QBEPAVQObject@@XZ @ 4397 NONAME ; class QObject * QStateMachine::WrappedEvent::object(void) const + ?sender@SignalEvent@QStateMachine@@QBEPAVQObject@@XZ @ 4398 NONAME ; class QObject * QStateMachine::SignalEvent::sender(void) const + ?signalIndex@SignalEvent@QStateMachine@@QBEHXZ @ 4399 NONAME ; int QStateMachine::SignalEvent::signalIndex(void) const diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 8a43f21..166b6fe 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12514,4 +12514,7 @@ EXPORTS ?app_compile_version@QApplicationPrivate@@2HA @ 12513 NONAME ; int QApplicationPrivate::app_compile_version ?spacerItemFactoryMethod@QLayoutPrivate@@2P6APAVQSpacerItem@@PBVQLayout@@HHW4Policy@QSizePolicy@@1@ZA @ 12514 NONAME ; class QSpacerItem * (*QLayoutPrivate::spacerItemFactoryMethod)(class QLayout const *, int, int, enum QSizePolicy::Policy, enum QSizePolicy::Policy) ?allWidgets@QWidgetPrivate@@2PAV?$QSet@PAVQWidget@@@@A @ 12515 NONAME ; class QSet * QWidgetPrivate::allWidgets + ?effectiveFocusWidget@QWidgetPrivate@@QAEPAVQWidget@@XZ @ 12516 NONAME ; class QWidget * QWidgetPrivate::effectiveFocusWidget(void) + ?ignoreUnusedNavigationEvents@QTextControl@@QBE_NXZ @ 12517 NONAME ; bool QTextControl::ignoreUnusedNavigationEvents(void) const + ?setIgnoreUnusedNavigationEvents@QTextControl@@QAEX_N@Z @ 12518 NONAME ; void QTextControl::setIgnoreUnusedNavigationEvents(bool) diff --git a/src/s60installs/bwins/QtWebKitu.def b/src/s60installs/bwins/QtWebKitu.def index c14abe2..e5631f8 100644 --- a/src/s60installs/bwins/QtWebKitu.def +++ b/src/s60installs/bwins/QtWebKitu.def @@ -361,8 +361,8 @@ EXPORTS ?previousSibling@QWebElement@@QBE?AV1@XZ @ 360 NONAME ; class QWebElement QWebElement::previousSibling(void) const ?print@QWebView@@QBEXPAVQPrinter@@@Z @ 361 NONAME ; void QWebView::print(class QPrinter *) const ?printRequested@QWebPage@@IAEXPAVQWebFrame@@@Z @ 362 NONAME ; void QWebPage::printRequested(class QWebFrame *) - ?printingMaximumShrinkFactor@QWebSettings@@QBEMXZ @ 363 NONAME ; float QWebSettings::printingMaximumShrinkFactor(void) const - ?printingMinimumShrinkFactor@QWebSettings@@QBEMXZ @ 364 NONAME ; float QWebSettings::printingMinimumShrinkFactor(void) const + ?printingMaximumShrinkFactor@QWebSettings@@QBEMXZ @ 363 NONAME ABSENT ; float QWebSettings::printingMaximumShrinkFactor(void) const + ?printingMinimumShrinkFactor@QWebSettings@@QBEMXZ @ 364 NONAME ABSENT ; float QWebSettings::printingMinimumShrinkFactor(void) const ?provisionalLoad@QWebFrame@@IAEXXZ @ 365 NONAME ; void QWebFrame::provisionalLoad(void) ?qWebKitMajorVersion@@YAHXZ @ 366 NONAME ; int qWebKitMajorVersion(void) ?qWebKitMinorVersion@@YAHXZ @ 367 NONAME ; int qWebKitMinorVersion(void) @@ -488,8 +488,8 @@ EXPORTS ?setPluginFactory@QWebPage@@QAEXPAVQWebPluginFactory@@@Z @ 487 NONAME ; void QWebPage::setPluginFactory(class QWebPluginFactory *) ?setPreferredContentsSize@QWebPage@@QBEXABVQSize@@@Z @ 488 NONAME ; void QWebPage::setPreferredContentsSize(class QSize const &) const ?setPreferredPluginForMimeType@QWebPluginDatabase@@QAEXABVQString@@ABVQWebPluginInfo@@@Z @ 489 NONAME ; void QWebPluginDatabase::setPreferredPluginForMimeType(class QString const &, class QWebPluginInfo const &) - ?setPrintingMaximumShrinkFactor@QWebSettings@@QAEXM@Z @ 490 NONAME ; void QWebSettings::setPrintingMaximumShrinkFactor(float) - ?setPrintingMinimumShrinkFactor@QWebSettings@@QAEXM@Z @ 491 NONAME ; void QWebSettings::setPrintingMinimumShrinkFactor(float) + ?setPrintingMaximumShrinkFactor@QWebSettings@@QAEXM@Z @ 490 NONAME ABSENT ; void QWebSettings::setPrintingMaximumShrinkFactor(float) + ?setPrintingMinimumShrinkFactor@QWebSettings@@QAEXM@Z @ 491 NONAME ABSENT ; void QWebSettings::setPrintingMinimumShrinkFactor(float) ?setRenderHint@QWebView@@QAEXW4RenderHint@QPainter@@_N@Z @ 492 NONAME ; void QWebView::setRenderHint(enum QPainter::RenderHint, bool) ?setRenderHints@QWebView@@QAEXV?$QFlags@W4RenderHint@QPainter@@@@@Z @ 493 NONAME ; void QWebView::setRenderHints(class QFlags) ?setScrollBarPolicy@QWebFrame@@QAEXW4Orientation@Qt@@W4ScrollBarPolicy@3@@Z @ 494 NONAME ; void QWebFrame::setScrollBarPolicy(enum Qt::Orientation, enum Qt::ScrollBarPolicy) @@ -619,4 +619,5 @@ EXPORTS ?staticMetaObject@QGraphicsWebView@@2UQMetaObject@@B @ 618 NONAME ; struct QMetaObject const QGraphicsWebView::staticMetaObject ?staticMetaObject@QWebPage@@2UQMetaObject@@B @ 619 NONAME ; struct QMetaObject const QWebPage::staticMetaObject ?staticMetaObject@QWebView@@2UQMetaObject@@B @ 620 NONAME ; struct QMetaObject const QWebView::staticMetaObject + ?attributeNames@QWebElement@@QBE?AVQStringList@@ABVQString@@@Z @ 621 NONAME ; class QStringList QWebElement::attributeNames(class QString const &) const diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 99be68e..6a4cdbd 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -3619,4 +3619,18 @@ EXPORTS _ZN15QBasicAtomicInt19isFetchAndAddNativeEv @ 3618 NONAME _ZN15QBasicAtomicInt21isFetchAndStoreNativeEv @ 3619 NONAME _ZN15QBasicAtomicInt25isReferenceCountingNativeEv @ 3620 NONAME + _ZN13QStateMachine11SignalEventC1EP7QObjectiRK5QListI8QVariantE @ 3621 NONAME + _ZN13QStateMachine11SignalEventC2EP7QObjectiRK5QListI8QVariantE @ 3622 NONAME + _ZN13QStateMachine11SignalEventD0Ev @ 3623 NONAME + _ZN13QStateMachine11SignalEventD1Ev @ 3624 NONAME + _ZN13QStateMachine11SignalEventD2Ev @ 3625 NONAME + _ZN13QStateMachine12WrappedEventC1EP7QObjectP6QEvent @ 3626 NONAME + _ZN13QStateMachine12WrappedEventC2EP7QObjectP6QEvent @ 3627 NONAME + _ZN13QStateMachine12WrappedEventD0Ev @ 3628 NONAME + _ZN13QStateMachine12WrappedEventD1Ev @ 3629 NONAME + _ZN13QStateMachine12WrappedEventD2Ev @ 3630 NONAME + _ZTIN13QStateMachine11SignalEventE @ 3631 NONAME + _ZTIN13QStateMachine12WrappedEventE @ 3632 NONAME + _ZTVN13QStateMachine11SignalEventE @ 3633 NONAME + _ZTVN13QStateMachine12WrappedEventE @ 3634 NONAME diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 43e291c..6c45a6e 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -11735,4 +11735,6 @@ EXPORTS _Zls6QDebugP15QGraphicsObject @ 11734 NONAME _Zls6QDebugRK12QStyleOption @ 11735 NONAME _Zls6QDebugRKN12QStyleOption10OptionTypeE @ 11736 NONAME + _ZN12QTextControl31setIgnoreUnusedNavigationEventsEb @ 11737 NONAME + _ZNK12QTextControl28ignoreUnusedNavigationEventsEv @ 11738 NONAME diff --git a/src/s60installs/eabi/QtWebKitu.def b/src/s60installs/eabi/QtWebKitu.def index 88343c1..4aad884 100644 --- a/src/s60installs/eabi/QtWebKitu.def +++ b/src/s60installs/eabi/QtWebKitu.def @@ -654,8 +654,8 @@ EXPORTS _Z34qt_drt_resetOriginAccessWhiteListsv @ 653 NONAME _ZN11QWebElement17removeAllChildrenEv @ 654 NONAME _ZN11QWebElement6renderEP8QPainter @ 655 NONAME - _ZN12QWebSettings30setPrintingMaximumShrinkFactorEf @ 656 NONAME - _ZN12QWebSettings30setPrintingMinimumShrinkFactorEf @ 657 NONAME + _ZN12QWebSettings30setPrintingMaximumShrinkFactorEf @ 656 NONAME ABSENT + _ZN12QWebSettings30setPrintingMinimumShrinkFactorEf @ 657 NONAME ABSENT _ZN16QGraphicsWebView10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 658 NONAME _ZN16QGraphicsWebView11linkClickedERK4QUrl @ 659 NONAME _ZN16QGraphicsWebView12loadFinishedEb @ 660 NONAME @@ -674,8 +674,8 @@ EXPORTS _ZN21QWebElementCollectionD2Ev @ 673 NONAME _ZN21QWebElementCollectionaSERKS_ @ 674 NONAME _ZN9QWebFrame6renderEP8QPainterNS_11RenderLayerERK7QRegion @ 675 NONAME - _ZNK12QWebSettings27printingMaximumShrinkFactorEv @ 676 NONAME - _ZNK12QWebSettings27printingMinimumShrinkFactorEv @ 677 NONAME + _ZNK12QWebSettings27printingMaximumShrinkFactorEv @ 676 NONAME ABSENT + _ZNK12QWebSettings27printingMinimumShrinkFactorEv @ 677 NONAME ABSENT _ZNK16QGraphicsWebView10isModifiedEv @ 678 NONAME _ZNK16QGraphicsWebView10pageActionEN8QWebPage9WebActionE @ 679 NONAME _ZNK16QGraphicsWebView16inputMethodQueryEN2Qt16InputMethodQueryE @ 680 NONAME @@ -689,4 +689,5 @@ EXPORTS _ZThn16_NK16QGraphicsWebView8sizeHintEN2Qt8SizeHintERK6QSizeF @ 688 NONAME _ZThn8_N16QGraphicsWebView10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 689 NONAME _ZThn8_NK16QGraphicsWebView16inputMethodQueryEN2Qt16InputMethodQueryE @ 690 NONAME + _ZNK11QWebElement14attributeNamesERK7QString @ 691 NONAME -- cgit v0.12 From 5f5e1b7aa5d03203346e00751b8bf15883944b25 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 19 Nov 2009 17:52:51 +0100 Subject: Fix crash when using splash screen, or QPixmap::copy() Missing virtual function now implemented Task-number: QTBUG-5977 Reviewed-by: axis --- src/gui/image/qpixmap_s60.cpp | 5 +++++ src/gui/image/qpixmap_s60_p.h | 2 ++ tests/auto/qpixmap/tst_qpixmap.cpp | 13 +++++++++++++ 3 files changed, 20 insertions(+) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 17baa50..dc33ade 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -977,4 +977,9 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) } } +QPixmapData *QS60PixmapData::createCompatiblePixmapData() const +{ + return new QS60PixmapData(pixelType()); +} + QT_END_NAMESPACE diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h index b1b5824..8631ebd 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/gui/image/qpixmap_s60_p.h @@ -87,6 +87,8 @@ public: QS60PixmapData(PixelType type); ~QS60PixmapData(); + QPixmapData *createCompatiblePixmapData() const; + void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); void copy(const QPixmapData *data, const QRect &rect); diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index d7f042e..0effd01 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include @@ -169,6 +170,7 @@ private slots: void loadFromDataNullValues(); void preserveDepth(); + void splash_crash(); }; static bool lenientCompare(const QPixmap &actual, const QPixmap &expected) @@ -1421,6 +1423,17 @@ void tst_QPixmap::fromImage_crash() delete img; } +//This is testing QPixmapData::createCompatiblePixmapData - see QTBUG-5977 +void tst_QPixmap::splash_crash() +{ + QPixmap pix; + pix = QPixmap(":/images/designer.png"); + QSplashScreen splash(pix); + splash.show(); + QCoreApplication::processEvents(); + splash.close(); +} + void tst_QPixmap::fromData() { unsigned char bits[] = { 0xaa, 0x55 }; -- cgit v0.12 From 593ea5ec3f08a8f39a8487161106cc0b28c1511f Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Thu, 19 Nov 2009 18:15:43 +0100 Subject: Symbian: QKeyEvent:isAutoRepeat() doesn't work Task-number: QTBUG-6011 Reviewed-by: Gareth Stockwell --- src/gui/kernel/qapplication_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index c7f0c00..85b6d00 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -712,7 +712,7 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers); QKeyEventEx qKeyEvent(type == EEventKeyUp ? QEvent::KeyRelease : QEvent::KeyPress, keyCode, mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods), - false, 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers); + (keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers); // WId wid = reinterpret_cast(keyEvent.Handle())->Child(); // if (!wid) // Could happen if window isn't shown yet. -- cgit v0.12 From 9f6eec91ce4a2a2ac7aae0779e238c0b2c90d0d1 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Thu, 19 Nov 2009 18:00:47 +0100 Subject: QAbstractSlider: keypad navigation is slow. Add logic to make keypad navigation faster when auto repeating. Task-number: QTBUG-5988 Reviewed-by: Gareth Stockwell --- src/gui/widgets/qabstractslider.cpp | 45 ++++++++++++++++++++++++++++++++++--- src/gui/widgets/qabstractslider_p.h | 33 ++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index e0db9c2..988a7e7 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -219,6 +219,10 @@ QAbstractSliderPrivate::QAbstractSliderPrivate() blocktracking(false), pressed(false), invertedAppearance(false), invertedControls(false), orientation(Qt::Horizontal), repeatAction(QAbstractSlider::SliderNoAction) +#ifdef QT_KEYPAD_NAVIGATION + , isAutoRepeating(false) + , repeatMultiplier(1) +#endif { } @@ -371,6 +375,9 @@ int QAbstractSlider::maximum() const abstract sliders provides and typically corresponds to the user pressing an arrow key. + If the property is modified during an auto repeating key event, behavior + is undefined. + \sa pageStep */ @@ -598,10 +605,10 @@ void QAbstractSlider::triggerAction(SliderAction action) d->blocktracking = true; switch (action) { case SliderSingleStepAdd: - setSliderPosition(d->overflowSafeAdd(d->singleStep)); + setSliderPosition(d->overflowSafeAdd(d->effectiveSingleStep())); break; case SliderSingleStepSub: - setSliderPosition(d->overflowSafeAdd(-d->singleStep)); + setSliderPosition(d->overflowSafeAdd(-d->effectiveSingleStep())); break; case SliderPageStepAdd: setSliderPosition(d->overflowSafeAdd(d->pageStep)); @@ -702,7 +709,7 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e) // Calculate how many lines to scroll. Depending on what delta is (and // offset), we might end up with a fraction (e.g. scroll 1.3 lines). We can // only scroll whole lines, so we keep the reminder until next event. - qreal stepsToScrollF = offset * QApplication::wheelScrollLines() * d->singleStep; + qreal stepsToScrollF = offset * QApplication::wheelScrollLines() * d->effectiveSingleStep(); // Check if wheel changed direction since last event: if (d->offset_accumulated != 0 && (offset / d->offset_accumulated) < 0) d->offset_accumulated = 0; @@ -773,6 +780,38 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) { Q_D(QAbstractSlider); SliderAction action = SliderNoAction; +#ifdef QT_KEYPAD_NAVIGATION + if (ev->isAutoRepeat()) { + if (d->firstRepeat.isNull()) + d->firstRepeat = QTime::currentTime(); + else if (1 == d->repeatMultiplier) { + // This is the interval in milli seconds which one key repetition + // takes. + const int repeatMSecs = d->firstRepeat.msecsTo(QTime::currentTime()); + + /** + * The time it takes to currently navigate the whole slider. + */ + const qreal currentTimeElapse = (qreal(maximum()) / singleStep()) * repeatMSecs; + + /** + * This is an arbitrarily determined constant in msecs that + * specifies how long time it should take to navigate from the + * start to the end(excluding starting key auto repeat). + */ + const int SliderRepeatElapse = 2500; + + d->repeatMultiplier = currentTimeElapse / SliderRepeatElapse; + } + + } + else if (!d->firstRepeat.isNull()) { + d->firstRepeat = QTime(); + d->repeatMultiplier = 1; + } + +#endif + switch (ev->key()) { #ifdef QT_KEYPAD_NAVIGATION case Qt::Key_Select: diff --git a/src/gui/widgets/qabstractslider_p.h b/src/gui/widgets/qabstractslider_p.h index 9324d44..6591981 100644 --- a/src/gui/widgets/qabstractslider_p.h +++ b/src/gui/widgets/qabstractslider_p.h @@ -68,7 +68,13 @@ public: void setSteps(int single, int page); - int minimum, maximum, singleStep, pageStep, value, position, pressValue; + int minimum, maximum, pageStep, value, position, pressValue; + + /** + * Call effectiveSingleStep() when changing the slider value. + */ + int singleStep; + float offset_accumulated; uint tracking : 1; uint blocktracking :1; @@ -83,8 +89,33 @@ public: #ifdef QT_KEYPAD_NAVIGATION int origValue; + + /** + */ + bool isAutoRepeating; + + /** + * When we're auto repeating, we multiply singleStep with this value to + * get our effective step. + */ + qreal repeatMultiplier; + + /** + * The time of when the first auto repeating key press event occurs. + */ + QTime firstRepeat; + #endif + inline int effectiveSingleStep() const + { + return singleStep +#ifdef QT_KEYPAD_NAVIGATION + * repeatMultiplier +#endif + ; + } + inline int bound(int val) const { return qMax(minimum, qMin(maximum, val)); } inline int overflowSafeAdd(int add) const { -- cgit v0.12 From c7d7fae74f3b8df9e5b07493a36db31f2c499699 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 19 Nov 2009 20:33:01 +0100 Subject: Improved documentation Qt for the Symbian platform By Janne Anttila: - Switched links/references from 'S60' to 'Symbian' - Added collection page for Symbian specific documentation - Added page about application deployment for Symbian - Update supported compiler list for Symbian to more specific one - Added bullet about dev env. setup to Symbian installation page - Commented that SBSv2 is not offically supported by current S60 SDKs - Moved S60 3rd FP1 special patching note after SDK installation bullet - Recommedation to look into Qt quick start guide from Symbian Forum - Added Symbian bullet to known issues page and link to wiki - Added link to "state of support" document from symbian docs main page By aportale: - Rephrasing - More consistent naming of 'Qt for the Symbian platform' - Implementation of suggestions from other Nokians Reviewed-By: Janne Anttila --- doc/src/deployment/deployment.qdoc | 102 ++++++++++- doc/src/getting-started/installation.qdoc | 73 +++++--- doc/src/getting-started/known-issues.qdoc | 7 + doc/src/howtos/exceptionsafety.qdoc | 2 +- doc/src/platforms/compiler-notes.qdoc | 5 + doc/src/platforms/qt-embedded.qdoc | 9 +- doc/src/platforms/s60-introduction.qdoc | 152 ---------------- doc/src/platforms/supported-platforms.qdoc | 4 +- doc/src/platforms/symbian-exceptionsafety.qdoc | 2 +- doc/src/platforms/symbian-introduction.qdoc | 197 +++++++++++++++++++++ doc/src/platforms/winsystem.qdoc | 4 +- doc/src/qt4-intro.qdoc | 2 +- doc/src/snippets/code/doc_src_deployment.qdoc | 41 +++++ doc/src/snippets/code/doc_src_installation.qdoc | 7 + .../snippets/code/doc_src_s60-introduction.qdoc | 69 -------- .../code/doc_src_symbian-introduction.qdoc | 69 ++++++++ 16 files changed, 483 insertions(+), 262 deletions(-) delete mode 100644 doc/src/platforms/s60-introduction.qdoc create mode 100644 doc/src/platforms/symbian-introduction.qdoc delete mode 100644 doc/src/snippets/code/doc_src_s60-introduction.qdoc create mode 100644 doc/src/snippets/code/doc_src_symbian-introduction.qdoc diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index b5b1b9c..ea841f9 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -187,6 +187,7 @@ \o \l{Deploying an Application on Windows}{Qt for Windows} \o \l{Deploying an Application on Mac OS X}{Qt for Mac OS X} \o \l{Deploying Qt for Embedded Linux Applications}{Qt for Embedded Linux} + \o \l{Deploying an Application on the Symbian platform}{Qt for the Symbian platform} \endlist \sa Installation {Platform-Specific Documentation} @@ -1492,8 +1493,101 @@ macdeployqt supports the following options: \list - \o -no-plugins: Skip plugin deployment - \o -dmg : Create a .dmg disk image - \o -no-strip : Don't run 'strip' on the binaries - \endlist + \o -no-plugins: Skip plugin deployment + \o -dmg : Create a .dmg disk image + \o -no-strip : Don't run 'strip' on the binaries + \endlist +*/ + +/*! + \page deployment-symbian.html + \contentspage Deploying Qt Applications + + \title Deploying an Application on the Symbian platform + + Applications are deployed to Symbian devices in signed \c .sis package files. + The \c .sis file content is controlled with \c .pkg files. The \c .pkg file contains a set + of instructions used by tools to produce a \c .sis file. \c qmake generates a + default \c .pkg file for your project. The \c .pkg file generated by \c qmake is typically + fully functional for testing purposes but when planning to deliver your application + to end-users some changes are needed. This document describes what changes are + typically needed and how to implement them. + + \section1 Static Linking + + Qt for the Symbian platform does currently not support static linking of + Qt libraries. + + \section1 Shared Libraries + + When deploying the application using the shared libraries approach we must ensure that the + Qt runtime is correctly redistributed along with the application executable, + and also that all Qt dependencies are redistributed along with the application. + + We will demonstrate these procedures in terms of deploying the \l {widgets/wiggly}{Wiggly} + application that is provided in Qt's examples directory. + + \section2 Building Qt as a Shared Library + + We assume that you already have installed Qt as a shared library, + in the \c C:\path\to\Qt directory which is the default when installing Qt for Symbian. + For more information on how to build Qt, see the \l {Installation} documentation. + + \section1 Shared Libraries + + After ensuring that Qt is built as a shared library, we can build + the \l {widgets/wiggly}{Wiggly} application. First, we + must go into the directory that contains the application: + + \snippet doc/src/snippets/code/doc_src_deployment.qdoc 55 + + To prepare the application for deployment we must ensure that the \c .pkg file generated by + \c qmake contains the relevant vendor information and embeds the necessary + dependencies to the application deployment file (\c .sis). The content of the generated \c .pkg + file can be controlled with the Symbian specific \c qmake \l DEPLOYMENT keyword extensions. + + First, we will change the vendor statement to something more meaningful. The application + vendor is visible to end-user during the installation. + + \snippet doc/src/snippets/code/doc_src_deployment.qdoc 56 + + Second we will tell the Symbian application installer that this application supports + only S60 5.0 based devices: + + \snippet doc/src/snippets/code/doc_src_deployment.qdoc 57 + + You can find a list of platform and device indentification codes from + \l {http://wiki.forum.nokia.com/index.php/S60_Platform_and_device_identification_codes}{Forum Nokia Wiki}. + By default \c .pkg file generated by \c qmake adds support for all + S60 3rd edition FP1, S60 3rd edition FP2 and S60 5th edition devices. + + As a last step we will embed the Open C, Open C++ and Qt \c .sis files to the Wiggly + deployment file: + + \snippet doc/src/snippets/code/doc_src_deployment.qdoc 58 + + By embedding all dependencies to the application deployment file, the + end-user does not need to download and install all dependencies separately. + The drawback of \c .sis embedding is that the application \c .sis file size becomes + big. To address these problems Forum Nokia is planning to release a smart installer + which will take care of downloading and installing the necessary dependencies + over-the-air. The expected availability of smart installer is 1Q 2010. + + Now we are ready to compile the application and create the application + deployment file. Run \c qmake to create Symbian specific makefiles, resources (\.rss) + and deployment packaging files (\c .pkg). And do build to create the + application binaries and resources. + + \snippet doc/src/snippets/code/doc_src_deployment.qdoc 59 + + If everything compiled and linked without any errors, we are now ready to create + an application installation file: + + \snippet doc/src/snippets/code/doc_src_deployment.qdoc 60 + + If all binaries and dependencies were found, we should now have a self-signed + \c wiggly_release-gcce.sis ready to be installed on a device. For more information + about creating a \c .sis file and installing it to device see also + \l {The Symbian platform - Introduction to Qt#Installing your own applications}{here}. + */ diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index c8e225c..1a5cd99 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -495,12 +495,12 @@ in the \l{Qt for Windows CE Requirements} document. */ /*! \page install-Symbian-installer.html -\title Installing Qt on the Symbian Platform from a Binary Package -\ingroup qts60 +\title Installing Qt on the Symbian platform from a Binary Package +\ingroup qtsymbian \brief How to install Qt on the Symbian platform from a binary package. -\note Qt for Symbian platform has some requirements that are given in more detail -in the \l{Qt for Symbian platform Requirements} document. +\note Qt for the Symbian platform has some requirements that are given in more detail +in the \l{Qt for the Symbian platform Requirements} document. \list 1 @@ -517,13 +517,16 @@ in the \l{Qt for Symbian platform Requirements} document. to try out. An excellent starting point is the "fluidlauncher" demo. To run the demo on a real device, you first have to install \c{qt.sis} and \c{fluidlauncher.sis} found in the Qt installation - directory. Begin by connecting your phone using the USB cable and - selecting "PC Suite mode". In Windows Explorer right click on the - \c{.sis} files and select "Install with Nokia Application Installer" + directory. Also, check if the device needs additional + \l{Qt for the Symbian platform Requirements}{requirements}. + Begin by connecting your device via USB cable to a computer that has + the \l{http://www.nokia.com/pcsuite}{Nokia PC Suite} installed. + On the device, select "PC Suite mode". In Windows Explorer right click + on the \c{.sis} files, select "Install with Nokia Application Installer" and follow the instructions. To run the demos and examples on the emulator, you need to build them first. - Open the "Qt for Symbian platform Command Prompt" from the Start menu and type: + Open the "Qt for the Symbian platform Command Prompt" from the Start menu and type: \snippet doc/src/snippets/code/doc_src_installation.qdoc 25 @@ -534,7 +537,7 @@ in the \l{Qt for Symbian platform Requirements} document. For more information about building and running Qt programs on the Symbian platform, - see \l{Symbian platform - Introduction to Qt}. + see \l{The Symbian platform - Introduction to Qt}. We hope you will enjoy using Qt. @@ -542,25 +545,40 @@ Symbian platform, */ /*! \page install-Symbian.html -\title Installing Qt on the Symbian Platform +\title Installing Qt on the Symbian platform \ingroup installation -\ingroup qts60 +\ingroup qtsymbian \brief How to install Qt on the Symbian platform. \note Qt for the Symbian platform has some requirements that are given in more detail -in the \l{Qt for Symbian Platform Requirements} document. +in the \l{Qt for the Symbian platform Requirements} document. \note \bold {This document describes how to install and configure Qt for the Symbian platform from scratch. If you are using pre-built binaries, follow the instructions given in the -\l{Installing Qt on the Symbian Platform from a Binary Package} document.} +\l{Installing Qt on the Symbian platform from a Binary Package} document.} \list 1 + \o Setup the development environment + + Make sure your Symbian development environment is correctly installed and + patched as explained in the \l{Qt for the Symbian platform Requirements} document. + + After you have finished the Symbian development environment setup, it is good + to verify that environment is functional for example by compiling one + of the pure Symbian examples for both emulator and HW. This can be done from + command prompt as follows: + + \snippet doc/src/snippets/code/doc_src_installation.qdoc 32 + + If all steps pass without errors your Symbian development environment is + very likely installed correctly. + \o Install Qt - Uncompress the package into the directory you want Qt installed, - e.g. \c{C:\Qt\%VERSION%}. + Uncompress the \l{http://qt.nokia.com/downloads}{downloaded} source package into the + directory you want Qt installed, e.g. \c{C:\Qt\%VERSION%}. \note Qt must be installed on the same drive as the Symbian SDK you are using, and the install path must not contain any spaces. @@ -589,10 +607,11 @@ If you are using pre-built binaries, follow the instructions given in the to build the tools using MinGW, and the libraries using abld. or \snippet doc/src/snippets/code/doc_src_installation.qdoc 31 - to build the tools using MinGW, and the libraries using sbsv2. + to build the tools using MinGW, and the libraries using SBSv2. - For other options, type \c{configure -help} to get a list of all available - options. + SBSv2 also known as a (\l{http://developer.symbian.org/wiki/index.php/Introduction_to_RAPTOR} {Raptor}) + is a next-generation Symbian build system. SBSv2 is not officially + supported by any of the S60 SDKs currently available from Forum Nokia. \o Build Qt @@ -631,7 +650,7 @@ If you are using pre-built binaries, follow the instructions given in the \snippet doc/src/snippets/code/doc_src_installation.qdoc 27 For more information about building and running Qt programs on the -Symbian platform, see \l{Symbian platform - Introduction to Qt}. + Symbian platform, see \l{The Symbian platform - Introduction to Qt}. We hope you will enjoy using Qt. @@ -666,7 +685,7 @@ Symbian platform, see \l{Symbian platform - Introduction to Qt}. \list \o \l{Qt for Embedded Linux Requirements} \o \l{Qt for Mac OS X Requirements} - \o \l{Qt for Symbian platform Requirements} + \o \l{Qt for the Symbian platform Requirements} \o \l{Qt for Windows CE Requirements} \o \l{Qt for Windows Requirements} \o \l{Qt for X11 Requirements} @@ -951,12 +970,12 @@ Symbian platform, see \l{Symbian platform - Introduction to Qt}. /*! \page requirements-symbian.html - \title Qt for Symbian Platform Requirements + \title Qt for the Symbian platform Requirements \ingroup installation \brief Setting up the Symbian platform environment for Qt. \previouspage General Qt Requirements - Qt for Symbian platform requires the following software installed on your development PC: + Qt for the Symbian platform requires the following software installed on your development PC: \list \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/carbide_cpp/}{Carbide.c++ v2.0.0 or higher} \list @@ -969,7 +988,11 @@ Symbian platform, see \l{Symbian platform - Introduction to Qt}. \o \bold{Note:} According to Symbian, version 5.6.1 build 638 is mandatory. Using later versions may result in unexplained errors. \endlist \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/S60SDK/}{S60 Platform SDK 3rd Edition FP1 or higher} - \o \l{http://www.forum.nokia.com/main/resources/technologies/openc_cpp/}{Open C/C++ v1.6.0 or higher}. + \list + \o \bold{Note:} Users of \bold{S60 Platform SDK 3rd Edition FP1} also need special update. The update can be found + \l{http://pepper.troll.no/s60prereleases/patches/}{here}. + \endlist + \o \l{http://www.forum.nokia.com/main/resources/technologies/openc_cpp/}{Open C/C++ v1.6.0 or higher}. Install this to all Symbian SDKs you plan to use Qt with. \o Building Qt tools from scratch requires \l{http://www.mingw.org/}{MinGW 3.4.5 or higher}, or another windows compiler. \list @@ -987,8 +1010,8 @@ Symbian platform, see \l{Symbian platform - Introduction to Qt}. \o \c{nokia_plugin\opencpp\s60opencppsis\stdcpp_s60_.sis} \endlist - \note Users of \bold{S60 Platform SDK 3rd Edition FP1} also need special updates. The update can be found - \l{http://pepper.troll.no/s60prereleases/patches/}{here}. + We recommend you to take a look of \l{http://developer.symbian.org/wiki/index.php/Qt_Quick_Start}{Symbian Foundation - Qt Quick Start} + to get more information about how to setup the development environment. \sa {Known Issues in %VERSION%} */ diff --git a/doc/src/getting-started/known-issues.qdoc b/doc/src/getting-started/known-issues.qdoc index 0b63423..0716e25 100644 --- a/doc/src/getting-started/known-issues.qdoc +++ b/doc/src/getting-started/known-issues.qdoc @@ -159,4 +159,11 @@ window will cause it to flash. This behavior has been reported to Apple (bug number 5827676). \endlist + + \section2 Symbian + + \list + \o Check known issues for Symbian at + \l{http://qt.gitorious.org/qt/pages/Qt460KnownIssues} {Known Issues Wiki}. + \endlist */ diff --git a/doc/src/howtos/exceptionsafety.qdoc b/doc/src/howtos/exceptionsafety.qdoc index fa1427b..2f561a0 100644 --- a/doc/src/howtos/exceptionsafety.qdoc +++ b/doc/src/howtos/exceptionsafety.qdoc @@ -147,7 +147,7 @@ \section2 The Symbian platform The Symbian platform implements its own exception system that differs from the standard - C++ mechanism. When using Qt for Symbian platform, and especially when writing code to + C++ mechanism. When using Qt for the Symbian platform, and especially when writing code to access Symbian functionality directly, it may be necessary to know about the underlying implementation and how it interacts with Qt. diff --git a/doc/src/platforms/compiler-notes.qdoc b/doc/src/platforms/compiler-notes.qdoc index 4577bf0..e27a9dc 100644 --- a/doc/src/platforms/compiler-notes.qdoc +++ b/doc/src/platforms/compiler-notes.qdoc @@ -287,4 +287,9 @@ Make sure you have the \l{http://www-1.ibm.com/support/search.wss?rs=32&tc=SSEP5D&dc=D400}{latest upgrades} installed. + + \section2 GCCE (Symbian) + + GCCE cannot be used to compile Qt libaries for the Symbian platform, but GCCE is supported + when compiling Qt applications for Symbian platform. */ diff --git a/doc/src/platforms/qt-embedded.qdoc b/doc/src/platforms/qt-embedded.qdoc index b38c94f..afed540 100644 --- a/doc/src/platforms/qt-embedded.qdoc +++ b/doc/src/platforms/qt-embedded.qdoc @@ -67,10 +67,9 @@ Applications use the appropriate style for the embedded environment and use native features, such as menus, to conform to the native style guidelines. - \o \l{Symbian Platform - Introduction to Qt}{Qt for the Symbian - platform} is used to create applications running in existing Symbian - platform environments. Applications use the appropriate style for the - embedded environment and use native features, such as menus, to conform - to the native style guidelines. + \o \l{Qt for the Symbian platform} is used to create applications running + in existing Symbian platform environments. Applications use the appropriate + style for the embedded environment and use native features, such as menus, + to conform to the native style guidelines. \endtable */ diff --git a/doc/src/platforms/s60-introduction.qdoc b/doc/src/platforms/s60-introduction.qdoc deleted file mode 100644 index 0581982..0000000 --- a/doc/src/platforms/s60-introduction.qdoc +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page symbian-with-qt-introduction.html - - \title Symbian Platform - Introduction to Qt - \brief An introduction to Qt for Symbian platform developers. - \ingroup howto - \ingroup qts60 - - \tableofcontents - - \section1 Required tools - - See \l{Qt for Symbian Platform Requirements} to see what tools are - required to use Qt for Symbian platform. - - \section1 Installing Qt and running demos - - Follow the instructions found in \l{Installing Qt on the Symbian platform from a Binary Package} - to learn how to install Qt using a binary package and how to build and run Qt demos. - - Follow the instructions found in \l{Installing Qt on the Symbian Platform} to learn how to install Qt using - using source package and how to build and run the Qt demos. - - \section1 Building your own applications - - If you are new to Qt development, have a look at \l{How to Learn Qt}. - In general, the difference between developing a - Qt application on the Symbian platform compared to any of the other platforms supported - by Qt is not that big. - - Once you have created a \c .pro file for your project, generate the - Carbide specific \c Bld.inf and \c .mmp files this way: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 0 - - For more information on how to use qmake have a look at the \l - {qmake Tutorial}. - - Now you can build the Qt for the Symbian platform application with - standard build tools. By default, running \c make will produce binaries for - the emulator. However, the Symbian platform comes with several alternative - build targets, as shown in the table below: - - \table - \row \o \c debug-winscw \o Build debug binaries for the emulator (default). - It is currently not possible to build release - binaries for the emulator. - \row \o \c debug-gcce \o Build debug binaries for hardware using GCCE. - \row \o \c release-gcce \o Build release binaries for hardware using GCCE. - \row \o \c debug-armv5 \o Build debug binaries for hardware using RVCT. - \row \o \c release-armv5 \o Build release binaries for hardware using RVCT. - \row \o \c run \o Run the emulator binaries from the build directory. - \row \o \c sis \o Create signed \c .sis file for project. - \endtable - - The following lines perform a debug build for the emulator - and deploy all the needed files: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 1 - - To work on your project in Carbide, simply import the \c .pro file - by right clicking on the project explorer and executing "Import...". - - \section1 Installing your own applications - - To install your own applications on hardware, you need signed \c .sis file. - The signed \c .sis file can be created with \c make \c sis target. \c sis target - is only supported for executables or projects with \c DEPLOYMENT statements. - By default the \c sis target will create signed \c .sis file for last build - target. For example, the following sequence will generate the needed makefiles, - build the project for \c debug-winscw and \c release-armv5, and create - self-signed \c .sis file for \c release-armv5 target: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 2 - - If you want to use different certificate information or override the default - target for \c .sis file creation you can use the environment variables as - shown in the table below: - - \table - \row \o \c QT_SIS_OPTIONS \o Options accepted by \c .sis creation. - -i, install the package right away using PC suite. - -c=, read certificate information from a file. - Execute the \c{createpackage.pl} script without any - parameters for more information about options. - By default no otions are given. - \row \o \c QT_SIS_TARGET \o Target for which \c .sis file is created. - Accepted values are build targets listed in - previous table. By default last build target. - \row \o \c QT_SIS_CERTIFICATE \o The certificate file used for signing. - By default self-signed certificate. - \row \o \c QT_SIS_KEY \o The certificate's private key file. - By default key is associated to self-signed certificate. - \row \o \c QT_SIS_PASSPHRASE \o The certificate's private key file's passphrase. - By default empty. - \endtable - - For example: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 4 - - The environment variables for \c make can also be given as parameters: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 3 - - If you want to install the program immediately, make sure that the device - is connected to the computer in "PC Suite" mode, and run \c sis target - with the \c QT_SIS_OPTIONS=-i, like this: - - \snippet doc/src/snippets/code/doc_src_s60-introduction.qdoc 5 -*/ diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index 560ddfe..d1affe2 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -89,8 +89,8 @@ \o gcc (\l{http://www.codesourcery.com/}{Codesourcery version)} \row \o Windows CE 5.0 (ARMv4i, x86, MIPS) \o MSVC 2005 WinCE 5.0 Standard (x86, pocket, smart, mipsii) - \row \o Symbian (S60 3.1, 3.2 and 5.0) - \o RVCT, GCCE, WINSCW + \row \o Symbian (Symbian/S60 3.1, 3.2 and 5.0) + \o RVCT 2.2 [build 686 or later], WINSCW 3.2.5 [build 482 or later], GCCE (for applications) \endtable \section1 Tier 2 Platforms diff --git a/doc/src/platforms/symbian-exceptionsafety.qdoc b/doc/src/platforms/symbian-exceptionsafety.qdoc index 88f4d03..99bd2d8 100644 --- a/doc/src/platforms/symbian-exceptionsafety.qdoc +++ b/doc/src/platforms/symbian-exceptionsafety.qdoc @@ -42,7 +42,7 @@ /*! \page symbianexceptionsafety.html \title Exception Safety with Symbian - \ingroup qts60 + \ingroup qtsymbian \brief A guide to integrating exception safety in Qt with Symbian. The following sections describe how Qt code can interoperate with Symbian's diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc new file mode 100644 index 0000000..c0c4fb3 --- /dev/null +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -0,0 +1,197 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \group qtsymbian + \title Qt for the Symbian platform + \ingroup qt-embedded + \brief Documents related to Qt on the Symbian platform + + Qt for Symbian is a C++ framework for GUI and application development + for embedded devices running Symbian. Qt for Symbian provides all + functionality required to develop rich end-user applications for devices + running S60 3.1 and later. + + \table 100% + \header \o Getting Started \o Reference \o Development + \row + \o + \list + \o \l {Qt for the Symbian platform Requirements} + \o \l {Installing Qt on the Symbian platform from a Binary Package} + \o \l {Installing Qt on the Symbian platform} + \o \l {The Symbian platform - Introduction to Qt}{Introduction to using Qt} + \endlist + \o + \list + \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} + \endlist + \o + \list + \o \l {Deploying an Application on the Symbian platform}{Deploying Applications} + \endlist + \endtable +*/ + +/*! + \page symbian-with-qt-introduction.html + + \title The Symbian platform - Introduction to Qt + \brief An introduction to Qt for the Symbian platform developers. + \ingroup howto + \ingroup qtsymbian + + \tableofcontents + + \section1 Required tools + + See \l{Qt for the Symbian platform Requirements} to see what tools are + required to use Qt for the Symbian platform. + + \section1 Installing Qt and running demos + + Follow the instructions found in \l{Installing Qt on the Symbian platform from a Binary Package} + to learn how to install Qt using a binary package and how to build and run Qt demos. + + Follow the instructions found in \l{Installing Qt on the Symbian platform} to learn how to install Qt using + using source package and how to build and run the Qt demos. + + \section1 Building your own applications + + If you are new to Qt development, have a look at \l{How to Learn Qt}. + In general, the difference between developing a + Qt application on the Symbian platform compared to any of the other platforms supported + by Qt is not that big. + + Once you have created a \c .pro file for your project, generate the + Symbian specific \c Bld.inf and \c .mmp files this way: + + \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 0 + + For more information on how to use qmake have a look at the \l + {qmake Tutorial}. + + Now you can build the Qt for the Symbian platform application with + standard build tools. By default, running \c make will produce binaries for + the emulator. However, the Symbian platform comes with several alternative + build targets, as shown in the table below: + + \table + \row \o \c debug-winscw \o Build debug binaries for the emulator (default). + It is currently not possible to build release + binaries for the emulator. + \row \o \c debug-gcce \o Build debug binaries for hardware using GCCE. + \row \o \c release-gcce \o Build release binaries for hardware using GCCE. + \row \o \c debug-armv5 \o Build debug binaries for hardware using RVCT. + \row \o \c release-armv5 \o Build release binaries for hardware using RVCT. + \row \o \c run \o Run the emulator binaries from the build directory. + \row \o \c sis \o Create signed \c .sis file for project. + \endtable + + The following lines perform a debug build for the emulator + and deploy all the needed files: + + \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 1 + + To work on your project in Carbide, simply import the \c .pro file + by right clicking on the project explorer and executing "Import...". + + \section1 Installing your own applications + + To install your own applications on hardware, you need a signed \c .sis file. + (Refer to the \l{http://developer.symbian.org/wiki/index.php/Platform_Security_%28Fundamentals_of_Symbian_C%2B%2B%29#Self-Signed_Applications} + {Platform Security Article} for more informations about self-signing.) + The signed \c .sis file can be created with \c make \c sis target. \c sis target + is only supported for executables or projects with \c DEPLOYMENT statements. + By default the \c sis target will create signed \c .sis file for last build + target. For example, the following sequence will generate the needed makefiles, + build the project for \c debug-winscw and \c release-armv5, and create + self-signed \c .sis file for \c release-armv5 target: + + \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 2 + + If you want to use different certificate information or override the default + target for \c .sis file creation you can use the environment variables as + shown in the table below: + + \table + \row \o \c QT_SIS_OPTIONS \o Options accepted by \c .sis creation. See + \l{Supported options for QT_SIS_OPTIONS}{Supported options} + below. By default no otions are given. + \row \o \c QT_SIS_TARGET \o Target for which \c .sis file is created. + Accepted values are build targets listed in + previous table. By default last build target. + \row \o \c QT_SIS_CERTIFICATE \o The certificate file used for signing. + By default self-signed certificate. + \row \o \c QT_SIS_KEY \o The certificate's private key file. + By default key is associated to self-signed certificate. + \row \o \c QT_SIS_PASSPHRASE \o The certificate's private key file's passphrase. + By default empty. + \endtable + + The suppported options for \c QT_SIS_OPTIONS: + + \target Supported options for QT_SIS_OPTIONS + \table + \row \o -i \o Install the package right away using PC suite. + \row \o -p \o Only preprocess the template \c .pkg file. + \row \o -c= \o Read certificate information from a file. + \endtable + + Execute the \c{createpackage.pl} script without any + parameters for detailed information about options. By default no otions are given. + + For example: + + \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 4 + + The environment variables for \c make can also be given as parameters: + + \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 3 + + If you want to install the program immediately, make sure that the device + is connected to the computer in "PC Suite" mode, and run \c sis target + with the \c QT_SIS_OPTIONS=-i, like this: + + \snippet doc/src/snippets/code/doc_src_symbian-introduction.qdoc 5 +*/ diff --git a/doc/src/platforms/winsystem.qdoc b/doc/src/platforms/winsystem.qdoc index 72e7da6..2f43a74 100644 --- a/doc/src/platforms/winsystem.qdoc +++ b/doc/src/platforms/winsystem.qdoc @@ -102,9 +102,9 @@ When compiling for this platform, the macro \c{Q_WS_WINCE} is defined. See the \l{Qt for Windows CE} documentation for more information. - \section1 Qt for Symbian Platform + \section1 Qt for the Symbian platform When compiling for this platform, the macro \c{Q_WS_S60} is defined. - See the \l{Symbian Platform - Introduction to Qt} documentation for + See the \l{The Symbian platform - Introduction to Qt} documentation for more information. */ diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 2a1f8ff..fb1d0e4 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -491,7 +491,7 @@ rich end-user applications for devices running S60 3.1 and later. - See the \l{Symbian Platform - Introduction to Qt} for more information. + See the \l{The Symbian platform - Introduction to Qt} for more information. \section1 Animation Framework diff --git a/doc/src/snippets/code/doc_src_deployment.qdoc b/doc/src/snippets/code/doc_src_deployment.qdoc index d233ec3..2d6a78f 100644 --- a/doc/src/snippets/code/doc_src_deployment.qdoc +++ b/doc/src/snippets/code/doc_src_deployment.qdoc @@ -453,3 +453,44 @@ CONFIG+=x86 ppc //! [54] qApp->addLibraryPath("C:/customPath/plugins"); //! [54] + +//! [55] +cd examples\widgets\wiggly +//! [55] + +//! [56] +vendorinfo = \ + "%{\"Example Localized Vendor\"}" \ + ":\"Example Vendor\"" + +default_deployment.pkg_prerules = vendorinfo +//! [56] + +//! [57] +supported_platforms = \ + "; This demo only supports S60 5.0" \ + "[0x1028315F],0,0,0,{\"S60ProductID\"}" + +default_deployment.pkg_prerules += supported_platforms +//! [57] + +//! [58] +embedded_deployments = \ + "; Embed Open C dependencies" \ + "@\"$${EPOCROOT}nokia_plugin/openc/s60opencsis/pips_s60_1_6_SS.sis\",(0x20013851)" \ + "@\"$${EPOCROOT}nokia_plugin/openc/s60opencsis/openc_ssl_s60_1_6_SS.sis\",(0x200110CB)" \ + "@\"$${EPOCROOT}nokia_plugin/opencpp/s60opencppsis/STDCPP_s60_1_6_SS.sis\",(0x2000F866)" \ + "; Embed Qt dependencies" \ + "@\"$$[QT_INSTALL_PREFIX]/qt_rndsigned.sis\",(0x2001E61C)" + +default_deployment.pkg_prerules += embedded_deployments +//! [58] + +//! [59] +qmake +make release-gcce +//! [59] + +//! [60] +make sis +//! [60] \ No newline at end of file diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc index 68765ec..3563a64 100644 --- a/doc/src/snippets/code/doc_src_installation.qdoc +++ b/doc/src/snippets/code/doc_src_installation.qdoc @@ -209,3 +209,10 @@ make sis QT_SIS_OPTIONS=-i cd \Qt\%VERSION% configure -platform win32-g++ -xplatform symbian-sbsv2 //! [31] + +//! [32] +cd \S60CppExamples\Note\group +bldmake bldfiles +abld build winscw udeb +abld build gcce urel +//! [32] diff --git a/doc/src/snippets/code/doc_src_s60-introduction.qdoc b/doc/src/snippets/code/doc_src_s60-introduction.qdoc deleted file mode 100644 index 8949df6..0000000 --- a/doc/src/snippets/code/doc_src_s60-introduction.qdoc +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [0] - qmake -//! [0] - - -//! [1] - make debug-winscw -//! [1] - -//! [2] - qmake - make debug-winscw release-armv5 - make sis -//! [2] - -//! [3] - make sis QT_SIS_TARGET=debug-armv5 -//! [3] - -//! [4] - set QT_SIS_TARGET=debug-armv5 - make sis -//! [4] - -//! [5] - set QT_SIS_OPTIONS=-i - make sis -//! [5] diff --git a/doc/src/snippets/code/doc_src_symbian-introduction.qdoc b/doc/src/snippets/code/doc_src_symbian-introduction.qdoc new file mode 100644 index 0000000..8949df6 --- /dev/null +++ b/doc/src/snippets/code/doc_src_symbian-introduction.qdoc @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] + qmake +//! [0] + + +//! [1] + make debug-winscw +//! [1] + +//! [2] + qmake + make debug-winscw release-armv5 + make sis +//! [2] + +//! [3] + make sis QT_SIS_TARGET=debug-armv5 +//! [3] + +//! [4] + set QT_SIS_TARGET=debug-armv5 + make sis +//! [4] + +//! [5] + set QT_SIS_OPTIONS=-i + make sis +//! [5] -- cgit v0.12 From 70f482d84022da55b8cc7580d9993a339165219b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 19 Nov 2009 22:06:26 +0100 Subject: fix potentially wrong output codec for UTF-16 input files querying the actual codec before the file has been read is pointless --- tools/linguist/lupdate/cpp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 443abd0..bd7d4ec 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -2150,9 +2150,9 @@ void loadCPP(Translator &translator, const QStringList &filenames, ConversionDat QTextStream ts(&file); ts.setCodec(codec); ts.setAutoDetectUnicode(true); + parser.setInput(ts, filename); if (ts.codec()->name() == "UTF-16") translator.setCodecName("System"); - parser.setInput(ts, filename); Translator *tor = new Translator; tor->setCodecName(translator.codecName()); parser.setTranslator(tor); -- cgit v0.12 From ae653c8ff92c23c3f9ebbdb753a1e0edea95be7e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 19 Nov 2009 22:09:28 +0100 Subject: don't overwrite explicitly specified CODECFORTR on UTF-16 input --- tools/linguist/lupdate/cpp.cpp | 2 +- tools/linguist/lupdate/main.cpp | 1 + tools/linguist/shared/translator.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index bd7d4ec..7c9b27a 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -2151,7 +2151,7 @@ void loadCPP(Translator &translator, const QStringList &filenames, ConversionDat ts.setCodec(codec); ts.setAutoDetectUnicode(true); parser.setInput(ts, filename); - if (ts.codec()->name() == "UTF-16") + if (cd.m_outputCodec.isEmpty() && ts.codec()->name() == "UTF-16") translator.setCodecName("System"); Translator *tor = new Translator; tor->setCodecName(translator.codecName()); diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index bdaec4f..7defee0 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -494,6 +494,7 @@ int main(int argc, char **argv) if (!tmp.isEmpty() && !tmp.first().isEmpty()) { codecForTr = tmp.first().toLatin1(); fetchedTor.setCodecName(codecForTr); + cd.m_outputCodec = codecForTr; } tmp = variables.value("CODECFORSRC"); if (!tmp.isEmpty() && !tmp.first().isEmpty()) { diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index f29317b..e36f822 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -97,7 +97,7 @@ public: public: QString m_defaultContext; QByteArray m_codecForSource; // CPP, PO & QM specific - QByteArray m_outputCodec; // PO specific + QByteArray m_outputCodec; // CPP & PO specific QString m_unTrPrefix; // QM specific QString m_sourceFileName; QString m_targetFileName; -- cgit v0.12 From 73477789bdeeba851cf095cbdda5c36d9f5c31df Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 20 Nov 2009 10:22:17 +1000 Subject: Prevent a deep copy of QImage::bits() in the OpenVG pixmap implementation Task-number: QTBUG-5869 Reviewed-by: Sarah Smith --- src/openvg/qpixmapdata_vg.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 3254aa3..fad5bb5 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -202,6 +202,14 @@ QPaintEngine* QVGPixmapData::paintEngine() const return source.paintEngine(); } +// This function works around QImage::bits() making a deep copy if the +// QImage is not const. We force it to be const and then get the bits. +// XXX: Should add a QImage::constBits() in the future to replace this. +static inline const uchar *qt_vg_imageBits(const QImage& image) +{ + return image.bits(); +} + VGImage QVGPixmapData::toVGImage() { if (!isValid()) @@ -232,7 +240,7 @@ VGImage QVGPixmapData::toVGImage() if (!source.isNull() && recreate) { vgImageSubData (vgImage, - source.bits(), source.bytesPerLine(), + qt_vg_imageBits(source), source.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, w, h); } @@ -272,7 +280,7 @@ VGImage QVGPixmapData::toVGImage(qreal opacity) if (!source.isNull() && recreate) { vgImageSubData (vgImage, - source.bits(), source.bytesPerLine(), + qt_vg_imageBits(source), source.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, w, h); } -- cgit v0.12 From 55b1f191d2ab97b2c1029f12e2315412e74a1dc2 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 20 Nov 2009 15:11:17 +1000 Subject: Remove unmatched else in non-EGL mode for OpenVG pixmap data Reviewed-by: Gunnar Sletta --- src/openvg/qpixmapdata_vg.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index fad5bb5..f462113 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -92,7 +92,6 @@ QVGPixmapData::~QVGPixmapData() vgDestroyImage(vgImage); if (vgImageOpacity != VG_INVALID_HANDLE) vgDestroyImage(vgImageOpacity); - } else { #endif } #if !defined(QT_NO_EGL) -- cgit v0.12 From a8c8c2274d2d0a708786adbb357013955f99c0af Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 20 Nov 2009 16:32:35 +1000 Subject: Do not recreate the VGImage if the size is unchanged When a pixmap's contents change in QVGPixmapData, only recreate the VGImage in the GPU if the size is different than before. This should help reduce GPU memory fragmentation. Task-number: QT-2504 Reviewed-by: Sarah Smith --- src/openvg/qpixmapdata_vg.cpp | 42 +++++++++--------------------------------- src/openvg/qpixmapdata_vg_p.h | 1 + 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index f462113..19c90ed 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -220,7 +220,7 @@ VGImage QVGPixmapData::toVGImage() context = qt_vg_create_context(0); #endif - if (recreate) { + if (recreate && prevSize != QSize(w, h)) { if (vgImage != VG_INVALID_HANDLE) { vgDestroyImage(vgImage); vgImage = VG_INVALID_HANDLE; @@ -229,6 +229,8 @@ VGImage QVGPixmapData::toVGImage() vgDestroyImage(vgImageOpacity); vgImageOpacity = VG_INVALID_HANDLE; } + } else if (recreate) { + cachedOpacity = -1.0f; // Force opacity image to be refreshed later. } if (vgImage == VG_INVALID_HANDLE) { @@ -244,6 +246,7 @@ VGImage QVGPixmapData::toVGImage() } recreate = false; + prevSize = QSize(w, h); return vgImage; } @@ -251,43 +254,14 @@ VGImage QVGPixmapData::toVGImage() VGImage QVGPixmapData::toVGImage(qreal opacity) { #if !defined(QT_SHIVAVG) - if (!isValid()) + // Force the primary VG image to be recreated if necessary. + if (toVGImage() == VG_INVALID_HANDLE) return VG_INVALID_HANDLE; -#if !defined(QT_NO_EGL) - // Increase the reference count on the shared context. - if (!context) - context = qt_vg_create_context(0); -#endif - - if (recreate) { - if (vgImage != VG_INVALID_HANDLE) { - vgDestroyImage(vgImage); - vgImage = VG_INVALID_HANDLE; - } - if (vgImageOpacity != VG_INVALID_HANDLE) { - vgDestroyImage(vgImageOpacity); - vgImageOpacity = VG_INVALID_HANDLE; - } - } - - if (vgImage == VG_INVALID_HANDLE) { - vgImage = vgCreateImage - (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER); - } - - if (!source.isNull() && recreate) { - vgImageSubData - (vgImage, - qt_vg_imageBits(source), source.bytesPerLine(), - VG_sARGB_8888_PRE, 0, 0, w, h); - } - - recreate = false; - if (opacity == 1.0f) return vgImage; + // Create an alternative image for the selected opacity. if (vgImageOpacity == VG_INVALID_HANDLE || cachedOpacity != opacity) { if (vgImageOpacity == VG_INVALID_HANDLE) { vgImageOpacity = vgCreateImage @@ -412,6 +386,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) vgDestroyImage(vgImageOpacity); vgImageOpacity = VG_INVALID_HANDLE; } + prevSize = QSize(); TInt err = 0; @@ -472,6 +447,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) is_null = (w <= 0 || h <= 0); source = QImage(); recreate = false; + prevSize = QSize(w, h); setSerialNumber(++qt_vg_pixmap_serial); // release stuff eglDestroyImageKHR(context->display(), eglImage); diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h index f6fac88..fe19f35 100644 --- a/src/openvg/qpixmapdata_vg_p.h +++ b/src/openvg/qpixmapdata_vg_p.h @@ -109,6 +109,7 @@ protected: #endif protected: + QSize prevSize; VGImage vgImage; VGImage vgImageOpacity; qreal cachedOpacity; -- cgit v0.12 From 8b07ffbf0e7f2758c3ae172b888bccdfea509cfc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Nov 2009 11:02:39 +0100 Subject: =?UTF-8?q?QT=20=E2=80=94=3D=20xml=20for=20bootstrapped=20lrelease?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/linguist/lrelease/lrelease.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/linguist/lrelease/lrelease.pro b/tools/linguist/lrelease/lrelease.pro index e4c18ee..a48c011 100644 --- a/tools/linguist/lrelease/lrelease.pro +++ b/tools/linguist/lrelease/lrelease.pro @@ -9,6 +9,8 @@ include(../../../src/tools/bootstrap/bootstrap.pri) include(../shared/formats.pri) include(../shared/proparser.pri) +QT -= xml # formats.pri pulls that in, but it breaks bootstrapping + win32-msvc*:LIBS += advapi32.lib # for qsettings_win.cpp target.path=$$[QT_INSTALL_BINS] -- cgit v0.12 From 7e0e7abcfea715ae17c560e7903100a1f3ee0aeb Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 20 Nov 2009 12:32:25 +0200 Subject: Fix ICON keyword to work with absolute paths also in SBSv2. Task-number: QTBUG-4745 Reviewed-by: Miikka Heikkinen --- qmake/generators/symbian/symmake_sbsv2.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 4fd5833..c7eae64 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -376,7 +376,10 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t t << "START EXTENSION s60/mifconv" << endl; QFileInfo iconInfo = fileInfo(icon); - QString iconPath = iconInfo.path(); + + QFileInfo bldinf(project->values("MAKEFILE").first()); + QString iconPath = bldinf.dir().relativeFilePath(iconInfo.path()); + QString iconFile = iconInfo.baseName(); QFileInfo iconTargetInfo = fileInfo(iconTargetFile); -- cgit v0.12 From 31958f5f013eda50373d9960cfa2a6f398357b3b Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Fri, 20 Nov 2009 11:33:54 +0100 Subject: Symbian: Add capability NetworkServices. From discussions with Helix team. Reviewed-by: Gareth Stockwell --- demos/qmediaplayer/qmediaplayer.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/demos/qmediaplayer/qmediaplayer.pro b/demos/qmediaplayer/qmediaplayer.pro index 2f15c28..9407a81 100644 --- a/demos/qmediaplayer/qmediaplayer.pro +++ b/demos/qmediaplayer/qmediaplayer.pro @@ -32,4 +32,6 @@ symbian { DEPLOYMENT += addFiles include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) + + TARGET.CAPABILITY="NetworkServices" } -- cgit v0.12 From e2001432f89b6934b6c60c29c3c742a5bbc322a6 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Fri, 20 Nov 2009 11:34:24 +0100 Subject: Docs: Symbian: correct capabilities wrt. Helix Phonon plugin. Reviewed-by: Gareth Stockwell --- doc/src/platforms/platform-notes.qdoc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index 68015a6..85b9ff8 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -515,11 +515,8 @@ In addition, there exists a backend for the Helix framework. However, due to it not shipping with Qt, its availability depends on the Symbian platform in use. If available, it is loaded in preference over the MMF - plugin. The Helix plugin requires Symbian signed capabilities. If the - application does not have those capabilities, the MMF plugin, if present on - the device, will be loaded instead. The capabilities the Helix backend - requires are AllFiles, DiskAdmin and MultimediaDD. - + plugin. If the Helix plugin fails to load, the MMF plugin, if present on + the device, will be loaded instead. */ /*! -- cgit v0.12 From 8fb9ed08c60b667737a9ae1b209da61fe9c67200 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 20 Nov 2009 11:16:31 +0100 Subject: Fix for tabwidget usesScrollButton being overriden by stylesheet Setting a stylesheet or reparenting a widget into a widget using style sheet would cause the usesScrollButtons to be reset. Instead we now keep the flag whenever it has been explicitly set by the user rather than querying from the style again. Task-number: QTBUG-3370 Reviewed-by: jbache --- src/gui/widgets/qtabbar.cpp | 4 +++- src/gui/widgets/qtabbar_p.h | 3 ++- tests/auto/qtabbar/tst_qtabbar.cpp | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 3935c55..8ef6017 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1948,7 +1948,8 @@ void QTabBar::changeEvent(QEvent *event) Q_D(QTabBar); if (event->type() == QEvent::StyleChange) { d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); - d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); + if (!d->useScrollButtonsSetByUser) + d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); d->refresh(); } else if (event->type() == QEvent::FontChange) { d->refresh(); @@ -2003,6 +2004,7 @@ bool QTabBar::usesScrollButtons() const void QTabBar::setUsesScrollButtons(bool useButtons) { Q_D(QTabBar); + d->useScrollButtonsSetByUser = true; if (d->useScrollButtons == useButtons) return; d->useScrollButtons = useButtons; diff --git a/src/gui/widgets/qtabbar_p.h b/src/gui/widgets/qtabbar_p.h index 9f3285b..2e8fb6d 100644 --- a/src/gui/widgets/qtabbar_p.h +++ b/src/gui/widgets/qtabbar_p.h @@ -75,7 +75,7 @@ class QTabBarPrivate : public QWidgetPrivate public: QTabBarPrivate() :currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), layoutDirty(false), - drawBase(true), scrollOffset(0), expanding(true), closeButtonOnTabs(false), + drawBase(true), scrollOffset(0), useScrollButtonsSetByUser(false) , expanding(true), closeButtonOnTabs(false), selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false), movingTab(0) #ifdef Q_WS_MAC @@ -187,6 +187,7 @@ public: QSize iconSize; Qt::TextElideMode elideMode; bool useScrollButtons; + bool useScrollButtonsSetByUser; bool expanding; bool closeButtonOnTabs; diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp index 2db72b9..e83312d 100644 --- a/tests/auto/qtabbar/tst_qtabbar.cpp +++ b/tests/auto/qtabbar/tst_qtabbar.cpp @@ -295,6 +295,10 @@ void tst_QTabBar::setUsesScrollButtons() if (usesArrows != -128) tabBar.setUsesScrollButtons(usesArrows); QTEST(tabBar.usesScrollButtons(), "expectedArrows"); + + // Make sure style sheet does not override user set mode + tabBar.setStyleSheet("QWidget { background-color: #ABA8A6;}"); + QTEST(tabBar.usesScrollButtons(), "expectedArrows"); } void tst_QTabBar::removeLastTab() @@ -532,7 +536,7 @@ void tst_QTabBar::task251184_removeTab() QCOMPARE(bar.count(), 1); QCOMPARE(bar.currentIndex(), 0); - QCOMPARE(bar.tabText(bar.currentIndex()), QString("bar2")); + QCOMPARE(bar.tabText(bar.currentIndex()), QString("bar2")); } -- cgit v0.12 From f8fb064d6b2ad55c66ce1a481e7f829278051fcb Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 20 Nov 2009 11:34:22 +0100 Subject: avoid possible crash when showing a modal dialog from a widget destructor Task-number: QTBUG-5804 Reviewed-by: denis --- src/gui/kernel/qwidget.cpp | 5 +++-- tests/auto/qwidget/tst_qwidget.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 709f6f3..fbb9115 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -8248,7 +8248,8 @@ bool QWidget::event(QEvent *event) QList childList = d->children; for (int i = 0; i < childList.size(); ++i) { QObject *o = childList.at(i); - QApplication::sendEvent(o, event); + if (o) + QApplication::sendEvent(o, event); } } update(); @@ -8277,7 +8278,7 @@ bool QWidget::event(QEvent *event) QList childList = d->children; for (int i = 0; i < childList.size(); ++i) { QObject *o = childList.at(i); - if (o != QApplication::activeModalWidget()) { + if (o && o != QApplication::activeModalWidget()) { if (qobject_cast(o) && static_cast(o)->isWindow()) { // do not forward the event to child windows, // QApplication does this for us diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 9692c6e..1e3f5f8 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -384,6 +384,8 @@ private slots: void activateWindow(); + void openModal_taskQTBUG_5804(); + #ifdef Q_OS_SYMBIAN void cbaVisibility(); #endif @@ -9583,6 +9585,29 @@ void tst_QWidget::activateWindow() QTRY_VERIFY(!mainwindow2->isActiveWindow()); } +void tst_QWidget::openModal_taskQTBUG_5804() +{ + class Widget : public QWidget + { + public: + Widget(QWidget *parent) : QWidget(parent) + { + } + ~Widget() + { + QMessageBox msgbox; + QTimer::singleShot(10, &msgbox, SLOT(accept())); + msgbox.exec(); //open a modal dialog + } + }; + + QWidget *win = new QWidget; + new Widget(win); + win->show(); + QTest::qWaitForWindowShown(win); + delete win; +} + #ifdef Q_OS_SYMBIAN void tst_QWidget::cbaVisibility() { -- cgit v0.12 From ea990fc4c575a76c46464e8b8caa2a03c64f067b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Nov 2009 11:47:12 +0100 Subject: revert QT -= xml nonsense we have CONFIG -= qt in bootstrap.pri, so all QT settings are irrelevant. the actual breakage comes from a bad cherry-pick in the release branch. --- tools/linguist/lrelease/lrelease.pro | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/linguist/lrelease/lrelease.pro b/tools/linguist/lrelease/lrelease.pro index a48c011..e4c18ee 100644 --- a/tools/linguist/lrelease/lrelease.pro +++ b/tools/linguist/lrelease/lrelease.pro @@ -9,8 +9,6 @@ include(../../../src/tools/bootstrap/bootstrap.pri) include(../shared/formats.pri) include(../shared/proparser.pri) -QT -= xml # formats.pri pulls that in, but it breaks bootstrapping - win32-msvc*:LIBS += advapi32.lib # for qsettings_win.cpp target.path=$$[QT_INSTALL_BINS] -- cgit v0.12 From 1b8d5bec5763708c66e7bd586aee3df7f94b5cb5 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Fri, 20 Nov 2009 12:17:34 +0100 Subject: Add support for opening Real Media RAM files. Requested by Nokia Dallas/Helix team. Patch supplied by Fu Liz EXT-DextraTech/Dallas, minor changes by me. Task-number: QTBUG-4882 Reviewed-by: Gareth Stockwell --- demos/qmediaplayer/mediaplayer.cpp | 48 ++++++++++++++++++++++++++++++++++++++ demos/qmediaplayer/mediaplayer.h | 1 + 2 files changed, 49 insertions(+) diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 4021352..f8ca8ea 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -266,6 +266,9 @@ MediaPlayer::MediaPlayer(const QString &filePath, fileMenu = new QMenu(this); QAction *openFileAction = fileMenu->addAction(tr("Open &File...")); QAction *openUrlAction = fileMenu->addAction(tr("Open &Location...")); + QAction *const openLinkAction = fileMenu->addAction(tr("Open &RAM File...")); + + connect(openLinkAction, SIGNAL(triggered(bool)), this, SLOT(openRamFile())); fileMenu->addSeparator(); QMenu *aspectMenu = fileMenu->addMenu(tr("&Aspect ratio")); @@ -835,6 +838,51 @@ void MediaPlayer::openUrl() } } +/*! + \since 4.6 + */ +void MediaPlayer::openRamFile() +{ + QSettings settings; + settings.beginGroup(QLatin1String("BrowserMainWindow")); + + const QStringList fileNameList(QFileDialog::getOpenFileNames(this, + QString(), + settings.value("openRamFile").toString(), + QLatin1String("RAM files (*.ram)"))); + + if (fileNameList.isEmpty()) + return; + + QFile linkFile; + QList list; + QByteArray sourceURL; + for (int i = 0; i < fileNameList.count(); i++ ) { + linkFile.setFileName(fileNameList[i]); + if (linkFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + while (!linkFile.atEnd()) { + sourceURL = linkFile.readLine().trimmed(); + if (!sourceURL.isEmpty()) { + const QUrl url(QUrl::fromEncoded(sourceURL)); + if (url.isValid()) + list.append(url); + } + } + linkFile.close(); + } + } + + if (!list.isEmpty()) { + m_MediaObject.setCurrentSource(Phonon::MediaSource(list[0])); + m_MediaObject.play(); + for (int i = 1; i < list.count(); i++) + m_MediaObject.enqueue(Phonon::MediaSource(list[i])); + } + + forwardButton->setEnabled(!m_MediaObject.queue().isEmpty()); + settings.setValue("openRamFile", fileNameList[0]); +} + void MediaPlayer::finished() { } diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h index a1c3d92..a8f18f0 100644 --- a/demos/qmediaplayer/mediaplayer.h +++ b/demos/qmediaplayer/mediaplayer.h @@ -107,6 +107,7 @@ private slots: void showContextMenu(const QPoint &); void bufferStatus(int percent); void openUrl(); + void openRamFile(); void configureEffect(); void hasVideoChanged(bool); -- cgit v0.12 From 5cf6f6276a3a9103876937c300c1adce157eebeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 20 Nov 2009 12:24:06 +0100 Subject: Fixed antialiasing in the GL based QGraphicsView demos under X11. All the examples/demos that used a QGraphicsView with a QGLWidget as a viewport, that had multisampling enabled, was broken after 7b61fbf03e170a7da37d5f57ed4053aae719ec7f. This is because the reparented QGLWidget will be forced to use the parent widget's visual, which in this case does not contain any multisample buffers. The QX11Info structure for QGLWidget is put together based on the QGLFormat that is passed into the QGLWidget constructor and will in most cases always be different from the parent widget visual. Task-number: QTBUG-5998 and QTBUG-6003 Reviewed-by: Eskil --- src/gui/kernel/qwidget_x11.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 7461637..0bc9cbc 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -527,8 +527,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO QX11InfoData *xd = &X11->screens[qt_x11_create_desktop_on_screen]; xinfo.setX11Data(xd); } else if (parentXinfo && (parentXinfo->screen() != xinfo.screen() - || parentXinfo->visual() != xinfo.visual())) + || (parentXinfo->visual() != xinfo.visual() + && !q->inherits("QGLWidget")))) { + // QGLWidgets have to be excluded here as they have a + // specially crafted QX11Info structure which can't be swapped + // out with the parent widgets QX11Info. The parent visual, + // for instance, might not even be GL capable. xinfo = *parentXinfo; } -- cgit v0.12 From 75d68b2b245da91ec9f985893f9b233d9d6a0793 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 Nov 2009 13:40:34 +0100 Subject: Q_ASSERT failure when resizing a span to (1,1) in 1st cell Reviewed-by: Olivier Task-number: QTBUG-6004 --- src/gui/itemviews/qtableview.cpp | 2 +- tests/auto/qtableview/tst_qtableview.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index a3877b7..d27e693 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -114,7 +114,7 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) } } else if (old_height > span->height()) { //remove the span from all the subspans lists that intersect the columns not covered anymore - Index::iterator it_y = index.lowerBound(-span->bottom()); + Index::iterator it_y = index.lowerBound(qMin(-span->bottom(), 0)); Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list while (-it_y.key() <= span->top() + old_height -1) { if (-it_y.key() > span->bottom()) { diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 46c3fb6..50d6c67 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -3016,6 +3016,14 @@ void tst_QTableView::spans_data() << QPoint(2, 0) << 1 << 2; + + QTest::newRow("QTBUG-6004: No failing Q_ASSERT, then it passes.") + << 5 << 5 + << (SpanList() << QRect(0, 0, 2, 2) << QRect(0, 0, 1, 1)) + << false + << QPoint(0, 0) + << 1 + << 1; } void tst_QTableView::spans() -- cgit v0.12 From a2c247ed521d88f99a21b4207cdff8ea03e949be Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 20 Nov 2009 13:59:18 +0100 Subject: Do not extend the last toolbar in a line when moving it --- src/gui/widgets/qtoolbararealayout.cpp | 11 ++++++----- src/gui/widgets/qtoolbararealayout_p.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index b7e985c..d09a301 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -100,7 +100,7 @@ bool QToolBarAreaLayoutItem::skip() const */ QToolBarAreaLayoutLine::QToolBarAreaLayoutLine(Qt::Orientation orientation) - : o(orientation) + : o(orientation), lastVisible(-1) { } @@ -146,7 +146,7 @@ QSize QToolBarAreaLayoutLine::minimumSize() const void QToolBarAreaLayoutLine::fitLayout() { - int last = -1; + lastVisible = -1; int min = pick(o, minimumSize()); int space = pick(o, rect.size()); int extra = qMax(0, space - min); @@ -169,7 +169,7 @@ void QToolBarAreaLayoutLine::fitLayout() extra -= extraSpace; - last = i; + lastVisible = i; } // calculate the positions from the sizes @@ -180,7 +180,7 @@ void QToolBarAreaLayoutLine::fitLayout() continue; item.pos = pos; - if (i == last) // stretch the last item to the end of the line + if (i == lastVisible) // stretch the last item to the end of the line item.size = qMax(0, pick(o, rect.size()) - item.pos); pos += item.size; } @@ -441,7 +441,8 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos) } //update for the current item - current.extendSize(line.o, -extra); + if (k != line.lastVisible) + current.extendSize(line.o, -extra); if (extra >= 0) { previous.extendSize(line.o, extra); diff --git a/src/gui/widgets/qtoolbararealayout_p.h b/src/gui/widgets/qtoolbararealayout_p.h index f0ab80c..afbd455 100644 --- a/src/gui/widgets/qtoolbararealayout_p.h +++ b/src/gui/widgets/qtoolbararealayout_p.h @@ -148,6 +148,7 @@ public: QRect rect; Qt::Orientation o; + int lastVisible; QList toolBarItems; }; -- cgit v0.12 From 4fbf19955d5c018d8f12611d39348b48be3ff006 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 20 Nov 2009 14:13:03 +0100 Subject: Revert "Do not extend the last toolbar in a line when moving it" make a real fix for the problem is defaulting to sizehint when there is no preferred size set (ie the toolbar hasn't been moved) This reverts commit a2c247ed521d88f99a21b4207cdff8ea03e949be. --- src/gui/widgets/qtoolbararealayout.cpp | 11 +++++------ src/gui/widgets/qtoolbararealayout_p.h | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index d09a301..b7e985c 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -100,7 +100,7 @@ bool QToolBarAreaLayoutItem::skip() const */ QToolBarAreaLayoutLine::QToolBarAreaLayoutLine(Qt::Orientation orientation) - : o(orientation), lastVisible(-1) + : o(orientation) { } @@ -146,7 +146,7 @@ QSize QToolBarAreaLayoutLine::minimumSize() const void QToolBarAreaLayoutLine::fitLayout() { - lastVisible = -1; + int last = -1; int min = pick(o, minimumSize()); int space = pick(o, rect.size()); int extra = qMax(0, space - min); @@ -169,7 +169,7 @@ void QToolBarAreaLayoutLine::fitLayout() extra -= extraSpace; - lastVisible = i; + last = i; } // calculate the positions from the sizes @@ -180,7 +180,7 @@ void QToolBarAreaLayoutLine::fitLayout() continue; item.pos = pos; - if (i == lastVisible) // stretch the last item to the end of the line + if (i == last) // stretch the last item to the end of the line item.size = qMax(0, pick(o, rect.size()) - item.pos); pos += item.size; } @@ -441,8 +441,7 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos) } //update for the current item - if (k != line.lastVisible) - current.extendSize(line.o, -extra); + current.extendSize(line.o, -extra); if (extra >= 0) { previous.extendSize(line.o, extra); diff --git a/src/gui/widgets/qtoolbararealayout_p.h b/src/gui/widgets/qtoolbararealayout_p.h index afbd455..134e95a 100644 --- a/src/gui/widgets/qtoolbararealayout_p.h +++ b/src/gui/widgets/qtoolbararealayout_p.h @@ -118,7 +118,7 @@ public: void extendSize(Qt::Orientation o, int extent) { - int newSize = qMax(pick(o, minimumSize()), (preferredSize > 0 ? preferredSize : size) + extent); + int newSize = qMax(pick(o, minimumSize()), (preferredSize > 0 ? preferredSize : pick(o, sizeHint())) + extent); int sizeh = pick(o, sizeHint()); if (newSize == sizeh) { preferredSize = -1; @@ -148,7 +148,6 @@ public: QRect rect; Qt::Orientation o; - int lastVisible; QList toolBarItems; }; -- cgit v0.12 From 0b8639aee92913cdfaa4386aa09dde0f5cb2eaee Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Fri, 20 Nov 2009 13:29:57 +0100 Subject: Fixes painting issues when scaling a QGraphicsView. The problem was that the 'exposed rectangle' passed to the Item's paint() function was rounded to Int values, whereas the one passed to drawBackground and drawForeground was not. Autotest included. Task-number: QTBUG-5859 Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 39 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 3f6dff2..710048e 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1240,7 +1240,7 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con const QTransform reverseMap = worldTransform.inverted(); const QVector exposedRects(exposedRegion.rects()); for (int i = 0; i < exposedRects.size(); ++i) { - option->exposedRect |= reverseMap.mapRect(exposedRects.at(i)); + option->exposedRect |= reverseMap.mapRect(QRectF(exposedRects.at(i))); if (option->exposedRect.contains(brect)) break; } diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 1ff06c2..797e1fb 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -235,6 +235,7 @@ private slots: void task259503_scrollingArtifacts(); void QTBUG_4151_clipAndIgnore_data(); void QTBUG_4151_clipAndIgnore(); + void QTBUG_5859_exposedRect(); }; void tst_QGraphicsView::initTestCase() @@ -3867,5 +3868,43 @@ void tst_QGraphicsView::QTBUG_4151_clipAndIgnore() QCOMPARE(view.items(view.rect()).size(), numItems); } +void tst_QGraphicsView::QTBUG_5859_exposedRect() +{ + class CustomScene : public QGraphicsScene + { + public: + CustomScene(const QRectF &rect) : QGraphicsScene(rect) { } + void drawBackground(QPainter *painter, const QRectF &rect) + { lastBackgroundExposedRect = rect; } + QRectF lastBackgroundExposedRect; + }; + + class CustomRectItem : public QGraphicsRectItem + { + public: + CustomRectItem(const QRectF &rect) : QGraphicsRectItem(rect) + { setFlag(QGraphicsItem::ItemUsesExtendedStyleOption); } + void paint(QPainter * painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) + { lastExposedRect = option->exposedRect; } + QRectF lastExposedRect; + }; + + CustomScene scene(QRectF(0,0,50,50)); + + CustomRectItem item(scene.sceneRect()); + + scene.addItem(&item); + + QGraphicsView view(&scene); + view.scale(4.15, 4.15); + view.show(); + QTest::qWaitForWindowShown(&view); + + view.viewport()->repaint(10,10,20,20); + QApplication::processEvents(); + + QCOMPARE(item.lastExposedRect, scene.lastBackgroundExposedRect); +} + QTEST_MAIN(tst_QGraphicsView) #include "tst_qgraphicsview.moc" -- cgit v0.12 From c74a5ae953899b9109ef56b2057b094152616480 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 20 Nov 2009 15:22:56 +0100 Subject: Mention the changed architecture and license of QtScript in the 4.6.0 changelog Reviewed-by: Kent Hansen --- dist/changes-4.6.0 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 736fa66..887c96f 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -73,6 +73,8 @@ New features * Support for getting return arguments in remote method invocation via QMetaMethod::invokeMethod. + - The QtScript module is now based on the 3rdparty JavaScriptCore library. It + is only available under the LGPL or a compatible license. Optimizations ------------- -- cgit v0.12 From 2bfa405a9798372624c410d3d13fa143985440b8 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Thu, 19 Nov 2009 17:43:18 -0300 Subject: QGAL: deal correctly with anchors in parallel with the layout In the preferred size calculation, we should not add 'layout anchors' (either one or the two halves) into the objective function, since the layout doesn't impose or prefer any size at all. This already worked for cases when the layout anchor is one, but not when we have two halves. The mechanism was a 'skipInPreferred' flag that were not being set. The flag is pretty much redundant right now, since we can get this information from the 'isLayoutAnchor' flag. So, the flag was removed and a test was added for both a parallel case with the entire layout and other with half of the layout (which wasn't passing before). Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 6 +-- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 4 +- .../tst_qgraphicsanchorlayout.cpp | 52 ++++++++++++++++++++++ 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index fb67278..b324469 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -1272,7 +1272,6 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges() addAnchor_helper(layout, Qt::AnchorLeft, layout, Qt::AnchorRight, data); data->maxSize = QWIDGETSIZE_MAX; - data->skipInPreferred = 1; // Save a reference to layout vertices layoutFirstVertex[Horizontal] = internalVertex(layout, Qt::AnchorLeft); @@ -1284,7 +1283,6 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges() addAnchor_helper(layout, Qt::AnchorTop, layout, Qt::AnchorBottom, data); data->maxSize = QWIDGETSIZE_MAX; - data->skipInPreferred = 1; // Save a reference to layout vertices layoutFirstVertex[Vertical] = internalVertex(layout, Qt::AnchorTop); @@ -2700,7 +2698,9 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QListskipInPreferred) + + // The layout original structure anchors are not relevant in preferred size calculation + if (ad->isLayoutAnchor) continue; QSimplexVariable *grower = new QSimplexVariable; diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 2b365fb..8529e2e 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -124,8 +124,7 @@ struct AnchorData : public QSimplexVariable { : QSimplexVariable(), from(0), to(0), minSize(0), prefSize(0), maxSize(0), sizeAtMinimum(0), sizeAtPreferred(0), - sizeAtMaximum(0), item(0), - graphicsAnchor(0), skipInPreferred(0), + sizeAtMaximum(0), item(0), graphicsAnchor(0), type(Normal), isLayoutAnchor(false), isCenterAnchor(false), orientation(0), dependency(Independent) {} @@ -169,7 +168,6 @@ struct AnchorData : public QSimplexVariable { QGraphicsLayoutItem *item; QGraphicsAnchor *graphicsAnchor; - uint skipInPreferred : 1; uint type : 2; // either Normal, Sequential or Parallel uint isLayoutAnchor : 1; // if this anchor is an internal layout anchor uint isCenterAnchor : 1; diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 2ad024f..4f8c240 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -86,6 +86,7 @@ private slots: void parallelSimplificationOfCenter(); void simplificationVsRedundance(); void spacingPersistency(); + void snakeParallelWithLayout(); }; class RectWidget : public QGraphicsWidget @@ -1892,5 +1893,56 @@ void tst_QGraphicsAnchorLayout::spacingPersistency() QCOMPARE(anchor->spacing(), 30.0); } +/* + Test whether a correct preferred size is set when a "snake" sequence is in parallel with the + layout or half of the layout. The tricky thing here is that all items on the snake should + keep their preferred sizes. +*/ +void tst_QGraphicsAnchorLayout::snakeParallelWithLayout() +{ + QSizeF min(10, 20); + QSizeF pref(50, 20); + QSizeF max(100, 20); + + QGraphicsWidget *a = createItem(max, max, max, "A"); + QGraphicsWidget *b = createItem(min, pref, max, "B"); + QGraphicsWidget *c = createItem(max, max, max, "C"); + + QGraphicsWidget parent; + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&parent); + l->setContentsMargins(0, 0, 0, 0); + l->setSpacing(0); + + // First we'll do the case in parallel with the entire layout... + l->addAnchor(l, Qt::AnchorLeft, a, Qt::AnchorLeft); + l->addAnchor(a, Qt::AnchorRight, b, Qt::AnchorRight); + l->addAnchor(b, Qt::AnchorLeft, c, Qt::AnchorLeft); + l->addAnchor(c, Qt::AnchorRight, l, Qt::AnchorRight); + + l->addAnchor(l, Qt::AnchorTop, a, Qt::AnchorTop); + l->addAnchor(a, Qt::AnchorBottom, b, Qt::AnchorTop); + l->addAnchor(b, Qt::AnchorBottom, c, Qt::AnchorTop); + l->addAnchor(c, Qt::AnchorBottom, l, Qt::AnchorBottom); + + parent.resize(l->effectiveSizeHint(Qt::PreferredSize)); + + // Note that A and C are fixed in the maximum size + QCOMPARE(l->geometry(), QRectF(QPointF(0, 0), QSizeF(150, 60))); + QCOMPARE(a->geometry(), QRectF(QPointF(0, 0), max)); + QCOMPARE(b->geometry(), QRectF(QPointF(50, 20), pref)); + QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), max)); + + // Then, we change the "snake" to be in parallel with half of the layout + delete l->anchor(c, Qt::AnchorRight, l, Qt::AnchorRight); + l->addAnchor(c, Qt::AnchorRight, l, Qt::AnchorHorizontalCenter); + + parent.resize(l->effectiveSizeHint(Qt::PreferredSize)); + + QCOMPARE(l->geometry(), QRectF(QPointF(0, 0), QSizeF(300, 60))); + QCOMPARE(a->geometry(), QRectF(QPointF(0, 0), max)); + QCOMPARE(b->geometry(), QRectF(QPointF(50, 20), pref)); + QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), max)); +} + QTEST_MAIN(tst_QGraphicsAnchorLayout) #include "tst_qgraphicsanchorlayout.moc" -- cgit v0.12 From 33f9b5435edcf56555745e19896a14c790a33b1d Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Wed, 18 Nov 2009 17:14:57 -0300 Subject: QGAL: sizeHint constraints needed by anchors parallel with the layout The method "constraintsFromSizeHints" does not create constraints for anchors between the layout vertices _only if_ these anchors have infinite maximum sizes. However, this test was not being done for half-anchors, ie. those created when the layout center anchorage point is used. That was OK when there was no chance that the center anchors had been simplified by a parallel anchor. Nowadays there's a chance that happens, so the test was extended. Commit also adds a test to avoid regressions. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 20 ++++++++++---- .../tst_qgraphicsanchorlayout.cpp | 32 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index b324469..a6f5992 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -2269,13 +2269,21 @@ QList QGraphicsAnchorLayoutPrivate::constraintsFromSizeHin layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutCentralVertex[orient]); } else { layoutEdge = graph[orient].edgeData(layoutFirstVertex[orient], layoutLastVertex[orient]); + } - // If maxSize is less then "infinite", that means there are other anchors - // grouped together with this one. We can't ignore its maximum value so we - // set back the variable to NULL to prevent the continue condition from being - // satisfied in the loop below. - if (layoutEdge->maxSize < QWIDGETSIZE_MAX) - layoutEdge = 0; + // If maxSize is less then "infinite", that means there are other anchors + // grouped together with this one. We can't ignore its maximum value so we + // set back the variable to NULL to prevent the continue condition from being + // satisfied in the loop below. + const qreal expectedMax = layoutCentralVertex[orient] ? QWIDGETSIZE_MAX / 2 : QWIDGETSIZE_MAX; + qreal actualMax; + if (layoutEdge->from == layoutFirstVertex[orient]) { + actualMax = layoutEdge->maxSize; + } else { + actualMax = -layoutEdge->minSize; + } + if (actualMax != expectedMax) { + layoutEdge = 0; } // For each variable, create constraints based on size hints diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 4f8c240..e2f87b8 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -87,6 +87,7 @@ private slots: void simplificationVsRedundance(); void spacingPersistency(); void snakeParallelWithLayout(); + void parallelToHalfLayout(); }; class RectWidget : public QGraphicsWidget @@ -1944,5 +1945,36 @@ void tst_QGraphicsAnchorLayout::snakeParallelWithLayout() QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), max)); } +/* + Avoid regression where the sizeHint constraints would not be + created for a parallel anchor that included the first layout half +*/ +void tst_QGraphicsAnchorLayout::parallelToHalfLayout() +{ + QGraphicsWidget *a = createItem(); + + QGraphicsWidget w; + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&w); + l->setContentsMargins(10, 10, 10, 10); + + l->addAnchors(l, a, Qt::Vertical); + + QGraphicsAnchor *anchor; + anchor = l->addAnchor(l, Qt::AnchorLeft, a, Qt::AnchorLeft); + anchor->setSpacing(5); + anchor = l->addAnchor(l, Qt::AnchorHorizontalCenter, a, Qt::AnchorRight); + anchor->setSpacing(-5); + + const QSizeF minimumSizeHint = w.effectiveSizeHint(Qt::MinimumSize); + const QSizeF preferredSizeHint = w.effectiveSizeHint(Qt::PreferredSize); + const QSizeF maximumSizeHint = w.effectiveSizeHint(Qt::MaximumSize); + + const QSizeF overhead = QSizeF(10 + 5 + 5, 10) * 2; + + QCOMPARE(minimumSizeHint, QSizeF(200, 100) + overhead); + QCOMPARE(preferredSizeHint, QSizeF(300, 100) + overhead); + QCOMPARE(maximumSizeHint, QSizeF(400, 100) + overhead); +} + QTEST_MAIN(tst_QGraphicsAnchorLayout) #include "tst_qgraphicsanchorlayout.moc" -- cgit v0.12 From b7692016f282251002b3e85dfcb5567bd91a12c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 20 Nov 2009 13:50:41 +0100 Subject: Fix regression introduced in 1e6b424b692b20dcfec920f8d3563e520ec1ff05 When processing the result of QIODevice::readLine, forgot to take into account that a '\0' is appended to the array. The terminating character is not accounted for in the number of bytes returned. By pre-allocating a byte for the terminating null character, we make sure we'll actually read 16k bytes on each and every iteration. Task-number: QTBUG-6019 Reviewed-by: Thiago Macieira --- src/corelib/io/qiodevice.cpp | 6 +- tests/auto/qiodevice/tst_qiodevice.cpp | 112 +++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index b84961f..0e5a2de 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1157,6 +1157,10 @@ QByteArray QIODevice::readLine(qint64 maxSize) // If resize fails or maxSize == 0, read incrementally if (maxSize == 0) maxSize = INT_MAX; + + // The first iteration needs to leave an extra byte for the terminating null + result.resize(1); + qint64 readResult; do { result.resize(int(qMin(maxSize, result.size() + QIODEVICE_BUFFERSIZE))); @@ -1164,7 +1168,7 @@ QByteArray QIODevice::readLine(qint64 maxSize) if (readResult > 0 || readBytes == 0) readBytes += readResult; } while (readResult == QIODEVICE_BUFFERSIZE - && result[int(readBytes)] != '\n'); + && result[int(readBytes - 1)] != '\n'); } else readBytes = readLine(result.data(), result.size()); diff --git a/tests/auto/qiodevice/tst_qiodevice.cpp b/tests/auto/qiodevice/tst_qiodevice.cpp index 056ad6a..84fd8ad 100644 --- a/tests/auto/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/qiodevice/tst_qiodevice.cpp @@ -77,6 +77,9 @@ private slots: void readLine_data(); void readLine(); + + void readLine2_data(); + void readLine2(); }; // Testing get/set functions @@ -453,5 +456,114 @@ void tst_QIODevice::readLine() QCOMPARE(line.size(), linelen); } +void tst_QIODevice::readLine2_data() +{ + QTest::addColumn("line"); + + QTest::newRow("1024 - 4") << QByteArray(1024 - 4, 'x'); + QTest::newRow("1024 - 3") << QByteArray(1024 - 3, 'x'); + QTest::newRow("1024 - 2") << QByteArray(1024 - 2, 'x'); + QTest::newRow("1024 - 1") << QByteArray(1024 - 1, 'x'); + QTest::newRow("1024" ) << QByteArray(1024 , 'x'); + QTest::newRow("1024 + 1") << QByteArray(1024 + 1, 'x'); + QTest::newRow("1024 + 2") << QByteArray(1024 + 2, 'x'); + + QTest::newRow("4096 - 4") << QByteArray(4096 - 4, 'x'); + QTest::newRow("4096 - 3") << QByteArray(4096 - 3, 'x'); + QTest::newRow("4096 - 2") << QByteArray(4096 - 2, 'x'); + QTest::newRow("4096 - 1") << QByteArray(4096 - 1, 'x'); + QTest::newRow("4096" ) << QByteArray(4096 , 'x'); + QTest::newRow("4096 + 1") << QByteArray(4096 + 1, 'x'); + QTest::newRow("4096 + 2") << QByteArray(4096 + 2, 'x'); + + QTest::newRow("8192 - 4") << QByteArray(8192 - 4, 'x'); + QTest::newRow("8192 - 3") << QByteArray(8192 - 3, 'x'); + QTest::newRow("8192 - 2") << QByteArray(8192 - 2, 'x'); + QTest::newRow("8192 - 1") << QByteArray(8192 - 1, 'x'); + QTest::newRow("8192" ) << QByteArray(8192 , 'x'); + QTest::newRow("8192 + 1") << QByteArray(8192 + 1, 'x'); + QTest::newRow("8192 + 2") << QByteArray(8192 + 2, 'x'); + + QTest::newRow("16384 - 4") << QByteArray(16384 - 4, 'x'); + QTest::newRow("16384 - 3") << QByteArray(16384 - 3, 'x'); + QTest::newRow("16384 - 2") << QByteArray(16384 - 2, 'x'); + QTest::newRow("16384 - 1") << QByteArray(16384 - 1, 'x'); + QTest::newRow("16384" ) << QByteArray(16384 , 'x'); + QTest::newRow("16384 + 1") << QByteArray(16384 + 1, 'x'); + QTest::newRow("16384 + 2") << QByteArray(16384 + 2, 'x'); + + QTest::newRow("20000") << QByteArray(20000, 'x'); + + QTest::newRow("32768 - 4") << QByteArray(32768 - 4, 'x'); + QTest::newRow("32768 - 3") << QByteArray(32768 - 3, 'x'); + QTest::newRow("32768 - 2") << QByteArray(32768 - 2, 'x'); + QTest::newRow("32768 - 1") << QByteArray(32768 - 1, 'x'); + QTest::newRow("32768" ) << QByteArray(32768 , 'x'); + QTest::newRow("32768 + 1") << QByteArray(32768 + 1, 'x'); + QTest::newRow("32768 + 2") << QByteArray(32768 + 2, 'x'); + + QTest::newRow("40000") << QByteArray(40000, 'x'); +} + +void tst_QIODevice::readLine2() +{ + QFETCH(QByteArray, line); + + int length = line.size(); + + QByteArray data("First line.\r\n"); + data.append(line); + data.append("\r\n"); + data.append(line); + data.append("\r\n"); + data.append("\r\n0123456789"); + + { + QBuffer buffer(&data); + buffer.open(QIODevice::ReadOnly); + + buffer.seek(0); + QByteArray temp; + temp.resize(64536); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(13)); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(length + 2)); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(length + 2)); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(2)); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(10)); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(-1)); + + buffer.seek(0); + QCOMPARE(buffer.readLine().size(), 13); + QCOMPARE(buffer.readLine().size(), length + 2); + QCOMPARE(buffer.readLine().size(), length + 2); + QCOMPARE(buffer.readLine().size(), 2); + QCOMPARE(buffer.readLine().size(), 10); + QVERIFY(buffer.readLine().isNull()); + } + + { + QBuffer buffer(&data); + buffer.open(QIODevice::ReadOnly | QIODevice::Text); + + buffer.seek(0); + QByteArray temp; + temp.resize(64536); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(12)); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(length + 1)); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(length + 1)); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(1)); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(10)); + QCOMPARE(buffer.readLine(temp.data(), temp.size()), qint64(-1)); + + buffer.seek(0); + QCOMPARE(buffer.readLine().size(), 12); + QCOMPARE(buffer.readLine().size(), length + 1); + QCOMPARE(buffer.readLine().size(), length + 1); + QCOMPARE(buffer.readLine().size(), 1); + QCOMPARE(buffer.readLine().size(), 10); + QVERIFY(buffer.readLine().isNull()); + } +} + QTEST_MAIN(tst_QIODevice) #include "tst_qiodevice.moc" -- cgit v0.12 From 68595bbc28ba0d1cd78557c61011dc004a4a507c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Nov 2009 16:35:41 +0100 Subject: fix encodings, take N Task-number: QTBUG-4499 Task-number: QTBUG-5276 --- .../lupdate/testdata/good/codecforsrc/main.cpp | 13 +++++++++++-- .../testdata/good/codecforsrc/project.ts.result | 22 ++++++++++++++++++++-- .../testdata/good/codecfortr/project.ts.result | 2 +- .../lupdate/testdata/good/codecfortr1/main.cpp | 6 ++++-- .../testdata/good/codecfortr1/project.ts.result | 16 +++++++++++++--- .../lupdate/testdata/good/codecfortr2/main.cpp | 5 +++-- .../testdata/good/codecfortr2/project.ts.result | 11 ++++++++--- tools/linguist/lupdate/cpp.cpp | 22 ++++++++++------------ tools/linguist/shared/translator.cpp | 11 ++++++++--- tools/linguist/shared/translator.h | 5 +++-- 10 files changed, 81 insertions(+), 32 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp index 158451a..d99723e 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/main.cpp @@ -47,12 +47,21 @@ int main(int argc, char **argv) { QApplication a(argc, argv); + QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); + QWidget w; QLabel label1(QObject::tr("abc", "ascii"), &w); QLabel label2(QObject::tr("æøå", "utf-8"), &w); + QLabel label2a(QObject::tr("\303\246\303\270\303\245", "utf-8 oct"), &w); + QLabel label3(QObject::trUtf8("Für Élise", "trUtf8"), &w); + QLabel label3a(QObject::trUtf8("F\303\274r \303\211lise", "trUtf8 oct"), &w); -// I would expect the following to work !? -// QLabel label3(QObject::trUtf8("F\374r \310lise", "trUtf8"), &w); + QBoxLayout *ly = new QVBoxLayout(&w); + ly->addWidget(&label1); + ly->addWidget(&label2); + ly->addWidget(&label2a); + ly->addWidget(&label3); + ly->addWidget(&label3a); w.show(); return a.exec(); diff --git a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result index bc0d9bb..711bf02 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/codecforsrc/project.ts.result @@ -5,16 +5,34 @@ QObject - + abc ascii - + æøå utf-8 + + + æøå + utf-8 oct + + + + + Für Élise + trUtf8 + + + + + Für Élise + trUtf8 oct + + diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result index 91da744..6ee369a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr/project.ts.result @@ -6,7 +6,7 @@ QObject - Á + Б diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp index abb8b89..98b491c 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/main.cpp @@ -49,9 +49,11 @@ public: void doFoo() { tr("random ascii only"); - tr("this contains an umlaut ü"); + tr("this contains an umlaut ü literally"); + tr("this contains an umlaut \xfc ü escaped"); trUtf8("random ascii only in utf8"); - trUtf8("umlaut \xfc ü in utf8"); + trUtf8("umlaut ü ü in literal utf8"); + trUtf8("umlaut \303\274 ü in escaped utf8"); } }; diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result index 26eb245..d548e24 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr1/project.ts.result @@ -11,17 +11,27 @@ - this contains an umlaut ü &uuml; + this contains an umlaut ü &uuml; literally + this contains an umlaut ü &uuml; escaped + + + + random ascii only in utf8 - - umlaut ü &uuml; in utf8 + + umlaut ü &uuml; in literal utf8 + + + + + umlaut ü &uuml; in escaped utf8 diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp index abb8b89..cd93539 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/main.cpp @@ -49,9 +49,10 @@ public: void doFoo() { tr("random ascii only"); - tr("this contains an umlaut ü"); + tr("this contains an umlaut ü literally"); + tr("this contains an umlaut \303\274 ü escaped, really in utf-8"); trUtf8("random ascii only in utf8"); - trUtf8("umlaut \xfc ü in utf8"); + trUtf8("umlaut \303\274 ü in escaped utf8"); } }; diff --git a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result index e27c157..6728a25 100644 --- a/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/codecfortr2/project.ts.result @@ -11,17 +11,22 @@ - this contains an umlaut ü &uuml; + this contains an umlaut ü &uuml; literally - random ascii only in utf8 + this contains an umlaut ü &uuml; escaped, really in utf-8 - umlaut ü &uuml; in utf8 + random ascii only in utf8 + + + + + umlaut ü &uuml; in escaped utf8 diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 7c9b27a..857233e 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -306,7 +306,6 @@ private: // the string to read from and current position in the string QTextCodec *yySourceCodec; - bool yySourceIsUnicode; QString yyInStr; const ushort *yyInPtr; @@ -353,7 +352,6 @@ void CppParser::setInput(const QString &in) yyInStr = in; yyFileName = QString(); yySourceCodec = 0; - yySourceIsUnicode = true; yyForceUtf8 = true; } @@ -362,7 +360,6 @@ void CppParser::setInput(QTextStream &ts, const QString &fileName) yyInStr = ts.readAll(); yyFileName = fileName; yySourceCodec = ts.codec(); - yySourceIsUnicode = yySourceCodec->name().startsWith("UTF-"); yyForceUtf8 = false; } @@ -1430,24 +1427,24 @@ QString CppParser::transcode(const QString &str, bool utf8) { static const char tab[] = "abfnrtv"; static const char backTab[] = "\a\b\f\n\r\t\v"; - const QString in = (!utf8 || yySourceIsUnicode) - ? str : QString::fromUtf8(yySourceCodec->fromUnicode(str).data()); - QString out; + // This function has to convert back to bytes, as C's \0* sequences work at that level. + const QByteArray in = yyForceUtf8 ? str.toUtf8() : tor->codec()->fromUnicode(str); + QByteArray out; out.reserve(in.length()); for (int i = 0; i < in.length();) { - ushort c = in[i++].unicode(); + uchar c = in[i++]; if (c == '\\') { if (i >= in.length()) break; - c = in[i++].unicode(); + c = in[i++]; if (c == '\n') continue; if (c == 'x') { QByteArray hex; - while (i < in.length() && isxdigit((c = in[i].unicode()))) { + while (i < in.length() && isxdigit((c = in[i]))) { hex += c; i++; } @@ -1456,7 +1453,7 @@ QString CppParser::transcode(const QString &str, bool utf8) QByteArray oct; int n = 0; oct += c; - while (n < 2 && i < in.length() && (c = in[i].unicode()) >= '0' && c < '8') { + while (n < 2 && i < in.length() && (c = in[i]) >= '0' && c < '8') { i++; n++; oct += c; @@ -1464,13 +1461,14 @@ QString CppParser::transcode(const QString &str, bool utf8) out += oct.toUInt(0, 8); } else { const char *p = strchr(tab, c); - out += QChar(QLatin1Char(!p ? c : backTab[p - tab])); + out += !p ? c : backTab[p - tab]; } } else { out += c; } } - return out; + return (utf8 || yyForceUtf8) ? QString::fromUtf8(out.constData(), out.length()) + : tor->codec()->toUnicode(out); } void CppParser::recordMessage( diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index 05fc6e5..8a071d3 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -67,7 +67,7 @@ QString QObject::tr(const char *sourceText, const char *, int n) #endif Translator::Translator() : - m_codecName("ISO-8859-1"), + m_codec(QTextCodec::codecForName("ISO-8859-1")), m_locationsType(AbsoluteLocations) { } @@ -713,12 +713,17 @@ void Translator::setCodecName(const QByteArray &name) if (!codec) { if (!name.isEmpty()) qWarning("No QTextCodec for %s available. Using Latin1\n", name.constData()); - m_codecName = "ISO-8859-1"; + m_codec = QTextCodec::codecForName("ISO-8859-1"); } else { - m_codecName = codec->name(); + m_codec = codec; } } +QByteArray Translator::codecName() const +{ + return m_codec->name(); +} + void Translator::dump() const { for (int i = 0; i != messageCount(); ++i) diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index e36f822..353cf9d 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -151,7 +151,8 @@ public: void reportDuplicates(const Duplicates &dupes, const QString &fileName, bool verbose); void setCodecName(const QByteArray &name); - QByteArray codecName() const { return m_codecName; } + QByteArray codecName() const; + QTextCodec *codec() const { return m_codec; } QString languageCode() const { return m_language; } QString sourceLanguageCode() const { return m_sourceLanguage; } @@ -211,7 +212,7 @@ private: typedef QList TMM; // int stores the sequence position. TMM m_messages; - QByteArray m_codecName; + QTextCodec *m_codec; LocationsType m_locationsType; // A string beginning with a 2 or 3 letter language code (ISO 639-1 -- cgit v0.12 From 7367a12c4a0d7686b9d35778e5de33a463504d75 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Nov 2009 21:07:04 +0100 Subject: fix crash on closing "rightmost" file "This cannot happen" ... yeah, right. :} Task-number: QTBUG-5989 --- tools/linguist/linguist/messageeditor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp index 616bb26..a7cc636 100644 --- a/tools/linguist/linguist/messageeditor.cpp +++ b/tools/linguist/linguist/messageeditor.cpp @@ -407,10 +407,12 @@ QTextEdit *MessageEditor::activeTranslation() const { if (m_currentNumerus < 0) return 0; - foreach (QTextEdit *te, m_editors[m_currentModel].transTexts[m_currentNumerus]->getEditors()) + const QList &editors = + m_editors[m_currentModel].transTexts[m_currentNumerus]->getEditors(); + foreach (QTextEdit *te, editors) if (te->hasFocus()) return te; - return 0; // This cannot happen + return editors.first(); } QTextEdit *MessageEditor::activeOr1stTranslation() const -- cgit v0.12 From aae4b037317a9ad0d41022d6309f1d4f36443764 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Nov 2009 21:32:15 +0100 Subject: don't use qWarning for things which are not really warnings ... so the tools are usable with QT_FATAL_WARNINGS. it may be sensible to "degrade" the c++ parser warnings to info messages. possibly later ... Task-number: QTBUG-5683 --- tools/linguist/lconvert/main.cpp | 6 ++++-- tools/linguist/lupdate/main.cpp | 15 +++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index 7807761..5f3de7b 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -46,6 +46,8 @@ #include #include +#include + static int usage(const QStringList &args) { Q_UNUSED(args); @@ -55,7 +57,7 @@ static int usage(const QStringList &args) foreach (Translator::FileFormat format, Translator::registeredFileFormats()) loaders += line.arg(format.extension, -5).arg(format.description); - qWarning("%s", qPrintable(QString(QLatin1String("\nUsage:\n" + std::cerr << qPrintable(QString(QLatin1String("\nUsage:\n" " lconvert [options] [...]\n\n" "lconvert is part of Qt's Linguist tool chain. It can be used as a\n" "stand-alone tool to convert and filter translation data files.\n" @@ -117,7 +119,7 @@ static int usage(const QStringList &args) " 0 on success\n" " 1 on command line parse failures\n" " 2 on read failures\n" - " 3 on write failures\n")).arg(loaders))); + " 3 on write failures\n")).arg(loaders)); return 1; } diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 7defee0..9a9af68 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -54,13 +54,20 @@ #include #include +#include + static QString m_defaultExtensions; -static void printOut(const QString & out) +static void printErr(const QString & out) { qWarning("%s", qPrintable(out)); } +static void printOut(const QString & out) +{ + std::cerr << qPrintable(out); +} + static void recursiveFileInfoList(const QDir &dir, const QSet &nameFilters, QDir::Filters filter, QFileInfoList *fileinfolist) @@ -137,7 +144,7 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil cd.m_sortContexts = !(options & NoSort); if (QFile(fileName).exists()) { if (!tor.load(fileName, cd, QLatin1String("auto"))) { - printOut(cd.error()); + printErr(cd.error()); *fail = true; continue; } @@ -197,11 +204,11 @@ static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFil out.normalizeTranslations(cd); if (!cd.errors().isEmpty()) { - printOut(cd.error()); + printErr(cd.error()); cd.clearErrors(); } if (!out.save(fileName, cd, QLatin1String("auto"))) { - printOut(cd.error()); + printErr(cd.error()); *fail = true; } } -- cgit v0.12 From 50465c3409d699612a59b6c1d16e3502bb3a92fd Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 23 Nov 2009 07:00:51 +1000 Subject: Support semi-transparent surfaces in the OpenVG graphics system Task-number: QT-2026 Reviewed-by: Jason Barron --- src/openvg/qpaintengine_vg.cpp | 28 ++++++++++++++++++++++++++++ src/openvg/qpaintengine_vg_p.h | 2 ++ src/openvg/qwindowsurface_vg.cpp | 14 +++++++++++--- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 75b7fa5..fda4b10 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3407,6 +3407,34 @@ void QVGPaintEngine::restoreState(QPaintEngine::DirtyFlags dirty) #endif } +void QVGPaintEngine::fillRegion + (const QRegion& region, const QColor& color, const QSize& surfaceSize) +{ + Q_D(QVGPaintEngine); + if (d->clearColor != color || d->clearOpacity != 1.0f) { + VGfloat values[4]; + values[0] = color.redF(); + values[1] = color.greenF(); + values[2] = color.blueF(); + values[3] = color.alphaF(); + vgSetfv(VG_CLEAR_COLOR, 4, values); + d->clearColor = color; + d->clearOpacity = 1.0f; + } + if (region.rectCount() == 1) { + QRect r = region.boundingRect(); + vgClear(r.x(), surfaceSize.height() - r.y() - r.height(), + r.width(), r.height()); + } else { + const QVector rects = region.rects(); + for (int i = 0; i < rects.size(); ++i) { + QRect r = rects.at(i); + vgClear(r.x(), surfaceSize.height() - r.y() - r.height(), + r.width(), r.height()); + } + } +} + #if !defined(QVG_NO_SINGLE_CONTEXT) && !defined(QT_NO_EGL) QVGCompositionHelper::QVGCompositionHelper() diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h index 1202b55..86a522a 100644 --- a/src/openvg/qpaintengine_vg_p.h +++ b/src/openvg/qpaintengine_vg_p.h @@ -151,6 +151,8 @@ public: QVGPaintEnginePrivate *vgPrivate() { Q_D(QVGPaintEngine); return d; } + void fillRegion(const QRegion& region, const QColor& color, const QSize& surfaceSize); + protected: QVGPaintEngine(QVGPaintEnginePrivate &data); diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index f8486a6..a1301e3 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -48,6 +48,7 @@ #if !defined(QT_NO_EGL) #include +#include QT_BEGIN_NAMESPACE @@ -71,7 +72,6 @@ QVGWindowSurface::~QVGWindowSurface() QPaintDevice *QVGWindowSurface::paintDevice() { - d_ptr->beginPaint(window()); return this; } @@ -94,8 +94,16 @@ bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy) void QVGWindowSurface::beginPaint(const QRegion ®ion) { - // Nothing to do here. - Q_UNUSED(region); + d_ptr->beginPaint(window()); + + // If the window is not opaque, then fill the region we are about + // to paint with the transparent color. + if (!qt_widget_private(window())->isOpaque && + window()->testAttribute(Qt::WA_TranslucentBackground)) { + QVGPaintEngine *engine = static_cast + (d_ptr->paintEngine()); + engine->fillRegion(region, Qt::transparent, d_ptr->surfaceSize()); + } } void QVGWindowSurface::endPaint(const QRegion ®ion) -- cgit v0.12 From 1ce247ec7c2b4bda79cedf5dda2e6b1f636903b1 Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Mon, 23 Nov 2009 13:41:06 +1000 Subject: Handle errors and data truncation in QMYSQLResult::fetchNext() Add additional error handling Task-number:QTBUG-5758 Reviewed-by: trustme --- src/sql/drivers/mysql/qsql_mysql.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index f368d1d..b74babc 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -509,15 +509,24 @@ bool QMYSQLResult::fetchNext() return false; if (d->preparedQuery) { #if MYSQL_VERSION_ID >= 40108 - if (mysql_stmt_fetch(d->stmt)) + int nRC = mysql_stmt_fetch(d->stmt); + if (nRC) { +#ifdef MYSQL_DATA_TRUNCATED + if (nRC == 1 || nRC == MYSQL_DATA_TRUNCATED) +#else + if (nRC == 1) +#endif // MYSQL_DATA_TRUNCATED + setLastError(qMakeStmtError(QCoreApplication::translate("QMYSQLResult", + "Unable to fetch data"), QSqlError::StatementError, d->stmt)); return false; + } #else return false; #endif } else { - d->row = mysql_fetch_row(d->result); - if (!d->row) - return false; + d->row = mysql_fetch_row(d->result); + if (!d->row) + return false; } setAt(at() + 1); return true; @@ -1365,7 +1374,6 @@ QStringList QMYSQLDriver::tables(QSql::TableType type) const QSqlIndex QMYSQLDriver::primaryIndex(const QString& tablename) const { QSqlIndex idx; - bool prepQ; if (!isOpen()) return idx; -- cgit v0.12 From 7e7e3c3fe15780aa7d024e136acaf697ab49458c Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 23 Nov 2009 14:00:05 +1000 Subject: Fix configure warning for non-symbian builds Configure complains about "Could not retrieve HKEY_LOCAL_MACHINE\Software\Symbian\EPOC SDKs setting". It should only try to do that for Symbian builds. Reviewed-by: Lincoln Ramsay --- src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro index 158633d..9687908 100644 --- a/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro +++ b/src/plugins/sqldrivers/sqlite_symbian/sqlite_symbian.pro @@ -2,6 +2,8 @@ TEMPLATE = subdirs # We just want to export the sqlite3 binaries for Symbian for platforms that do not have them. -!exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) { - BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip" +symbian { + !exists($${EPOCROOT}epoc32/release/armv5/lib/sqlite3.dso) { + BLD_INF_RULES.prj_exports += ":zip SQLite3_v9.2.zip" + } } -- cgit v0.12 From b66c4141617eecb7a988287d9708499070ea9745 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Mon, 23 Nov 2009 11:25:44 +0200 Subject: Removed window activation hack, unified and fixed title&icon setting. The window activation hack is not needed anynmore since AppUi()->RemoveFromStack() ensures the next visible window will get the keyboard focus. Hack removal also required change to window title setting logic. Since window title (and icon) are associated to top-level windows, the logical place to set them is the same place where active window is changed i.e. QApplication::setActiveWindow is called. At the same time also window icon setting from show_sys was move to focusChanged to make icon/title setting more consistent. When changing orientation or switching to different statuspane mode we receive KInternalStatusPaneChange events for each window in QSymbianControl::HandleResourceChange. When receiving such event we only need to reset the icon for focused/visible window. If we don't handle it like this, it might happen that invisible widget added to control stack resets the global icon/title. Task-number: QTBUG-5780 Reviewed-by: Axis --- src/gui/kernel/qapplication_s60.cpp | 7 ++++++- src/gui/kernel/qwidget_s60.cpp | 18 ------------------ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 85b6d00..fb2bc72 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -908,6 +908,8 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) } QApplication::setActiveWindow(qwidget->window()); + qwidget->d_func()->setWindowIcon_sys(true); + qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); #ifdef Q_WS_S60 // If widget is fullscreen, hide status pane and button container // otherwise show them. @@ -945,7 +947,10 @@ void QSymbianControl::HandleResourceChange(int resourceType) TRect r = static_cast(S60->appUi())->ClientRect(); SetExtent(r.iTl, r.Size()); } - qwidget->d_func()->setWindowIcon_sys(true); + if (IsFocused() && IsVisible()) { + qwidget->d_func()->setWindowIcon_sys(true); + qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); + } break; case KUidValueCoeFontChangeEvent: // font change event diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index b1c37d3..359df2a 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -488,12 +488,6 @@ void QWidgetPrivate::show_sys() if(q->isWindow()) id->setFocusSafely(true); - - // Force setting of the icon after window is made visible, - // this is needed even WA_SetWindowIcon is not set, as in that case we need - // to reset to the application level window icon - if(q->isWindow()) - setWindowIcon_sys(true); } invalidateBuffer(q->rect()); @@ -1180,18 +1174,6 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (id->IsFocused()) // Avoid unnecessry calls to FocusChanged() id->setFocusSafely(false); id->ControlEnv()->AppUi()->RemoveFromStack(id); - - // Hack to activate window under destroyed one. With this activation - // the next visible window will get keyboard focus - WId wid = CEikonEnv::Static()->AppUi()->TopFocusedControl(); - if (wid) { - QWidget *widget = QWidget::find(wid); - QApplication::setActiveWindow(widget); - if (widget) { - // Reset global window title for focusing window - widget->d_func()->setWindowTitle_sys(widget->windowTitle()); - } - } } } -- cgit v0.12 From b4dbbd30c8092a81984cca30248db087353fe66e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 23 Nov 2009 11:59:05 +0100 Subject: Fix QHeaderView when the model is reset and section have moved. The logicalIndices and visualIndices array where not clean of the old sections, resulting in corrupted header. Task-number: QTBUG-6058 Reviewed-by: Thierry --- src/gui/itemviews/qheaderview.cpp | 25 ++++++++++++---- tests/auto/qheaderview/tst_qheaderview.cpp | 46 ++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index 5df8481..6f0fba6 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -1913,7 +1913,6 @@ void QHeaderView::initializeSections(int start, int end) Q_ASSERT(start >= 0); Q_ASSERT(end >= 0); - d->executePostedLayout(); d->invalidateCachedSizeHint(); if (end + 1 < d->sectionCount) { @@ -1939,11 +1938,25 @@ void QHeaderView::initializeSections(int start, int end) d->sectionCount = end + 1; if (!d->logicalIndices.isEmpty()) { - d->logicalIndices.resize(d->sectionCount); - d->visualIndices.resize(d->sectionCount); - for (int i = start; i < d->sectionCount; ++i){ - d->logicalIndices[i] = i; - d->visualIndices[i] = i; + if (oldCount <= d->sectionCount) { + d->logicalIndices.resize(d->sectionCount); + d->visualIndices.resize(d->sectionCount); + for (int i = oldCount; i < d->sectionCount; ++i) { + d->logicalIndices[i] = i; + d->visualIndices[i] = i; + } + } else { + int j = 0; + for (int i = 0; i < oldCount; ++i) { + int v = d->logicalIndices.at(i); + if (v < d->sectionCount) { + d->logicalIndices[j] = v; + d->visualIndices[v] = j; + j++; + } + } + d->logicalIndices.resize(d->sectionCount); + d->visualIndices.resize(d->sectionCount); } } diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp index c13e829..a8e7461 100644 --- a/tests/auto/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/qheaderview/tst_qheaderview.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -188,6 +189,7 @@ private slots: void task236450_hidden_data(); void task236450_hidden(); void task248050_hideRow(); + void QTBUG6058_reset(); protected: QHeaderView *view; @@ -1947,5 +1949,49 @@ void tst_QHeaderView::task248050_hideRow() } +//returns 0 if everything is fine. +static int checkHeaderViewOrder(QHeaderView *view, const QVector &expected) +{ + if (view->count() != expected.count()) + return 1; + + for (int i = 0; i < expected.count(); i++) { + if (view->logicalIndex(i) != expected.at(i)) + return i + 10; + if (view->visualIndex(expected.at(i)) != i) + return i + 100; + } + return 0; +} + + +void tst_QHeaderView::QTBUG6058_reset() +{ + QStringListModel model1( QStringList() << "0" << "1" << "2" << "3" << "4" << "5" ); + QStringListModel model2( QStringList() << "a" << "b" << "c" ); + QSortFilterProxyModel proxy; + + QHeaderView view(Qt::Vertical); + view.setModel(&proxy); + view.show(); + QTest::qWait(20); + + proxy.setSourceModel(&model1); + QApplication::processEvents(); + view.swapSections(0,2); + view.swapSections(1,4); + QApplication::processEvents(); + QCOMPARE(checkHeaderViewOrder(&view, QVector() << 2 << 4 << 0 << 3 << 1 << 5) , 0); + + proxy.setSourceModel(&model2); + QApplication::processEvents(); + QCOMPARE(checkHeaderViewOrder(&view, QVector() << 2 << 0 << 1 ) , 0); + + proxy.setSourceModel(&model1); + QApplication::processEvents(); + QCOMPARE(checkHeaderViewOrder(&view, QVector() << 2 << 0 << 1 << 3 << 4 << 5 ) , 0); +} + + QTEST_MAIN(tst_QHeaderView) #include "tst_qheaderview.moc" -- cgit v0.12 From 7faa417e1a2c0e85e5ac2c647c099c3f972141a5 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 23 Nov 2009 12:38:26 +0100 Subject: Fix symbol exports in QtScript with gcc Symbols declared as extern "C" will always be exported even when using -fvisibility=hidden (see gcc man-page). Instead of exporting we surround the extern declaration with a pragma push and pop to change the default visibility. In addition the use of HIDE_SYMBOL was missing in the "arm traditional" branch for declaring the trampoline functions in JITStubs.cpp Task-number: QTBUG-5513 Reviewed-by: Kent Hansen --- src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp | 3 +++ src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp index 073b35a..b098728 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.cpp @@ -561,6 +561,7 @@ SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiTrampoline) "\n" +HIDE_SYMBOL(ctiTrampoline) "\n" SYMBOL_STRING(ctiTrampoline) ":" "\n" "stmdb sp!, {r1-r3}" "\n" "stmdb sp!, {r4-r8, lr}" "\n" @@ -584,6 +585,7 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n" asm volatile ( ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" +HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" "mov r0, sp" "\n" "mov lr, r6" "\n" @@ -593,6 +595,7 @@ SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" // Both has the same return sequence ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" +HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" "add sp, sp, #32" "\n" "ldmia sp!, {r4-r8, lr}" "\n" diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h index 43975ff..c2b8c02 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JITStubs.h @@ -246,6 +246,10 @@ namespace JSC { MacroAssemblerCodePtr m_ctiNativeCallThunk; }; +#if COMPILER(GCC) +#pragma GCC visibility push(hidden) +#endif + extern "C" { EncodedJSValue JIT_STUB cti_op_add(STUB_ARGS_DECLARATION); EncodedJSValue JIT_STUB cti_op_bitand(STUB_ARGS_DECLARATION); @@ -363,6 +367,10 @@ extern "C" { void* JIT_STUB cti_vm_lazyLinkCall(STUB_ARGS_DECLARATION); } // extern "C" +#if COMPILER(GCC) +#pragma GCC visibility pop +#endif + } // namespace JSC #endif // ENABLE(JIT) -- cgit v0.12 From cda63c368dbb5acd040e2190db8f25de69462d8e Mon Sep 17 00:00:00 2001 From: ninerider Date: Mon, 23 Nov 2009 13:09:56 +0100 Subject: WinCE: only use native menu bars for windows mobile On Windows CE the native menubar must not be used. The corresponding flag was never set for Windows CE. Task-number: QT-2530 Reviewed-by: Maurice --- src/gui/widgets/qmenubar.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index e50de02..377b39a 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -736,6 +736,9 @@ void QMenuBarPrivate::init() if(wce_menubar) q->hide(); } + else { + QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); + } #endif #ifdef Q_WS_S60 symbianCreateMenuBar(q->parentWidget()); -- cgit v0.12 From 4ea54f03174778a4efdcb802f9179b6e1d17fd88 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 23 Nov 2009 11:33:25 +0100 Subject: Cocoa: apps with dialogs hangs on exit This happends because we refuse to exit if we have a modal dialog showing on screen. After some discussion, we decided that we need to allow to exit if the quit menu item is enabled. Some of the reason behind this is the way developers tend to (mis)use dialogs as normal windows in Qt. So, if you don't want your app to exit when showing a modal dialog, disable quit menuitem, or handle QCloseEvent. Task-number: 5613 Reviewed-by: MortenS --- src/gui/kernel/qapplication_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index 84da56e..22a0959 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -2449,7 +2449,7 @@ OSStatus QApplicationPrivate::globalAppleEventProcessor(const AppleEvent *ae, Ap switch(aeID) { case kAEQuitApplication: { extern bool qt_mac_quit_menu_item_enabled; // qmenu_mac.cpp - if(!QApplicationPrivate::modalState() && qt_mac_quit_menu_item_enabled) { + if (qt_mac_quit_menu_item_enabled) { QCloseEvent ev; QApplication::sendSpontaneousEvent(app, &ev); if(ev.isAccepted()) { -- cgit v0.12 From c275ba17d263f9108ee26e32a0f89b0c57e526e0 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 23 Nov 2009 13:35:23 +0100 Subject: Make the buttons react on mouse release only if it was pressed Task-number: QTBUG-3521 Reviewed-by: prasanth --- src/gui/widgets/qabstractbutton.cpp | 7 +++++-- src/gui/widgets/qabstractbutton_p.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp index cb46791..8834373 100644 --- a/src/gui/widgets/qabstractbutton.cpp +++ b/src/gui/widgets/qabstractbutton.cpp @@ -165,7 +165,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type) shortcutId(0), #endif checkable(false), checked(false), autoRepeat(false), autoExclusive(false), - down(false), blockRefresh(false), + down(false), blockRefresh(false), pressed(false), #ifndef QT_NO_BUTTONGROUP group(0), #endif @@ -1090,6 +1090,7 @@ void QAbstractButton::mousePressEvent(QMouseEvent *e) } if (hitButton(e->pos())) { setDown(true); + d->pressed = true; repaint(); //flush paint event before invoking potentially expensive operation QApplication::flush(); d->emitPressed(); @@ -1103,6 +1104,8 @@ void QAbstractButton::mousePressEvent(QMouseEvent *e) void QAbstractButton::mouseReleaseEvent(QMouseEvent *e) { Q_D(QAbstractButton); + d->pressed = false; + if (e->button() != Qt::LeftButton) { e->ignore(); return; @@ -1127,7 +1130,7 @@ void QAbstractButton::mouseReleaseEvent(QMouseEvent *e) void QAbstractButton::mouseMoveEvent(QMouseEvent *e) { Q_D(QAbstractButton); - if (!(e->buttons() & Qt::LeftButton)) { + if (!(e->buttons() & Qt::LeftButton) || !d->pressed) { e->ignore(); return; } diff --git a/src/gui/widgets/qabstractbutton_p.h b/src/gui/widgets/qabstractbutton_p.h index be7c022..d86163b 100644 --- a/src/gui/widgets/qabstractbutton_p.h +++ b/src/gui/widgets/qabstractbutton_p.h @@ -77,6 +77,7 @@ public: uint autoExclusive :1; uint down :1; uint blockRefresh :1; + uint pressed : 1; #ifndef QT_NO_BUTTONGROUP QButtonGroup* group; -- cgit v0.12 From c7f14f778b3e974631d29cb1ad87891f6b350f61 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Mon, 23 Nov 2009 13:34:37 +0100 Subject: Fixes qlistview failing autotest: QTBUG_5877_skippingItemInPageDownUp Reviewed-by: ogoffart --- tests/auto/qlistview/tst_qlistview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 605b3e3..602da61 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1898,7 +1898,7 @@ void tst_QListView::taskQTBUG_5877_skippingItemInPageDownUp() QTest::qWaitForWindowShown(&vu); int itemHeight = vu.visualRect(model.index(0, 0)).height(); - int visibleRowCount = vu.height() / itemHeight; + int visibleRowCount = vu.viewport()->height() / itemHeight; int scrolledRowCount = visibleRowCount - 1; for (int i = 0; i < currentItemIndexes.size(); ++i) { -- cgit v0.12 From b8367d1c0846455e9055aed7ff5a0e438531a9ae Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 23 Nov 2009 14:04:37 +0100 Subject: Mac: added some useful comments only --- src/gui/kernel/qcocoaapplicationdelegate_mac.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm index 37dcc67..304e5d3 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm @@ -178,6 +178,9 @@ static void cleanupCocoaApplicationDelegate() return [[qtMenuLoader retain] autorelease]; } +// This function will only be called when NSApp is actually running. Before +// that, the kAEQuitApplication apple event will be sendt to +// QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { Q_UNUSED(sender); -- cgit v0.12 From da40c39eb802a40a9108406d1665d9d9b19a7b3c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 23 Nov 2009 14:05:12 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( efa69b6181ce5c045097351cdcf6c158da3f4888 ) Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-11-19 Olivier Goffart Reviewed by Simon Hausmann. [Qt] Normalize signal and slot signatures. * Api/qgraphicswebview.cpp: (QGraphicsWebView::setPage): * Api/qwebview.cpp: (QWebView::setPage): * WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::setFrame): * docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp: (wrapInFunction): * tests/qwebframe/tst_qwebframe.cpp: * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::modified): (tst_QWebPage::database): --- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 17 +++++++++++++++++ .../webkit/JavaScriptCore/runtime/StringPrototype.cpp | 5 +++++ src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 9 +++++++++ src/3rdparty/webkit/WebKit/qt/ChangeLog | 19 +++++++++++++++++++ 5 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 304f9ef..382a8c7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,20 @@ +2009-11-23 Laszlo Gombos + + Reviewed by Kenneth Rohde Christiansen. + + [Symbian] Fix lastIndexOf() for Symbian + https://bugs.webkit.org/show_bug.cgi?id=31773 + + Symbian soft floating point library has problems with operators + comparing NaN to numbers. Without a workaround lastIndexOf() + function does not work. + + Patch developed by David Leong. + + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncLastIndexOf):Add an extra test + to check for NaN for Symbian. + 2009-11-18 Harald Fernengel Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp index a0713b8..a0cc9f1 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/StringPrototype.cpp @@ -469,6 +469,11 @@ JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec, JSObject*, JSV dpos = 0; else if (!(dpos <= len)) // true for NaN dpos = len; +#if PLATFORM(SYMBIAN) + // Work around for broken NaN compare operator + else if (isnan(dpos)) + dpos = len; +#endif return jsNumber(exec, s.rfind(u2, static_cast(dpos))); } diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index f40dda4..5818e83 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 - 7bdf90f753d25fb1b5628b0980827df11110ad5a + efa69b6181ce5c045097351cdcf6c158da3f4888 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 6daf411..9644470 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,12 @@ +2009-11-19 Olivier Goffart + + Reviewed by Simon Hausmann. + + [Qt] Normalize signal and slot signatures. + + * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp: + (WebCore::MediaPlayerPrivate::MediaPlayerPrivate): + 2009-11-18 Benjamin Poulain Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 457e9c2..2408dd4 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,22 @@ +2009-11-19 Olivier Goffart + + Reviewed by Simon Hausmann. + + [Qt] Normalize signal and slot signatures. + + * Api/qgraphicswebview.cpp: + (QGraphicsWebView::setPage): + * Api/qwebview.cpp: + (QWebView::setPage): + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::setFrame): + * docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp: + (wrapInFunction): + * tests/qwebframe/tst_qwebframe.cpp: + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::modified): + (tst_QWebPage::database): + 2009-11-18 Paul Olav Tvete Reviewed by Simon Hausmann. -- cgit v0.12 From 20594620667864c48745254abb54dbce442aa6f4 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 13 Nov 2009 18:09:23 +0100 Subject: Mac: remove superflucious call The line removed in the patch is done so as a result of change 639b9c0286f0f2d5e50121df8d4125f029074510. That change made the interrupt do an extra round in the event dispatcher. --- src/gui/dialogs/qcolordialog_mac.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm index 5f074c0..53d2e1e 100644 --- a/src/gui/dialogs/qcolordialog_mac.mm +++ b/src/gui/dialogs/qcolordialog_mac.mm @@ -336,7 +336,6 @@ QT_USE_NAMESPACE } } - QAbstractEventDispatcher::instance()->interrupt(); if (mResultCode == NSCancelButton) mPriv->colorDialog()->reject(); else -- cgit v0.12 From 896d4a4d5c9f9dc3831a23b81d39ff00e6f6d33f Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Sat, 14 Nov 2009 10:59:35 +0100 Subject: Cocoa: native dialogs might hang the application on close This patch implements the same fix as 639b9c0286f0f2d5e50121df8d4125f029074510, but when someone spins the event dispatcher manually (calling processEvents themselves). Rev-By: MortenS --- src/gui/kernel/qeventdispatcher_mac.mm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 427f0b0..e0eebfd 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -572,7 +572,7 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) while (!d->interrupt && [NSApp runModalSession:session] == NSRunContinuesResponse) qt_mac_waitForMoreModalSessionEvents(); if (!d->interrupt && session == d->currentModalSessionCached) { - // Someone called e.g. [NSApp stopModal:] from outside the event + // INVARIANT: Someone called e.g. [NSApp stopModal:] from outside the event // dispatcher (e.g to stop a native dialog). But that call wrongly stopped // 'session' as well. As a result, we need to restart all internal sessions: d->temporarilyStopAllModalSessions(); @@ -596,7 +596,13 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) if (NSModalSession session = d->currentModalSession()) { if (flags & QEventLoop::WaitForMoreEvents) qt_mac_waitForMoreModalSessionEvents(); - [NSApp runModalSession:session]; + NSInteger status = [NSApp runModalSession:session]; + if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) { + // INVARIANT: Someone called e.g. [NSApp stopModal:] from outside the event + // dispatcher (e.g to stop a native dialog). But that call wrongly stopped + // 'session' as well. As a result, we need to restart all internal sessions: + d->temporarilyStopAllModalSessions(); + } retVal = true; break; } else { -- cgit v0.12 From 8644ff560002c4ae786e5b1f11450c1b1f80e7e8 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 23 Nov 2009 13:14:30 +0100 Subject: Mac: Make gestures available when building Qt against SDK < 10.6 We build the release packages for Carbon against the 10.4 SDK. This means that the constants used for dealing with gestures are missing, and currently the implementation will be ifdeffed out. This patch defines these constants when building with an SDK < 10.6. Gestures will therefore work when running applications on 10.6. The same fix is also implemented for cocoa. Rev-By: MortenS --- src/gui/kernel/qcocoaview_mac.mm | 8 ++++++-- src/gui/kernel/qwidget_mac.mm | 25 +++++++++++++++++++------ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 72eedad..0445a16 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -64,12 +64,16 @@ #include -@interface NSEvent (DeviceDelta) +@interface NSEvent (Qt_Compile_Leopard_DeviceDelta) - (CGFloat)deviceDeltaX; - (CGFloat)deviceDeltaY; - (CGFloat)deviceDeltaZ; @end +@interface NSEvent (Qt_Compile_Leopard_Gestures) + - (CGFloat)magnification; +@end + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(DnDParams, qMacDnDParams); @@ -893,6 +897,7 @@ extern "C" { bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all)); } +#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 - (void)magnifyWithEvent:(NSEvent *)event; { @@ -963,7 +968,6 @@ extern "C" { qNGEvent.position = flipPoint(p).toPoint(); qt_sendSpontaneousEvent(qwidget, &qNGEvent); } -#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 - (void)frameDidChange:(NSNotification *)note { diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 71f0077..0d9f9ee 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -725,6 +725,23 @@ static OSWindowRef qt_mac_create_window(QWidget *, WindowClass wclass, WindowAtt return window; } +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 +/* We build the release package against the 10.4 SDK. + So, to enable gestures for applications running on + 10.6+, we define the missing constants here: */ +enum { + kEventClassGesture = 'gest', + kEventGestureStarted = 1, + kEventGestureEnded = 2, + kEventGestureMagnify = 4, + kEventGestureSwipe = 5, + kEventGestureRotate = 6, + kEventParamRotationAmount = 'rota', + kEventParamSwipeDirection = 'swip', + kEventParamMagnificationAmount = 'magn' +}; +#endif + // window events static EventTypeSpec window_events[] = { { kEventClassWindow, kEventWindowClose }, @@ -741,13 +758,11 @@ static EventTypeSpec window_events[] = { { kEventClassWindow, kEventWindowGetRegion }, { kEventClassWindow, kEventWindowGetClickModality }, { kEventClassWindow, kEventWindowTransitionCompleted }, -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 { kEventClassGesture, kEventGestureStarted }, { kEventClassGesture, kEventGestureEnded }, { kEventClassGesture, kEventGestureMagnify }, { kEventClassGesture, kEventGestureSwipe }, { kEventClassGesture, kEventGestureRotate }, -#endif { kEventClassMouse, kEventMouseDown } }; static EventHandlerUPP mac_win_eventUPP = 0; @@ -1036,7 +1051,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, handled_event = false; break; } -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 case kEventClassGesture: { // First, find the widget that was under // the mouse when the gesture happened: @@ -1064,7 +1078,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, break; case kEventGestureRotate: { CGFloat amount; - if (GetEventParameter(event, kEventParamRotationAmount, typeCGFloat, 0, + if (GetEventParameter(event, kEventParamRotationAmount, 'cgfl', 0, sizeof(amount), 0, &amount) != noErr) { handled_event = false; break; @@ -1091,7 +1105,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, break; } case kEventGestureMagnify: { CGFloat amount; - if (GetEventParameter(event, kEventParamMagnificationAmount, typeCGFloat, 0, + if (GetEventParameter(event, kEventParamMagnificationAmount, 'cgfl', 0, sizeof(amount), 0, &amount) != noErr) { handled_event = false; break; @@ -1103,7 +1117,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, QApplication::sendSpontaneousEvent(widget, &qNGEvent); break; } -#endif // gestures default: handled_event = false; -- cgit v0.12 From 23002374d11598b26b6585e78dc073071a13f0ec Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 23 Nov 2009 15:26:36 +0100 Subject: Don't crash in eval() function when QtScript debugger is attached The built-in eval() function bypasses the script registration performed by QScriptEngine::evaluate(), so if we get an atStatement() callback from JSC from that script, the scriptID-to-sourceProvider lookup will fail. In this case, just return from atStatement() without delivering the positionChange() callback to the QScriptEngineAgent, since the agent will not have received the scriptLoad() callback for that script anyway. This is a change in behavior from 4.5, but we consider it the minimum-impact fix at this point to keep 4.6.0 from crashing. The only downside is that debugging will effectively be "disabled" for the script passed to eval(), but that's a lot better than crashing. Task-number: QTBUG-6108 Reviewed-by: Jedrzej Nowacki --- src/script/api/qscriptengineagent.cpp | 10 ++++++-- .../qscriptengineagent/tst_qscriptengineagent.cpp | 28 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp index e7998b7..a2af514 100644 --- a/src/script/api/qscriptengineagent.cpp +++ b/src/script/api/qscriptengineagent.cpp @@ -154,7 +154,10 @@ void QScriptEngineAgentPrivate::exceptionCatch(const JSC::DebuggerCallFrame& fra void QScriptEngineAgentPrivate::atStatement(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno, int column) { QScript::UStringSourceProviderWithFeedback *source = engine->loadedScripts.value(sourceID); - Q_ASSERT(source != 0); + if (!source) { + // QTBUG-6108: We don't have the source for this script, so ignore. + return; + } column = source->columnNumberFromOffset(column); JSC::CallFrame *oldFrame = engine->currentFrame; int oldAgentLineNumber = engine->agentLineNumber; @@ -183,7 +186,10 @@ void QScriptEngineAgentPrivate::didReachBreakpoint(const JSC::DebuggerCallFrame& { if (q_ptr->supportsExtension(QScriptEngineAgent::DebuggerInvocationRequest)) { QScript::UStringSourceProviderWithFeedback *source = engine->loadedScripts.value(sourceID); - Q_ASSERT(source != 0); + if (!source) { + // QTBUG-6108: We don't have the source for this script, so ignore. + return; + } column = source->columnNumberFromOffset(column); JSC::CallFrame *oldFrame = engine->currentFrame; int oldAgentLineNumber = engine->agentLineNumber; diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 032c34b..77ccdb3 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -114,6 +114,7 @@ private slots: void evaluateProgram(); void evaluateProgram_SyntaxError(); void evaluateNullProgram(); + void QTBUG6108(); private: double m_testProperty; @@ -2306,5 +2307,32 @@ void tst_QScriptEngineAgent::evaluateNullProgram() QCOMPARE(spy->count(), 0); } +void tst_QScriptEngineAgent::QTBUG6108() +{ + QScriptEngine eng; + ScriptEngineSpy *spy = new ScriptEngineSpy(&eng); + eng.evaluate("eval('a = 1')"); + QCOMPARE(spy->count(), 5); + + QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad); + QVERIFY(spy->at(0).scriptId != -1); + + QCOMPARE(spy->at(1).type, ScriptEngineEvent::FunctionEntry); + QVERIFY(spy->at(1).scriptId != -1); + QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId); + + QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(2).scriptId != -1); + QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId); + QCOMPARE(spy->at(2).lineNumber, 1); + + QCOMPARE(spy->at(3).type, ScriptEngineEvent::FunctionExit); + QVERIFY(spy->at(3).scriptId != -1); + QCOMPARE(spy->at(3).scriptId, spy->at(0).scriptId); + + QCOMPARE(spy->at(4).type, ScriptEngineEvent::ScriptUnload); + QCOMPARE(spy->at(4).scriptId, spy->at(0).scriptId); +} + QTEST_MAIN(tst_QScriptEngineAgent) #include "tst_qscriptengineagent.moc" -- cgit v0.12 From db5e4496229a776768464d1d3d2e1f8e81bd6ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Mon, 23 Nov 2009 15:39:31 +0100 Subject: Compile fix for win32-icc. The Intel Compiler inlined the destructor of QObjectPrivate too agressively, causing it to generate a call to ~QObjectData for QtGui. ~QObjectData is not exported from QtCore, so it failed linking. Task-number: QTBUG-5145 Reviewed-by: Alexis Menard --- src/corelib/kernel/qobject.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 1260d47..95602d9 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -154,6 +154,15 @@ QObjectPrivate::QObjectPrivate(int version) hasGuards = false; } +#ifdef Q_CC_INTEL +/* Workaround for a bug in win32-icc where it seems to inline ~QObjectPrivate too aggressive. + When icc compiles QtGui, it inlines ~QObjectPrivate so that it would generate a call to + ~QObjectData. However, ~QObjectData is not exported from QtCore, so it does not link. + See also QTBUG-5145 for info on how this manifested itself. + */ +# pragma auto_inline(off) +#endif + QObjectPrivate::~QObjectPrivate() { delete static_cast(metaObject); @@ -165,6 +174,9 @@ QObjectPrivate::~QObjectPrivate() delete extraData; #endif } +#ifdef Q_CC_INTEL +# pragma auto_inline(on) +#endif int *QObjectPrivate::setDeleteWatch(QObjectPrivate *d, int *w) { -- cgit v0.12 From 44bea4d915ccfcb43b5392b4b915b9cb40f59faa Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Thu, 19 Nov 2009 18:34:43 +0100 Subject: A few tweaks to the frozen column example Reviewed-By: Thierry --- examples/itemviews/frozencolumn/freezetablewidget.cpp | 9 ++++++++- examples/itemviews/frozencolumn/freezetablewidget.h | 1 + examples/itemviews/frozencolumn/grades.txt | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/itemviews/frozencolumn/freezetablewidget.cpp b/examples/itemviews/frozencolumn/freezetablewidget.cpp index ee50ae1..72dc2a1 100644 --- a/examples/itemviews/frozencolumn/freezetablewidget.cpp +++ b/examples/itemviews/frozencolumn/freezetablewidget.cpp @@ -84,7 +84,8 @@ void FreezeTableWidget::init() //! [init part2] frozenTableView->setStyleSheet("QTableView { border: none;" - "background-color: #8EDE21;}"); //for demo purposes + "background-color: #8EDE21;" + "selection-background-color: #999}"); //for demo purposes frozenTableView->setSelectionModel(selectionModel()); for(int col=1; colcolumnCount(); col++) frozenTableView->setColumnHidden(col, true); @@ -146,6 +147,12 @@ QModelIndex FreezeTableWidget::moveCursor(CursorAction cursorAction, } //! [navigate] +void FreezeTableWidget::scrollTo (const QModelIndex & index, ScrollHint hint){ + if(index.column()>0) + QTableView::scrollTo(index, hint); +} + + //! [geometry] void FreezeTableWidget::updateFrozenTableGeometry() diff --git a/examples/itemviews/frozencolumn/freezetablewidget.h b/examples/itemviews/frozencolumn/freezetablewidget.h index 403890f..d236d40 100644 --- a/examples/itemviews/frozencolumn/freezetablewidget.h +++ b/examples/itemviews/frozencolumn/freezetablewidget.h @@ -56,6 +56,7 @@ public: protected: virtual void resizeEvent(QResizeEvent *event); virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers); + void scrollTo (const QModelIndex & index, ScrollHint hint = EnsureVisible); private: QTableView *frozenTableView; diff --git a/examples/itemviews/frozencolumn/grades.txt b/examples/itemviews/frozencolumn/grades.txt index 4b55b473..e1c6fcc 100644 --- a/examples/itemviews/frozencolumn/grades.txt +++ b/examples/itemviews/frozencolumn/grades.txt @@ -32,4 +32,5 @@ 9a+ , , 5.15a , , , XI+ , , , , 12a 9b , , 5.15b , , , , , , , 12b -# Wikipedia contributors. Grade (climbing). Wikipedia, The Free Encyclopedia. May 15, 2009, 20:42 UTC. Available at: http://en.wikipedia.org/w/index.php?title=Grade_(climbing)&oldid=290165724. Accessed May 28, 2009. +# Wikipedia contributors. Grade (climbing). Wikipedia, The Free Encyclopedia. May 15, 2009, 20:42 UTC. +# Available at: http://en.wikipedia.org/w/index.php?title=Grade_(climbing)&oldid=290165724. Accessed May 28, 2009. -- cgit v0.12 From 7ff2d919db8e0addd15c401e5ddda82d061ba5a1 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Thu, 19 Nov 2009 18:27:20 +0100 Subject: updates french phrasebook --- tools/linguist/phrasebooks/french.qph | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tools/linguist/phrasebooks/french.qph b/tools/linguist/phrasebooks/french.qph index d710abd..9e1a580 100644 --- a/tools/linguist/phrasebooks/french.qph +++ b/tools/linguist/phrasebooks/french.qph @@ -1402,4 +1402,40 @@ &Redo &Rétablir + + Edit + Éditer + + + PATH: + PATH : + + + Change: + Modification : + + + Edit... + Modifier... + + + &Username: + &Utilisateur : + + + Link + Lien + + + Paste: + Collage : + + + Label + Libellé + + + &Debug + &Déboguer + -- cgit v0.12 From 0bad605066f4cacabb2547b9b8895b69dac3d431 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 23 Nov 2009 15:48:51 +0100 Subject: Make the menubar filter out EScape only if there is a current action Task-number: QTBUG-4965 Reviewed-by: gabi --- src/gui/widgets/qmenubar.cpp | 3 ++- tests/auto/qmenubar/tst_qmenubar.cpp | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index e50de02..40cfe1a 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -1486,7 +1486,8 @@ bool QMenuBar::event(QEvent *e) break; case QEvent::ShortcutOverride: { QKeyEvent *kev = static_cast(e); - if (kev->key() == Qt::Key_Escape) { + //we only filter out escape if there is a current action + if (kev->key() == Qt::Key_Escape && d->currentAction) { e->accept(); return true; } diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 4291c3e..320cd8d 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -167,6 +167,7 @@ private slots: void task223138_triggered(); void task256322_highlight(); void menubarSizeHint(); + void taskQTBUG4965_escapeEaten(); #if defined(QT3_SUPPORT) void indexBasedInsertion_data(); @@ -1664,6 +1665,27 @@ void tst_QMenuBar::menubarSizeHint() QCOMPARE(resSize, mb.sizeHint()); } +void tst_QMenuBar::taskQTBUG4965_escapeEaten() +{ + QMenuBar menubar; + QMenu menu("menu1"); + QAction *first = menubar.addMenu(&menu); + menu.addAction("quit", &menubar, SLOT(close()), QKeySequence("ESC")); + menubar.show(); + menubar.setActiveWindow(); + QTest::qWaitForWindowShown(&menubar); + menubar.setActiveAction(first); + QTRY_VERIFY(menu.isVisible()); + QCOMPARE(menubar.activeAction(), first); + QTest::keyClick(0, Qt::Key_Escape); + QVERIFY(!menu.isVisible()); + QTRY_VERIFY(menubar.hasFocus()); + QCOMPARE(menubar.activeAction(), first); + QTest::keyClick(0, Qt::Key_Escape); + QVERIFY(!menubar.activeAction()); + QTest::keyClick(0, Qt::Key_Escape); //now the action should be triggered + QTRY_VERIFY(!menubar.isVisible()); +} #if defined(QT3_SUPPORT) void tst_QMenuBar::indexBasedInsertion_data() -- cgit v0.12 From ddd885ae9a46f8abcc4e5eb45bb4c53d7f86f4c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 23 Nov 2009 16:10:10 +0100 Subject: Fixed endless loop when printing a QTextDocument. If the user enters a valid page range, which lies outside of the actual number of printable pages, we can't detect that until the document has been paginated. Task-number: QTBUG-6051 Reviewed-by: Kim --- src/gui/text/qtextdocument.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 048325c..523dd18 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1767,6 +1767,12 @@ void QTextDocument::print(QPrinter *printer) const fromPage = qMax(1, fromPage); toPage = qMin(doc->pageCount(), toPage); + if (toPage < fromPage) { + // if the user entered a page range outside the actual number + // of printable pages, just return + return; + } + if (printer->pageOrder() == QPrinter::LastPageFirst) { int tmp = fromPage; fromPage = toPage; -- cgit v0.12 From 6ef5b4485b9fe5a9d25d2d9b5e67f110fb728a8b Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 23 Nov 2009 16:08:04 +0100 Subject: Fix positioning of diacritics in .otf fonts on Windows Since .otf fonts are not considered truetype fonts, they take the code paths intended for non-outline fonts. When calculating the bounding box of a glyph, this would mean we'd find the largest possible bounding rect of any glyph in the font, while the other metrics, such as the GPOS tables used to position diacritics in relation to base glyphs, are positioning the actual outline of the glyph. The result was that certain diacritics that depended on the opentype positioning would not be shown on Windows at all, as they would be positioned based on the wrong left bearing and height when drawn into the glyph cache. The fix is to find the tight bounding rect of the outline whenever possible and fall back to the old code when this fails. I've also added the left bearing of the glyph to the bounding box in the fallback case, as we did not respect this before and would misplace glyphs that has a bearing. Task-number: QTBUG-5860 Reviewed-by: Trond --- src/gui/text/qfontengine_win.cpp | 105 +++++++++++++++++++++++---------------- src/gui/text/qfontengine_win_p.h | 2 + 2 files changed, 63 insertions(+), 44 deletions(-) diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 6c367ab..18851b7 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -485,61 +485,78 @@ glyph_metrics_t QFontEngineWin::boundingBox(const QGlyphLayout &glyphs) return glyph_metrics_t(0, -tm.tmAscent, w, tm.tmHeight, w, 0); } +bool QFontEngineWin::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const +{ + Q_ASSERT(metrics != 0); + + HDC hdc = shared_dc(); + + GLYPHMETRICS gm; + DWORD res = 0; + MAT2 mat; + mat.eM11.value = mat.eM22.value = 1; + mat.eM11.fract = mat.eM22.fract = 0; + mat.eM21.value = mat.eM12.value = 0; + mat.eM21.fract = mat.eM12.fract = 0; + + if (t.type() > QTransform::TxTranslate) { + // We need to set the transform using the HDC's world + // matrix rather than using the MAT2 above, because the + // results provided when transforming via MAT2 does not + // match the glyphs that are drawn using a WorldTransform + XFORM xform; + xform.eM11 = t.m11(); + xform.eM12 = t.m12(); + xform.eM21 = t.m21(); + xform.eM22 = t.m22(); + xform.eDx = 0; + xform.eDy = 0; + SetGraphicsMode(hdc, GM_ADVANCED); + SetWorldTransform(hdc, &xform); + } + + uint format = GGO_METRICS; + if (ttf) + format |= GGO_GLYPH_INDEX; + res = GetGlyphOutline(hdc, glyph, format, &gm, 0, 0, &mat); + + if (t.type() > QTransform::TxTranslate) { + XFORM xform; + xform.eM11 = xform.eM22 = 1; + xform.eM12 = xform.eM21 = xform.eDx = xform.eDy = 0; + SetWorldTransform(hdc, &xform); + SetGraphicsMode(hdc, GM_COMPATIBLE); + } + + if (res != GDI_ERROR) { + *metrics = glyph_metrics_t(gm.gmptGlyphOrigin.x, -gm.gmptGlyphOrigin.y, + (int)gm.gmBlackBoxX, (int)gm.gmBlackBoxY, gm.gmCellIncX, gm.gmCellIncY); + return true; + } else { + return false; + } +} glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t) { #ifndef Q_WS_WINCE - GLYPHMETRICS gm; - HDC hdc = shared_dc(); SelectObject(hdc, hfont); - if (!ttf) { + + glyph_metrics_t glyphMetrics; + bool success = getOutlineMetrics(glyph, t, &glyphMetrics); + + if (!ttf && !success) { + // Bitmap fonts wchar_t ch = glyph; ABCFLOAT abc; GetCharABCWidthsFloat(hdc, ch, ch, &abc); int width = qRound(abc.abcfB); - return glyph_metrics_t(0, -tm.tmAscent, width, tm.tmHeight, width, 0).transformed(t); - } else { - DWORD res = 0; - MAT2 mat; - mat.eM11.value = mat.eM22.value = 1; - mat.eM11.fract = mat.eM22.fract = 0; - mat.eM21.value = mat.eM12.value = 0; - mat.eM21.fract = mat.eM12.fract = 0; - - if (t.type() > QTransform::TxTranslate) { - // We need to set the transform using the HDC's world - // matrix rather than using the MAT2 above, because the - // results provided when transforming via MAT2 does not - // match the glyphs that are drawn using a WorldTransform - XFORM xform; - xform.eM11 = t.m11(); - xform.eM12 = t.m12(); - xform.eM21 = t.m21(); - xform.eM22 = t.m22(); - xform.eDx = 0; - xform.eDy = 0; - SetGraphicsMode(hdc, GM_ADVANCED); - SetWorldTransform(hdc, &xform); - } - - res = GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gm, 0, 0, &mat); - - if (t.type() > QTransform::TxTranslate) { - XFORM xform; - xform.eM11 = xform.eM22 = 1; - xform.eM12 = xform.eM21 = xform.eDx = xform.eDy = 0; - SetWorldTransform(hdc, &xform); - SetGraphicsMode(hdc, GM_COMPATIBLE); - } - - if (res != GDI_ERROR) { - return glyph_metrics_t(gm.gmptGlyphOrigin.x, -gm.gmptGlyphOrigin.y, - (int)gm.gmBlackBoxX, (int)gm.gmBlackBoxY, gm.gmCellIncX, gm.gmCellIncY); - } + return glyph_metrics_t(QFixed::fromReal(abc.abcfA), -tm.tmAscent, width, tm.tmHeight, width, 0).transformed(t); } - return glyph_metrics_t(); + + return glyphMetrics; #else HDC hdc = shared_dc(); HGDIOBJ oldFont = SelectObject(hdc, hfont); @@ -1135,7 +1152,7 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin { ExtTextOut(hdc, -gx + margin, -gy + margin, options, 0, (LPCWSTR) &glyph, 1, 0); } - + SelectObject(hdc, old_font); return ni; } diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h index 9c4b0a9..43e1f12 100644 --- a/src/gui/text/qfontengine_win_p.h +++ b/src/gui/text/qfontengine_win_p.h @@ -109,6 +109,8 @@ public: int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, bool mirrored) const; void getCMap(); + bool getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const; + QString _name; HFONT hfont; LOGFONT logfont; -- cgit v0.12 From 1514917196835887c4d4c93cf2522d1a70285c16 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 23 Nov 2009 17:03:38 +0100 Subject: Fixes: Fuzzy standard icons with Ubuntu Humanity theme Task: QTBUG-6121 RevBy: thorbjorn Details: This icon theme is a bit special in that it uses svg icons even for fixed size entries such as 16x16 icons. An optimization in the icon loader explicitly ignores svgs for such entries so we simply have to remove this check. In addition the actualSize had to be altered to never return a size bigger than the requested size. Otherwise certain menu elements will be bigger than intended. --- src/gui/image/qiconloader.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 15af7a2..ad9bdd0 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -249,21 +249,19 @@ QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName, const QIconDirInfo &dirInfo = subDirs.at(i); QString subdir = dirInfo.path; QDir currentDir(contentDir + subdir); - - if (dirInfo.type == QIconDirInfo::Scalable && m_supportsSvg && - currentDir.exists(iconName + svgext)) { - ScalableEntry *iconEntry = new ScalableEntry; - iconEntry->dir = dirInfo; - iconEntry->filename = currentDir.filePath(iconName + svgext); - entries.append(iconEntry); - - } else if (currentDir.exists(iconName + pngext)) { + if (currentDir.exists(iconName + pngext)) { PixmapEntry *iconEntry = new PixmapEntry; iconEntry->dir = dirInfo; iconEntry->filename = currentDir.filePath(iconName + pngext); // Notice we ensure that pixmap entries allways come before // scalable to preserve search order afterwards entries.prepend(iconEntry); + } else if (m_supportsSvg && + currentDir.exists(iconName + svgext)) { + ScalableEntry *iconEntry = new ScalableEntry; + iconEntry->dir = dirInfo; + iconEntry->filename = currentDir.filePath(iconName + svgext); + entries.append(iconEntry); } } @@ -444,10 +442,8 @@ QIconLoaderEngineEntry *QIconLoaderEngine::entryForSize(const QSize &size) /* * Returns the actual icon size. For scalable svg's this is equivalent - * to the requested size. Otherwise the closest match is returned. - * - * todo: the spec is a bit fuzzy in this area, but we should probably - * allow scaling down pixmap icons as well. + * to the requested size. Otherwise the closest match is returned but + * we can never return a bigger size than the requested size. * */ QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode, @@ -460,8 +456,10 @@ QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode, const QIconDirInfo &dir = entry->dir; if (dir.type == QIconDirInfo::Scalable) return size; - else - return QSize(dir.size, dir.size); + else { + int result = qMin(dir.size, qMin(size.width(), size.height())); + return QSize(result, result); + } } return QIconEngineV2::actualSize(size, mode, state); } -- cgit v0.12 From 664b77d83677281cddcedd90f7c172d443523487 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 23 Nov 2009 18:36:14 +0100 Subject: Add references to JIRA tasks for expected test failures These are behavioral differences between QtScript in 4.6 and 4.5, and so should have tasks to figure out whether anyone actually depend on the behavior. --- tests/auto/qscriptable/tst_qscriptable.cpp | 2 +- tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 2 +- tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp | 6 +++--- tests/auto/qscriptengine/tst_qscriptengine.cpp | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/auto/qscriptable/tst_qscriptable.cpp b/tests/auto/qscriptable/tst_qscriptable.cpp index 90f1db8..c0945d8 100644 --- a/tests/auto/qscriptable/tst_qscriptable.cpp +++ b/tests/auto/qscriptable/tst_qscriptable.cpp @@ -332,7 +332,7 @@ void tst_QScriptable::thisObject() { QVERIFY(!m_scriptable.oofThisObject().isValid()); m_engine.evaluate("o.oof = 123"); - QEXPECT_FAIL("", "Setter doesn't get called when it's in the prototype", Continue); + QEXPECT_FAIL("", "QTBUG-5749: Setter doesn't get called when it's in the prototype", Continue); QVERIFY(m_scriptable.oofThisObject().strictlyEquals(m_engine.evaluate("o"))); } { diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index a0af214..4ecd887 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -1114,7 +1114,7 @@ void tst_QScriptContext::calledAsConstructor() QVERIFY(!fun3.property("calledAsConstructor").toBool()); eng.evaluate("new test();"); if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "calledAsConstructor is not correctly set for JS functions when JIT is enabled", Continue); + QEXPECT_FAIL("", "QTBUG-6132: calledAsConstructor is not correctly set for JS functions when JIT is enabled", Continue); QVERIFY(fun3.property("calledAsConstructor").toBool()); } diff --git a/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp b/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp index fe69c07..09ef820 100644 --- a/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp +++ b/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp @@ -249,13 +249,13 @@ void tst_QScriptContextInfo::qtFunction() QCOMPARE(info.functionEndLineNumber(), -1); QCOMPARE(info.functionStartLineNumber(), -1); if (x == 0) - QEXPECT_FAIL("", "QScriptContextInfo doesn't pick the correct meta-index for overloaded slots", Continue); + QEXPECT_FAIL("", "QTBUG-6133: QScriptContextInfo doesn't pick the correct meta-index for overloaded slots", Continue); QCOMPARE(info.functionParameterNames().size(), pnames.size()); if (x == 0) - QEXPECT_FAIL("", "QScriptContextInfo doesn't pick the correct meta-index for overloaded slots", Continue); + QEXPECT_FAIL("", "QTBUG-6133: QScriptContextInfo doesn't pick the correct meta-index for overloaded slots", Continue); QCOMPARE(info.functionParameterNames(), pnames); if (x == 0) - QEXPECT_FAIL("", "QScriptContextInfo doesn't pick the correct meta-index for overloaded slots", Continue); + QEXPECT_FAIL("", "QTBUG-6133: QScriptContextInfo doesn't pick the correct meta-index for overloaded slots", Continue); QCOMPARE(info.functionMetaIndex(), metaObject()->indexOfMethod(sig)); } diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 8eaad78..0887a68 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -1148,7 +1148,7 @@ void tst_QScriptEngine::globalObjectProperties() QScriptValue::PropertyFlags flags = QScriptValue::ReadOnly | QScriptValue::SkipInEnumeration; global.setProperty(name, val, flags); QVERIFY(global.property(name).equals(val)); - QEXPECT_FAIL("", "custom Global Object properties don't retain attributes", Continue); + QEXPECT_FAIL("", "QTBUG-6134: custom Global Object properties don't retain attributes", Continue); QCOMPARE(global.propertyFlags(name), flags); global.setProperty(name, QScriptValue()); QVERIFY(!global.property(name).isValid()); @@ -2033,7 +2033,7 @@ void tst_QScriptEngine::valueConversion() QScriptValue val = qScriptValueFromValue(&eng, in); QVERIFY(val.isRegExp()); QRegExp out = val.toRegExp(); - QEXPECT_FAIL("", "JSC-based back-end doesn't preserve QRegExp::patternSyntax (always uses RegExp2)", Continue); + QEXPECT_FAIL("", "QTBUG-6136: JSC-based back-end doesn't preserve QRegExp::patternSyntax (always uses RegExp2)", Continue); QCOMPARE(out.patternSyntax(), in.patternSyntax()); QCOMPARE(out.pattern(), in.pattern()); QCOMPARE(out.caseSensitivity(), in.caseSensitivity()); @@ -2050,7 +2050,7 @@ void tst_QScriptEngine::valueConversion() in.setMinimal(true); QScriptValue val = qScriptValueFromValue(&eng, in); QVERIFY(val.isRegExp()); - QEXPECT_FAIL("", "JSC-based back-end doesn't preserve QRegExp::minimal (always false)", Continue); + QEXPECT_FAIL("", "QTBUG-6136: JSC-based back-end doesn't preserve QRegExp::minimal (always false)", Continue); QCOMPARE(val.toRegExp().isMinimal(), in.isMinimal()); } } @@ -3045,7 +3045,7 @@ void tst_QScriptEngine::errorConstructors() eng.clearExceptions(); QVERIFY(ret.toString().startsWith(name)); if (x != 0) - QEXPECT_FAIL("", "JSC doesn't assign lineNumber when errors are not thrown", Continue); + QEXPECT_FAIL("", "QTBUG-6138: JSC doesn't assign lineNumber when errors are not thrown", Continue); QCOMPARE(ret.property("lineNumber").toInt32(), i+2); } } -- cgit v0.12 From 0ea7b40128bde00868bbab040b337fbc59cc0287 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 23 Nov 2009 20:00:21 +0100 Subject: Add reference to JIRA task for expected test failure --- tests/auto/qscriptengine/tst_qscriptengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 0887a68..3505b5d 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -2505,7 +2505,7 @@ void tst_QScriptEngine::stacktrace() QVERIFY(eng.hasUncaughtException()); QVERIFY(result.isError()); - QEXPECT_FAIL("", "", Abort); + QEXPECT_FAIL("", "QTBUG-6139: uncaughtExceptionBacktrace() doesn't give the full backtrace", Abort); QCOMPARE(eng.uncaughtExceptionBacktrace(), backtrace); QVERIFY(eng.hasUncaughtException()); QVERIFY(result.strictlyEquals(eng.uncaughtException())); -- cgit v0.12 From cf89e30f6885efb4b63f01e4459f8b277cb52113 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 23 Nov 2009 20:04:52 +0100 Subject: update autotest to match 4.6 behavior In 4.6 the Global Object no longer has an arguments property with undefined value; there should be no such property. --- tests/auto/qscriptengine/tst_qscriptengine.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 3505b5d..3bc2443 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -3063,14 +3063,19 @@ void tst_QScriptEngine::argumentsProperty() { { QScriptEngine eng; - QEXPECT_FAIL("", "", Continue); - QVERIFY(eng.evaluate("arguments").isUndefined()); + { + QScriptValue ret = eng.evaluate("arguments"); + QVERIFY(ret.isError()); + QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: arguments")); + } eng.evaluate("arguments = 10"); - QScriptValue ret = eng.evaluate("arguments"); - QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 10); - QEXPECT_FAIL("", "", Continue); - QVERIFY(!eng.evaluate("delete arguments").toBoolean()); + { + QScriptValue ret = eng.evaluate("arguments"); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toInt32(), 10); + } + QVERIFY(eng.evaluate("delete arguments").toBoolean()); + QVERIFY(!eng.globalObject().property("arguments").isValid()); } { QScriptEngine eng; @@ -3081,11 +3086,11 @@ void tst_QScriptEngine::argumentsProperty() } { QScriptEngine eng; + QVERIFY(!eng.globalObject().property("arguments").isValid()); QScriptValue ret = eng.evaluate("(function() { arguments = 456; return arguments; })()"); QVERIFY(ret.isNumber()); QCOMPARE(ret.toInt32(), 456); - QEXPECT_FAIL("", "", Continue); - QVERIFY(eng.evaluate("arguments").isUndefined()); + QVERIFY(!eng.globalObject().property("arguments").isValid()); } { -- cgit v0.12 From e494b391984a98ea40867cbe6f6bb01726924162 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Mon, 23 Nov 2009 20:10:53 +0100 Subject: Fix background rendering for read-only comboboxes on Maemo5 Reviewed-by: jbache --- src/gui/styles/qgtkstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 5566cc6..b32c55b 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -1368,7 +1368,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom else { gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, - GTK_SHADOW_NONE, style, entryPath + QString::number(focus)); + GTK_SHADOW_NONE, gtkCombo->style, entryPath + QString::number(focus)); } gtkCachedPainter.paintShadow(gtkEntry, comboBox->editable ? "entry" : "frame", frameRect, frameState, -- cgit v0.12 From 762a7d37f961235cf48364760762c7457897a8f8 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 23 Nov 2009 15:26:36 +0100 Subject: Don't crash in eval() function when QtScript debugger is attached The built-in eval() function bypasses the script registration performed by QScriptEngine::evaluate(), so if we get an atStatement() callback from JSC from that script, the scriptID-to-sourceProvider lookup will fail. In this case, just return from atStatement() without delivering the positionChange() callback to the QScriptEngineAgent, since the agent will not have received the scriptLoad() callback for that script anyway. This is a change in behavior from 4.5, but we consider it the minimum-impact fix at this point to keep 4.6.0 from crashing. The only downside is that debugging will effectively be "disabled" for the script passed to eval(), but that's a lot better than crashing. Task-number: QTBUG-6108 Reviewed-by: Jedrzej Nowacki (cherry picked from commit 23002374d11598b26b6585e78dc073071a13f0ec) --- src/script/api/qscriptengineagent.cpp | 10 ++++++-- .../qscriptengineagent/tst_qscriptengineagent.cpp | 28 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp index e7998b7..a2af514 100644 --- a/src/script/api/qscriptengineagent.cpp +++ b/src/script/api/qscriptengineagent.cpp @@ -154,7 +154,10 @@ void QScriptEngineAgentPrivate::exceptionCatch(const JSC::DebuggerCallFrame& fra void QScriptEngineAgentPrivate::atStatement(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno, int column) { QScript::UStringSourceProviderWithFeedback *source = engine->loadedScripts.value(sourceID); - Q_ASSERT(source != 0); + if (!source) { + // QTBUG-6108: We don't have the source for this script, so ignore. + return; + } column = source->columnNumberFromOffset(column); JSC::CallFrame *oldFrame = engine->currentFrame; int oldAgentLineNumber = engine->agentLineNumber; @@ -183,7 +186,10 @@ void QScriptEngineAgentPrivate::didReachBreakpoint(const JSC::DebuggerCallFrame& { if (q_ptr->supportsExtension(QScriptEngineAgent::DebuggerInvocationRequest)) { QScript::UStringSourceProviderWithFeedback *source = engine->loadedScripts.value(sourceID); - Q_ASSERT(source != 0); + if (!source) { + // QTBUG-6108: We don't have the source for this script, so ignore. + return; + } column = source->columnNumberFromOffset(column); JSC::CallFrame *oldFrame = engine->currentFrame; int oldAgentLineNumber = engine->agentLineNumber; diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 032c34b..77ccdb3 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -114,6 +114,7 @@ private slots: void evaluateProgram(); void evaluateProgram_SyntaxError(); void evaluateNullProgram(); + void QTBUG6108(); private: double m_testProperty; @@ -2306,5 +2307,32 @@ void tst_QScriptEngineAgent::evaluateNullProgram() QCOMPARE(spy->count(), 0); } +void tst_QScriptEngineAgent::QTBUG6108() +{ + QScriptEngine eng; + ScriptEngineSpy *spy = new ScriptEngineSpy(&eng); + eng.evaluate("eval('a = 1')"); + QCOMPARE(spy->count(), 5); + + QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad); + QVERIFY(spy->at(0).scriptId != -1); + + QCOMPARE(spy->at(1).type, ScriptEngineEvent::FunctionEntry); + QVERIFY(spy->at(1).scriptId != -1); + QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId); + + QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange); + QVERIFY(spy->at(2).scriptId != -1); + QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId); + QCOMPARE(spy->at(2).lineNumber, 1); + + QCOMPARE(spy->at(3).type, ScriptEngineEvent::FunctionExit); + QVERIFY(spy->at(3).scriptId != -1); + QCOMPARE(spy->at(3).scriptId, spy->at(0).scriptId); + + QCOMPARE(spy->at(4).type, ScriptEngineEvent::ScriptUnload); + QCOMPARE(spy->at(4).scriptId, spy->at(0).scriptId); +} + QTEST_MAIN(tst_QScriptEngineAgent) #include "tst_qscriptengineagent.moc" -- cgit v0.12 From 77a6bea85942cee8e1ffa526a31b75c57756a1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Mon, 23 Nov 2009 15:39:31 +0100 Subject: Compile fix for win32-icc. The Intel Compiler inlined the destructor of QObjectPrivate too agressively, causing it to generate a call to ~QObjectData for QtGui. ~QObjectData is not exported from QtCore, so it failed linking. Task-number: QTBUG-5145 Reviewed-by: Alexis Menard (cherry picked from commit db5e4496229a776768464d1d3d2e1f8e81bd6ba0) --- src/corelib/kernel/qobject.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 1260d47..95602d9 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -154,6 +154,15 @@ QObjectPrivate::QObjectPrivate(int version) hasGuards = false; } +#ifdef Q_CC_INTEL +/* Workaround for a bug in win32-icc where it seems to inline ~QObjectPrivate too aggressive. + When icc compiles QtGui, it inlines ~QObjectPrivate so that it would generate a call to + ~QObjectData. However, ~QObjectData is not exported from QtCore, so it does not link. + See also QTBUG-5145 for info on how this manifested itself. + */ +# pragma auto_inline(off) +#endif + QObjectPrivate::~QObjectPrivate() { delete static_cast(metaObject); @@ -165,6 +174,9 @@ QObjectPrivate::~QObjectPrivate() delete extraData; #endif } +#ifdef Q_CC_INTEL +# pragma auto_inline(on) +#endif int *QObjectPrivate::setDeleteWatch(QObjectPrivate *d, int *w) { -- cgit v0.12 From 3d5089e3b117c33fd20c7ef5ffd9c51560655854 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 24 Nov 2009 09:22:26 +0100 Subject: Small doc fix. RevBy: Trust me --- doc/src/snippets/code/doc_src_installation.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc index 3563a64..8f6bbdc 100644 --- a/doc/src/snippets/code/doc_src_installation.qdoc +++ b/doc/src/snippets/code/doc_src_installation.qdoc @@ -201,7 +201,7 @@ make sis QT_SIS_OPTIONS=-i QT_SIS_CERTIFICATE= QT_SIS_KEY= Date: Tue, 24 Nov 2009 09:51:11 +0100 Subject: Namespace build fails for webkit example Forward declarations outside namespace scope will fail in this case. Reviewed-by: brad --- examples/webkit/domtraversal/window.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/webkit/domtraversal/window.h b/examples/webkit/domtraversal/window.h index 5988df9..2795976 100644 --- a/examples/webkit/domtraversal/window.h +++ b/examples/webkit/domtraversal/window.h @@ -46,7 +46,9 @@ #include #include +QT_BEGIN_NAMESPACE class QTreeWidgetItem; +QT_END_NAMESPACE //! [Window class definition] #include "ui_window.h" -- cgit v0.12 From 32ea1aedcf1f588da1ac112bb615088d954b84e1 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 20 Nov 2009 14:21:15 +0100 Subject: Fix QWindowsSystemProxy::init Seems like WinHttpGetIEProxyConfigForCurrentUser can return more than one proxy even if this is not documented. Task-number: QTBUG-5981 Reviewed-by: Peter Hartmann --- src/network/kernel/qnetworkproxy_win.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index 6f92424..0e2dd2b 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -291,7 +291,10 @@ void QWindowsSystemProxy::init() GlobalFree(ieProxyConfig.lpszAutoConfigUrl); } if (ieProxyConfig.lpszProxy) { - proxyServerList << QString::fromWCharArray(ieProxyConfig.lpszProxy); + // http://msdn.microsoft.com/en-us/library/aa384250%28VS.85%29.aspx speaks only about a "proxy URL", + // not multiple URLs. However we tested this and it can return multiple URLs. So we use splitSpaceSemicolon + // on it. + proxyServerList = splitSpaceSemicolon(QString::fromWCharArray(ieProxyConfig.lpszProxy)); GlobalFree(ieProxyConfig.lpszProxy); } if (ieProxyConfig.lpszProxyBypass) { -- cgit v0.12 From 829d9e10ad3d26fb2fddef01c8e36352018c3fec Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 24 Nov 2009 09:34:48 +0100 Subject: Fix QFile::map in Linux 64bit On 64bit, qint64(size_t(-1)) = -1 Reviewed-by: Joao Reviewed-by: Thiago --- src/corelib/io/qfsfileengine_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 35737b3..8cbf6a3 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1245,7 +1245,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla } if (offset < 0 || offset != qint64(QT_OFF_T(offset)) - || size < 0 || size > qint64(size_t(-1))) { + || size < 0 || quint64(size) > quint64(size_t(-1))) { q->setError(QFile::UnspecifiedError, qt_error_string(int(EINVAL))); return 0; } -- cgit v0.12 From 8010d279fa9ee4c47bd4c1fb2cc50ad9ca08f945 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 24 Nov 2009 10:37:15 +0100 Subject: Fix accept call in q3process Use QT_SOCKLEN_T like we do on all other places where accept() is called. Task-number: QTBUG-6141 Reviewed-by: mstormo --- src/qt3support/other/q3process_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt3support/other/q3process_unix.cpp b/src/qt3support/other/q3process_unix.cpp index 955b65f..32a68e0 100644 --- a/src/qt3support/other/q3process_unix.cpp +++ b/src/qt3support/other/q3process_unix.cpp @@ -249,7 +249,7 @@ int qnx6SocketPairReplacement (int socketFD[2]) { if (errno != EINPROGRESS) { BAILOUT }; // Accept connection - socketFD[0] = accept(tmpSocket, (struct sockaddr *)NULL, (size_t *)NULL); + socketFD[0] = accept(tmpSocket, (struct sockaddr *)NULL, (QT_SOCKLEN_T *)NULL); if(socketFD[0] == -1) { BAILOUT }; // We're done -- cgit v0.12 From 0d20ec8604b318ceafd6c35dfe1d73519bf024d3 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 24 Nov 2009 10:16:13 +0100 Subject: QNetworkCookieJar: don't do path checking when receiving cookies Actually, the RFC 2109 says cookies should not be stored if the path attribute is not a prefix of the request URI the cookie comes from. However, all browsers allow it anyway; with the demo browser e.g. logging in to wordpress.com was not possible. We still do path checking when sending cookies, i.e. in QNetworkCookieJar::cookiesForUrl(). Reviewed-by: Markus Goetz Task-number: QTBUG-5815 --- src/network/access/qnetworkcookiejar.cpp | 7 ++++--- .../qnetworkcookiejar/tst_qnetworkcookiejar.cpp | 23 ++++++++++++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 19f7217..f826115 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -192,9 +192,10 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList &cookieLis // validate the cookie & set the defaults if unset if (cookie.path().isEmpty()) cookie.setPath(defaultPath); - else if (!isParentPath(pathAndFileName, cookie.path())) - continue; // not accepted - + // don't do path checking. See http://bugreports.qt.nokia.com/browse/QTBUG-5815 +// else if (!isParentPath(pathAndFileName, cookie.path())) { +// continue; // not accepted +// } if (cookie.domain().isEmpty()) { cookie.setDomain(defaultDomain); } else { diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index ff7e78e..b52c515 100644 --- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -168,13 +168,16 @@ void tst_QNetworkCookieJar::setCookiesFromUrl_data() cookie.setDomain("something.completely.different"); QTest::newRow("security-domain-1") << preset << cookie << "http://www.foo.tld" << result << false; - cookie.setDomain("www.foo.tld"); + // we want the cookie to be accepted although the path does not match, see QTBUG-5815 + cookie.setDomain(".foo.tld"); cookie.setPath("/something"); - QTest::newRow("security-path-1") << preset << cookie << "http://www.foo.tld" << result << false; + result += cookie; + QTest::newRow("security-path-1") << preset << cookie << "http://www.foo.tld" << result << true; // setting the defaults: finalCookie = cookie; finalCookie.setPath("/something/"); + finalCookie.setDomain("www.foo.tld"); cookie.setPath(""); cookie.setDomain(""); result.clear(); @@ -285,6 +288,22 @@ void tst_QNetworkCookieJar::cookiesForUrl_data() QTest::newRow("exp-match-4") << allCookies << "http://qt.nokia.com/web" << result; QTest::newRow("exp-match-4") << allCookies << "http://qt.nokia.com/web/" << result; QTest::newRow("exp-match-6") << allCookies << "http://qt.nokia.com/web/content" << result; + + // path matching + allCookies.clear(); + QNetworkCookie anotherCookie; + anotherCookie.setName("a"); + anotherCookie.setPath("/web"); + anotherCookie.setDomain(".nokia.com"); + allCookies += anotherCookie; + result.clear(); + QTest::newRow("path-unmatch-1") << allCookies << "http://nokia.com/" << result; + QTest::newRow("path-unmatch-2") << allCookies << "http://nokia.com/something/else" << result; + result += anotherCookie; + QTest::newRow("path-match-1") << allCookies << "http://nokia.com/web" << result; + QTest::newRow("path-match-2") << allCookies << "http://nokia.com/web/" << result; + QTest::newRow("path-match-3") << allCookies << "http://nokia.com/web/content" << result; + } void tst_QNetworkCookieJar::cookiesForUrl() -- cgit v0.12 From 33bb49ba251ff2fb111d1cb393476e0ec0a84e34 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 24 Nov 2009 10:49:01 +0100 Subject: Maximizing a window makes it a bit smaller that the minimum size:Cocoa When returning preferred sizes for the frame, we should consider the size for non client area elements like frame, tittlebar etc. Task-number: 6090 Reviewed-by: Denis --- src/gui/kernel/qcocoawindowdelegate_mac.mm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 9fb674e..8a22a65 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -324,8 +324,13 @@ static void cleanupCocoaWindowDelegate() NSRect frameToReturn = defaultFrame; QWidget *qwidget = m_windowHash->value(window); QSizeF size = qwidget->maximumSize(); - frameToReturn.size.width = qMin(frameToReturn.size.width, size.width()); - frameToReturn.size.height = qMin(frameToReturn.size.height, size.height()); + NSRect windowFrameRect = [window frame]; + NSRect viewFrameRect = [[window contentView] frame]; + // consider additional size required for titlebar & frame + frameToReturn.size.width = qMin(frameToReturn.size.width, + size.width()+(windowFrameRect.size.width - viewFrameRect.size.width)); + frameToReturn.size.height = qMin(frameToReturn.size.height, + size.height()+(windowFrameRect.size.height - viewFrameRect.size.height)); return frameToReturn; } -- cgit v0.12 From ac48a6c4f360631e83841be24113d7da495aae4b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 24 Nov 2009 11:11:27 +0100 Subject: Fix build on AIX: all of the .a file is linked into the program. The qlibraryinfo.cpp is only needed by lrelease. It has a hack for qmake_libraryInfoFile(), which doesn't work on AIX. So don't put qlibraryinfo.cpp in libbootstrap.a, but instead build directly for lrelease. Reviewed-by: thiago --- src/tools/bootstrap/bootstrap.pro | 10 +++------- tools/linguist/lrelease/lrelease.pro | 7 +++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 722981c..0dbb90f 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -30,8 +30,7 @@ win32:DEFINES += QT_NODLL INCLUDEPATH += $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ - $$QT_BUILD_TREE/include/QtXml \ - $$QT_BUILD_TREE/src/corelib/global # qlibraryinfo.cpp includes qconfig.cpp + $$QT_BUILD_TREE/include/QtXml DEPENDPATH += $$INCLUDEPATH \ ../../corelib/global \ @@ -49,7 +48,6 @@ SOURCES += \ ../../corelib/codecs/qtsciicodec.cpp \ ../../corelib/codecs/qutfcodec.cpp \ ../../corelib/global/qglobal.cpp \ - ../../corelib/global/qlibraryinfo.cpp \ ../../corelib/global/qmalloc.cpp \ ../../corelib/global/qnumeric.cpp \ ../../corelib/io/qabstractfileengine.cpp \ @@ -65,7 +63,6 @@ SOURCES += \ ../../corelib/io/qtemporaryfile.cpp \ ../../corelib/io/qtextstream.cpp \ ../../corelib/io/qurl.cpp \ - ../../corelib/io/qsettings.cpp \ ../../corelib/kernel/qmetatype.cpp \ ../../corelib/kernel/qvariant.cpp \ ../../corelib/tools/qbitarray.cpp \ @@ -90,12 +87,11 @@ unix:SOURCES += ../../corelib/io/qfsfileengine_unix.cpp \ ../../corelib/io/qfsfileengine_iterator_unix.cpp win32:SOURCES += ../../corelib/io/qfsfileengine_win.cpp \ - ../../corelib/io/qfsfileengine_iterator_win.cpp \ - ../../corelib/io/qsettings_win.cpp + ../../corelib/io/qfsfileengine_iterator_win.cpp macx: { QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported) - SOURCES += ../../corelib/kernel/qcore_mac.cpp ../../corelib/io/qsettings_mac.cpp + SOURCES += ../../corelib/kernel/qcore_mac.cpp LIBS += -framework CoreServices } diff --git a/tools/linguist/lrelease/lrelease.pro b/tools/linguist/lrelease/lrelease.pro index e4c18ee..b13c03e 100644 --- a/tools/linguist/lrelease/lrelease.pro +++ b/tools/linguist/lrelease/lrelease.pro @@ -5,6 +5,13 @@ DESTDIR = ../../../bin DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII SOURCES += main.cpp +INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global # qlibraryinfo.cpp includes qconfig.cpp +SOURCES += \ + $$QT_SOURCE_TREE/src/corelib/global/qlibraryinfo.cpp \ + $$QT_SOURCE_TREE/src/corelib/io/qsettings.cpp +win32:SOURCES += $$QT_SOURCE_TREE/src/corelib/io/qsettings_win.cpp +macx:SOURCES += $$QT_SOURCE_TREE/src/corelib/io/qsettings_mac.cpp + include(../../../src/tools/bootstrap/bootstrap.pri) include(../shared/formats.pri) include(../shared/proparser.pri) -- cgit v0.12 From 056f8d08efc7ef57b36a22b37a0bc2bd4e7cfa94 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 24 Nov 2009 13:11:10 +0100 Subject: tst_qnetworkreply: Stabilize test by increasing timeout Reviewed-by: TrustMe --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index bd83c47..09456ed 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -2622,7 +2622,7 @@ void tst_QNetworkReply::ioPostToHttpFromSocket() QSignalSpy authenticationRequiredSpy(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*))); QSignalSpy proxyAuthenticationRequiredSpy(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); - QTestEventLoop::instance().enterLoop(6); + QTestEventLoop::instance().enterLoop(12); disconnect(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), -- cgit v0.12 From 31036a9e1b09b1d18043e55d3134a2d911d694c0 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 24 Nov 2009 13:14:21 +0100 Subject: tst_qftp: Test upload with 1MB instead of not-at-all on Symbian Reviewed-by: Aleksandar Sasha Babic --- tests/auto/qftp/tst_qftp.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp index 1e7f424..13d0f0b 100644 --- a/tests/auto/qftp/tst_qftp.cpp +++ b/tests/auto/qftp/tst_qftp.cpp @@ -1295,10 +1295,11 @@ void tst_QFtp::abort_data() // Qt/CE and Symbian test environment has to less memory for this test #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) QByteArray bigData( 10*1024*1024, 0 ); +#else + QByteArray bigData( 1*1024*1024, 0 ); +#endif bigData.fill( 'B' ); - QTest::newRow( "put_fluke01" ) << QtNetworkSettings::serverName() << (uint)21 << QString("qtest/upload/abort_put") << bigData; -#endif } void tst_QFtp::abort() -- cgit v0.12 From d3bea65eae71a21a7b9893317c4dbafba20f17c8 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 18 Nov 2009 21:03:41 +0100 Subject: QLineEdit fix for mac On the Mac Up/Down arrow keys move the cursor to the beginning/end of the lineedit. The fix is to make sure the corresponding keyevent will be accepted by the QLineEdit and not propagated to parent widgets (resulting in a beep). Reviewed-by: Prasanth --- src/gui/widgets/qlinecontrol.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 300a2ea..9d533ae 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1666,6 +1666,7 @@ void QLineControl::processKeyEvent(QKeyEvent* event) } #endif // QT_NO_SHORTCUT else { + bool handled = false; #ifdef Q_WS_MAC if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) { Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier); @@ -1683,6 +1684,7 @@ void QLineControl::processKeyEvent(QKeyEvent* event) event->key() == Qt::Key_Up ? home(0) : end(0); } } + handled = true; } #endif if (event->modifiers() & Qt::ControlModifier) { @@ -1715,7 +1717,8 @@ void QLineControl::processKeyEvent(QKeyEvent* event) break; #endif default: - unknown = true; + if (!handled) + unknown = true; } } else { // ### check for *no* modifier switch (event->key()) { @@ -1748,7 +1751,8 @@ void QLineControl::processKeyEvent(QKeyEvent* event) #endif default: - unknown = true; + if (!handled) + unknown = true; } } } -- cgit v0.12 From aae81f370f6afede95064bc75eb7ee6ac13b1c30 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 23 Nov 2009 17:56:03 +0100 Subject: Fixes implicit grabbing in Qt/Cocoa When delivering mouse events in Qt/Cocoa set the implicit mouse grabber and deliver the event to it and do not try to propagate the event to the parent view. Reviewed-by: Prasanth --- src/gui/kernel/qcocoaview_mac.mm | 51 ++++++++++++++-------------------- src/gui/kernel/qt_cocoa_helpers_mac.mm | 8 ++++++ 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 0445a16..3da783f 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -83,6 +83,7 @@ extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); // qapplication.cpp extern OSViewRef qt_mac_nativeview_for(const QWidget *w); // qwidget_mac.mm extern const QStringList& qEnabledDraggedTypes(); // qmime_mac.cpp extern QPointer qt_mouseover; //qapplication_mac.mm +extern QPointer qt_button_down; //qapplication_mac.cpp Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum) { @@ -695,6 +696,9 @@ extern "C" { - (void)mouseDown:(NSEvent *)theEvent { + if (!qt_button_down) + qt_button_down = qwidget; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::LeftButton); // Don't call super here. This prevents us from getting the mouseUp event, // which we need to send even if the mouseDown event was not accepted. @@ -704,75 +708,62 @@ extern "C" { - (void)mouseUp:(NSEvent *)theEvent { - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton); + qt_button_down = 0; - if (!mouseOK) - [super mouseUp:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton); } - (void)rightMouseDown:(NSEvent *)theEvent { - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton); + if (!qt_button_down) + qt_button_down = qwidget; - if (!mouseOK) - [super rightMouseDown:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton); } - (void)rightMouseUp:(NSEvent *)theEvent { - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton); + qt_button_down = 0; - if (!mouseOK) - [super rightMouseUp:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton); } - (void)otherMouseDown:(NSEvent *)theEvent { - Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]); - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton); + if (!qt_button_down) + qt_button_down = qwidget; - if (!mouseOK) - [super otherMouseDown:theEvent]; + Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]); + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton); } - (void)otherMouseUp:(NSEvent *)theEvent { - Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]); - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton); - - if (!mouseOK) - [super otherMouseUp:theEvent]; + qt_button_down = 0; + Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]); + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton); } - (void)mouseDragged:(NSEvent *)theEvent { qMacDnDParams()->view = self; qMacDnDParams()->theEvent = theEvent; - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); - - if (!mouseOK) - [super mouseDragged:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); } - (void)rightMouseDragged:(NSEvent *)theEvent { qMacDnDParams()->view = self; qMacDnDParams()->theEvent = theEvent; - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); - - if (!mouseOK) - [super rightMouseDragged:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); } - (void)otherMouseDragged:(NSEvent *)theEvent { qMacDnDParams()->view = self; qMacDnDParams()->theEvent = theEvent; - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); - - if (!mouseOK) - [super otherMouseDragged:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); } - (void)scrollWheel:(NSEvent *)theEvent diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index c0fb8aa..2bf1465 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -899,6 +899,14 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev widgetToGetMouse = [static_cast(tmpView) qt_qwidget]; } + } else { + extern QPointer qt_button_down; //qapplication_mac.cpp + if (!mac_mouse_grabber && qt_button_down) { + // if there is no explicit grabber, and the mouse was grabbed + // implicitely (i.e. a mousebutton was pressed) + widgetToGetMouse = qt_button_down; + tmpView = qt_mac_nativeview_for(widgetToGetMouse); + } } NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil]; -- cgit v0.12 From fc835ea41dffaa7ac6247c2d0d602aadf0e0f09b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 24 Nov 2009 13:18:41 +0100 Subject: Itemview: Fixes statustip not cleared Task-number: QTBUG-1717 Reviewed-by: Thierry --- src/gui/itemviews/qabstractitemview.cpp | 14 ++++++++++++-- src/gui/itemviews/qabstractitemview_p.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index c691fe2..ad15655 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -96,6 +96,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate() autoScrollMargin(16), autoScrollCount(0), shouldScrollToCurrentOnShow(false), + shouldClearStatusTip(false), alternatingColors(false), textElideMode(Qt::ElideRight), verticalScrollMode(QAbstractItemView::ScrollPerItem), @@ -161,14 +162,15 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index emit q->entered(index); #ifndef QT_NO_STATUSTIP QString statustip = model->data(index, Qt::StatusTipRole).toString(); - if (parent && !statustip.isEmpty()) { + if (parent && (shouldClearStatusTip || !statustip.isEmpty())) { QStatusTipEvent tip(statustip); QApplication::sendEvent(parent, &tip); + shouldClearStatusTip = !statustip.isEmpty(); } #endif } else { #ifndef QT_NO_STATUSTIP - if (parent) { + if (parent && shouldClearStatusTip) { QString emptyString; QStatusTipEvent tip( emptyString ); QApplication::sendEvent(parent, &tip); @@ -1559,6 +1561,14 @@ bool QAbstractItemView::viewportEvent(QEvent *event) d->viewportEnteredNeeded = true; break; case QEvent::Leave: + #ifndef QT_NO_STATUSTIP + if (d->shouldClearStatusTip && d->parent) { + QString empty; + QStatusTipEvent tip(empty); + QApplication::sendEvent(d->parent, &tip); + d->shouldClearStatusTip = false; + } + #endif d->enteredIndex = QModelIndex(); break; case QEvent::ToolTip: diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index f1ba874..0b5cfbe 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -396,6 +396,7 @@ public: int autoScrollMargin; int autoScrollCount; bool shouldScrollToCurrentOnShow; //used to know if we should scroll to current on show event + bool shouldClearStatusTip; //if there is a statustip currently shown that need to be cleared when leaving. bool alternatingColors; -- cgit v0.12 From 0d833e51a1917433a9fb77080632a5803ab6deb8 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Tue, 24 Nov 2009 14:21:57 +0200 Subject: Few of the QEXPECT_FAIL messages were enriched by the Jira's task number All the QEXPECT_FAIL messages should contain Jira's task number. Reviewed-by: TrustMe --- .../qscriptengineagent/tst_qscriptengineagent.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 77ccdb3..b061eb2 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -476,7 +476,7 @@ void tst_QScriptEngineAgent::scriptLoadAndUnload_eval() spy->clear(); eng.evaluate("eval('function foo() { print(123); }')"); - QEXPECT_FAIL("","Eval is threaded in different way that in old backend", Abort); + QEXPECT_FAIL("","QTBUG-6140 Eval is threaded in different way that in old backend", Abort); QCOMPARE(spy->count(), 3); QCOMPARE(spy->at(0).type, ScriptEngineEvent::ScriptLoad); @@ -1161,16 +1161,16 @@ void tst_QScriptEngineAgent::positionChange_1() { spy->clear(); eng.evaluate(";"); - QEXPECT_FAIL("","JSC do not evaluate ';' to statemant",Continue); + QEXPECT_FAIL("","QTBUG-6142 JSC do not evaluate ';' to statemant",Continue); QCOMPARE(spy->count(), 1); if (spy->count()) { - QEXPECT_FAIL("","JSC do not evaluate ';' to statemant",Continue); + QEXPECT_FAIL("","QTBUG-6142 JSC do not evaluate ';' to statemant",Continue); QCOMPARE(spy->at(0).type, ScriptEngineEvent::PositionChange); - QEXPECT_FAIL("","JSC do not evaluate ';' to statemant",Continue); + QEXPECT_FAIL("","QTBUG-6142 JSC do not evaluate ';' to statemant",Continue); QVERIFY(spy->at(0).scriptId != -1); - QEXPECT_FAIL("","JSC do not evaluate ';' to statemant",Continue); + QEXPECT_FAIL("","QTBUG-6142 JSC do not evaluate ';' to statemant",Continue); QCOMPARE(spy->at(0).lineNumber, 1); - QEXPECT_FAIL("","JSC do not evaluate ';' to statemant",Continue); + QEXPECT_FAIL("","QTBUG-6142 JSC do not evaluate ';' to statemant",Continue); QCOMPARE(spy->at(0).columnNumber, 1); } } @@ -1552,7 +1552,7 @@ void tst_QScriptEngineAgent::positionChange_2() } { - QEXPECT_FAIL("","I believe the test is wrong. Expressions shouldn't call positionChange " + QEXPECT_FAIL("","QTBUG-6142 I believe the test is wrong. Expressions shouldn't call positionChange " "because statement '1+2' will call it at least twice, why debugger have to " "stop here so many times?", Abort); spy->clear(); @@ -2089,8 +2089,6 @@ void tst_QScriptEngineAgent::syntaxError() i = 2; QCOMPARE(spy->at(i).type, ScriptEngineEvent::ContextPush); - QEXPECT_FAIL("","The test is broken, contextPush event do not provide scriptId", Continue); - QVERIFY(spy->at(i).scriptId == -1); i = 3; QCOMPARE(spy->at(i).type, ScriptEngineEvent::FunctionEntry); QVERIFY(spy->at(i).scriptId == -1); @@ -2099,14 +2097,12 @@ void tst_QScriptEngineAgent::syntaxError() QVERIFY(spy->at(i).scriptId == -1); i = 5; QCOMPARE(spy->at(i).type, ScriptEngineEvent::ContextPop); - QEXPECT_FAIL("","The test is broken, contextPop event do not provide scriptId", Continue); - QVERIFY(spy->at(i).scriptId == -1); i = 6; QCOMPARE(spy->at(i).type, ScriptEngineEvent::ExceptionThrow); QCOMPARE(spy->at(i).scriptId, spy->at(0).scriptId); QVERIFY(!spy->at(i).hasExceptionHandler); QVERIFY(spy->at(i).value.isError()); - QEXPECT_FAIL("","There are other messages in JSC",Continue); + QEXPECT_FAIL("","QTBUG-6137 There are other messages in JSC",Continue); QCOMPARE(spy->at(i).value.toString(), QString("SyntaxError: Expected `}'")); QCOMPARE(spy->at(i).scriptId, spy->at(0).scriptId); i = 7; @@ -2139,7 +2135,7 @@ void tst_QScriptEngineAgent::extension_invoctaion() QCOMPARE(spy->at(1).lineNumber, lineNumber); QCOMPARE(spy->at(1).columnNumber, 1); - QEXPECT_FAIL("","In JSC Eval('debugger') returns undefined",Abort); + QEXPECT_FAIL("","QTBUG-6135 In JSC Eval('debugger') returns undefined",Abort); QVERIFY(ret.isString()); QCOMPARE(ret.toString(), QString::fromLatin1("extension(DebuggerInvocationRequest)")); } -- cgit v0.12 From d79d756d057f20ecc1a6e70a00fe792c2a1f95c8 Mon Sep 17 00:00:00 2001 From: Dean Dettman Date: Tue, 24 Nov 2009 14:25:41 +0100 Subject: Docs : Add details to QMdiArea::removeSubWindow() Clarifying that the behaviour is different depending on what is passed in. Reviewed-by: Morten Engvoldsen --- src/gui/widgets/qmdiarea.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp index b3288c3..f3dbe34 100644 --- a/src/gui/widgets/qmdiarea.cpp +++ b/src/gui/widgets/qmdiarea.cpp @@ -1947,8 +1947,10 @@ QMdiSubWindow *QMdiArea::addSubWindow(QWidget *widget, Qt::WindowFlags windowFla /*! Removes \a widget from the MDI area. The \a widget must be either a QMdiSubWindow or a widget that is the internal widget of - a subwindow. Note that the subwindow is not deleted by QMdiArea - and that its parent is set to 0. + a subwindow. Note \a widget is never actually deleted by QMdiArea. + If a QMdiSubWindow is passed in its parent is set to 0 and it is + removed, but if an internal widget is passed in the child widget + is set to 0 but the QMdiSubWindow is not removed. \sa addSubWindow() */ -- cgit v0.12 From fe23e6e4e7ae81b3a2dee76282be2a4cb4208b89 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 24 Nov 2009 14:34:33 +0100 Subject: Doc: Fixes to markup. Reviewed-by: Trust Me --- src/gui/graphicsview/qgraphicsitem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 3f6dff2..da1c151 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -52,7 +52,7 @@ painting implementation and item interaction through its event handlers. QGraphicsItem is part of \l{The Graphics View Framework} - \img graphicsview-items.png + \image graphicsview-items.png For convenience, Qt provides a set of standard graphics items for the most common shapes. These are: @@ -378,14 +378,14 @@ it's parent if it's z-value is negative. This flag enables setZValue() to toggle ItemStacksBehindParent. - \value ItemIsPanel. The item is a panel. A panel provides activation and + \value ItemIsPanel The item is a panel. A panel provides activation and contained focus handling. Only one panel can be active at a time (see QGraphicsItem::isActive()). When no panel is active, QGraphicsScene activates all non-panel items. Window items (i.e., QGraphicsItem::isWindow() returns true) are panels. This flag was introduced in Qt 4.6. - \omitvalue ItemIsFocusScope Internal only (for now). + \omitvalue ItemIsFocusScope \omit Internal only (for now). \endomit \value ItemSendsScenePositionChanges The item enables itemChange() notifications for ItemScenePositionHasChanged. For performance reasons, -- cgit v0.12 From 8eea9828289b842c8a300f1f4309d059b15fd7b0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 24 Nov 2009 14:36:34 +0100 Subject: Doc: Added missing version information about XML Schema support. Reviewed-by: Trust Me --- doc/src/external-resources.qdoc | 5 +++++ doc/src/modules.qdoc | 2 +- src/xmlpatterns/api/qxmlschema.cpp | 5 +++++ src/xmlpatterns/api/qxmlschemavalidator.cpp | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index f965869..cd99505 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -417,3 +417,8 @@ \externalpage http://www.w3.org/TR/REC-CSS2/selector.html#q1 \title Standard CSS2 selector */ + +/*! + \externalpage http://www.w3.org/XML/Schema + \title XML Schema +*/ diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 94cab58..3058b84 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -503,7 +503,7 @@ \ingroup modules \brief The QtXmlPatterns module provides support for XPath, - XQuery, XSLT and XML schema-validation. + XQuery, XSLT and XML Schema validation. To include the definitions of the module's classes, use the following directive: diff --git a/src/xmlpatterns/api/qxmlschema.cpp b/src/xmlpatterns/api/qxmlschema.cpp index 287cf11..ee92195 100644 --- a/src/xmlpatterns/api/qxmlschema.cpp +++ b/src/xmlpatterns/api/qxmlschema.cpp @@ -65,6 +65,11 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/qxmlschema/main.cpp 0 + \section1 XML Schema Version + + This class is used to represent schemas that conform to the \l{XML Schema} 1.0 + specification. + \sa QXmlSchemaValidator, {xmlpatterns/schema}{XML Schema Validation Example} */ diff --git a/src/xmlpatterns/api/qxmlschemavalidator.cpp b/src/xmlpatterns/api/qxmlschemavalidator.cpp index 11e0417..682d34f 100644 --- a/src/xmlpatterns/api/qxmlschemavalidator.cpp +++ b/src/xmlpatterns/api/qxmlschemavalidator.cpp @@ -71,6 +71,11 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/qxmlschemavalidator/main.cpp 3 + \section1 XML Schema Version + + This class implements schema validation according to the \l{XML Schema} 1.0 + specification. + \sa QXmlSchema, {xmlpatterns/schema}{XML Schema Validation Example} */ -- cgit v0.12 From 4817debee23a72f44eedbb8f33b6b611b5161174 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 24 Nov 2009 14:36:08 +0100 Subject: Added some missing build instructions for abld. WebKit will not build unless the mentioned variable is set. RevBy: Aleksandar Sasha Babic --- doc/src/getting-started/installation.qdoc | 7 +++++++ doc/src/snippets/code/doc_src_installation.qdoc | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 1a5cd99..057629d 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -599,6 +599,13 @@ If you are using pre-built binaries, follow the instructions given in the emulator. This is done by locating the Carbide.c++ submenu on the Start menu, and choosing "Configure environment for WINSCW command line". + If you are planning to use abld (the default build system that comes with the S60 SDK) + to build Qt, you will also need to set the following environment variable: + + \snippet doc/src/snippets/code/doc_src_installation.qdoc 33 + + This is not necessary for other applications, only when building Qt. + \o Configure Qt To configure Qt for the Symbian platform, do: diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc index 3563a64..50e29d0 100644 --- a/doc/src/snippets/code/doc_src_installation.qdoc +++ b/doc/src/snippets/code/doc_src_installation.qdoc @@ -216,3 +216,7 @@ bldmake bldfiles abld build winscw udeb abld build gcce urel //! [32] + +//! [33] +SYMBIANBUILD_DEPENDENCYOFF=1 +//! [33] -- cgit v0.12 From f31d0e45952276f3de9c049c84a0ea52ce370e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 19 Nov 2009 12:16:45 +0100 Subject: Mac: Fixes broken window decorations for QGraphicsProxyWidget. The problem was the QMacStyle didn't handle the pixel metric for PM_TitleBarHeight correctly when passing a style option containing an unitialized rect (empty rect). It already had special logic for invalid rects, so the fix is simply to extend the check to also handle empty rects. Auto-test included. Task-number: QTBUG-4160 Reviewed-by: msorvig --- src/gui/styles/qmacstyle_mac.mm | 4 ++-- .../tst_qgraphicsproxywidget.cpp | 24 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 38c3feb..51c2a96 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -2155,9 +2155,9 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW wdi.titleWidth = tb->rect.width(); QCFType region; HIRect hirect = qt_hirectForQRect(tb->rect); - if (hirect.size.width == -1) + if (hirect.size.width <= 0) hirect.size.width = 100; - if (hirect.size.height == -1) + if (hirect.size.height <= 0) hirect.size.height = 30; HIThemeGetWindowShape(&hirect, &wdi, kWindowTitleBarRgn, ®ion); diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 36ee22c..42d5268 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -181,6 +181,7 @@ private slots: void updateAndDelete(); void inputMethod(); void clickFocus(); + void windowFrameMargins(); }; // Subclass that exposes the protected functions. @@ -3506,6 +3507,29 @@ void tst_QGraphicsProxyWidget::clickFocus() QVERIFY(!proxy->widget()->hasFocus()); } +void tst_QGraphicsProxyWidget::windowFrameMargins() +{ + // Make sure the top margin is non-zero when passing Qt::Window. + QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(0, Qt::Window); + + qreal left, top, right, bottom; + proxy->getWindowFrameMargins(&left, &top, &right, &bottom); + QVERIFY(top > 0); + + proxy->setWidget(new QPushButton("testtest")); + proxy->getWindowFrameMargins(&left, &top, &right, &bottom); + QVERIFY(top > 0); + + QGraphicsScene scene; + scene.addItem(proxy); + proxy->getWindowFrameMargins(&left, &top, &right, &bottom); + QVERIFY(top > 0); + + proxy->unsetWindowFrameMargins(); + proxy->getWindowFrameMargins(&left, &top, &right, &bottom); + QVERIFY(top > 0); +} + QTEST_MAIN(tst_QGraphicsProxyWidget) #include "tst_qgraphicsproxywidget.moc" -- cgit v0.12 From bd2a3643c9796cc938c40c4d340d8cc5346992f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 23 Nov 2009 16:43:53 +0100 Subject: Mac: Fixes painting artifacts in Graphics View Problem was that pending updates were not dispatched properly on the Mac, which is strongly required in order to get correct behavior wrt QGraphicsItem::update(). Task-number: QTBUG-4160 Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsview_p.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index 762cad1..cd161ad 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -172,10 +172,17 @@ public: inline void dispatchPendingUpdateRequests() { +#ifndef Q_WS_MAC + // QWidget::update() works slightly different on the Mac; it's not part of + // our backing store so it needs special threatment. if (qt_widget_private(viewport)->paintOnScreen()) QCoreApplication::sendPostedEvents(viewport, QEvent::UpdateRequest); else QCoreApplication::sendPostedEvents(viewport->window(), QEvent::UpdateRequest); +#else + QCoreApplication::processEvents(QEventLoop::AllEvents | QEventLoop::ExcludeSocketNotifiers + | QEventLoop::ExcludeUserInputEvents); +#endif } bool updateRect(const QRect &rect); -- cgit v0.12 From 7db46e32124ad902eb08baaa146f84403b1fbcbd Mon Sep 17 00:00:00 2001 From: Samuel Nevala Date: Fri, 20 Nov 2009 11:48:48 +0100 Subject: Softkeys: Text disappears from textbox when predictive text is active. If two QInputMethodEvent("preedittext", attributes) or more are send in a row, textedit is drawn empty. Event creates lines based on isGettingInput flag and clears line every time there is preedit text. On 2nd event lines are cleared but not created since e->preeditString() != cursor.block().layout()->preeditAreaText() set isGettingInput to zero. When draw begins line count is checked. If no lines return. Moved layout->setPreeditArea() under if (isGettingInput) so pre-edit text is set only when text really changes. http://bugreports.qt.nokia.com/browse/QTBUG-4696 Task-number:QTBUG-4696 Reviewed-by:Markku Luukkainen Merge-request: 2132 Reviewed-by: Denis Dzyubenko --- src/gui/text/qtextcontrol.cpp | 3 ++- tests/auto/qtextedit/tst_qtextedit.cpp | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index be79773..90e876c 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1876,7 +1876,8 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) QTextBlock block = cursor.block(); QTextLayout *layout = block.layout(); - layout->setPreeditArea(cursor.position() - block.position(), e->preeditString()); + if (isGettingInput) + layout->setPreeditArea(cursor.position() - block.position(), e->preeditString()); QList overrides; preeditCursor = e->preeditString().length(); hideCursor = false; diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp index fee030c..bebc4bd 100644 --- a/tests/auto/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/qtextedit/tst_qtextedit.cpp @@ -200,6 +200,7 @@ private slots: void pasteFromQt3RichText(); void noWrapBackgrounds(); void preserveCharFormatAfterUnchangingSetPosition(); + void twoSameInputMethodEvents(); private: void createSelection(); @@ -2183,5 +2184,23 @@ void tst_QTextEdit::preserveCharFormatAfterUnchangingSetPosition() QCOMPARE(edit.textColor(), color); } +// Regression test for QTBUG-4696 +void tst_QTextEdit::twoSameInputMethodEvents() +{ + ed->setText("testLine"); + ed->show(); + QList attributes; + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, + ed->textCursor().position(), + 0, + QVariant())); + + QInputMethodEvent event("PreEditText", attributes); + QApplication::sendEvent(ed, &event); + QCOMPARE(ed->document()->firstBlock().layout()->lineCount(), 1); + QApplication::sendEvent(ed, &event); + QCOMPARE(ed->document()->firstBlock().layout()->lineCount(), 1); +} + QTEST_MAIN(tst_QTextEdit) #include "tst_qtextedit.moc" -- cgit v0.12 From 203a13e83a224d646df854678fe63a66506b09a6 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 24 Nov 2009 15:00:35 +0100 Subject: tst_qftp: Increase timeout in the abort() test. Reviewed-by: TrustMe --- tests/auto/qftp/tst_qftp.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp index 13d0f0b..dde023e 100644 --- a/tests/auto/qftp/tst_qftp.cpp +++ b/tests/auto/qftp/tst_qftp.cpp @@ -1304,6 +1304,9 @@ void tst_QFtp::abort_data() void tst_QFtp::abort() { + // In case you wonder where the abort() actually happens, look into + // tst_QFtp::dataTransferProgress + // QFETCH( QString, host ); QFETCH( uint, port ); QFETCH( QString, file ); @@ -1325,7 +1328,7 @@ void tst_QFtp::abort() addCommand( QFtp::Close, ftp->close() ); for(int time = 0; time <= uploadData.length() / 30000; time += 30) { - QTestEventLoop::instance().enterLoop( 30 ); + QTestEventLoop::instance().enterLoop( 50 ); if(ftp->currentCommand() == QFtp::None) break; } -- cgit v0.12 From 995629aba904f730b773b5a811e74f63ea0ff517 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 24 Nov 2009 14:55:11 +0100 Subject: Incorrect background while composing Japanese text(e.g 'shi' + ). This happens only when there is a single japanese character entered & the suggested text is same as the one already displayed. In this case, black background was not drawn correctly. Reviewed-by: Simon Hausmann Reviewed-by: axis --- src/gui/text/qtextcontrol.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 90e876c..f96f66b 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1849,8 +1849,8 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) || e->preeditString() != cursor.block().layout()->preeditAreaText() || e->replacementLength() > 0; + cursor.beginEditBlock(); if (isGettingInput) { - cursor.beginEditBlock(); cursor.removeSelectedText(); } @@ -1898,9 +1898,7 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) } } layout->setAdditionalFormats(overrides); - - if (isGettingInput) - cursor.endEditBlock(); + cursor.endEditBlock(); } QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const -- cgit v0.12 From e6d6ed97a3dd2e7ec5c95d760b0db47ad6e45250 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 24 Nov 2009 15:21:15 +0100 Subject: We don't need to initialize multitouch in non-gui applications. Reviewed-by: trustme Patch-by: raipriha --- src/gui/kernel/qapplication.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 4764a2d..9f4cd0c 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -933,7 +933,8 @@ void QApplicationPrivate::initialize() QApplicationPrivate::wheel_scroll_lines = 3; #endif - initializeMultitouch(); + if (qt_is_gui_used) + initializeMultitouch(); } /*! -- cgit v0.12 From 1e36e3917cae1e6b55cce46dc7e0e8a0b336cd01 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 24 Nov 2009 15:29:37 +0100 Subject: Make paste + undo behave in QLineEdit as it does in QTextEdit On the undo/redo stack, it needs to be treated as a separate command Task-number: QTBUG-5786 Reviewed-by: ogoffart --- src/gui/widgets/qlinecontrol.cpp | 7 ++++++- tests/auto/qlineedit/tst_qlineedit.cpp | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 300a2ea..334a925 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -138,7 +138,12 @@ void QLineControl::copy(QClipboard::Mode mode) const */ void QLineControl::paste() { - insert(QApplication::clipboard()->text(QClipboard::Clipboard)); + QString clip = QApplication::clipboard()->text(QClipboard::Clipboard); + if (!clip.isEmpty() || hasSelectedText()) { + separate(); //make it a separate undo/redo command + insert(clip); + separate(); + } } #endif // !QT_NO_CLIPBOARD diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index b4dfbba..dd5bb29 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -51,6 +51,10 @@ #include "qcompleter.h" #include "qstandarditemmodel.h" +#ifndef QT_NO_CLIPBOARD +#include "qclipboard.h" +#endif + #ifdef Q_WS_MAC #include // For the random function. #include // For the random function. @@ -157,6 +161,10 @@ private slots: void undo_keypressevents_data(); void undo_keypressevents(); +#ifndef QT_NO_CLIPBOARD + void QTBUG5786_undoPaste(); +#endif + void clear(); void text_data(); @@ -1406,6 +1414,36 @@ void tst_QLineEdit::undo_keypressevents() QVERIFY(testWidget->text().isEmpty()); } +#ifndef QT_NO_CLIPBOARD +void tst_QLineEdit::QTBUG5786_undoPaste() +{ + QString initial("initial"); + QString string("test"); + QString additional("add"); + QApplication::clipboard()->setText(string); + QLineEdit edit(initial); + QCOMPARE(edit.text(), initial); + edit.paste(); + QCOMPARE(edit.text(), initial + string); + edit.paste(); + QCOMPARE(edit.text(), initial + string + string); + edit.insert(additional); + QCOMPARE(edit.text(), initial + string + string + additional); + edit.undo(); + QCOMPARE(edit.text(), initial + string + string); + edit.undo(); + QCOMPARE(edit.text(), initial + string); + edit.undo(); + QCOMPARE(edit.text(), initial); + edit.selectAll(); + QApplication::clipboard()->setText(QString()); + edit.paste(); + QVERIFY(edit.text().isEmpty()); + +} +#endif + + void tst_QLineEdit::clear() { // checking that clear of empty/nullstring doesn't add to undo history -- cgit v0.12 From aaa46d829b83eaaf276fdd68921c4dd4d4dd5d2a Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Tue, 24 Nov 2009 16:21:17 +0200 Subject: The functionEntryAndExit_builtin autotest was enriched by a new dataset. The new dataset was created. In the function we shouldn't test only one data type. In the same time a new Jira's task were created (QTBUG-6187) as a result of the XFail investigation. Reviewed-by: TrustMe --- .../qscriptengineagent/tst_qscriptengineagent.cpp | 38 ++++++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index b061eb2..1a02785 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -85,6 +85,7 @@ private slots: void functionEntryAndExit_native(); void functionEntryAndExit_native2(); void functionEntryAndExit_nativeThrowing(); + void functionEntryAndExit_builtin_data(); void functionEntryAndExit_builtin(); void functionEntryAndExit_objects(); void functionEntryAndExit_slots(); @@ -811,18 +812,42 @@ void tst_QScriptEngineAgent::functionEntryAndExit_nativeThrowing() delete spy; } +void tst_QScriptEngineAgent::functionEntryAndExit_builtin_data() +{ + QTest::addColumn("script"); + QTest::addColumn("result"); + + QTest::newRow("string native") << "'ciao'.toString()" << "ciao"; + QTest::newRow("string object") << "String('ciao').toString()" << "ciao"; + QTest::newRow("number native") << "(123).toString()" << "123"; + QTest::newRow("number object") << "Number(123).toString()" << "123"; + QTest::newRow("array native") << "['s','a'].toString()" << "s, a"; + QTest::newRow("array object") << "Array('s', 'a').toString()" << "s,a"; + QTest::newRow("boolean native") << "false.toString()" << "false"; + QTest::newRow("boolean object") << "Boolean(true).toString()" << "true"; + QTest::newRow("regexp native") << "/a/.toString()" << "/a/"; + QTest::newRow("regexp object") << "RegExp('a').toString()" << "/a/"; +} + /** check behaiviour of built-in function */ void tst_QScriptEngineAgent::functionEntryAndExit_builtin() { + QFETCH(QString, script); + QFETCH(QString, result); QScriptEngine eng; ScriptEngineSpy *spy = new ScriptEngineSpy(&eng, ~(ScriptEngineSpy::IgnoreFunctionEntry | ScriptEngineSpy::IgnoreFunctionExit)); { spy->clear(); - eng.evaluate("'ciao'.toString()"); - - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "Some events are missing when JIT is enabled", Abort); + eng.evaluate(script); + + if (qt_script_isJITEnabled()) { + QEXPECT_FAIL("string native", "QTBUG-6187 Some events are missing when JIT is enabled", Abort); + QEXPECT_FAIL("number native", "QTBUG-6187 Some events are missing when JIT is enabled", Abort); + QEXPECT_FAIL("array native", "QTBUG-6187 Some events are missing when JIT is enabled", Abort); + QEXPECT_FAIL("boolean native", "QTBUG-6187 Some events are missing when JIT is enabled", Abort); + QEXPECT_FAIL("regexp native", "QTBUG-6187 Some events are missing when JIT is enabled", Abort); + } QCOMPARE(spy->count(), 4); // evaluate() entry @@ -835,14 +860,13 @@ void tst_QScriptEngineAgent::functionEntryAndExit_builtin() // built-in native function exit QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(2).scriptId, qint64(-1)); - QVERIFY(spy->at(2).value.isString()); - QCOMPARE(spy->at(2).value.toString(), QString("ciao")); + QCOMPARE(spy->at(2).value.toString(), QString(result)); // evaluate() exit QCOMPARE(spy->at(3).type, ScriptEngineEvent::FunctionExit); QCOMPARE(spy->at(3).scriptId, spy->at(0).scriptId); QVERIFY(spy->at(3).value.isString()); - QCOMPARE(spy->at(3).value.toString(), QString("ciao")); + QCOMPARE(spy->at(3).value.toString(), QString(result)); } delete spy; } -- cgit v0.12 From 2d659017a0318dbef18cc0583beb6de85c60808b Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 24 Nov 2009 15:22:58 +0100 Subject: tst_qhttp: Increase timeout Reviewed-by: TrustMe --- tests/auto/qhttp/tst_qhttp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/qhttp/tst_qhttp.cpp index 0ea0d15..b4b6ceb 100644 --- a/tests/auto/qhttp/tst_qhttp.cpp +++ b/tests/auto/qhttp/tst_qhttp.cpp @@ -363,7 +363,7 @@ void tst_QHttp::get() } addRequest( QHttpRequestHeader(), getId ); - QTestEventLoop::instance().enterLoop( 30 ); + QTestEventLoop::instance().enterLoop( 50 ); if ( QTestEventLoop::instance().timeout() ) QFAIL( "Network operation timed out" ); -- cgit v0.12 From 04273b42e1e7a295415f4081a6d470eb440bfffe Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 24 Nov 2009 15:47:15 +0100 Subject: tst_qftp: Increased some more timeouts Reviewed-by: TrustMe --- tests/auto/qftp/tst_qftp.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp index dde023e..263c957 100644 --- a/tests/auto/qftp/tst_qftp.cpp +++ b/tests/auto/qftp/tst_qftp.cpp @@ -618,7 +618,7 @@ void tst_QFtp::get() } addCommand( QFtp::Close, ftp->close() ); - QTestEventLoop::instance().enterLoop( 30 ); + QTestEventLoop::instance().enterLoop( 50 ); delete ftp; if ( QTestEventLoop::instance().timeout() ) QFAIL( "Network operation timed out" ); @@ -1020,7 +1020,7 @@ void tst_QFtp::renameInit( const QString &host, const QString &user, const QStri addCommand( QFtp::Put, ftp->put( QByteArray(), createFile ) ); addCommand( QFtp::Close, ftp->close() ); - QTestEventLoop::instance().enterLoop( 30 ); + QTestEventLoop::instance().enterLoop( 50 ); delete ftp; if ( QTestEventLoop::instance().timeout() ) QFAIL( "Network operation timed out" ); @@ -1497,7 +1497,7 @@ void tst_QFtp::proxy() addCommand( QFtp::Cd, ftp->cd( dir ) ); addCommand( QFtp::List, ftp->list() ); - QTestEventLoop::instance().enterLoop( 30 ); + QTestEventLoop::instance().enterLoop( 50 ); delete ftp; if ( QTestEventLoop::instance().timeout() ) { @@ -1925,7 +1925,7 @@ bool tst_QFtp::fileExists( const QString &host, quint16 port, const QString &use delete ftp; if ( QTestEventLoop::instance().timeout() ) { // ### make this test work - qWarning("Network operation timed out"); + qWarning("tst_QFtp::fileExists: Network operation timed out"); return FALSE; } inFileDirExistsFunction = FALSE; @@ -1976,6 +1976,7 @@ bool tst_QFtp::dirExists( const QString &host, quint16 port, const QString &user if ( QTestEventLoop::instance().timeout() ) { // ### make this test work // QFAIL( "Network operation timed out" ); + qWarning("tst_QFtp::dirExists: Network operation timed out"); return FALSE; } inFileDirExistsFunction = FALSE; -- cgit v0.12 From bd73818849b181ac29109ed580a60e99a38bf63d Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 24 Nov 2009 15:50:48 +0100 Subject: Fixes rendering issues when rendering a QWidget to PDF with WindowsXP Style. The problem was that the images added to the PDF were not clipped to the expected area. Task-number: QTBUG-3412 Reviewed-by: Trond Kjernaasen --- src/gui/painting/qprintengine_pdf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp index 4cccc91..3d82edf 100644 --- a/src/gui/painting/qprintengine_pdf.cpp +++ b/src/gui/painting/qprintengine_pdf.cpp @@ -206,7 +206,7 @@ void QPdfEngine::drawImage(const QRectF &rectangle, const QImage &image, const Q QRect sourceRect = sr.toRect(); QImage im = sourceRect != image.rect() ? image.copy(sourceRect) : image; bool bitmap = true; - const int object = d->addImage(image, &bitmap, im.cacheKey()); + const int object = d->addImage(im, &bitmap, im.cacheKey()); if (object < 0) return; -- cgit v0.12 From a0c8e134a284d45520dd3a229e68dbcd155299e6 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 24 Nov 2009 15:52:38 +0100 Subject: Fix softkeys for QDialogButtonBoxes created without a parent. Inthe case where a QDialogButtonBox was created without a parent, for example in the FTP example, the softkeys that are automatically created inside the button box were not being added to the right widget when the button box was given a parent (or added to a layout) later. This patch resolves that issue by handling the ParentChange event and then adding the softkeys at this point. Task-number: QTBUG-6086 Reviewed-by: axis --- src/gui/widgets/qdialogbuttonbox.cpp | 24 +++++++++ .../auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp | 60 ++++++++++++++++------ 2 files changed, 68 insertions(+), 16 deletions(-) diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 2ee5751..0e859f1 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -1215,6 +1215,30 @@ bool QDialogButtonBox::event(QEvent *event) }else if (event->type() == QEvent::LanguageChange) { d->retranslateStrings(); } +#ifdef QT_SOFTKEYS_ENABLED + else if (event->type() == QEvent::ParentChange) { + QWidget *dialog = 0; + QWidget *p = this; + while (p && !p->isWindow()) { + p = p->parentWidget(); + if ((dialog = qobject_cast(p))) + break; + } + + // If the parent changes, then move the softkeys + for (QHash::const_iterator it = d->softKeyActions.constBegin(); + it != d->softKeyActions.constEnd(); ++it) { + QAction *current = it.value(); + QList widgets = current->associatedWidgets(); + foreach (QWidget *w, widgets) + w->removeAction(current); + if (dialog) + dialog->addAction(current); + else + addAction(current); + } + } +#endif return QWidget::event(event); } diff --git a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp index 936ebf7..2c49fc8 100644 --- a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp +++ b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp @@ -111,6 +111,9 @@ private slots: void testDefaultButton_data(); void testDefaultButton(); void testS60SoftKeys(); +#ifdef QT_SOFTKEYS_ENABLED + void testSoftKeyReparenting(); +#endif void task191642_default(); private: @@ -715,6 +718,17 @@ void tst_QDialogButtonBox::testDefaultButton_data() QTest::newRow("third accept explicit after add") << 0 << 2 << 2; } +static int softKeyCount(QWidget *widget) +{ + int softkeyCount = 0; + QList actions = widget->actions(); + foreach (QAction *action, actions) { + if (action->softKeyRole() != QAction::NoSoftKey) + softkeyCount++; + } + return softkeyCount; +} + void tst_QDialogButtonBox::testS60SoftKeys() { #ifdef Q_WS_S60 @@ -722,33 +736,47 @@ void tst_QDialogButtonBox::testS60SoftKeys() QDialogButtonBox buttonBox(&dialog); buttonBox.setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); dialog.show(); - - int softkeyCount = 0; - QList actions = dialog.actions(); - foreach (QAction *action, actions) { - if (action->softKeyRole() != QAction::NoSoftKey) - softkeyCount++; - } - QCOMPARE( softkeyCount, 2); + + QCOMPARE( softKeyCount(&dialog), 2); QDialog dialog2(0); QDialogButtonBox buttonBox2(&dialog2); buttonBox2.setStandardButtons(QDialogButtonBox::Cancel); dialog2.show(); - int softkeyCount2 = 0; - QList actions2 = dialog2.actions(); - foreach (QAction *action, actions2) { - if (action->softKeyRole() != QAction::NoSoftKey) - softkeyCount2++; - } - QCOMPARE( softkeyCount2, 1); - + QCOMPARE( softKeyCount(&dialog2), 1); + #else QSKIP("S60-specific test", SkipAll ); #endif } +#ifdef QT_SOFTKEYS_ENABLED +void tst_QDialogButtonBox::testSoftKeyReparenting() +{ + QDialog dialog; + QDialogButtonBox *buttonBox = new QDialogButtonBox; + buttonBox->addButton(QDialogButtonBox::Ok); + buttonBox->addButton(QDialogButtonBox::Cancel); + + QCOMPARE(softKeyCount(&dialog), 0); + QCOMPARE(softKeyCount(buttonBox), 2); + + // Were the softkeys re-parented correctly? + dialog.setLayout(new QVBoxLayout); + dialog.layout()->addWidget(buttonBox); + QCOMPARE(softKeyCount(&dialog), 2); + QCOMPARE(softKeyCount(buttonBox), 0); + + // Softkeys are only added to QDialog, not QWidget + QWidget *nested = new QWidget; + nested->setLayout(new QVBoxLayout); + nested->layout()->addWidget(buttonBox); + QCOMPARE(softKeyCount(nested), 0); + QCOMPARE(softKeyCount(buttonBox), 2); +} +#endif + void tst_QDialogButtonBox::testDefaultButton() { QFETCH(int, whenToSetDefault); -- cgit v0.12 From 792e43aa2607d21deeada4b9f14bb82dc96ad4ec Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 24 Nov 2009 16:12:06 +0100 Subject: tst_qtcpserver: Increased timeout Reviewed-by: TrustMe --- tests/auto/qtcpserver/tst_qtcpserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp index 2540096..8b86111 100644 --- a/tests/auto/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp @@ -523,7 +523,7 @@ void tst_QTcpServer::waitForConnectionTest() QTcpSocket findLocalIpSocket; findLocalIpSocket.connectToHost(QtNetworkSettings::serverName(), 143); - QVERIFY(findLocalIpSocket.waitForConnected(2000)); + QVERIFY(findLocalIpSocket.waitForConnected(5000)); QTcpServer server; bool timeout = false; -- cgit v0.12 From 346887e731df4143699ce0c2310ded4fec849d30 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 24 Nov 2009 16:44:29 +0100 Subject: Fix QTreeWidgetItem::setChildIndicatorPolicy not updating. The problem is that the ChildIndicatorPolicy change the hasChildren in the model. But this is cached in the QTreeView layout. We must do a relayout to clear the cache. Reviewed-by: Thierry Task-number: QTBUG-3071 --- src/gui/itemviews/qtreewidget.cpp | 2 +- tests/auto/qtreewidget/tst_qtreewidget.cpp | 53 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index c133ae4..948ca79 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -1580,7 +1580,7 @@ void QTreeWidgetItem::setChildIndicatorPolicy(QTreeWidgetItem::ChildIndicatorPol if (!view) return; - view->viewport()->update( view->d_func()->itemDecorationRect(view->d_func()->index(this))); + view->scheduleDelayedItemsLayout(); } /*! diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index 621072c..0c6df4f 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -168,6 +168,8 @@ private slots: void task239150_editorWidth(); void setTextUpdate(); void taskQTBUG2844_visualItemRect(); + void setChildIndicatorPolicy(); + public slots: void itemSelectionChanged(); @@ -3290,6 +3292,57 @@ void tst_QTreeWidget::taskQTBUG2844_visualItemRect() QCOMPARE(tree.visualItemRect(&item), rectCol0 | rectCol1); } +void tst_QTreeWidget::setChildIndicatorPolicy() +{ + QTreeWidget treeWidget; + treeWidget.setColumnCount(1); + + class MyItemDelegate : public QStyledItemDelegate + { + public: + MyItemDelegate() : numPaints(0), expectChildren(false) { } + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const + { + numPaints++; + QCOMPARE(!(option.state & QStyle::State_Children), !expectChildren); + QStyledItemDelegate::paint(painter, option, index); + } + mutable int numPaints; + bool expectChildren; + } delegate; + + treeWidget.setItemDelegate(&delegate); + treeWidget.show(); + + QTreeWidgetItem *item = new QTreeWidgetItem(QStringList("Hello")); + treeWidget.insertTopLevelItem(0, item); + QTest::qWait(50); + QTRY_VERIFY(delegate.numPaints > 0); + + delegate.numPaints = 0; + delegate.expectChildren = true; + item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator); + QApplication::processEvents(); + QTRY_COMPARE(delegate.numPaints, 1); + + delegate.numPaints = 0; + delegate.expectChildren = false; + item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless); + QApplication::processEvents(); + QTRY_COMPARE(delegate.numPaints, 1); + + delegate.numPaints = 0; + delegate.expectChildren = true; + new QTreeWidgetItem(item); + QApplication::processEvents(); + QTRY_COMPARE(delegate.numPaints, 1); + + delegate.numPaints = 0; + delegate.expectChildren = false; + item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicator); + QApplication::processEvents(); + QTRY_COMPARE(delegate.numPaints, 1); +} -- cgit v0.12 From 76f61c87fcdaabef668babb79e3da2fe87c1d9cc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 Nov 2009 12:01:17 +0100 Subject: Revert "Revert "Stop using the NameOwnerChanged signal without arg0 in QtDBus itself"" This reverts commit db1cff73726ff12d50139769dc8071f9e9173261. Task-number: QTBUG-5979 --- src/dbus/qdbusconnection.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index d3aff6d..d7088ff 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -1005,9 +1005,6 @@ void QDBusConnectionPrivate::setBusService(const QDBusConnection &connection) busService = new QDBusConnectionInterface(connection, this); ref.deref(); // busService has increased the refcounting to us // avoid cyclic refcounting -// if (mode != PeerMode) - QObject::connect(busService, SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SIGNAL(serviceOwnerChanged(QString,QString,QString))); QObject::connect(this, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), busService, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), -- cgit v0.12 From 70d0d80e5cc11f98778234ddd20ce668551e9d9d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 Nov 2009 13:20:47 +0100 Subject: Revert "Disable the deprecation warning for this signal since we're using it now" This reverts commit f01c631f84f9373b06d0572bfed7a4e8213a46a7. --- src/dbus/qdbusconnectioninterface.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dbus/qdbusconnectioninterface.cpp b/src/dbus/qdbusconnectioninterface.cpp index 3b38432..414d318 100644 --- a/src/dbus/qdbusconnectioninterface.cpp +++ b/src/dbus/qdbusconnectioninterface.cpp @@ -337,6 +337,11 @@ void QDBusConnectionInterface::connectNotify(const char *signalName) QDBusAbstractInterface::connectNotify(SIGNAL(NameLost(QString))); else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0) { + static bool warningPrinted = false; + if (!warningPrinted) { + qWarning("Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)"); + warningPrinted = true; + } QDBusAbstractInterface::connectNotify(SIGNAL(NameOwnerChanged(QString,QString,QString))); } } -- cgit v0.12 From 8a820c790f2316052819148e344a3cd197877433 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 Nov 2009 13:21:04 +0100 Subject: Fix the detection of when this process gets names on the bus. Previously, we were relying on NameOwnerChanged to notify us of our own names. This worked because we got all NameOwnerChanged that happened on the bus. Now, we only get those we're interested in. Instead of watching for newOwner==baseService, let's just use the NameAcquired and NameLost signals, that the D-Bus server sends to us anyway. Task-number: QTBUG-5979 --- src/dbus/qdbusconnection_p.h | 5 +- src/dbus/qdbusintegrator.cpp | 18 +++--- tests/auto/qdbusconnection/tst_qdbusconnection.cpp | 66 ++++++++++++++++++++++ 3 files changed, 77 insertions(+), 12 deletions(-) diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 830dac3..b65e101 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -199,9 +199,6 @@ public: QDBusMetaObject *findMetaObject(const QString &service, const QString &path, const QString &interface, QDBusError &error); - void registerService(const QString &serviceName); - void unregisterService(const QString &serviceName); - void postEventToThread(int action, QObject *target, QEvent *event); inline void serverConnection(const QDBusConnection &connection) @@ -238,6 +235,8 @@ public slots: void objectDestroyed(QObject *o); void relaySignal(QObject *obj, const QMetaObject *, int signalId, const QVariantList &args); void _q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); + void registerService(const QString &serviceName); + void unregisterService(const QString &serviceName); signals: void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 870ddd0..40febc4 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -948,9 +948,6 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) rootNode.flags = 0; watchedServiceNames[QLatin1String(DBUS_SERVICE_DBUS)] = 1; - - connect(this, SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } QDBusConnectionPrivate::~QDBusConnectionPrivate() @@ -1180,11 +1177,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in void QDBusConnectionPrivate::_q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner) { - if (oldOwner == baseService) - unregisterService(name); - if (newOwner == baseService) - registerService(name); - + Q_UNUSED(oldOwner); QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this); QMutableHashIterator it(signalHooks); it.toFront(); @@ -1655,9 +1648,16 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError baseService = QString::fromUtf8(service); } else { - qWarning("QDBusConnectionPrivate::SetConnection: Unable to get base service"); + qWarning("QDBusConnectionPrivate::setConnection: Unable to get base service"); } + QString busService = QLatin1String(DBUS_SERVICE_DBUS); + connectSignal(busService, QString(), QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(), + this, SLOT(registerService(QString))); + connectSignal(busService, QString(), QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(), + this, SLOT(unregisterService(QString))); + + q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0); //qDebug("base service: %s", service); diff --git a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp index bb034a3..c1976c0 100644 --- a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp @@ -96,6 +96,8 @@ private slots: void registerQObjectChildren(); void callSelf(); + void callSelfByAnotherName_data(); + void callSelfByAnotherName(); void multipleInterfacesInQObject(); void slotsWithLessParameters(); @@ -493,6 +495,70 @@ void tst_QDBusConnection::callSelf() QCOMPARE(reply.arguments().value(0).toInt(), 45); } +void tst_QDBusConnection::callSelfByAnotherName_data() +{ + QTest::addColumn("registerMethod"); + QTest::newRow("connection") << 0; + QTest::newRow("connection-interface") << 1; + QTest::newRow("direct") << 2; +} + +void tst_QDBusConnection::callSelfByAnotherName() +{ + static int counter = 0; + QString sname = serviceName() + QString::number(counter++); + + QDBusConnection con = QDBusConnection::sessionBus(); + QVERIFY(con.isConnected()); + + TestObject testObject; + QVERIFY(con.registerObject("/test", &testObject, + QDBusConnection::ExportAllContents)); + con.connect("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", + QStringList() << sname << "", + QString(), &QTestEventLoop::instance(), SLOT(exitLoop())); + + // register the name + QFETCH(int, registerMethod); + switch (registerMethod) { + case 0: + QVERIFY(con.registerService(sname)); + break; + + case 1: + QVERIFY(con.interface()->registerService(sname).value() == QDBusConnectionInterface::ServiceRegistered); + break; + + case 2: { + // flag is DBUS_NAME_FLAG_DO_NOT_QUEUE = 0x04 + // reply is DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER = 1 + QDBusReply reply = con.interface()->call("RequestName", sname, 4u); + QVERIFY(reply.value() == 1); + } + } + + struct Deregisterer { + QDBusConnection con; + QString sname; + Deregisterer(const QDBusConnection &con, const QString &sname) : con(con), sname(sname) {} + ~Deregisterer() { con.interface()->unregisterService(sname); } + } deregisterer(con, sname); + + // give the connection a chance to find out that we're good to go + QTestEventLoop::instance().enterLoop(2); + con.disconnect("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", + QStringList() << sname << "", + QString(), &QTestEventLoop::instance(), SLOT(exitLoop())); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // make the call + QDBusMessage msg = QDBusMessage::createMethodCall(sname, "/test", + QString(), "test0"); + QDBusMessage reply = con.call(msg, QDBus::Block, 1000); + + QVERIFY(reply.type() == QDBusMessage::ReplyMessage); +} + void tst_QDBusConnection::multipleInterfacesInQObject() { QDBusConnection con = QDBusConnection::sessionBus(); -- cgit v0.12 From ad9a9657d2244e42b730482d8089ea7431f31773 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 Nov 2009 13:43:19 +0100 Subject: Doc: Update the documentation for the serviceOwnerChanged signal. Add the note that this signal will cause many activations and that QDBusServiceWatcher is better. --- src/dbus/qdbusconnectioninterface.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dbus/qdbusconnectioninterface.cpp b/src/dbus/qdbusconnectioninterface.cpp index 414d318..0f9a67f 100644 --- a/src/dbus/qdbusconnectioninterface.cpp +++ b/src/dbus/qdbusconnectioninterface.cpp @@ -394,6 +394,12 @@ void QDBusConnectionInterface::disconnectNotify(const char *signalName) empty string, it means the name \a name has just been created; if \a newOwner is empty, the name \a name has no current owner and is no longer available. + + \note connecting to this signal will make the application listen for and + receive every single service ownership change on the bus. Depending on + how many services are running, this make the application be activated to + receive more signals than it needs. To avoid this problem, use the + QDBusServiceWatcher class, which can listen for specific changes. */ /*! -- cgit v0.12 From ad87a761207ac1155c55773270bb6583677ccd30 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 Nov 2009 13:44:10 +0100 Subject: Small performance improvement: don't match the bus path. We trust the bus, so no need to match per path. The sender and the interface should be enough for us. --- src/dbus/qdbusservicewatcher.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/dbus/qdbusservicewatcher.cpp b/src/dbus/qdbusservicewatcher.cpp index 1557b47..4328558 100644 --- a/src/dbus/qdbusservicewatcher.cpp +++ b/src/dbus/qdbusservicewatcher.cpp @@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC_WITH_ARGS(QString, busService, (QLatin1String(DBUS_SERVICE_DBUS))) -Q_GLOBAL_STATIC_WITH_ARGS(QString, busPath, (QLatin1String(DBUS_PATH_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString, busInterface, (QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString, signalName, (QLatin1String("NameOwnerChanged"))) @@ -127,7 +126,7 @@ QStringList QDBusServiceWatcherPrivate::matchArgsForService(const QString &servi void QDBusServiceWatcherPrivate::addService(const QString &service) { QStringList matchArgs = matchArgsForService(service); - connection.connect(*busService(), *busPath(), *busInterface(), *signalName(), + connection.connect(*busService(), QString(), *busInterface(), *signalName(), matchArgs, QString(), q_func(), SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } @@ -135,7 +134,7 @@ void QDBusServiceWatcherPrivate::addService(const QString &service) void QDBusServiceWatcherPrivate::removeService(const QString &service) { QStringList matchArgs = matchArgsForService(service); - connection.disconnect(*busService(), *busPath(), *busInterface(), *signalName(), + connection.disconnect(*busService(), QString(), *busInterface(), *signalName(), matchArgs, QString(), q_func(), SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } -- cgit v0.12 From 80e9b7cdeeb1b1e85e724b4ed1903e0923005c79 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 25 Nov 2009 10:16:26 +1000 Subject: Fix links to docs in INSTALL and README The names of the doc directories on the doc site don't include the patch version number. Task-number: QTBUG-6043 Reviewed-by: Trust Me --- INSTALL | 14 +++++++------- dist/README | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/INSTALL b/INSTALL index b62f21d..7279f06 100644 --- a/INSTALL +++ b/INSTALL @@ -1,14 +1,14 @@ INSTALLING Qt Source Package Version %VERSION%. For full installation instructions for each supported platform, please -see http://qt.nokia.com/doc/%VERSION%/installation.html, the file +see http://qt.nokia.com/doc/%SHORTVERSION%/installation.html, the file doc/html/installation.html in this package, or follow one of the following links: -Embedded Linux: http://qt.nokia.com/doc/%VERSION%/qt-embedded-install.html -Mac OS X: http://qt.nokia.com/doc/%VERSION%/install-mac.html -Windows: http://qt.nokia.com/doc/%VERSION%/install-win.html -Windows CE: http://qt.nokia.com/doc/%VERSION%/install-wince.html -X11 Platforms: http://qt.nokia.com/doc/%VERSION%/install-x11.html -Symbian Platform: http://qt.nokia.com/doc/%VERSION%/install-symbian.html +Embedded Linux: http://qt.nokia.com/doc/%SHORTVERSION%/qt-embedded-install.html +Mac OS X: http://qt.nokia.com/doc/%SHORTVERSION%/install-mac.html +Windows: http://qt.nokia.com/doc/%SHORTVERSION%/install-win.html +Windows CE: http://qt.nokia.com/doc/%SHORTVERSION%/install-wince.html +X11 Platforms: http://qt.nokia.com/doc/%SHORTVERSION%/install-x11.html +Symbian Platform: http://qt.nokia.com/doc/%SHORTVERSION%/install-symbian.html diff --git a/dist/README b/dist/README index 529d2bd..e7dfb19 100644 --- a/dist/README +++ b/dist/README @@ -52,7 +52,7 @@ documentation is available at http://qt.nokia.com/doc/. SUPPORTED PLATFORMS For a complete list of supported platforms, see -http://qt.nokia.com/doc/%VERSION%/supported-platforms.html. +http://qt.nokia.com/doc/%SHORTVERSION%/supported-platforms.html. COMMERCIAL EDITIONS @@ -65,7 +65,7 @@ the QtCore, QtGui (except QGraphicsView), QtTest, QtDBus and Qt3Support modules. For a full listing of the contents of each module, please refer to -http://qt.nokia.com/doc/%VERSION%/modules.html +http://qt.nokia.com/doc/%SHORTVERSION%/modules.html HOW TO REPORT A BUG -- cgit v0.12 From c71c46430317b70e784f0952d0aac048775ad842 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 24 Nov 2009 09:34:48 +0100 Subject: Fix QFile::map in Linux 64bit On 64bit, qint64(size_t(-1)) = -1 Reviewed-by: Joao Reviewed-by: Thiago (cherry picked from commit 829d9e10ad3d26fb2fddef01c8e36352018c3fec) --- src/corelib/io/qfsfileengine_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 35737b3..8cbf6a3 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1245,7 +1245,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla } if (offset < 0 || offset != qint64(QT_OFF_T(offset)) - || size < 0 || size > qint64(size_t(-1))) { + || size < 0 || quint64(size) > quint64(size_t(-1))) { q->setError(QFile::UnspecifiedError, qt_error_string(int(EINVAL))); return 0; } -- cgit v0.12 From 106121a74bca32a6411b9ca968ee415f8bdfbff1 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 23 Nov 2009 17:56:03 +0100 Subject: Fixes implicit grabbing in Qt/Cocoa When delivering mouse events in Qt/Cocoa set the implicit mouse grabber and deliver the event to it and do not try to propagate the event to the parent view. Reviewed-by: Prasanth (cherry picked from commit aae81f370f6afede95064bc75eb7ee6ac13b1c30) --- src/gui/kernel/qcocoaview_mac.mm | 51 ++++++++++++++-------------------- src/gui/kernel/qt_cocoa_helpers_mac.mm | 8 ++++++ 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 72eedad..bf6bf4a 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -79,6 +79,7 @@ extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); // qapplication.cpp extern OSViewRef qt_mac_nativeview_for(const QWidget *w); // qwidget_mac.mm extern const QStringList& qEnabledDraggedTypes(); // qmime_mac.cpp extern QPointer qt_mouseover; //qapplication_mac.mm +extern QPointer qt_button_down; //qapplication_mac.cpp Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum) { @@ -691,6 +692,9 @@ extern "C" { - (void)mouseDown:(NSEvent *)theEvent { + if (!qt_button_down) + qt_button_down = qwidget; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::LeftButton); // Don't call super here. This prevents us from getting the mouseUp event, // which we need to send even if the mouseDown event was not accepted. @@ -700,75 +704,62 @@ extern "C" { - (void)mouseUp:(NSEvent *)theEvent { - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton); + qt_button_down = 0; - if (!mouseOK) - [super mouseUp:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton); } - (void)rightMouseDown:(NSEvent *)theEvent { - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton); + if (!qt_button_down) + qt_button_down = qwidget; - if (!mouseOK) - [super rightMouseDown:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton); } - (void)rightMouseUp:(NSEvent *)theEvent { - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton); + qt_button_down = 0; - if (!mouseOK) - [super rightMouseUp:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton); } - (void)otherMouseDown:(NSEvent *)theEvent { - Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]); - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton); + if (!qt_button_down) + qt_button_down = qwidget; - if (!mouseOK) - [super otherMouseDown:theEvent]; + Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]); + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton); } - (void)otherMouseUp:(NSEvent *)theEvent { - Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]); - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton); - - if (!mouseOK) - [super otherMouseUp:theEvent]; + qt_button_down = 0; + Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]); + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton); } - (void)mouseDragged:(NSEvent *)theEvent { qMacDnDParams()->view = self; qMacDnDParams()->theEvent = theEvent; - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); - - if (!mouseOK) - [super mouseDragged:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); } - (void)rightMouseDragged:(NSEvent *)theEvent { qMacDnDParams()->view = self; qMacDnDParams()->theEvent = theEvent; - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); - - if (!mouseOK) - [super rightMouseDragged:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); } - (void)otherMouseDragged:(NSEvent *)theEvent { qMacDnDParams()->view = self; qMacDnDParams()->theEvent = theEvent; - bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); - - if (!mouseOK) - [super otherMouseDragged:theEvent]; + qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton); } - (void)scrollWheel:(NSEvent *)theEvent diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index c0fb8aa..2bf1465 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -899,6 +899,14 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev widgetToGetMouse = [static_cast(tmpView) qt_qwidget]; } + } else { + extern QPointer qt_button_down; //qapplication_mac.cpp + if (!mac_mouse_grabber && qt_button_down) { + // if there is no explicit grabber, and the mouse was grabbed + // implicitely (i.e. a mousebutton was pressed) + widgetToGetMouse = qt_button_down; + tmpView = qt_mac_nativeview_for(widgetToGetMouse); + } } NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil]; -- cgit v0.12 From 410ed81027232e669bf6a28699fa833e56a27ef7 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 25 Nov 2009 14:04:28 +1000 Subject: Bind the EGL API type before calling eglMakeCurrent() When mixing GL and VG in the same thread, some devices require that eglBindAPI() be called before eglMakeCurrent() when switching between context types. The EGL spec indicates that this shouldn't be required unless the context parameter is EGL_NO_CONTEXT, but it isn't a big deal to work around slightly non-compliant devices. Reviewed-by: Tom Cooksey --- src/gui/egl/qegl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index c0e4890..cf28dc4 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -236,6 +236,18 @@ bool QEglContext::makeCurrent(EGLSurface surface) currentSurface = surface; setCurrentContext(apiType, this); + // Force the right API to be bound before making the context current. + // The EGL implementation should be able to figure this out from ctx, + // but some systems require the API to be explicitly set anyway. +#ifdef EGL_OPENGL_ES_API + if (apiType == QEgl::OpenGL) + eglBindAPI(EGL_OPENGL_ES_API); +#endif +#ifdef EGL_OPENVG_API + if (apiType == QEgl::OpenVG) + eglBindAPI(EGL_OPENVG_API); +#endif + bool ok = eglMakeCurrent(dpy, surface, surface, ctx); if (!ok) qWarning() << "QEglContext::makeCurrent():" << errorString(eglGetError()); -- cgit v0.12 From 5b5c098bda20cab7825207640cc69230c1864586 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 25 Nov 2009 14:13:51 +1000 Subject: Make QVGCompositionHelper::blitWindow() more generic Previously, the composition helper would use the VG window surface private structure to get the VGImage to blit. This change passes the VGImage and size values in directly so that the composition helper can also be used to blit GL surfaces that have been converted into a VGImage via an EGLImage. Reviewed-by: Tom Cooksey --- src/openvg/qpaintengine_vg.cpp | 7 ++----- src/openvg/qvgcompositionhelper_p.h | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index fda4b10..ba97d4f 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3459,14 +3459,11 @@ void QVGCompositionHelper::endCompositing() } void QVGCompositionHelper::blitWindow - (QVGEGLWindowSurfacePrivate *surface, const QRect& rect, - const QPoint& topLeft, int opacity) + (VGImage image, const QSize& imageSize, + const QRect& rect, const QPoint& topLeft, int opacity) { - // Get the VGImage that is acting as a back buffer for the window. - VGImage image = surface->surfaceImage(); if (image == VG_INVALID_HANDLE) return; - QSize imageSize = surface->surfaceSize(); // Determine which sub rectangle of the window to draw. QRect sr = rect.translated(-topLeft); diff --git a/src/openvg/qvgcompositionhelper_p.h b/src/openvg/qvgcompositionhelper_p.h index 3afe31e..ed24e73 100644 --- a/src/openvg/qvgcompositionhelper_p.h +++ b/src/openvg/qvgcompositionhelper_p.h @@ -71,8 +71,8 @@ public: void startCompositing(const QSize& screenSize); void endCompositing(); - void blitWindow(QVGEGLWindowSurfacePrivate *surface, const QRect& rect, - const QPoint& topLeft, int opacity); + void blitWindow(VGImage image, const QSize& imageSize, + const QRect& rect, const QPoint& topLeft, int opacity); void fillBackground(const QRegion& region, const QBrush& brush); void drawCursorPixmap(const QPixmap& pixmap, const QPoint& offset); void setScissor(const QRegion& region); -- cgit v0.12 From d51c590b8443d5d6dadf76a678439c990213d848 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Nov 2009 09:21:04 +0100 Subject: StandardDialogs example: Fix warning about QKeySequence::mnemonic. ... with several '&'. Task-number: QTBUG-5667 Reviewed-by: Gabriel --- examples/dialogs/standarddialogs/dialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/dialogs/standarddialogs/dialog.cpp b/examples/dialogs/standarddialogs/dialog.cpp index 6e06190..270fdd0 100644 --- a/examples/dialogs/standarddialogs/dialog.cpp +++ b/examples/dialogs/standarddialogs/dialog.cpp @@ -124,7 +124,7 @@ Dialog::Dialog(QWidget *parent) errorLabel = new QLabel; errorLabel->setFrameStyle(frameStyle); QPushButton *errorButton = - new QPushButton(tr("QErrorMessage::show&M&essage()")); + new QPushButton(tr("QErrorMessage::showM&essage()")); connect(integerButton, SIGNAL(clicked()), this, SLOT(setInteger())); connect(doubleButton, SIGNAL(clicked()), this, SLOT(setDouble())); -- cgit v0.12 From 339a11182a3e64c9cfbd8082622b5920c90c99c5 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 24 Nov 2009 19:54:02 +0100 Subject: Fix crash in QApplication::beep() on S60 Using an asynchronous API synchronously caused a crash, because the data structure was deleted while an async request is still pending. Depending on the multimedia implementation on the phone, the crash will happen or you just get no sound (or it can even work if the underlying implementation is blocking). Solution is to use the API asynchronously, and delete the handling object in qt_cleanup. Also raised the tone by one octave to be more similar to the system beep. Task-number: QTBUG-6170 Reviewed-by: Janne Anttila Reviewed-by: Miikka Heikkinen --- src/gui/kernel/qapplication_s60.cpp | 56 +++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index fb2bc72..89d961c 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -133,36 +133,46 @@ private: TTimeIntervalMicroSeconds iDuration; }; +static QS60Beep* qt_S60Beep = 0; + QS60Beep::~QS60Beep() { + if (iToneUtil) { + switch (iState) { + case EBeepPlaying: + iToneUtil->CancelPlay(); + break; + case EBeepNotPrepared: + iToneUtil->CancelPrepare(); + break; + } + } delete iToneUtil; } QS60Beep* QS60Beep::NewL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration) { - QS60Beep* self=new (ELeave) QS60Beep(); + QS60Beep* self = new (ELeave) QS60Beep(); CleanupStack::PushL(self); self->ConstructL(aFrequency, aDuration); CleanupStack::Pop(); return self; -}; +} void QS60Beep::ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration) { - iToneUtil=CMdaAudioToneUtility::NewL(*this); - iState=EBeepNotPrepared; - iFrequency=aFrequency; - iDuration=aDuration; - iToneUtil->PrepareToPlayTone(iFrequency,iDuration); + iToneUtil = CMdaAudioToneUtility::NewL(*this); + iState = EBeepNotPrepared; + iFrequency = aFrequency; + iDuration = aDuration; + iToneUtil->PrepareToPlayTone(iFrequency, iDuration); } void QS60Beep::Play() { - if (iState != EBeepNotPrepared) { - if (iState == EBeepPlaying) { - iToneUtil->CancelPlay(); - iState = EBeepPrepared; - } + if (iState == EBeepPlaying) { + iToneUtil->CancelPlay(); + iState = EBeepPrepared; } iToneUtil->Play(); @@ -173,13 +183,14 @@ void QS60Beep::MatoPrepareComplete(TInt aError) { if (aError == KErrNone) { iState = EBeepPrepared; + Play(); } } void QS60Beep::MatoPlayComplete(TInt aError) { Q_UNUSED(aError); - iState=EBeepPrepared; + iState = EBeepPrepared; } @@ -1226,6 +1237,10 @@ void qt_init(QApplicationPrivate * /* priv */, int) *****************************************************************************/ void qt_cleanup() { + if(qt_S60Beep) { + delete qt_S60Beep; + qt_S60Beep = 0; + } QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles // S60 structure and window server session are freed in eventdispatcher destructor as they are needed there @@ -1467,14 +1482,13 @@ void QApplication::setCursorFlashTime(int msecs) void QApplication::beep() { - TInt frequency=440; - TTimeIntervalMicroSeconds duration(500000); - QS60Beep* beep=NULL; - TRAPD(err, beep=QS60Beep::NewL(frequency, duration)); - if (!err) - beep->Play(); - delete beep; - beep=NULL; + if (!qt_S60Beep) { + TInt frequency = 880; + TTimeIntervalMicroSeconds duration(500000); + TRAP_IGNORE(qt_S60Beep=QS60Beep::NewL(frequency, duration)); + } + if (qt_S60Beep) + qt_S60Beep->Play(); } /*! -- cgit v0.12 From 9073a38e2ad3342291e9b2e68cf120a2faba06b0 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 25 Nov 2009 10:01:23 +0100 Subject: Make sure the cursor of the lineedit doesn't blink when a key is pressed This was a regression against 4.5 Task-number: QTBUG-4944 Reviewed-by: ogoffart --- src/gui/widgets/qlineedit.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 3800224..785b2bd 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1411,6 +1411,8 @@ bool QLineEdit::event(QEvent * e) QTimer::singleShot(0, this, SLOT(_q_handleWindowActivate())); }else if(e->type() == QEvent::ShortcutOverride){ d->control->processEvent(e); + } else if (e->type() == QEvent::KeyRelease) { + d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()); } #ifdef QT_KEYPAD_NAVIGATION @@ -1615,6 +1617,8 @@ void QLineEdit::keyPressEvent(QKeyEvent *event) } #endif d->control->processKeyEvent(event); + if (event->isAccepted()) + d->control->setCursorBlinkPeriod(0); } /*! -- cgit v0.12 From acf398f764a7d73f5857d4544df4e06bfe60797a Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 25 Nov 2009 10:04:19 +0100 Subject: Fixed subpixel text antialiasing with the GL2 engine on ATI. Use subpixel antialiasing even if the there is an alpha channel. Reviewed-by: Trond --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 823f919..07432c6 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1773,13 +1773,10 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; #if !defined(QT_OPENGL_ES_2) - if (!d->device->format().alpha() #if defined(Q_WS_WIN) - && qt_cleartype_enabled + if (qt_cleartype_enabled) #endif - ) { d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask; - } #endif #if defined(QT_OPENGL_ES_2) -- cgit v0.12 From 503f9eb56d16dcf2a44ad491da8b17b2aea72d7d Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 25 Nov 2009 10:12:51 +0100 Subject: Make the animation timer more consistent We ensure that the startStop timer is always ticking before the animation timer. Task-number: QTBUG-5967 Reviewed-by: Aaron Kennedy --- src/corelib/animation/qabstractanimation.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index ef4989b..299585a 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -229,7 +229,10 @@ void QUnifiedTimer::restartAnimationTimer() void QUnifiedTimer::timerEvent(QTimerEvent *event) { - if (event->timerId() == startStopAnimationTimer.timerId()) { + //in the case of consistent timing we make sure the orders in which events come is always the same + //for that purpose we do as if the startstoptimer would always fire before the animation timer + if ((consistentTiming && startStopAnimationTimer.isActive()) || + event->timerId() == startStopAnimationTimer.timerId()) { startStopAnimationTimer.stop(); //we transfer the waiting animations into the "really running" state @@ -247,7 +250,9 @@ void QUnifiedTimer::timerEvent(QTimerEvent *event) time.start(); } } - } else if (event->timerId() == animationTimer.timerId()) { + } + + if (event->timerId() == animationTimer.timerId()) { // update current time on all top level animations updateAnimationsTime(); restartAnimationTimer(); -- cgit v0.12 From 6cb0ac70301a21e914cb5716642c756312b3ec30 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 25 Nov 2009 10:30:52 +0100 Subject: Network auto tests: Some timeout increases Reviewed-by: TrustMe --- tests/auto/networkselftest/tst_networkselftest.cpp | 4 ++-- tests/auto/qftp/tst_qftp.cpp | 2 +- tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 4 ++-- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 2 +- tests/auto/qudpsocket/tst_qudpsocket.cpp | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index f13bcad..b9be5cb 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -156,7 +156,7 @@ static QString prettyByteArray(const QByteArray &array) return result; } -static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout = 2000) +static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout = 4000) { QTime timer; timer.start(); @@ -171,7 +171,7 @@ static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout } } -static bool doSocketFlush(QTcpSocket *socket, int timeout = 2000) +static bool doSocketFlush(QTcpSocket *socket, int timeout = 4000) { #ifndef QT_NO_OPENSSL QSslSocket *sslSocket = qobject_cast(socket); diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp index 263c957..27c2e13 100644 --- a/tests/auto/qftp/tst_qftp.cpp +++ b/tests/auto/qftp/tst_qftp.cpp @@ -1408,7 +1408,7 @@ void tst_QFtp::bytesAvailable() if ( type != 0 ) addCommand( QFtp::Close, ftp->close() ); - QTestEventLoop::instance().enterLoop( 30 ); + QTestEventLoop::instance().enterLoop( 40 ); if ( QTestEventLoop::instance().timeout() ) QFAIL( "Network operation timed out" ); diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index 5ead049..8cabadb 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -695,7 +695,7 @@ public: || socket.error() == QLocalSocket::ConnectionRefusedError) && tries < 1000); if (tries == 0 && socket.state() != QLocalSocket::ConnectedState) { - QVERIFY(socket.waitForConnected(3000)); + QVERIFY(socket.waitForConnected(7000)); QVERIFY(socket.state() == QLocalSocket::ConnectedState); } @@ -725,7 +725,7 @@ public: int done = clients; while (done > 0) { bool timedOut = true; - QVERIFY(server.waitForNewConnection(3000, &timedOut)); + QVERIFY(server.waitForNewConnection(7000, &timedOut)); QVERIFY(!timedOut); QLocalSocket *serverSocket = server.nextPendingConnection(); QVERIFY(serverSocket); diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 09456ed..5fe716a 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -2212,7 +2212,7 @@ void tst_QNetworkReply::ioGetWithManyProxies() connect(&manager, SIGNAL(sslErrors(QNetworkReply*,QList)), SLOT(sslErrors(QNetworkReply*,QList))); #endif - QTestEventLoop::instance().enterLoop(10); + QTestEventLoop::instance().enterLoop(15); QVERIFY(!QTestEventLoop::instance().timeout()); manager.disconnect(SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp index 9418be0..160d74c 100644 --- a/tests/auto/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp @@ -295,8 +295,8 @@ void tst_QUdpSocket::loop() QCOMPARE(paul.writeDatagram(paulMessage.data(), paulMessage.length(), peterAddress, peter.localPort()), qint64(paulMessage.length())); - QVERIFY(peter.waitForReadyRead(5000)); - QVERIFY(paul.waitForReadyRead(5000)); + QVERIFY(peter.waitForReadyRead(9000)); + QVERIFY(paul.waitForReadyRead(9000)); char peterBuffer[16*1024]; char paulBuffer[16*1024]; if (success) { -- cgit v0.12 From c6eee578665bfd2c3b25b238cf8ae24fee00f9f7 Mon Sep 17 00:00:00 2001 From: Jakub Wieczorek Date: Mon, 26 Oct 2009 22:23:28 +0100 Subject: QXmlStream: Fix parsing of DTDs that contain empty markup declarations like e.g. According to the specification, it is possible for a doctype to contain no markup declarations: http://www.w3.org/TR/xml/#sec-prolog-dtd "intSubset ::= (markupdecl | DeclSep)*" However, currently QXmlStreamReader would raise an error when encountering such a declaration. Merge-request: 1926 Reviewed-by: Peter Hartmann --- src/corelib/xml/qxmlstream.g | 1 + tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.ref | 7 +++++++ tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.xml | 3 +++ 3 files changed, 11 insertions(+) create mode 100644 tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.ref create mode 100644 tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.xml diff --git a/src/corelib/xml/qxmlstream.g b/src/corelib/xml/qxmlstream.g index 22ba33d..9921d41 100644 --- a/src/corelib/xml/qxmlstream.g +++ b/src/corelib/xml/qxmlstream.g @@ -915,6 +915,7 @@ markup ::= markup_start markup_list RBRACK; markup_list ::= markup_decl | space | pereference; markup_list ::= markup_list markup_decl | markup_list space | markup_list pereference; +markup_list ::=; markup_decl ::= element_decl | attlist_decl | entity_decl | entity_done | notation_decl | processing_instruction | comment; diff --git a/tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.ref b/tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.ref new file mode 100644 index 0000000..ea85e32 --- /dev/null +++ b/tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.ref @@ -0,0 +1,7 @@ +StartDocument( ) +Comment( text=" Empty markup declaration in a doctype. " ) +DTD( text=" +" dtdName="doc" ) +StartElement( name="doc" qualifiedName="doc" ) +EndElement( name="doc" qualifiedName="doc" ) +EndDocument( ) diff --git a/tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.xml b/tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.xml new file mode 100644 index 0000000..1c66c0c --- /dev/null +++ b/tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.xml @@ -0,0 +1,3 @@ + + + -- cgit v0.12 From 82657e28ebe0ed5b1d60b2a18ac4af145f5c4c46 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 25 Nov 2009 10:19:21 +0100 Subject: QXmlStream: regenerate header after grammar change the grammar file src/corelib/xml/qxmlstream.g has been changed in the previous commit, this commit regenerates the file src/corelib/xml/qxmlstream_p.h . Reviewed-by: TrustMe --- src/corelib/xml/qxmlstream_p.h | 323 +++++++++++++++++++++-------------------- 1 file changed, 162 insertions(+), 161 deletions(-) diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index 253f8bd..5eea065 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -121,7 +121,7 @@ public: XML = 54, ACCEPT_STATE = 416, - RULE_COUNT = 269, + RULE_COUNT = 270, STATE_COUNT = 427, TERMINAL_COUNT = 57, NON_TERMINAL_COUNT = 84, @@ -172,105 +172,105 @@ const char *const QXmlStreamReader_Table::spell [] = { const short QXmlStreamReader_Table::lhs [] = { 57, 57, 59, 59, 59, 59, 59, 59, 59, 59, 67, 68, 64, 72, 72, 72, 75, 66, 66, 66, - 66, 79, 78, 80, 80, 80, 80, 80, 80, 81, - 81, 81, 81, 81, 81, 81, 87, 83, 88, 88, - 88, 88, 91, 92, 93, 93, 93, 93, 94, 94, - 96, 96, 96, 97, 97, 98, 98, 99, 99, 100, - 100, 89, 89, 95, 90, 101, 101, 103, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 104, 105, 105, - 105, 105, 107, 108, 109, 109, 84, 84, 110, 110, - 112, 112, 85, 85, 85, 65, 65, 76, 114, 63, - 115, 116, 86, 86, 86, 117, 117, 117, 117, 117, + 66, 79, 78, 80, 80, 80, 80, 80, 80, 80, + 81, 81, 81, 81, 81, 81, 81, 87, 83, 88, + 88, 88, 88, 91, 92, 93, 93, 93, 93, 94, + 94, 96, 96, 96, 97, 97, 98, 98, 99, 99, + 100, 100, 89, 89, 95, 90, 101, 101, 103, 103, + 103, 103, 103, 103, 103, 103, 103, 103, 104, 105, + 105, 105, 105, 107, 108, 109, 109, 84, 84, 110, + 110, 112, 112, 85, 85, 85, 65, 65, 76, 114, + 63, 115, 116, 86, 86, 86, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 118, 118, - 119, 119, 119, 119, 119, 119, 119, 119, 122, 70, - 70, 70, 70, 123, 124, 123, 124, 123, 124, 123, - 124, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 118, + 118, 119, 119, 119, 119, 119, 119, 119, 119, 122, + 70, 70, 70, 70, 123, 124, 123, 124, 123, 124, + 123, 124, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 125, 73, 113, 113, 113, 113, 127, - 128, 127, 128, 127, 128, 127, 128, 129, 129, 129, + 126, 126, 126, 126, 125, 73, 113, 113, 113, 113, + 127, 128, 127, 128, 127, 128, 127, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, - 129, 129, 106, 106, 106, 106, 131, 132, 131, 132, - 131, 131, 132, 132, 133, 133, 133, 133, 135, 71, - 71, 71, 136, 136, 137, 62, 60, 61, 138, 121, - 82, 130, 134, 120, 139, 139, 139, 139, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 74, 69, - 69, 77, 111, 102, 102, 102, 102, 102, 140}; + 129, 129, 129, 106, 106, 106, 106, 131, 132, 131, + 132, 131, 131, 132, 132, 133, 133, 133, 133, 135, + 71, 71, 71, 136, 136, 137, 62, 60, 61, 138, + 121, 82, 130, 134, 120, 139, 139, 139, 139, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 74, + 69, 69, 77, 111, 102, 102, 102, 102, 102, 140}; const short QXmlStreamReader_Table::rhs [] = { 2, 1, 4, 2, 2, 2, 2, 2, 2, 0, 1, 1, 9, 2, 4, 0, 4, 4, 6, 6, - 4, 1, 3, 1, 1, 1, 2, 2, 2, 1, - 1, 1, 1, 1, 1, 1, 4, 4, 1, 1, - 1, 1, 1, 2, 1, 1, 1, 0, 2, 2, - 2, 6, 6, 1, 5, 1, 5, 3, 5, 0, - 1, 6, 8, 4, 2, 1, 5, 1, 1, 1, - 1, 1, 1, 1, 1, 6, 7, 1, 2, 2, - 1, 4, 3, 3, 1, 2, 5, 6, 4, 6, - 3, 5, 5, 3, 4, 4, 5, 2, 3, 2, - 2, 4, 5, 5, 7, 1, 1, 1, 1, 1, + 4, 1, 3, 1, 1, 1, 2, 2, 2, 0, + 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, + 1, 1, 1, 1, 2, 1, 1, 1, 0, 2, + 2, 2, 6, 6, 1, 5, 1, 5, 3, 5, + 0, 1, 6, 8, 4, 2, 1, 5, 1, 1, + 1, 1, 1, 1, 1, 1, 6, 7, 1, 2, + 2, 1, 4, 3, 3, 1, 2, 5, 6, 4, + 6, 3, 5, 5, 3, 4, 4, 5, 2, 3, + 2, 2, 4, 5, 5, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, - 2, 3, 3, 2, 2, 2, 2, 1, 1, 1, + 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, + 2, 2, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 2, 2, 3, 3, 2, - 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, + 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 3, 3, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 5, 0, - 1, 3, 1, 3, 2, 4, 3, 5, 1, 3, - 3, 3, 3, 4, 1, 1, 2, 2, 2, 4, - 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2}; + 1, 1, 1, 2, 2, 3, 3, 2, 2, 2, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 5, + 0, 1, 3, 1, 3, 2, 4, 3, 5, 1, + 3, 3, 3, 3, 4, 1, 1, 2, 2, 2, + 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 2}; const short QXmlStreamReader_Table::action_default [] = { - 10, 258, 0, 2, 1, 0, 124, 116, 118, 119, - 126, 128, 122, 11, 113, 107, 0, 108, 127, 110, - 114, 112, 120, 123, 125, 106, 109, 111, 117, 115, - 130, 121, 239, 12, 253, 135, 249, 252, 0, 129, - 139, 256, 16, 251, 137, 136, 0, 255, 138, 258, - 230, 257, 254, 0, 0, 263, 0, 246, 245, 0, - 248, 247, 244, 240, 98, 262, 0, 235, 0, 0, - 259, 96, 97, 100, 0, 131, 133, 132, 134, 0, - 0, 260, 0, 0, 175, 0, 172, 164, 166, 167, - 141, 153, 170, 161, 155, 156, 152, 158, 162, 160, - 168, 171, 151, 154, 157, 159, 165, 163, 173, 169, - 149, 174, 0, 143, 147, 145, 150, 140, 148, 0, - 146, 142, 144, 0, 15, 14, 261, 0, 22, 21, - 260, 0, 0, 20, 0, 0, 31, 36, 30, 0, - 32, 260, 0, 33, 0, 24, 0, 34, 0, 26, - 35, 25, 0, 241, 40, 39, 260, 42, 48, 260, - 41, 0, 43, 260, 48, 260, 0, 260, 0, 48, - 0, 47, 45, 46, 50, 51, 260, 260, 0, 56, - 260, 53, 260, 0, 57, 0, 54, 260, 52, 260, - 0, 55, 64, 0, 260, 60, 260, 0, 58, 61, - 62, 0, 260, 0, 0, 59, 63, 44, 49, 65, - 0, 38, 0, 0, 260, 0, 93, 94, 0, 0, - 0, 0, 260, 0, 209, 200, 202, 204, 177, 189, - 207, 198, 192, 190, 193, 188, 195, 197, 205, 208, - 187, 191, 194, 196, 201, 199, 203, 206, 210, 212, - 211, 185, 0, 0, 242, 179, 183, 181, 0, 0, - 92, 186, 176, 184, 0, 182, 178, 180, 91, 0, - 95, 0, 0, 0, 0, 0, 260, 85, 260, 0, - 261, 0, 86, 0, 88, 68, 73, 72, 69, 70, - 71, 260, 74, 75, 0, 0, 0, 268, 267, 265, - 266, 264, 66, 260, 0, 260, 0, 0, 67, 76, - 260, 0, 260, 0, 0, 77, 0, 78, 0, 81, - 84, 0, 0, 214, 224, 223, 0, 226, 228, 227, - 225, 0, 243, 216, 220, 218, 222, 213, 221, 0, - 219, 215, 217, 0, 80, 79, 0, 82, 0, 83, - 87, 99, 0, 37, 0, 0, 0, 0, 90, 89, - 0, 102, 23, 27, 29, 28, 0, 0, 260, 261, - 0, 260, 0, 105, 104, 260, 0, 103, 101, 0, - 0, 18, 260, 17, 0, 19, 0, 0, 250, 0, - 260, 0, 238, 0, 231, 237, 0, 236, 233, 260, - 260, 261, 232, 234, 0, 260, 0, 229, 260, 0, - 260, 0, 230, 0, 0, 13, 269, 9, 5, 8, - 4, 0, 7, 258, 6, 0, 3}; + 10, 259, 0, 2, 1, 0, 125, 117, 119, 120, + 127, 129, 123, 11, 114, 108, 0, 109, 128, 111, + 115, 113, 121, 124, 126, 107, 110, 112, 118, 116, + 131, 122, 240, 12, 254, 136, 250, 253, 0, 130, + 140, 257, 16, 252, 138, 137, 0, 256, 139, 259, + 231, 258, 255, 0, 0, 264, 0, 247, 246, 0, + 249, 248, 245, 241, 99, 263, 0, 236, 0, 0, + 260, 97, 98, 101, 0, 132, 134, 133, 135, 0, + 0, 261, 0, 0, 176, 0, 173, 165, 167, 168, + 142, 154, 171, 162, 156, 157, 153, 159, 163, 161, + 169, 172, 152, 155, 158, 160, 166, 164, 174, 170, + 150, 175, 0, 144, 148, 146, 151, 141, 149, 0, + 147, 143, 145, 0, 15, 14, 262, 0, 22, 21, + 261, 30, 0, 20, 0, 0, 32, 37, 31, 0, + 33, 261, 0, 34, 0, 24, 0, 35, 0, 26, + 36, 25, 0, 242, 41, 40, 261, 43, 49, 261, + 42, 0, 44, 261, 49, 261, 0, 261, 0, 49, + 0, 48, 46, 47, 51, 52, 261, 261, 0, 57, + 261, 54, 261, 0, 58, 0, 55, 261, 53, 261, + 0, 56, 65, 0, 261, 61, 261, 0, 59, 62, + 63, 0, 261, 0, 0, 60, 64, 45, 50, 66, + 0, 39, 0, 0, 261, 0, 94, 95, 0, 0, + 0, 0, 261, 0, 210, 201, 203, 205, 178, 190, + 208, 199, 193, 191, 194, 189, 196, 198, 206, 209, + 188, 192, 195, 197, 202, 200, 204, 207, 211, 213, + 212, 186, 0, 0, 243, 180, 184, 182, 0, 0, + 93, 187, 177, 185, 0, 183, 179, 181, 92, 0, + 96, 0, 0, 0, 0, 0, 261, 86, 261, 0, + 262, 0, 87, 0, 89, 69, 74, 73, 70, 71, + 72, 261, 75, 76, 0, 0, 0, 269, 268, 266, + 267, 265, 67, 261, 0, 261, 0, 0, 68, 77, + 261, 0, 261, 0, 0, 78, 0, 79, 0, 82, + 85, 0, 0, 215, 225, 224, 0, 227, 229, 228, + 226, 0, 244, 217, 221, 219, 223, 214, 222, 0, + 220, 216, 218, 0, 81, 80, 0, 83, 0, 84, + 88, 100, 0, 38, 0, 0, 0, 0, 91, 90, + 0, 103, 23, 27, 29, 28, 0, 0, 261, 262, + 0, 261, 0, 106, 105, 261, 0, 104, 102, 0, + 0, 18, 261, 17, 0, 19, 0, 0, 251, 0, + 261, 0, 239, 0, 232, 238, 0, 237, 234, 261, + 261, 262, 233, 235, 0, 261, 0, 230, 261, 0, + 261, 0, 231, 0, 0, 13, 270, 9, 5, 8, + 4, 0, 7, 259, 6, 0, 3}; const short QXmlStreamReader_Table::goto_default [] = { 2, 4, 3, 49, 388, 43, 37, 52, 47, 41, @@ -736,8 +736,8 @@ public: } }; -class QXmlStreamEntityResolver; +class QXmlStreamEntityResolver; #ifndef QT_NO_XMLSTREAMREADER class QXmlStreamReaderPrivate : public QXmlStreamReader_Table, public QXmlStreamPrivateTagStack{ QXmlStreamReader *q_ptr; @@ -1355,44 +1355,44 @@ bool QXmlStreamReaderPrivate::parse() scanDtd = false; break; - case 36: + case 37: if (!scanString(spell[EMPTY], EMPTY, false) && !scanString(spell[ANY], ANY, false) && atEnd) { - resume(36); + resume(37); return false; } break; - case 42: + case 43: if (!scanString(spell[PCDATA], PCDATA, false) && atEnd) { - resume(42); + resume(43); return false; } break; - case 67: { + case 68: { lastAttributeIsCData = true; } break; - case 77: + case 78: if (!scanAfterDefaultDecl() && atEnd) { - resume(77); + resume(78); return false; } break; - case 82: + case 83: sym(1) = sym(2); lastAttributeValue.clear(); lastAttributeIsCData = false; if (!scanAttType() && atEnd) { - resume(82); + resume(83); return false; } break; - case 83: { + case 84: { DtdAttribute &dtdAttribute = dtdAttributes.push(); dtdAttribute.tagName.clear(); dtdAttribute.isCDATA = lastAttributeIsCData; @@ -1413,7 +1413,7 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 87: { + case 88: { if (referenceToUnparsedEntityDetected && !standalone) break; int n = dtdAttributes.size(); @@ -1433,9 +1433,9 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 88: { + case 89: { if (!scanPublicOrSystem() && atEnd) { - resume(88); + resume(89); return false; } EntityDeclaration &entityDeclaration = entityDeclarations.push(); @@ -1443,9 +1443,9 @@ bool QXmlStreamReaderPrivate::parse() entityDeclaration.name = symString(3); } break; - case 89: { + case 90: { if (!scanPublicOrSystem() && atEnd) { - resume(89); + resume(90); return false; } EntityDeclaration &entityDeclaration = entityDeclarations.push(); @@ -1454,9 +1454,9 @@ bool QXmlStreamReaderPrivate::parse() entityDeclaration.parameter = true; } break; - case 90: { + case 91: { if (!scanNData() && atEnd) { - resume(90); + resume(91); return false; } EntityDeclaration &entityDeclaration = entityDeclarations.top(); @@ -1464,9 +1464,9 @@ bool QXmlStreamReaderPrivate::parse() entityDeclaration.external = true; } break; - case 91: { + case 92: { if (!scanNData() && atEnd) { - resume(91); + resume(92); return false; } EntityDeclaration &entityDeclaration = entityDeclarations.top(); @@ -1475,7 +1475,7 @@ bool QXmlStreamReaderPrivate::parse() entityDeclaration.external = true; } break; - case 92: { + case 93: { EntityDeclaration &entityDeclaration = entityDeclarations.top(); entityDeclaration.notationName = symString(3); if (entityDeclaration.parameter) @@ -1483,8 +1483,8 @@ bool QXmlStreamReaderPrivate::parse() } //fall through - case 93: - case 94: { + case 94: + case 95: { if (referenceToUnparsedEntityDetected && !standalone) { entityDeclarations.pop(); break; @@ -1502,7 +1502,7 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 95: { + case 96: { setType(QXmlStreamReader::ProcessingInstruction); int pos = sym(4).pos + sym(4).len; processingInstructionTarget = symString(3); @@ -1515,39 +1515,39 @@ bool QXmlStreamReaderPrivate::parse() else if(!QXmlUtils::isNCName(piTarget)) raiseWellFormedError(QXmlStream::tr("%1 is an invalid processing instruction name.").arg(piTarget)); } else if (type != QXmlStreamReader::Invalid){ - resume(95); + resume(96); return false; } } break; - case 96: + case 97: setType(QXmlStreamReader::ProcessingInstruction); processingInstructionTarget = symString(3); if (!processingInstructionTarget.toString().compare(QLatin1String("xml"), Qt::CaseInsensitive)) raiseWellFormedError(QXmlStream::tr("Invalid processing instruction name.")); break; - case 97: + case 98: if (!scanAfterLangleBang() && atEnd) { - resume(97); + resume(98); return false; } break; - case 98: + case 99: if (!scanUntil("--")) { - resume(98); + resume(99); return false; } break; - case 99: { + case 100: { setType(QXmlStreamReader::Comment); int pos = sym(1).pos + 4; text = QStringRef(&textBuffer, pos, textBuffer.size() - pos - 3); } break; - case 100: { + case 101: { setType(QXmlStreamReader::Characters); isCDATA = true; isWhitespace = false; @@ -1555,131 +1555,131 @@ bool QXmlStreamReaderPrivate::parse() if (scanUntil("]]>", -1)) { text = QStringRef(&textBuffer, pos, textBuffer.size() - pos - 3); } else { - resume(100); + resume(101); return false; } } break; - case 101: { + case 102: { if (!scanPublicOrSystem() && atEnd) { - resume(101); + resume(102); return false; } NotationDeclaration ¬ationDeclaration = notationDeclarations.push(); notationDeclaration.name = symString(3); } break; - case 102: { + case 103: { NotationDeclaration ¬ationDeclaration = notationDeclarations.top(); notationDeclaration.systemId = symString(3); notationDeclaration.publicId.clear(); } break; - case 103: { + case 104: { NotationDeclaration ¬ationDeclaration = notationDeclarations.top(); notationDeclaration.systemId.clear(); checkPublicLiteral((notationDeclaration.publicId = symString(3))); } break; - case 104: { + case 105: { NotationDeclaration ¬ationDeclaration = notationDeclarations.top(); checkPublicLiteral((notationDeclaration.publicId = symString(3))); notationDeclaration.systemId = symString(5); } break; - case 128: + case 129: isWhitespace = false; // fall through - case 129: + case 130: sym(1).len += fastScanContentCharList(); if (atEnd && !inParseEntity) { - resume(129); + resume(130); return false; } break; - case 138: + case 139: if (!textBuffer.isEmpty()) { setType(QXmlStreamReader::Characters); text = &textBuffer; } break; - case 139: case 140: + case 141: clearSym(); break; - case 141: case 142: + case 143: sym(1) = sym(2); break; - case 143: case 144: case 145: case 146: + case 147: sym(1).len += sym(2).len; break; - case 172: + case 173: if (normalizeLiterals) textBuffer.data()[textBuffer.size()-1] = QLatin1Char(' '); break; - case 173: + case 174: sym(1).len += fastScanLiteralContent(); if (atEnd) { - resume(173); + resume(174); return false; } break; - case 174: { + case 175: { if (!QXmlUtils::isPublicID(symString(1).toString())) { raiseWellFormedError(QXmlStream::tr("%1 is an invalid PUBLIC identifier.").arg(symString(1).toString())); - resume(174); + resume(175); return false; } } break; - case 175: case 176: + case 177: clearSym(); break; - case 177: case 178: + case 179: sym(1) = sym(2); break; - case 179: case 180: case 181: case 182: + case 183: sym(1).len += sym(2).len; break; - case 212: case 213: + case 214: clearSym(); break; - case 214: case 215: + case 216: sym(1) = sym(2); lastAttributeValue = symString(1); break; - case 216: case 217: case 218: case 219: + case 220: sym(1).len += sym(2).len; break; - case 228: { + case 229: { QStringRef prefix = symPrefix(1); if (prefix.isEmpty() && symString(1) == QLatin1String("xmlns") && namespaceProcessing) { NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); @@ -1749,7 +1749,7 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 234: { + case 235: { normalizeLiterals = true; Tag &tag = tagStack_push(); prefix = tag.namespaceDeclaration.prefix = addToStringStorage(symPrefix(2)); @@ -1759,11 +1759,11 @@ bool QXmlStreamReaderPrivate::parse() raiseWellFormedError(QXmlStream::tr("Invalid XML name.")); } break; - case 235: + case 236: isEmptyElement = true; // fall through - case 236: + case 237: setType(QXmlStreamReader::StartElement); resolveTag(); if (tagStack.size() == 1 && hasSeenTag && !inParseEntity) @@ -1771,7 +1771,7 @@ bool QXmlStreamReaderPrivate::parse() hasSeenTag = true; break; - case 237: { + case 238: { setType(QXmlStreamReader::EndElement); Tag &tag = tagStack_pop(); @@ -1782,7 +1782,7 @@ bool QXmlStreamReaderPrivate::parse() raiseWellFormedError(QXmlStream::tr("Opening and ending tag mismatch.")); } break; - case 238: + case 239: if (entitiesMustBeDeclared()) { raiseWellFormedError(QXmlStream::tr("Entity '%1' not declared.").arg(unresolvedEntity)); break; @@ -1791,7 +1791,7 @@ bool QXmlStreamReaderPrivate::parse() name = &unresolvedEntity; break; - case 239: { + case 240: { sym(1).len += sym(2).len + 1; QString reference = symString(2).toString(); if (entityHash.contains(reference)) { @@ -1830,7 +1830,7 @@ bool QXmlStreamReaderPrivate::parse() } break; - case 240: { + case 241: { sym(1).len += sym(2).len + 1; QString reference = symString(2).toString(); if (parameterEntityHash.contains(reference)) { @@ -1849,11 +1849,11 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 241: + case 242: sym(1).len += sym(2).len + 1; break; - case 242: { + case 243: { sym(1).len += sym(2).len + 1; QString reference = symString(2).toString(); if (entityHash.contains(reference)) { @@ -1889,7 +1889,7 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 243: { + case 244: { if (uint s = resolveCharRef(3)) { if (s >= 0xffff) putStringLiteral(QString::fromUcs4(&s, 1)); @@ -1903,43 +1903,43 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 246: case 247: + case 248: sym(1).len += sym(2).len; break; - case 258: + case 259: sym(1).len += fastScanSpace(); if (atEnd) { - resume(258); + resume(259); return false; } break; - case 261: { + case 262: { sym(1).len += fastScanName(&sym(1).prefix); if (atEnd) { - resume(261); + resume(262); return false; } } break; - case 262: + case 263: sym(1).len += fastScanName(); if (atEnd) { - resume(262); + resume(263); return false; } break; - case 263: case 264: case 265: case 266: case 267: + case 268: sym(1).len += fastScanNMTOKEN(); if (atEnd) { - resume(267); + resume(268); return false; } @@ -1958,7 +1958,8 @@ bool QXmlStreamReaderPrivate::parse() } return false; } +#endif //QT_NO_XMLSTREAMREADER.xml + -#endif //QT_NO_XMLSTREAMREADER #endif // QXMLSTREAM_P_H -- cgit v0.12 From e6010544c06232ff1baed9123c0292a7aff6985e Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 25 Nov 2009 11:20:13 +0100 Subject: skip one test on mac because it uses native menu bars --- tests/auto/qmenubar/tst_qmenubar.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 320cd8d..7fbb760 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -1667,6 +1667,9 @@ void tst_QMenuBar::menubarSizeHint() void tst_QMenuBar::taskQTBUG4965_escapeEaten() { +#ifdef Q_WS_MAC + QSKIP("On Mac, do not test the menubar with escape key", SkipAll); +#endif QMenuBar menubar; QMenu menu("menu1"); QAction *first = menubar.addMenu(&menu); -- cgit v0.12 From b463bd91f5e19ec597990ea736ee51a4baaca338 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 25 Nov 2009 11:47:46 +0100 Subject: stabilize tests on X11 --- tests/auto/qcombobox/tst_qcombobox.cpp | 2 ++ tests/auto/qmenubar/tst_qmenubar.cpp | 12 ++++++------ tests/auto/qwidget_window/tst_qwidget_window.cpp | 24 ++++++++++++++---------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index af71961..bd5cd70 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2516,10 +2516,12 @@ void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated() layout.addWidget(&edit); w.show(); + QApplication::setActiveWindow(&w); QTest::qWaitForWindowShown(&w); cb.clearEditText(); cb.setFocus(); QApplication::processEvents(); + QTRY_VERIFY(cb.hasFocus()); QTest::keyClick(0, '1'); QCOMPARE(spy.count(), 0); edit.setFocus(); diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 7fbb760..aa6caae 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -168,7 +168,7 @@ private slots: void task256322_highlight(); void menubarSizeHint(); void taskQTBUG4965_escapeEaten(); - + #if defined(QT3_SUPPORT) void indexBasedInsertion_data(); void indexBasedInsertion(); @@ -1360,7 +1360,7 @@ tst_QMenuBar::allowActiveAndDisabled() // disabled menu items are added QMenu fileMenu("&File"); - // Task 241043 : check that second menu is activated + // Task 241043 : check that second menu is activated // if all items are disabled QAction *act = fileMenu.addAction("Disabled"); act->setEnabled(false); @@ -1388,7 +1388,7 @@ tst_QMenuBar::allowActiveAndDisabled() QCOMPARE(mb->activeAction()->text(), fileMenu.title()); else QCOMPARE(mb->activeAction()->text(), fileMenu.title()); - + mb->hide(); #endif //Q_WS_MAC } @@ -1603,7 +1603,7 @@ void tst_QMenuBar::menubarSizeHint() virtual int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) const { // I chose strange values (prime numbers to be more sure that the size of the menubar is correct) - switch (metric) + switch (metric) { case QStyle::PM_MenuBarItemSpacing: return 7; @@ -1621,7 +1621,7 @@ void tst_QMenuBar::menubarSizeHint() QMenuBar mb; mb.setNativeMenuBar(false); //we can't check the geometry of native menubars - + mb.setStyle(&style); //this is a list of arbitrary strings so that we check the geometry QStringList list = QStringList() << "trer" << "ezrfgtgvqd" << "sdgzgzerzerzer" << "eerzertz" << "er"; @@ -1675,7 +1675,7 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten() QAction *first = menubar.addMenu(&menu); menu.addAction("quit", &menubar, SLOT(close()), QKeySequence("ESC")); menubar.show(); - menubar.setActiveWindow(); + QApplication::setActiveWindow(&menubar); QTest::qWaitForWindowShown(&menubar); menubar.setActiveAction(first); QTRY_VERIFY(menu.isVisible()); diff --git a/tests/auto/qwidget_window/tst_qwidget_window.cpp b/tests/auto/qwidget_window/tst_qwidget_window.cpp index 13d1d2d..ec11ab3 100644 --- a/tests/auto/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/qwidget_window/tst_qwidget_window.cpp @@ -52,6 +52,9 @@ #include #endif // Q_WS_X11 +#include "../../shared/util.h" + + class tst_QWidget_window : public QWidget { Q_OBJECT @@ -150,7 +153,7 @@ void tst_QWidget_window::tst_show_resize_hide_show() class TestWidget : public QWidget { public: - int m_first, m_next; + int m_first, m_next; bool paintEventReceived; void reset(){ m_first = m_next = 0; paintEventReceived = false; } @@ -163,7 +166,7 @@ public: case QEvent::Show: if (m_first) m_next = event->type(); - else + else m_first = event->type(); break; case QEvent::Paint: @@ -173,7 +176,7 @@ public: break; } return QWidget::event(event); - } + } }; void tst_QWidget_window::tst_windowFilePathAndwindowTitle_data() @@ -289,7 +292,7 @@ void tst_QWidget_window::tst_showWithoutActivating() #else QWidget w; w.show(); - qt_x11_wait_for_window_manager(&w); + QTest::qWaitForWindowShown(&w); QApplication::processEvents(); QApplication::clipboard(); @@ -302,8 +305,11 @@ void tst_QWidget_window::tst_showWithoutActivating() Window window; int revertto; - XGetInputFocus(QX11Info::display(), &window, &revertto); - QCOMPARE(lineEdit->winId(), window); + QTRY_COMPARE(lineEdit->winId(), + (XGetInputFocus(QX11Info::display(), &window, &revertto), window) ); + // Note the use of the , before window because we want the XGetInputFocus to be re-executed + // in each iteration of the inside loop of the QTRY_COMPARE macro + #endif // Q_WS_X11 } @@ -315,11 +321,9 @@ void tst_QWidget_window::tst_paintEventOnSecondShow() w.reset(); w.show(); -#ifdef Q_WS_X11 - QTest::qWait(500); -#endif + QTest::qWaitForWindowShown(&w); QApplication::processEvents(); - QVERIFY(w.paintEventReceived); + QTRY_VERIFY(w.paintEventReceived); } QTEST_MAIN(tst_QWidget_window) -- cgit v0.12 From 800ad1c685060bfb6f469a506e8cd85ff3d81577 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 25 Nov 2009 12:15:27 +0100 Subject: Removed unused setThemePalette(QStyleOption *option) Not used or missed, anywhere. Reviewed-By: Trustme --- src/gui/styles/qs60style.cpp | 5 ----- src/gui/styles/qs60style_p.h | 2 -- 2 files changed, 7 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b5c0d4f..03f7a95 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -459,11 +459,6 @@ void QS60StylePrivate::setThemePalette(QApplication *app) const storeThemePalette(&widgetPalette); } -void QS60StylePrivate::setThemePalette(QStyleOption *option) const -{ - setThemePalette(&option->palette); -} - QPalette* QS60StylePrivate::themePalette() { return m_themePalette; diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index ea86bb2..36979a2 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -418,8 +418,6 @@ public: //set theme palette for application void setThemePalette(QApplication *application) const; - //set theme palette for style option - void setThemePalette(QStyleOption *option) const; //access to theme palette static QPalette* themePalette(); -- cgit v0.12 From eaf355c488070a36eed6b99c794d4b055c788e15 Mon Sep 17 00:00:00 2001 From: ck Date: Wed, 25 Nov 2009 12:32:54 +0100 Subject: Assistant: Move tab widget allocation up. We follow the controversial RABU ("Resource Acquisition Before Usage") pattern here. Patch is actually by con. Reviewed-by: con --- tools/assistant/tools/assistant/centralwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 6f6875f..7488662 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -223,6 +223,7 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent) QString resourcePath = QLatin1String(":/trolltech/assistant/images/"); vboxLayout->setMargin(0); + tabWidget = new QTabWidget(this); #ifndef Q_OS_MAC resourcePath.append(QLatin1String("win")); #else @@ -230,7 +231,6 @@ CentralWidget::CentralWidget(QHelpEngine *engine, MainWindow *parent) tabWidget->setDocumentMode(true); #endif - tabWidget = new QTabWidget(this); connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentPageChanged(int))); -- cgit v0.12 From 41f58d51cec171ccfa132dad2d863340d3ed2db4 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 25 Nov 2009 09:44:32 +0100 Subject: Offset in MDI subwindow bar buttons under Mac OS 10.6 Task-number: QTBUG-5830 Reviewed-by: Richard --- src/gui/styles/qmacstyle_mac.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 51c2a96..4075cf7 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -4843,9 +4843,11 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex uint sc = SC_TitleBarMinButton; ThemeTitleBarWidget tbw = kThemeWidgetCollapseBox; bool active = titlebar->state & State_Active; - int border = 2; - titleBarRect.origin.x += border; - titleBarRect.origin.y -= border; + if (qMacVersion() < QSysInfo::MV_10_6) { + int border = 2; + titleBarRect.origin.x += border; + titleBarRect.origin.y -= border; + } while (sc <= SC_TitleBarCloseButton) { if (sc & titlebar->subControls) { -- cgit v0.12 From a30aa66726c1992a0b21b3663b8080661d899e13 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 25 Nov 2009 12:33:34 +0100 Subject: Test for the clipboard presence in autotest --- tests/auto/qlineedit/tst_qlineedit.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index dd5bb29..79d1b3a 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -1415,8 +1415,22 @@ void tst_QLineEdit::undo_keypressevents() } #ifndef QT_NO_CLIPBOARD +static bool nativeClipboardWorking() +{ +#ifdef Q_WS_MAC + PasteboardRef pasteboard; + OSStatus status = PasteboardCreate(0, &pasteboard); + if (status == noErr) + CFRelease(pasteboard); + return status == noErr; +#endif + return true; +} + void tst_QLineEdit::QTBUG5786_undoPaste() { + if (!nativeClipboardWorking()) + QSKIP("this machine doesn't support the clipboard", SkipAll); QString initial("initial"); QString string("test"); QString additional("add"); -- cgit v0.12 From 43f24759e063df96d01785061bb0905d0352d36b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 24 Nov 2009 18:01:51 +0100 Subject: another shot at fixing directory separators in build commands --- translations/translations.pri | 2 +- translations/translations.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/translations/translations.pri b/translations/translations.pri index 5eb7328..7a24a4f 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -9,7 +9,7 @@ defineReplace(prependAll) { } LUPDATE = $$QT_BUILD_TREE/bin/lupdate -locations relative -no-ui-lines -win32:isEmpty(QMAKE_SH):LUPDATE ~= s|/|\\|g +LUPDATE ~= s,/,$$QMAKE_DIR_SEP, ###### Qt Libraries diff --git a/translations/translations.pro b/translations/translations.pro index 60f84e6..ef09dc3 100644 --- a/translations/translations.pro +++ b/translations/translations.pro @@ -1,7 +1,7 @@ TRANSLATIONS = $$files(*.ts) LRELEASE = $$QT_BUILD_TREE/bin/lrelease -win32:isEmpty(QMAKE_SH):LRELEASE ~= s|/|\\|g +LRELEASE ~= s,/,$$QMAKE_DIR_SEP, contains(TEMPLATE_PREFIX, vc):vcproj = 1 -- cgit v0.12 From c361eb5bfc7613b9b584d1b58d5d372000f2a47d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 25 Nov 2009 12:45:08 +0100 Subject: fix class/struct mismatch in the bootstrap magic qlocale.h includes qobjectdefs.h which forward-declares it as a class. Reviewed-by: aportale --- tools/linguist/shared/translator.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index 353cf9d..fa447a3 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -55,10 +55,12 @@ QT_BEGIN_NAMESPACE #ifdef QT_BOOTSTRAPPED -struct QObject { +class QObject { +public: static QString tr(const char *sourceText, const char * = 0, int n = -1); }; -struct QCoreApplication : public QObject { +class QCoreApplication : public QObject { +public: enum Encoding { CodecForTr }; static QString translate(const char *, const char *sourceText, const char * = 0, Encoding = CodecForTr, int n = -1) -- cgit v0.12 From cee1c16a4738e30db5c011f4ae7e273387b5d998 Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Wed, 25 Nov 2009 14:10:45 +0200 Subject: Fixed crash when scrolling with deleted backingstore In Symbian we save memory by deleting widget backingstore from non-visible windows. 12-key FEP is fullscreen and causes the backing store to be deleted but still continues to scroll the view to show current caret position in focused lineedit control. Task-number: QTBUG-5922 Reviewed-by: Jason Barron --- src/gui/painting/qbackingstore.cpp | 2 ++ tests/auto/qwidget/tst_qwidget.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 8226797..1b8f413 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -949,6 +949,8 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy) return; QWidgetBackingStore *wbs = x->backingStore; + if (!wbs) + return; static int accelEnv = -1; if (accelEnv == -1) { diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 1e3f5f8..9960f47 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -391,6 +391,7 @@ private slots: #endif void focusProxyAndInputMethods(); + void scrollWithoutBackingStore(); private: bool ensureScreenSize(int width, int height); @@ -9703,5 +9704,42 @@ void tst_QWidget::focusProxyAndInputMethods() delete toplevel; } +class scrollWidgetWBS : public QWidget +{ +public: + void deleteBackingStore() + { + if (static_cast(d_ptr.data())->maybeBackingStore()) { + delete static_cast(d_ptr.data())->topData()->backingStore; + static_cast(d_ptr.data())->topData()->backingStore = 0; + } + } + void enableBackingStore() + { + if (!static_cast(d_ptr.data())->maybeBackingStore()) { + static_cast(d_ptr.data())->topData()->backingStore = new QWidgetBackingStore(this); + static_cast(d_ptr.data())->invalidateBuffer(this->rect()); + repaint(); + } + } +}; + +void tst_QWidget::scrollWithoutBackingStore() +{ + scrollWidgetWBS scrollable; + scrollable.resize(100,100); + QLabel child(QString("@"),&scrollable); + child.resize(50,50); + scrollable.show(); + QTest::qWaitForWindowShown(&scrollable); + scrollable.scroll(50,50); + QCOMPARE(child.pos(),QPoint(50,50)); + scrollable.deleteBackingStore(); + scrollable.scroll(-25,-25); + QCOMPARE(child.pos(),QPoint(25,25)); + scrollable.enableBackingStore(); + QCOMPARE(child.pos(),QPoint(25,25)); +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" -- cgit v0.12 From 48e56643f1b7daf7c255a1e58f0e213b06e15f65 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 25 Nov 2009 13:56:00 +0100 Subject: On Windows Flash is played only while moving mouse inside the plugin. Qt is using the same window message as Flash plugin. We need to check the window handle before we treat this as Qt internal message. Reviewed-by: Bradley T. Hughes --- src/corelib/kernel/qeventdispatcher_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index b3497b9..b197b9d 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -725,7 +725,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) } } if (haveMessage) { - if (msg.message == WM_QT_SENDPOSTEDEVENTS) { + if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) { if (seenWM_QT_SENDPOSTEDEVENTS) { needWM_QT_SENDPOSTEDEVENTS = true; continue; -- cgit v0.12 From e506a8dcd7d29ce32d339b05a2e3b904d4b4ed0c Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 25 Nov 2009 12:56:18 +0100 Subject: Fix the tablet device recognition on Windows The unique ID was not taking into account the bits 4, 5, 6, 7 of CSR_TYPE. Those bytes identify similar devices with different flavor/color. The cursor data were also not updated correctly. The information were only updated if the pointer type changes (e.g.: pen to eraser) but not if the physical device change (e.g. stylus to brush). The information are now updated every time a proximity event has a new unique ID. Reviewed-by: Denis Dzyubenko Task-number: QTBUG-1930 --- src/gui/kernel/qapplication_win.cpp | 199 +++++++++++++++++++++--------------- 1 file changed, 115 insertions(+), 84 deletions(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 05e75a2..b677228 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -243,8 +243,12 @@ static PtrWTGet ptrWTGet = 0; static PACKET localPacketBuf[QT_TABLET_NPACKETQSIZE]; // our own tablet packet queue. HCTX qt_tablet_context; // the hardware context for the tablet (like a window handle) bool qt_tablet_tilt_support; -static void tabletInit(UINT wActiveCsr, HCTX hTab); + +#ifndef QT_NO_TABLETEVENT +static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab); +static void tabletUpdateCursor(QTabletDeviceData &tdd, const UINT currentCursor); static void initWinTabFunctions(); // resolve the WINTAB api functions +#endif // QT_NO_TABLETEVENT #ifndef QT_NO_ACCESSIBILITY @@ -256,7 +260,7 @@ extern QWidget* qt_get_tablet_widget(); extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); extern QRegion qt_dirtyRegion(QWidget *); -typedef QHash QTabletCursorInfo; +typedef QHash QTabletCursorInfo; Q_GLOBAL_STATIC(QTabletCursorInfo, tCursorInfo) QTabletDeviceData currentTabletPointer; @@ -791,7 +795,9 @@ void qt_init(QApplicationPrivate *priv, int) if (QApplication::desktopSettingsAware()) qt_set_windows_resources(); +#ifndef QT_NO_TABLETEVENT initWinTabFunctions(); +#endif // QT_NO_TABLETEVENT QApplicationPrivate::inputContext = new QWinInputContext(0); // Read the initial cleartype settings... @@ -2325,25 +2331,43 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam } break; case WT_PROXIMITY: - if (ptrWTPacketsGet) { - bool enteredProximity = LOWORD(lParam) != 0; - PACKET proximityBuffer[QT_TABLET_NPACKETQSIZE]; - int totalPacks = ptrWTPacketsGet(qt_tablet_context, QT_TABLET_NPACKETQSIZE, proximityBuffer); - if (totalPacks > 0 && enteredProximity) { - uint currentCursor = proximityBuffer[0].pkCursor; - if (!tCursorInfo()->contains(currentCursor)) - tabletInit(currentCursor, qt_tablet_context); - currentTabletPointer = tCursorInfo()->value(currentCursor); + + #ifndef QT_NO_TABLETEVENT + if (ptrWTPacketsGet && ptrWTInfo) { + const bool enteredProximity = LOWORD(lParam) != 0; + PACKET proximityBuffer[1]; // we are only interested in the first packet in this case + const int totalPacks = ptrWTPacketsGet(qt_tablet_context, 1, proximityBuffer); + if (totalPacks > 0) { + const UINT currentCursor = proximityBuffer[0].pkCursor; + + UINT csr_physid; + ptrWTInfo(WTI_CURSORS + currentCursor, CSR_PHYSID, &csr_physid); + UINT csr_type; + ptrWTInfo(WTI_CURSORS + currentCursor, CSR_TYPE, &csr_type); + const UINT deviceIdMask = 0xFF6; // device type mask && device color mask + quint64 uniqueId = (csr_type & deviceIdMask); + uniqueId = (uniqueId << 32) | csr_physid; + + // initialising and updating the cursor should be done in response to + // WT_CSRCHANGE. We do it in WT_PROXIMITY because some wintab never send + // the event WT_CSRCHANGE even if asked with CXO_CSRMESSAGES + const QTabletCursorInfo *const globalCursorInfo = tCursorInfo(); + if (!globalCursorInfo->contains(uniqueId)) + tabletInit(uniqueId, csr_type, qt_tablet_context); + + currentTabletPointer = globalCursorInfo->value(uniqueId); + tabletUpdateCursor(currentTabletPointer, currentCursor); } qt_tabletChokeMouse = false; -#ifndef QT_NO_TABLETEVENT + QTabletEvent tabletProximity(enteredProximity ? QEvent::TabletEnterProximity : QEvent::TabletLeaveProximity, QPoint(), QPoint(), QPointF(), currentTabletPointer.currentDevice, currentTabletPointer.currentPointerType, 0, 0, 0, 0, 0, 0, 0, currentTabletPointer.llId); QApplication::sendEvent(qApp, &tabletProximity); -#endif // QT_NO_TABLETEVENT } + #endif // QT_NO_TABLETEVENT + break; #ifdef Q_WS_WINCE_WM case WM_SETFOCUS: { @@ -3317,63 +3341,57 @@ bool QETWidget::translateWheelEvent(const MSG &msg) // the following is adapted from the wintab syspress example (public domain) /* -------------------------------------------------------------------------- */ -static void tabletInit(UINT wActiveCsr, HCTX hTab) +// Initialize the "static" information of a cursor device (pen, airbrush, etc). +// The QTabletDeviceData is initialized with the data that do not change in time +// (number of button, type of device, etc) but do not initialize the variable data +// (e.g.: pen or eraser) +#ifndef QT_NO_TABLETEVENT + +static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab) { + Q_ASSERT(ptrWTInfo); + Q_ASSERT(ptrWTGet); + + Q_ASSERT(!tCursorInfo()->contains(uniqueId)); + /* browse WinTab's many info items to discover pressure handling. */ - if (ptrWTInfo && ptrWTGet) { - AXIS np; - LOGCONTEXT lc; - BYTE wPrsBtn; - BYTE logBtns[32]; - UINT size; - - /* discover the LOGICAL button generated by the pressure channel. */ - /* get the PHYSICAL button from the cursor category and run it */ - /* through that cursor's button map (usually the identity map). */ - wPrsBtn = (BYTE)-1; - ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_NPBUTTON, &wPrsBtn); - size = ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_BUTTONMAP, &logBtns); - if ((UINT)wPrsBtn < size) - wPrsBtn = logBtns[wPrsBtn]; - - /* get the current context for its device variable. */ - ptrWTGet(hTab, &lc); - - /* get the size of the pressure axis. */ - QTabletDeviceData tdd; - ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_NPRESSURE, &np); - tdd.minPressure = int(np.axMin); - tdd.maxPressure = int(np.axMax); - - ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_TPRESSURE, &np); - tdd.minTanPressure = int(np.axMin); - tdd.maxTanPressure = int(np.axMax); - - LOGCONTEXT lcMine; - - /* get default region */ - ptrWTInfo(WTI_DEFCONTEXT, 0, &lcMine); - - tdd.minX = 0; - tdd.maxX = int(lcMine.lcInExtX) - int(lcMine.lcInOrgX); - - tdd.minY = 0; - tdd.maxY = int(lcMine.lcInExtY) - int(lcMine.lcInOrgY); - - tdd.minZ = 0; - tdd.maxZ = int(lcMine.lcInExtZ) - int(lcMine.lcInOrgZ); - - int csr_type, - csr_physid; - ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_TYPE, &csr_type); - ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_PHYSID, &csr_physid); - tdd.llId = csr_type & 0x0F06; - tdd.llId = (tdd.llId << 24) | csr_physid; -#ifndef QT_NO_TABLETEVENT - if (((csr_type & 0x0006) == 0x0002) && ((csr_type & 0x0F06) != 0x0902)) { - tdd.currentDevice = QTabletEvent::Stylus; - } else { - switch (csr_type & 0x0F06) { + AXIS np; + LOGCONTEXT lc; + + /* get the current context for its device variable. */ + ptrWTGet(hTab, &lc); + + /* get the size of the pressure axis. */ + QTabletDeviceData tdd; + tdd.llId = uniqueId; + + ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_NPRESSURE, &np); + tdd.minPressure = int(np.axMin); + tdd.maxPressure = int(np.axMax); + + ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_TPRESSURE, &np); + tdd.minTanPressure = int(np.axMin); + tdd.maxTanPressure = int(np.axMax); + + LOGCONTEXT lcMine; + + /* get default region */ + ptrWTInfo(WTI_DEFCONTEXT, 0, &lcMine); + + tdd.minX = 0; + tdd.maxX = int(lcMine.lcInExtX) - int(lcMine.lcInOrgX); + + tdd.minY = 0; + tdd.maxY = int(lcMine.lcInExtY) - int(lcMine.lcInOrgY); + + tdd.minZ = 0; + tdd.maxZ = int(lcMine.lcInExtZ) - int(lcMine.lcInOrgZ); + + const uint cursorTypeBitMask = 0x0F06; // bitmask to find the specific cursor type (see Wacom FAQ) + if (((csr_type & 0x0006) == 0x0002) && ((csr_type & cursorTypeBitMask) != 0x0902)) { + tdd.currentDevice = QTabletEvent::Stylus; + } else { + switch (csr_type & cursorTypeBitMask) { case 0x0802: tdd.currentDevice = QTabletEvent::Stylus; break; @@ -3391,26 +3409,34 @@ static void tabletInit(UINT wActiveCsr, HCTX hTab) break; default: tdd.currentDevice = QTabletEvent::NoDevice; - } - } - - switch (wActiveCsr % 3) { - case 2: - tdd.currentPointerType = QTabletEvent::Eraser; - break; - case 1: - tdd.currentPointerType = QTabletEvent::Pen; - break; - case 0: - tdd.currentPointerType = QTabletEvent::Cursor; - break; - default: - tdd.currentPointerType = QTabletEvent::UnknownPointer; } + } + tCursorInfo()->insert(uniqueId, tdd); +} #endif // QT_NO_TABLETEVENT - tCursorInfo()->insert(wActiveCsr, tdd); + +// Update the "dynamic" informations of a cursor device (pen, airbrush, etc). +// The dynamic information is the information of QTabletDeviceData that can change +// in time (eraser or pen if a device is turned around). +#ifndef QT_NO_TABLETEVENT + +static void tabletUpdateCursor(QTabletDeviceData &tdd, const UINT currentCursor) +{ + switch (currentCursor % 3) { // %3 for dual track + case 0: + tdd.currentPointerType = QTabletEvent::Cursor; + break; + case 1: + tdd.currentPointerType = QTabletEvent::Pen; + break; + case 2: + tdd.currentPointerType = QTabletEvent::Eraser; + break; + default: + tdd.currentPointerType = QTabletEvent::UnknownPointer; } } +#endif // QT_NO_TABLETEVENT bool QETWidget::translateTabletEvent(const MSG &msg, PACKET *localPacketBuf, int numPackets) @@ -3546,6 +3572,10 @@ bool QETWidget::translateTabletEvent(const MSG &msg, PACKET *localPacketBuf, } extern bool qt_is_gui_used; + + +#ifndef QT_NO_TABLETEVENT + static void initWinTabFunctions() { #if defined(Q_OS_WINCE) @@ -3564,6 +3594,7 @@ static void initWinTabFunctions() } #endif // Q_OS_WINCE } +#endif // QT_NO_TABLETEVENT // -- cgit v0.12 From af628d615a6e28a5c539bec818f0eb9792f05756 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Wed, 25 Nov 2009 13:20:25 +0200 Subject: Fix Broadcast receiver example. The broadcast receiver should share the port number. In most cases users won't run the example on a network, but only on one machine. In the case it simply should work too. According to our documentation the fix is platform specific, it will work only on Linux. Reviewed-by: Peter Hartmann --- examples/network/broadcastreceiver/receiver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/network/broadcastreceiver/receiver.cpp b/examples/network/broadcastreceiver/receiver.cpp index 0a5922b..7889a05 100644 --- a/examples/network/broadcastreceiver/receiver.cpp +++ b/examples/network/broadcastreceiver/receiver.cpp @@ -52,7 +52,7 @@ Receiver::Receiver(QWidget *parent) //! [0] udpSocket = new QUdpSocket(this); - udpSocket->bind(45454); + udpSocket->bind(45454, QUdpSocket::ShareAddress); //! [0] //! [1] -- cgit v0.12 From ab6fd6f9755ecbd556f1a7824ca0c3fa88148b87 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 25 Nov 2009 13:43:22 +0200 Subject: Fixes for tab/space usage in qwidget.cpp. Reviewed-by: TrustMe --- src/gui/kernel/qwidget.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index fbb9115..b389054 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -4605,7 +4605,7 @@ void QWidgetPrivate::updateFont(const QFont &font) if (!q->parentWidget() && extra && extra->proxyWidget) { QGraphicsProxyWidget *p = extra->proxyWidget; inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve(); - } else + } else #endif //QT_NO_GRAPHICSVIEW if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { inheritedFontResolveMask = 0; @@ -9897,13 +9897,13 @@ void QWidget::scroll(int dx, int dy) Q_D(QWidget); #ifndef QT_NO_GRAPHICSVIEW if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) { - // Graphics View maintains its own dirty region as a list of rects; - // until we can connect item updates directly to the view, we must - // separately add a translated dirty region. - if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects()) - proxy->update(rect); - } + // Graphics View maintains its own dirty region as a list of rects; + // until we can connect item updates directly to the view, we must + // separately add a translated dirty region. + if (!d->dirty.isEmpty()) { + foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects()) + proxy->update(rect); + } proxy->scroll(dx, dy, proxy->subWidgetRect(this)); return; } @@ -9932,13 +9932,13 @@ void QWidget::scroll(int dx, int dy, const QRect &r) Q_D(QWidget); #ifndef QT_NO_GRAPHICSVIEW if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) { - // Graphics View maintains its own dirty region as a list of rects; - // until we can connect item updates directly to the view, we must - // separately add a translated dirty region. - if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects()) - proxy->update(rect); - } + // Graphics View maintains its own dirty region as a list of rects; + // until we can connect item updates directly to the view, we must + // separately add a translated dirty region. + if (!d->dirty.isEmpty()) { + foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects()) + proxy->update(rect); + } proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint())); return; } -- cgit v0.12 From b461da1040c32d6690870290d6716a3b5cb7e9e9 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 25 Nov 2009 14:47:33 +0200 Subject: Fixed context menu not to have "Options" action. When calling QMainWindow::setMenuBar(), menuBarAction ("Options") gets added to widget actions list. This actions will be shown in widget context menu if visible. That's why we set the action invisible. Visibility property does not have impact to softkey contruction, i.e. also invisble softkeys are added. Task-number: QTBUG-6220 Reviewed-by: Jason Barron --- src/gui/widgets/qmainwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 501e62f..557acfb 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -120,6 +120,7 @@ void QMainWindowPrivate::init() #ifdef QT_SOFTKEYS_ENABLED menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q); menuBarAction->setObjectName(QLatin1String("_q_menuSoftKeyAction")); + menuBarAction->setVisible(false); #endif } -- cgit v0.12 From de593891c0e65c74d92958a7f6262ee01c055902 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 25 Nov 2009 14:11:06 +0100 Subject: Micro optimization Don't request a palette if you do not use it. Reviewed-By: Trustme --- 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 03f7a95..974c3ff 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -633,11 +633,11 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const { if(!widget) return; - QPalette widgetPalette = QApplication::palette(widget); //header view and its viewport need to be set 100% transparent button color, since drawing code will //draw transparent theme graphics to table column and row headers. if (qobject_cast(widget)){ + QPalette widgetPalette = QApplication::palette(widget); widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); QHeaderView* header = qobject_cast(widget); -- cgit v0.12 From 2a3a270e5d2a26b9ef7405abfa1892beaece9b04 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 25 Nov 2009 15:48:22 +0200 Subject: Fix for "saxbookmarks - file dialog starts in wrong directory (winscw)" QCoreApplication::applicationFilePath() in emulator returns path to Z drive. Use QDesktopServices instead which always returns the writable drive. Task-number: QTBUG-6117 Reviewed-by: Miikka Heikkinen --- examples/xml/saxbookmarks/mainwindow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/xml/saxbookmarks/mainwindow.cpp b/examples/xml/saxbookmarks/mainwindow.cpp index 49cb468..ff3cf11 100644 --- a/examples/xml/saxbookmarks/mainwindow.cpp +++ b/examples/xml/saxbookmarks/mainwindow.cpp @@ -67,8 +67,11 @@ MainWindow::MainWindow() void MainWindow::open() { #if defined(Q_OS_SYMBIAN) - // Always look for bookmarks on the same drive where the application is installed to. - QString bookmarksFolder = QCoreApplication::applicationFilePath().left(1); + // Look for bookmarks on the same drive where the application is installed to, + // if drive is not read only. QDesktopServices::DataLocation does this check, + // and returns writable drive. + QString bookmarksFolder = + QDesktopServices::storageLocation(QDesktopServices::DataLocation).left(1); bookmarksFolder.append(":/Data/qt/saxbookmarks"); QDir::setCurrent(bookmarksFolder); #endif -- cgit v0.12 From d393ab41a56ef96113fe7928ff30e2ea96825ff1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 25 Nov 2009 15:21:02 +0100 Subject: fix languagechange test --- tests/auto/languagechange/tst_languagechange.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/languagechange/tst_languagechange.cpp b/tests/auto/languagechange/tst_languagechange.cpp index 1319f15..449d34b 100644 --- a/tests/auto/languagechange/tst_languagechange.cpp +++ b/tests/auto/languagechange/tst_languagechange.cpp @@ -193,7 +193,7 @@ void tst_languageChange::retranslatability_data() #else << "QFileSystemModel::Type::All other platforms" #endif - << "QFileSystemModel::%1 KB" +// << "QFileSystemModel::%1 KB" << "QDialogButtonBox::Cancel" << "QDialogButtonBox::Open" << "QFileDialog::File &name:"); @@ -232,6 +232,7 @@ void tst_languageChange::retranslatability() QSKIP("The native file dialog is used on Mac OS", SkipSingle); #endif QFileDialog dlg; + dlg.setOption(QFileDialog::DontUseNativeDialog); QString tmpParentDir = QDir::tempPath() + "/languagechangetestdir"; QString tmpDir = tmpParentDir + "/finaldir"; QString fooName = tmpParentDir + "/foo"; -- cgit v0.12 From 8ebc15eb2768fab8a9e746785e0c67efb4ace02b Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Wed, 25 Nov 2009 15:19:13 +0100 Subject: Compile for 64-bit Windows The integral type should be a 64-bit integer, not long (which is only 32-bit even when building 64-bit). Reviewed-by: Prasanth Ullattil Task-number: QTBUG-6079 --- src/corelib/thread/qbasicatomic.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index 7b86ee0..5017dbd 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -137,7 +137,12 @@ public: #if defined(QT_ARCH_WINDOWS) || defined(QT_ARCH_WINDOWSCE) union { T * volatile _q_value; - long volatile _q_value_integral; +# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) + qint64 +# else + long +# endif + volatile _q_value_integral; }; #else T * volatile _q_value; -- cgit v0.12 From e4710b39900023796aa785f84ea2ec6a725662d9 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 25 Nov 2009 15:34:14 +0100 Subject: Fix RCC test --- tests/auto/rcc/data/images.expected | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/rcc/data/images.expected b/tests/auto/rcc/data/images.expected index 24d75b6..71be819 100644 --- a/tests/auto/rcc/data/images.expected +++ b/tests/auto/rcc/data/images.expected @@ -97,10 +97,10 @@ static const unsigned char qt_resource_struct[] = { QT_BEGIN_NAMESPACE -extern bool qRegisterResourceData +extern Q_CORE_EXPORT bool qRegisterResourceData (int, const unsigned char *, const unsigned char *, const unsigned char *); -extern bool qUnregisterResourceData +extern Q_CORE_EXPORT bool qUnregisterResourceData (int, const unsigned char *, const unsigned char *, const unsigned char *); QT_END_NAMESPACE -- cgit v0.12 From 7b845236d8670bb9cb5884ea60f422d09dafd89c Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 25 Nov 2009 13:56:00 +0100 Subject: On Windows Flash is played only while moving mouse inside the plugin. Qt is using the same window message as Flash plugin. We need to check the window handle before we treat this as Qt internal message. Reviewed-by: Bradley T. Hughes (cherry picked from commit 48e56643f1b7daf7c255a1e58f0e213b06e15f65) --- src/corelib/kernel/qeventdispatcher_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index b3497b9..b197b9d 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -725,7 +725,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) } } if (haveMessage) { - if (msg.message == WM_QT_SENDPOSTEDEVENTS) { + if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) { if (seenWM_QT_SENDPOSTEDEVENTS) { needWM_QT_SENDPOSTEDEVENTS = true; continue; -- cgit v0.12 From c5eea852c73bab203541a08757be2c3cf9a18c1c Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 25 Nov 2009 15:35:42 +0100 Subject: Make the spinbox and doublespinbox better accept intermediate input Task-number: QTBUG-5008 Reviewed-by: ogoffart --- src/gui/widgets/qspinbox.cpp | 100 ++++++++--------------- tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp | 38 ++++++++- tests/auto/qspinbox/tst_qspinbox.cpp | 34 ++++++++ 3 files changed, 104 insertions(+), 68 deletions(-) diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp index 9eb07ac..50b225c 100644 --- a/src/gui/widgets/qspinbox.cpp +++ b/src/gui/widgets/qspinbox.cpp @@ -65,14 +65,13 @@ class QSpinBoxPrivate : public QAbstractSpinBoxPrivate { Q_DECLARE_PUBLIC(QSpinBox) public: - QSpinBoxPrivate(QWidget *parent = 0); + QSpinBoxPrivate(); void emitSignals(EmitPolicy ep, const QVariant &); virtual QVariant valueFromText(const QString &n) const; virtual QString textFromValue(const QVariant &n) const; QVariant validateAndInterpret(QString &input, int &pos, QValidator::State &state) const; - QChar thousand; inline void init() { Q_Q(QSpinBox); @@ -85,7 +84,7 @@ class QDoubleSpinBoxPrivate : public QAbstractSpinBoxPrivate { Q_DECLARE_PUBLIC(QDoubleSpinBox) public: - QDoubleSpinBoxPrivate(QWidget *parent = 0); + QDoubleSpinBoxPrivate(); void emitSignals(EmitPolicy ep, const QVariant &); virtual QVariant valueFromText(const QString &n) const; @@ -95,7 +94,6 @@ public: double round(double input) const; // variables int decimals; - QChar delimiter, thousand; inline void init() { Q_Q(QDoubleSpinBox); @@ -201,7 +199,7 @@ public: */ QSpinBox::QSpinBox(QWidget *parent) - : QAbstractSpinBox(*new QSpinBoxPrivate(parent), parent) + : QAbstractSpinBox(*new QSpinBoxPrivate, parent) { Q_D(QSpinBox); d->init(); @@ -213,7 +211,7 @@ QSpinBox::QSpinBox(QWidget *parent) argument and then use setObjectName() instead. */ QSpinBox::QSpinBox(QWidget *parent, const char *name) - : QAbstractSpinBox(*new QSpinBoxPrivate(parent), parent) + : QAbstractSpinBox(*new QSpinBoxPrivate, parent) { Q_D(QSpinBox); setObjectName(QString::fromAscii(name)); @@ -225,7 +223,7 @@ QSpinBox::QSpinBox(QWidget *parent, const char *name) argument and then use setObjectName() instead. */ QSpinBox::QSpinBox(int minimum, int maximum, int step, QWidget *parent, const char *name) - : QAbstractSpinBox(*new QSpinBoxPrivate(parent), parent) + : QAbstractSpinBox(*new QSpinBoxPrivate, parent) { Q_D(QSpinBox); d->minimum = QVariant(qMin(minimum, maximum)); @@ -464,10 +462,9 @@ void QSpinBox::setRange(int minimum, int maximum) QString QSpinBox::textFromValue(int value) const { - Q_D(const QSpinBox); QString str = locale().toString(value); if (qAbs(value) >= 1000 || value == INT_MIN) { - str.remove(d->thousand); + str.remove(locale().groupSeparator()); } return str; @@ -516,9 +513,7 @@ QValidator::State QSpinBox::validate(QString &text, int &pos) const */ void QSpinBox::fixup(QString &input) const { - Q_D(const QSpinBox); - - input.remove(d->thousand); + input.remove(locale().groupSeparator()); } @@ -600,7 +595,7 @@ void QSpinBox::fixup(QString &input) const \sa setMinimum(), setMaximum(), setSingleStep() */ QDoubleSpinBox::QDoubleSpinBox(QWidget *parent) - : QAbstractSpinBox(*new QDoubleSpinBoxPrivate(parent), parent) + : QAbstractSpinBox(*new QDoubleSpinBoxPrivate, parent) { Q_D(QDoubleSpinBox); d->init(); @@ -875,7 +870,7 @@ QString QDoubleSpinBox::textFromValue(double value) const Q_D(const QDoubleSpinBox); QString str = locale().toString(value, 'f', d->decimals); if (qAbs(value) >= 1000.0) { - str.remove(d->thousand); + str.remove(locale().groupSeparator()); } return str; } @@ -920,9 +915,7 @@ QValidator::State QDoubleSpinBox::validate(QString &text, int &pos) const */ void QDoubleSpinBox::fixup(QString &input) const { - Q_D(const QDoubleSpinBox); - - input.remove(d->thousand); + input.remove(locale().groupSeparator()); } // --- QSpinBoxPrivate --- @@ -932,18 +925,13 @@ void QDoubleSpinBox::fixup(QString &input) const Constructs a QSpinBoxPrivate object */ -QSpinBoxPrivate::QSpinBoxPrivate(QWidget *parent) +QSpinBoxPrivate::QSpinBoxPrivate() { minimum = QVariant((int)0); maximum = QVariant((int)99); value = minimum; singleStep = QVariant((int)1); type = QVariant::Int; - const QString str = (parent ? parent->locale() : QLocale()).toString(4567); - if (str.size() == 5) { - thousand = QChar(str.at(1)); - } - } /*! @@ -1019,20 +1007,17 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, state = QValidator::Invalid; // special-case -0 will be interpreted as 0 and thus not be invalid with a range from 0-100 } else { bool ok = false; - bool removedThousand = false; num = locale.toInt(copy, &ok, 10); - if (!ok && copy.contains(thousand) && (max >= 1000 || min <= -1000)) { - const int s = copy.size(); - copy.remove(thousand); - pos = qMax(0, pos - (s - copy.size())); - removedThousand = true; - num = locale.toInt(copy, &ok, 10); + if (!ok && copy.contains(locale.groupSeparator()) && (max >= 1000 || min <= -1000)) { + QString copy2 = copy; + copy2.remove(locale.groupSeparator()); + num = locale.toInt(copy2, &ok, 10); } QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num; if (!ok) { state = QValidator::Invalid; } else if (num >= min && num <= max) { - state = removedThousand ? QValidator::Intermediate : QValidator::Acceptable; + state = QValidator::Acceptable; } else if (max == min) { state = QValidator::Invalid; } else { @@ -1064,7 +1049,7 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, Constructs a QSpinBoxPrivate object */ -QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate(QWidget *parent) +QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate() { minimum = QVariant(0.0); maximum = QVariant(99.99); @@ -1072,15 +1057,6 @@ QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate(QWidget *parent) singleStep = QVariant(1.0); decimals = 2; type = QVariant::Double; - const QString str = (parent ? parent->locale() : QLocale()).toString(4567.1); - if (str.size() == 6) { - delimiter = str.at(4); - thousand = QChar((ushort)0); - } else if (str.size() == 7) { - thousand = str.at(1); - delimiter = str.at(5); - } - Q_ASSERT(!delimiter.isNull()); } /*! @@ -1155,7 +1131,7 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, state = max != min ? QValidator::Intermediate : QValidator::Invalid; goto end; case 1: - if (copy.at(0) == delimiter + if (copy.at(0) == locale.decimalPoint() || (plus && copy.at(0) == QLatin1Char('+')) || (minus && copy.at(0) == QLatin1Char('-'))) { state = QValidator::Intermediate; @@ -1163,7 +1139,7 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, } break; case 2: - if (copy.at(1) == delimiter + if (copy.at(1) == locale.decimalPoint() && ((plus && copy.at(0) == QLatin1Char('+')) || (minus && copy.at(0) == QLatin1Char('-')))) { state = QValidator::Intermediate; goto end; @@ -1172,14 +1148,14 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, default: break; } - if (copy.at(0) == thousand) { + if (copy.at(0) == locale.groupSeparator()) { QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; state = QValidator::Invalid; goto end; } else if (len > 1) { - const int dec = copy.indexOf(delimiter); + const int dec = copy.indexOf(locale.decimalPoint()); if (dec != -1) { - if (dec + 1 < copy.size() && copy.at(dec + 1) == delimiter && pos == dec + 1) { + if (dec + 1 < copy.size() && copy.at(dec + 1) == locale.decimalPoint() && pos == dec + 1) { copy.remove(dec + 1, 1); // typing a delimiter when you are on the delimiter } // should be treated as typing right arrow @@ -1189,7 +1165,7 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, goto end; } for (int i=dec + 1; i -1000 && copy.contains(thousand)) { + if (locale.groupSeparator().isPrint()) { + if (max < 1000 && min > -1000 && copy.contains(locale.groupSeparator())) { state = QValidator::Invalid; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; goto end; @@ -1227,27 +1202,23 @@ QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, const int len = copy.size(); for (int i=0; i= min && num <= max) { - state = notAcceptable ? QValidator::Intermediate : QValidator::Acceptable; - QSBDEBUG() << __FILE__ << __LINE__<< "state is set to " - << (state == QValidator::Intermediate ? "Intermediate" : "Acceptable"); + state = QValidator::Acceptable; + QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Acceptable"; } else if (max == min) { // when max and min is the same the only non-Invalid input is max (or min) state = QValidator::Invalid; QSBDEBUG() << __FILE__ << __LINE__<< "state is set to Invalid"; diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp index 3d2fa42..7d7453b 100644 --- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp @@ -147,6 +147,8 @@ private slots: void task221221(); void task255471_decimalsValidation(); + void taskQTBUG_5008_textFromValueAndValidate(); + public slots: void valueChangedHelper(const QString &); void valueChangedHelper(double); @@ -682,7 +684,7 @@ void tst_QDoubleSpinBox::valueFromTextAndValidate_data() QTest::newRow("data10") << QString(" 1") << Acceptable << 0.0 << 100.0 << (int)QLocale::Norwegian << QString("1"); QTest::newRow("data11") << QString(" 1") << Acceptable << 0.0 << 100.0 << (int)QLocale::C << QString("1"); QTest::newRow("data12") << QString("1,") << Acceptable << 0.0 << 100.0 << (int)QLocale::Norwegian << QString(); - QTest::newRow("data13") << QString("1,") << Intermediate << 0.0 << 1000.0 << (int)QLocale::C << QString(); + QTest::newRow("data13") << QString("1,") << Acceptable << 0.0 << 1000.0 << (int)QLocale::C << QString(); QTest::newRow("data14") << QString("1, ") << Acceptable << 0.0 << 100.0 << (int)QLocale::Norwegian << QString("1,"); QTest::newRow("data15") << QString("1, ") << Invalid << 0.0 << 100.0 << (int)QLocale::C << QString(); QTest::newRow("data16") << QString("2") << Intermediate << 100.0 << 102.0 << (int)QLocale::C << QString(); @@ -717,8 +719,8 @@ void tst_QDoubleSpinBox::valueFromTextAndValidate_data() QTest::newRow("data45") << QString("200,2") << Invalid << 0.0 << 1000.0 << (int)QLocale::C << QString(); QTest::newRow("data46") << QString("200,2") << Acceptable << 0.0 << 1000.0 << (int)QLocale::German << QString(); QTest::newRow("data47") << QString("2.2") << Acceptable << 0.0 << 1000.0 << (int)QLocale::C << QString(); - QTest::newRow("data48") << QString("2.2") << Intermediate << 0.0 << 1000.0 << (int)QLocale::German << QString(); - QTest::newRow("data49") << QString("2.2,00") << Intermediate << 0.0 << 1000.0 << (int)QLocale::German << QString(); + QTest::newRow("data48") << QString("2.2") << Acceptable << 0.0 << 1000.0 << (int)QLocale::German << QString(); + QTest::newRow("data49") << QString("2.2,00") << Acceptable << 0.0 << 1000.0 << (int)QLocale::German << QString(); QTest::newRow("data50") << QString("2.2") << Acceptable << 0.0 << 1000.0 << (int)QLocale::C << QString(); QTest::newRow("data51") << QString("2.2,00") << Invalid << 0.0 << 1000.0 << (int)QLocale::C << QString(); QTest::newRow("data52") << QString("2..2,00") << Invalid << 0.0 << 1000.0 << (int)QLocale::German << QString(); @@ -1044,6 +1046,36 @@ void tst_QDoubleSpinBox::task255471_decimalsValidation() } } +void tst_QDoubleSpinBox::taskQTBUG_5008_textFromValueAndValidate() +{ + class DecoratedSpinBox : public QDoubleSpinBox + { + friend class tst_QDoubleSpinBox; + public: + DecoratedSpinBox() + { + setLocale(QLocale::French); + setMaximum(100000000); + setValue(1000); + } + + //we use the French delimiters here + QString textFromValue (double value) const + { + return locale().toString(value); + } + } spinbox; + spinbox.show(); + spinbox.activateWindow(); + spinbox.setFocus(); + QTest::qWaitForWindowShown(&spinbox); + QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); + spinbox.lineEdit()->setCursorPosition(2); //just after the first thousand separator + QTest::keyClick(0, Qt::Key_0); // let's insert a 0 + QCOMPARE(spinbox.value(), 10000.); + spinbox.clearFocus(); //make sure the value is correctly formatted + QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); +} QTEST_MAIN(tst_QDoubleSpinBox) #include "tst_qdoublespinbox.moc" diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index 2389060..d2fe2ac 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -146,6 +146,8 @@ private slots: void sizeHint(); + void taskQTBUG_5008_textFromValueAndValidate(); + public slots: void valueChangedHelper(const QString &); void valueChangedHelper(int); @@ -1004,5 +1006,37 @@ void tst_QSpinBox::sizeHint() delete widget; } +void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate() +{ + class DecoratedSpinBox : public QSpinBox + { + friend class tst_QSpinBox; + public: + DecoratedSpinBox() + { + setLocale(QLocale::French); + setMaximum(100000000); + setValue(1000000); + } + + //we use the French delimiters here + QString textFromValue (int value) const + { + return locale().toString(value); + } + } spinbox; + spinbox.show(); + spinbox.activateWindow(); + spinbox.setFocus(); + QTest::qWaitForWindowShown(&spinbox); + QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); + spinbox.lineEdit()->setCursorPosition(2); //just after the first thousand separator + QTest::keyClick(0, Qt::Key_0); // let's insert a 0 + QCOMPARE(spinbox.value(), 10000000); //it's been multiplied by 10 + spinbox.clearFocus(); //make sure the value is correctly formatted + QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); +} + + QTEST_MAIN(tst_QSpinBox) #include "tst_qspinbox.moc" -- cgit v0.12 From 7f2f38d48b58b6b1ef90198bf2d03422826a5b08 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 25 Nov 2009 15:38:45 +0100 Subject: Cocoa: 'Quit' in menu bar does not work If you have two window, each with its own menu bar that has a 'Quit' action, we reuse the quit menu item when switching between the windows. Now, it we deleteLater one of the menu bars, the new menubar will update the 'Quit' item just before deleteLater will come along and remote the update again. This patch will fix this. Task-number: QTBUG-4684 Reviewed-by: Prasanth --- src/gui/kernel/qcocoamenuloader_mac.mm | 7 ++++++- src/gui/widgets/qmenu_mac.mm | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm index 9ab077f..990571d 100644 --- a/src/gui/kernel/qcocoamenuloader_mac.mm +++ b/src/gui/kernel/qcocoamenuloader_mac.mm @@ -76,9 +76,14 @@ QT_USE_NAMESPACE - (void)ensureAppMenuInMenu:(NSMenu *)menu { + // The application menu is the menu in the menu bar that contains the + // 'Quit' item. When changing menu bar (e.g when swithing between + // windows with different menu bars), we never recreate this menu, but + // instead pull it out the current menu bar and place into the new one: NSMenu *mainMenu = [NSApp mainMenu]; if ([NSApp mainMenu] == menu) - return; // nothing to do! + return; // nothing to do (menu is the current menu bar)! + #ifndef QT_NAMESPACE Q_ASSERT(mainMenu); #endif diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 9510cc6..8b371e5 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -774,8 +774,12 @@ QMacMenuAction::~QMacMenuAction() && menuItem != [getMenuLoader() quitMenuItem]) { [menuItem setHidden:YES]; } + // Only clear the tag if it points to this action. Since items like + // 'Quit' is being reused, we sometimes end up redirecting the item + // before deleting the assosiated action. + if (action.data() == reinterpret_cast([menuItem tag])) + [menuItem setTag:nil]; } - [menuItem setTag:nil]; [menuItem release]; #endif } -- cgit v0.12 From 41a8700c18b805d862c10847d29d30fd2d28911e Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 25 Nov 2009 15:51:03 +0100 Subject: autotest fix: mac shows sizegrip when window is maximized --- tests/auto/qstatusbar/tst_qstatusbar.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/qstatusbar/tst_qstatusbar.cpp b/tests/auto/qstatusbar/tst_qstatusbar.cpp index 92d9185..03d8ca8 100644 --- a/tests/auto/qstatusbar/tst_qstatusbar.cpp +++ b/tests/auto/qstatusbar/tst_qstatusbar.cpp @@ -266,10 +266,15 @@ void tst_QStatusBar::QTBUG4334_hiddenOnMaximizedWindow() main.setStatusBar(&statusbar); main.showMaximized(); QTest::qWaitForWindowShown(&main); +#ifndef Q_WS_MAC QVERIFY(!statusbar.findChild()->isVisible()); +#endif main.showNormal(); QTest::qWaitForWindowShown(&main); QVERIFY(statusbar.findChild()->isVisible()); + main.showFullScreen(); + QTest::qWaitForWindowShown(&main); + QVERIFY(!statusbar.findChild()->isVisible()); } QTEST_MAIN(tst_QStatusBar) -- cgit v0.12 From 4d7b7dc0bdd12188d92a5d05a35991af7b53cc81 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 25 Nov 2009 16:00:41 +0100 Subject: Mac: deleting a menu item might clear items in other menus The reson is that some menu items are reused across all menu bars. So we need to check that a menu actually still owns the item before clearing or hiding its data. Reviewed-by: Prasanth --- src/gui/widgets/qmenu_mac.mm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 8b371e5..30bbd31 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -763,7 +763,9 @@ QMacMenuAction::~QMacMenuAction() { #ifdef QT_MAC_USE_COCOA [menu release]; - if (action) { + // Update the menu item if this action still owns it. For some items + // (like 'Quit') ownership will be transferred between all menu bars... + if (action && action.data() == reinterpret_cast([menuItem tag])) { QAction::MenuRole role = action->menuRole(); // Check if the item is owned by Qt, and should be hidden to keep it from causing // problems. Do it for everything but the quit menu item since that should always @@ -774,11 +776,7 @@ QMacMenuAction::~QMacMenuAction() && menuItem != [getMenuLoader() quitMenuItem]) { [menuItem setHidden:YES]; } - // Only clear the tag if it points to this action. Since items like - // 'Quit' is being reused, we sometimes end up redirecting the item - // before deleting the assosiated action. - if (action.data() == reinterpret_cast([menuItem tag])) - [menuItem setTag:nil]; + [menuItem setTag:nil]; } [menuItem release]; #endif -- cgit v0.12 From 0fbf2304625cfe895f232b4c64a95bcf0584bd92 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 25 Nov 2009 15:16:35 +0100 Subject: Introduce QFileInfo benchmark Right now only a benchmark for the canonicalized path. Reviewed-by: TrustMe --- tests/benchmarks/benchmarks.pro | 1 + tests/benchmarks/qfileinfo/main.cpp | 81 ++++++++++++++++++++++++++++++++ tests/benchmarks/qfileinfo/qfileinfo.pro | 12 +++++ 3 files changed, 94 insertions(+) create mode 100644 tests/benchmarks/qfileinfo/main.cpp create mode 100644 tests/benchmarks/qfileinfo/qfileinfo.pro diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro index a63fb41..9170039 100644 --- a/tests/benchmarks/benchmarks.pro +++ b/tests/benchmarks/benchmarks.pro @@ -3,6 +3,7 @@ SUBDIRS = containers-associative \ containers-sequential \ qanimation \ qbytearray \ + qfileinfo \ qfile_vs_qnetworkaccessmanager \ qpainter \ qtestlib-simple events \ diff --git a/tests/benchmarks/qfileinfo/main.cpp b/tests/benchmarks/qfileinfo/main.cpp new file mode 100644 index 0000000..7950f58 --- /dev/null +++ b/tests/benchmarks/qfileinfo/main.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2009 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 +#include + + +class qfileinfo : public QObject +{ + Q_OBJECT +private slots: + void canonicalFileNamePerformance(); + + void initTestCase(); + void cleanupTestCase(); +public: + qfileinfo() : QObject() {}; +}; + +void qfileinfo::initTestCase() +{ +} + +void qfileinfo::cleanupTestCase() +{ +} + +void qfileinfo::canonicalFileNamePerformance() +{ + QBENCHMARK { + for (int i = 0; i < 5000; i++) { + // this actually calls canonicalFilePath twice, once inside QCoreApplication. + QFileInfo fi(QCoreApplication::applicationFilePath()); + fi.canonicalFilePath(); + } + } +} + +QTEST_MAIN(qfileinfo) + +#include "main.moc" diff --git a/tests/benchmarks/qfileinfo/qfileinfo.pro b/tests/benchmarks/qfileinfo/qfileinfo.pro new file mode 100644 index 0000000..295cb50 --- /dev/null +++ b/tests/benchmarks/qfileinfo/qfileinfo.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = qfileinfo +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui + +CONFIG += release + +# Input +SOURCES += main.cpp -- cgit v0.12 From cdc0b5fdf1197b07ad446cab339010e8c0fb8e8b Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 25 Nov 2009 16:12:43 +0100 Subject: Optimize QFSFileEnginePrivate::canonicalized() by using realpath() In our benchmark, this makes QFileInfo.canonical*Path() up to 50% faster. This should also improve application startup time. Let's see if it works on all Unices and Symbian. Reviewed-by: mariusSO --- src/corelib/io/qfsfileengine.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 3cf9b7e..6aace2c 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -55,6 +55,7 @@ #include "private/qcore_unix_p.h" #endif #include +#include QT_BEGIN_NAMESPACE @@ -137,6 +138,17 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) if (path.isEmpty()) return path; +#if defined(Q_OS_UNIX) || defined(Q_OS_SYMBIAN) + // FIXME let's see if this stuff works, then we might be able to remove some of the other code + const char *fileName = path.toLocal8Bit().constData(); + char *ret = realpath(fileName, (char*)0); + if (ret) { + QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); + free(ret); + return canonicalPath; + } +#endif + QFileInfo fi; const QChar slash(QLatin1Char('/')); QString tmpPath = path; -- cgit v0.12 From 59fd9669be156203a1117b9cbc4051973764ea6a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 25 Nov 2009 16:18:59 +0100 Subject: Doc: Work in progress example placeholders. Reviewed-by: Trust Me --- doc/src/examples/blurpicker.qdoc | 47 +++++++++++++++++++ doc/src/examples/fademessage.qdoc | 47 +++++++++++++++++++ doc/src/examples/fingerpaint.qdoc | 50 +++++++++++++++++++++ doc/src/examples/lighting.qdoc | 47 +++++++++++++++++++ doc/src/examples/multitouch-dials.qdoc | 50 +++++++++++++++++++++ doc/src/examples/multitouch-knobs.qdoc | 50 +++++++++++++++++++++ doc/src/examples/openvg-star.qdoc | 47 +++++++++++++++++++ doc/src/examples/pinchzoom.qdoc | 50 +++++++++++++++++++++ doc/src/images/blurpickereffect-example.png | Bin 0 -> 104450 bytes doc/src/images/fademessageeffect-example-faded.png | Bin 0 -> 81894 bytes doc/src/images/fademessageeffect-example.png | Bin 0 -> 104987 bytes doc/src/images/lightingeffect-example.png | Bin 0 -> 41132 bytes doc/src/images/multitouch-knobs-example.png | Bin 0 -> 1290 bytes doc/src/images/multitouch-pinchzoom-example.png | Bin 0 -> 48154 bytes 14 files changed, 388 insertions(+) create mode 100644 doc/src/examples/blurpicker.qdoc create mode 100644 doc/src/examples/fademessage.qdoc create mode 100644 doc/src/examples/fingerpaint.qdoc create mode 100644 doc/src/examples/lighting.qdoc create mode 100644 doc/src/examples/multitouch-dials.qdoc create mode 100644 doc/src/examples/multitouch-knobs.qdoc create mode 100644 doc/src/examples/openvg-star.qdoc create mode 100644 doc/src/examples/pinchzoom.qdoc create mode 100644 doc/src/images/blurpickereffect-example.png create mode 100644 doc/src/images/fademessageeffect-example-faded.png create mode 100644 doc/src/images/fademessageeffect-example.png create mode 100644 doc/src/images/lightingeffect-example.png create mode 100644 doc/src/images/multitouch-knobs-example.png create mode 100644 doc/src/images/multitouch-pinchzoom-example.png diff --git a/doc/src/examples/blurpicker.qdoc b/doc/src/examples/blurpicker.qdoc new file mode 100644 index 0000000..93c12bf --- /dev/null +++ b/doc/src/examples/blurpicker.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example effects/blurpicker + \title Blur Picker Effect Example + + \image blurpickereffect-example.png +*/ diff --git a/doc/src/examples/fademessage.qdoc b/doc/src/examples/fademessage.qdoc new file mode 100644 index 0000000..ecea095 --- /dev/null +++ b/doc/src/examples/fademessage.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example effects/fademessage + \title Fade Message Effect Example + + \image fademessageeffect-example.png +*/ diff --git a/doc/src/examples/fingerpaint.qdoc b/doc/src/examples/fingerpaint.qdoc new file mode 100644 index 0000000..9c55dac --- /dev/null +++ b/doc/src/examples/fingerpaint.qdoc @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example multitouch/fingerpaint + \title Finger Paint Example + + The Finger Paint example shows the use of multi-touch with a custom widget + to create a simple painting application. + + \image multitouch-fingerpaint.png +*/ diff --git a/doc/src/examples/lighting.qdoc b/doc/src/examples/lighting.qdoc new file mode 100644 index 0000000..8e9d1c2 --- /dev/null +++ b/doc/src/examples/lighting.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example effects/lighting + \title Lighting Effect Example + + \image lightingeffect-example.png +*/ diff --git a/doc/src/examples/multitouch-dials.qdoc b/doc/src/examples/multitouch-dials.qdoc new file mode 100644 index 0000000..52e964c --- /dev/null +++ b/doc/src/examples/multitouch-dials.qdoc @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example multitouch/dials + \title Multi-Touch Dials Example + + The Multi-Touch Dials example shows how to apply multi-touch to a set of + standard Qt widgets. + + \image multitouch-dials-example.png +*/ diff --git a/doc/src/examples/multitouch-knobs.qdoc b/doc/src/examples/multitouch-knobs.qdoc new file mode 100644 index 0000000..d0c537c --- /dev/null +++ b/doc/src/examples/multitouch-knobs.qdoc @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example multitouch/knobs + \title Multi-Touch Knobs Example + + The Multi-Touch Knobs example shows how to create custom controls that + accept multi-touch input. + + \image multitouch-knobs-example.png +*/ diff --git a/doc/src/examples/openvg-star.qdoc b/doc/src/examples/openvg-star.qdoc new file mode 100644 index 0000000..7c78e12 --- /dev/null +++ b/doc/src/examples/openvg-star.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example openvg/star + \title OpenVG Star Example + + The OpenVG Star example demonstrates the use of Qt's OpenVG integration. +*/ diff --git a/doc/src/examples/pinchzoom.qdoc b/doc/src/examples/pinchzoom.qdoc new file mode 100644 index 0000000..ff8c811 --- /dev/null +++ b/doc/src/examples/pinchzoom.qdoc @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example multitouch/pinchzoom + \title Pinch Zoom Example + + The Pinch Zoom example shows how to use low-level multi-touch information + to recognize a gesture. + + \image multitouch-pinchzoom.png +*/ diff --git a/doc/src/images/blurpickereffect-example.png b/doc/src/images/blurpickereffect-example.png new file mode 100644 index 0000000..8894338 Binary files /dev/null and b/doc/src/images/blurpickereffect-example.png differ diff --git a/doc/src/images/fademessageeffect-example-faded.png b/doc/src/images/fademessageeffect-example-faded.png new file mode 100644 index 0000000..ea66d2c Binary files /dev/null and b/doc/src/images/fademessageeffect-example-faded.png differ diff --git a/doc/src/images/fademessageeffect-example.png b/doc/src/images/fademessageeffect-example.png new file mode 100644 index 0000000..823c851 Binary files /dev/null and b/doc/src/images/fademessageeffect-example.png differ diff --git a/doc/src/images/lightingeffect-example.png b/doc/src/images/lightingeffect-example.png new file mode 100644 index 0000000..d9dc990 Binary files /dev/null and b/doc/src/images/lightingeffect-example.png differ diff --git a/doc/src/images/multitouch-knobs-example.png b/doc/src/images/multitouch-knobs-example.png new file mode 100644 index 0000000..1cbd90d Binary files /dev/null and b/doc/src/images/multitouch-knobs-example.png differ diff --git a/doc/src/images/multitouch-pinchzoom-example.png b/doc/src/images/multitouch-pinchzoom-example.png new file mode 100644 index 0000000..1079fb2 Binary files /dev/null and b/doc/src/images/multitouch-pinchzoom-example.png differ -- cgit v0.12 From 6b760aa0701bd6dbbd7f2f16db2f554979273c1d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 25 Nov 2009 16:19:49 +0100 Subject: Doc: Added the required legal notices. Reviewed-by: Trust Me --- doc/src/legal/3rdparty.qdoc | 74 ++++++- doc/src/legal/licenses.qdoc | 461 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 534 insertions(+), 1 deletion(-) diff --git a/doc/src/legal/3rdparty.qdoc b/doc/src/legal/3rdparty.qdoc index 974b2c4..f1c1847 100644 --- a/doc/src/legal/3rdparty.qdoc +++ b/doc/src/legal/3rdparty.qdoc @@ -114,6 +114,35 @@ FreeType-2, it has been modified in various other ways.} -- quoted from \c src/3rdparty/harfbuzz/README. + \hr + + Copyright (C) 2004,2007 Red Hat, Inc.\br + Copyright (C) 1998-2004 David Turner and Werner Lemberg\br + Copyright (C) 2006 Behdad Esfahbod\br + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + + This is part of HarfBuzz, an OpenType Layout engine library. + + Permission is hereby granted, without written agreement and without + license or royalty fees, to use, copy, modify, and distribute this + software and its documentation for any purpose, provided that the + above copyright notice and the following two paragraphs appear in + all copies of this software. + + IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + + THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + \hr + See \c src/3rdparty/harfbuzz/COPYING.FTL and src/3rdparty/harfbuzz/COPYING.GPL for license details. @@ -257,7 +286,9 @@ \hr Copyright (c) 1996-1997 Sam Leffler\br - Copyright (c) 1996 Pixar + Copyright (c) 1996 Pixar\br + Copyright (c) 1991-1997 Silicon Graphics, Inc.\br + Copyright (C) 2004, Andrey Kiselev Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided @@ -280,6 +311,27 @@ \hr + 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, + advertising materials, and other materials related to such + distribution and use acknowledge that the software was developed + by the University of California, Berkeley. The name of the + University may not be used to endorse or promote products derived + from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + \hr + See \c src/3rdparty/libtiff/COPYRIGHT for license details. \section1 Wintab API (\c wintab) @@ -297,4 +349,24 @@ src/3rdparty/zlib/README. See \c src/3rdparty/zlib/README for license details. + + \section1 JavaScriptCore + + \hr + + Copyright (c) 1991, 2000, 2001 by Lucent Technologies.\br + Copyright (C) 2002, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + + Permission to use, copy, modify, and distribute this software for any + purpose without fee is hereby granted, provided that this entire notice + is included in all copies of any software which is or includes a copy + or modification of this software and in all copies of the supporting + documentation for such software. + + THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY + REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + + See \c src/3rdparty/webkit/JavaScriptCore/wtf/dtoa.cpp for license details. */ diff --git a/doc/src/legal/licenses.qdoc b/doc/src/legal/licenses.qdoc index 11a84d2..3f24fc5 100644 --- a/doc/src/legal/licenses.qdoc +++ b/doc/src/legal/licenses.qdoc @@ -269,6 +269,467 @@ \list \o examples/webkit/fancybrowser/jquery.min.js \endlist + + \hr + + Copyright (C) Research In Motion Limited 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:\br + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer.\br + * 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 + * Neither the name of Research In Motion Limited 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 Research In Motion Limited ''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 Research In Motion Limited 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. + + \list + \o src/corelib/io/qurl.cpp + \endlist + + \hr + + Copyright (c) 2007-2008, Apple, Inc.\br + Copyright (C) 2008 Cameron Zwarich \br + Copyright (C) 2009 Google Inc. All rights reserved.\br + Copyright (C) 2008, 2009 Paul Pedriana . All rights reserved.\br + Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)\br + Copyright (C) 2009 Jian Li \br + Copyright (C) 2007 Staikos Computing Services Inc.\br + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)\br + Copyright (C) 2008 Nuanti Ltd.\br + Copyright (C) 2007 David Smith (catfish.man@gmail.com)\br + Copyright (C) 2008 Tony Chang \br + Copyright (C) 2007 Graham Dennis (graham.dennis@gmail.com) + + All rights reserved. + + 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 Apple, Inc. 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. + + \list + \o Parts of WebKit used by the QtWebKit module + \endlist + + \hr + + Copyright (C) 1999 Serika Kurusugawa, All rights reserved.\br + Copyright (C) 1999-2000 Mizi Research Inc. All rights reserved.\br + Copyright (C) 2004, 2005 Daniel M. Duley\br + Copyright (C) 2000 Ming-Che Chuang\br + Copyright (C) 2001, 2002 James Su, Turbolinux Inc.\br + Copyright (C) 2002 WU Yi, HancomLinux Inc.\br + Copyright (C) 2001, 2002 Anthony Fok, ThizLinux Laboratory Ltd.\br + Copyright (c) 2000 Hans Petter Bieker. All rights reserved.\br + Copyright (C) 2001, 2002 ThizLinux Laboratory Ltd.\br + Copyright (C) 2001, 2002 Turbolinux, Inc. + + 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. + 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 AUTHOR 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 REGENTS 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. + + \list + \o Parts of the codecs implemented by Qt + \endlist + + \hr + + Copyright (c) 1992, 1993\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: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 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. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgment: + This product includes software developed by the University of + California, Berkeley and its contributors. + 4. 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 + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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. + + \list + \o src/corelib/tools/qlocale.cpp + \endlist + + \hr + + Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\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: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer.\br + * 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 + * Neither the name of the author nor the names of 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. + + \list + \o Parts of WebKit used by the QtWebKit module + \endlist + + \hr + + Copyright (C) 2005, 2007, 2008 by George Williams + + 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. + + The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + + \list + \o Parts of the FreeType library + \endlist + + \hr + + Copyright (C) 2006 Apple Computer, Inc. All rights reserved.\br + Copyright (C) 2007 Eric Seidel \br + Copyright (C) 2008 Kelvin W Sherlock (ksherlock@gmail.com)\br + Copyright (C) 2008 Alp Toker \br + Copyright (C) 2009 University of Szeged\br + Copyright (C) 2007 Alexey Proskuryakov (ap@nypop.com)\br + Copyright (C) 2009 Daniel Bates (dbates@intudata.com)\br + Copyright (C) 2008 Nikolas Zimmermann \br + Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com\br + Copyright (C) 2007 Holger Hans Peter Freyther\br + Copyright (C) 2008 Collabora Ltd. All rights reserved.\br + Copyright (C) 2006 Dirk Mueller \br + Copyright (C) 2006 Zack Rusin \br + Copyright (C) 2006 George Staikos \br + Copyright (C) 2006 Simon Hausmann \br + Copyright (C) 2006 Rob Buis \br + Copyright (C) 2008 Julien Chaffraix \br + Copyright (C) 2007 Henry Mason (hmason@mac.com)\br + Copyright (C) 1999 Lars Knoll (knoll@kde.org)\br + Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)\br + Copyright (c) 2009 The Android Open Source Project\br + Copyright (C) 2008 Dirk Schulze \br + Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)\br + Copyright (C) 2008 Matt Lilek \br + Copyright (C) 2009 280 North Inc. All Rights Reserved.\br + Copyright (C) 2009 Joseph Pecoraro\br + Copyright (C) 2008 Anthony Ricaud (rik24d@gmail.com)\br + Copyright (C) 2006 Samuel Weinig \br + Copyright (C) 2008 Christian Dywan \br + Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com \br + Copyright (C) 2009 Holger Hans Peter Freyther\br + Copyright (C) 2008 Google Inc. All rights reserved.\br + Copyright (C) 2006 Friedemann Kleint \br + Copyright (C) 2007 Nicholas Shanks \br + Copyright (C) 2008 Collin Jackson \br + Copyright (C) 2007 Staikos Computing Services Inc. \br + Copyright (C) 2008 Kevin Ollivier All Rights Reserved.\br + Copyright (C) 2005 Frerich Raabe \br + Copyright (C) 2005 Maksim Orlovich \br + Copyright (C) 2005, 2006 Kimmo Kinnunen .\br + Copyright (C) 2007-2009 Torch Mobile, Inc. + + 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. + + 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. + + \list + \o Parts of WebKit used by the QtWebKit module + \endlist + + \hr + + Copyright (C) 2009 University of Szeged\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. + + THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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. + + \list + \o Parts of WebKit used by the QtWebKit module + \endlist + + \hr + + Copyright (C) 2002 Michael Ringgaard. 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 the project 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. + + \list + \o src/3rdparty/ce-compat/ce_time.c + \endlist + + \hr + + Copyright (c) 1997-2005 University of Cambridge. All rights reserved. + + 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 the University of Cambridge nor the name of Apple + Inc. 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 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. + + \list + \o Parts of WebKit used by the QtWebKit module + \endlist + + \hr + + Originally written by Philip Hazel\br + Copyright (c) 1997-2006 University of Cambridge\br + Copyright (C) 2007 Eric Seidel \br + Copyright (C) 2002, 2004, 2006, 2007, 2008, 2009 Apple 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: + + * 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 the University of Cambridge 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. + + \list + \o Parts of WebKit used by the QtWebKit module + \endlist + + \hr + + Copyright (C) 2006 Apple Computer, Inc. All rights reserved.\br + Copyright (C) 2008 Google Inc. All rights reserved.\br + Copyright (C) 2008 Matt Lilek + + 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.\br + * 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 + * Neither the name of Google Inc. 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. + + \list + \o Parts of WebKit used by the QtWebKit module + \endlist */ /*! -- cgit v0.12 From dddd3e5fc9658ebbb5f94b343e7c7c0cd27eb7f2 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Wed, 25 Nov 2009 16:22:29 +0100 Subject: Fix crash of QtWebKit on any page with Flash when compiled witn MinGW. Early push of this fix which should be overwritten by the fix upstreamed in WebKit trunk later. Reviewed-by: Simon Hausmann --- src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp index 5ccce0e..b313afb 100644 --- a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp @@ -145,7 +145,7 @@ HDC WINAPI PluginView::hookedBeginPaint(HWND hWnd, PAINTSTRUCT* lpPaint) "push %3\n" "call *%4\n" : "=a" (result) - : "a" (beginPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (*beginPaint) + : "a" (beginPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (beginPaint) : "memory" ); return result; @@ -175,7 +175,7 @@ BOOL WINAPI PluginView::hookedEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint) "push %3\n" "call *%4\n" : "=a" (result) - : "a" (endPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (*endPaint) + : "a" (endPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (endPaint) ); return result; #elif defined (_M_IX86) -- cgit v0.12 From d6f1feb5f0f639f9fb2deb5dc3758f5d6b7ad4d1 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 25 Nov 2009 16:29:34 +0100 Subject: Fixing background painting after orientation switch. Fixing previous fixes of QS60StylePrivate::setBackgroundTexture with commit SHAs a80e58335e69c8ce96d1596e0ed2d14e424a0d5e and d4089399a3ab7548a864d5a399e08df85c444783 Now, the palette gets the updated background brush and the palette is actually set as application palette. Also making sure that QS60StylePrivate::handleDynamicLayoutVariantSwitch does the right things in the right order. So that Table headers are not broken after orientaion switch. Task-number: QTBUG-6125 Task-number: QT-1478 --- src/gui/styles/qs60style.cpp | 1 + src/gui/styles/qs60style_s60.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 974c3ff..6c328b9 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -470,6 +470,7 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const QPalette applicationPalette = QApplication::palette(); applicationPalette.setBrush(QPalette::Window, backgroundTexture()); setThemePalette(&applicationPalette); + QApplication::setPalette(applicationPalette); } void QS60StylePrivate::deleteBackground() diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index a8dbf8d..48b8fad 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1324,9 +1324,9 @@ QS60Style::QS60Style() void QS60StylePrivate::handleDynamicLayoutVariantSwitch() { clearCaches(QS60StylePrivate::CC_LayoutChange); + setBackgroundTexture(qApp); setActiveLayout(); refreshUI(); - setBackgroundTexture(qApp); foreach (QWidget *widget, QApplication::allWidgets()) widget->ensurePolished(); } -- cgit v0.12 From 4c3539dfbc65d5decdd842d4181f9aa3d38d213c Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Wed, 25 Nov 2009 16:22:29 +0100 Subject: Fix crash of QtWebKit on any page with Flash when compiled witn MinGW. Early push of this fix which should be overwritten by the fix upstreamed in WebKit trunk later. Reviewed-by: Simon Hausmann (cherry picked from commit dddd3e5fc9658ebbb5f94b343e7c7c0cd27eb7f2) --- src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp index 5ccce0e..b313afb 100644 --- a/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp @@ -145,7 +145,7 @@ HDC WINAPI PluginView::hookedBeginPaint(HWND hWnd, PAINTSTRUCT* lpPaint) "push %3\n" "call *%4\n" : "=a" (result) - : "a" (beginPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (*beginPaint) + : "a" (beginPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (beginPaint) : "memory" ); return result; @@ -175,7 +175,7 @@ BOOL WINAPI PluginView::hookedEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint) "push %3\n" "call *%4\n" : "=a" (result) - : "a" (endPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (*endPaint) + : "a" (endPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (endPaint) ); return result; #elif defined (_M_IX86) -- cgit v0.12 From 5a180a11af102268d66f3822be256a1dc6980da4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 25 Nov 2009 16:58:50 +0100 Subject: qph: don't clobber fields the translator comment field is not written out, so reading the definition into it is basically discarding it as far as any roundtrips which arrive at qph again are concerned. the message's disambiguation seems most suitable for the task. Reviewed-by: hjk Task-number: QTBUG-4498 --- tools/linguist/shared/qph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/shared/qph.cpp b/tools/linguist/shared/qph.cpp index 788245c..a364037 100644 --- a/tools/linguist/shared/qph.cpp +++ b/tools/linguist/shared/qph.cpp @@ -104,7 +104,7 @@ bool QPHReader::read(Translator &translator) TranslatorMessage msg; msg.setSourceText(m_currentSource); msg.setTranslation(m_currentTarget); - msg.setTranslatorComment(m_currentDefinition); + msg.setComment(m_currentDefinition); translator.append(msg); m_currentSource.clear(); m_currentTarget.clear(); -- cgit v0.12 From aaae24808654d54bf8aca04f825c6aa786fe342f Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Wed, 25 Nov 2009 15:01:13 +0100 Subject: Use a pixmap instead of an image in the tablet example The transformations QImage->QPixmap are killing the performance of the tablet example. This is noticeable because of the number of events sent by the tablet (painting MUST be fast in tabletEvent()). Reviewed-by: David Boddie --- doc/src/examples/tablet.qdoc | 26 +++++++++++++------------- examples/widgets/tablet/tabletcanvas.cpp | 30 +++++++++++++++--------------- examples/widgets/tablet/tabletcanvas.h | 8 ++++---- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/doc/src/examples/tablet.qdoc b/doc/src/examples/tablet.qdoc index 3c3ced9..b0548d4 100644 --- a/doc/src/examples/tablet.qdoc +++ b/doc/src/examples/tablet.qdoc @@ -79,7 +79,7 @@ the examples menus and connect their slots and signals. \o The \c TabletCanvas class inherits QWidget and receives tablet events. It uses the events to paint on a - QImage, which it draws onto itself. + offscreen pixmap, which it draws onto itself. \o The \c TabletApplication class inherits QApplication. This class handles tablet events that are not sent to \c tabletEvent(). We will look at this later. @@ -214,16 +214,16 @@ alphaChannelType, \c colorSturationType, and \c penWidthType, which we provide access functions for. - We draw on a QImage with \c myPen and \c myBrush using \c + We draw on a QPixmap with \c myPen and \c myBrush using \c myColor. The \c saveImage() and \c loadImage() saves and loads - the QImage to disk. The image is drawn on the widget in \c + the QPixmap to disk. The pixmap is drawn on the widget in \c paintEvent(). The \c pointerType and \c deviceType keeps the type of pointer, which is either a pen or an eraser, and device currently used on the tablet, which is either a stylus or an airbrush. The interpretation of events from the tablet is done in \c - tabletEvent(); \c paintImage(), \c updateBrush(), and \c + tabletEvent(); \c paintPixmap(), \c updateBrush(), and \c brushPattern() are helper functions used by \c tabletEvent(). @@ -234,20 +234,20 @@ \snippet examples/widgets/tablet/tabletcanvas.cpp 0 In the constructor we initialize our class variables. We need - to draw the background of our image, as the default is gray. + to draw the background of our pixmap, as the default is gray. Here is the implementation of \c saveImage(): \snippet examples/widgets/tablet/tabletcanvas.cpp 1 - QImage implements functionality to save itself to disk, so we - simply call \l{QImage::}{save()}. + QPixmap implements functionality to save itself to disk, so we + simply call \l{QPixmap::}{save()}. Here is the implementation of \c loadImage(): \snippet examples/widgets/tablet/tabletcanvas.cpp 2 - We simply call \l{QImage::}{load()}, which loads the image in \a + We simply call \l{QPixmap::}{load()}, which loads the image in \a file. Here is the implementation of \c tabletEvent(): @@ -259,7 +259,7 @@ is pressed down on, leaves, or moves on the tablet. We set the \c deviceDown to true when a device is pressed down on the tablet; we then know when we should draw when we receive move events. We - have implemented the \c updateBrush() and \c paintImage() helper + have implemented the \c updateBrush() and \c paintPixmap() helper functions to update \c myBrush and \c myPen after the state of \c alphaChannelType, \c colorSaturationType, and \c lineWidthType. @@ -267,13 +267,13 @@ \snippet examples/widgets/tablet/tabletcanvas.cpp 4 - We simply draw the image to the top left of the widget. + We simply draw the pixmap to the top left of the widget. - Here is the implementation of \c paintImage(): + Here is the implementation of \c paintPixmap(): \snippet examples/widgets/tablet/tabletcanvas.cpp 5 - In this function we draw on the image based on the movement of the + In this function we draw on the pixmap based on the movement of the device. If the device used on the tablet is a stylus we want to draw a line between the positions of the stylus recorded in \c polyLine. We also assume that this is a reasonable handling of any unknown device, @@ -334,7 +334,7 @@ We finally check wether the pointer is the stylus or the eraser. If it is the eraser, we set the color to the background color of - the image an let the pressure decide the pen width, else we set + the pixmap an let the pressure decide the pen width, else we set the colors we have set up previously in the function. diff --git a/examples/widgets/tablet/tabletcanvas.cpp b/examples/widgets/tablet/tabletcanvas.cpp index 130498b..20b0d1e 100644 --- a/examples/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/tablet/tabletcanvas.cpp @@ -50,7 +50,7 @@ TabletCanvas::TabletCanvas() resize(500, 500); myBrush = QBrush(); myPen = QPen(); - initImage(); + initPixmap(); setAutoFillBackground(true); deviceDown = false; myColor = Qt::red; @@ -60,29 +60,29 @@ TabletCanvas::TabletCanvas() lineWidthType = LineWidthPressure; } -void TabletCanvas::initImage() +void TabletCanvas::initPixmap() { - QImage newImage = QImage(width(), height(), QImage::Format_ARGB32); - QPainter painter(&newImage); - painter.fillRect(0, 0, newImage.width(), newImage.height(), Qt::white); - if (!image.isNull()) - painter.drawImage(0, 0, image); + QPixmap newPixmap = QPixmap(width(), height()); + newPixmap.fill(Qt::white); + QPainter painter(&newPixmap); + if (!pixmap.isNull()) + painter.drawPixmap(0, 0, pixmap); painter.end(); - image = newImage; + pixmap = newPixmap; } //! [0] //! [1] bool TabletCanvas::saveImage(const QString &file) { - return image.save(file); + return pixmap.save(file); } //! [1] //! [2] bool TabletCanvas::loadImage(const QString &file) { - bool success = image.load(file); + bool success = pixmap.load(file); if (success) { update(); @@ -114,8 +114,8 @@ void TabletCanvas::tabletEvent(QTabletEvent *event) if (deviceDown) { updateBrush(event); - QPainter painter(&image); - paintImage(painter, event); + QPainter painter(&pixmap); + paintPixmap(painter, event); } break; default: @@ -129,12 +129,12 @@ void TabletCanvas::tabletEvent(QTabletEvent *event) void TabletCanvas::paintEvent(QPaintEvent *) { QPainter painter(this); - painter.drawImage(QPoint(0, 0), image); + painter.drawPixmap(0, 0, pixmap); } //! [4] //! [5] -void TabletCanvas::paintImage(QPainter &painter, QTabletEvent *event) +void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event) { QPoint brushAdjust(10, 10); @@ -271,6 +271,6 @@ void TabletCanvas::updateBrush(QTabletEvent *event) void TabletCanvas::resizeEvent(QResizeEvent *) { - initImage(); + initPixmap(); polyLine[0] = polyLine[1] = polyLine[2] = QPoint(); } diff --git a/examples/widgets/tablet/tabletcanvas.h b/examples/widgets/tablet/tabletcanvas.h index 02b8794..5a2fb1d 100644 --- a/examples/widgets/tablet/tabletcanvas.h +++ b/examples/widgets/tablet/tabletcanvas.h @@ -43,7 +43,7 @@ #define TABLETCANVAS_H #include -#include +#include #include #include #include @@ -92,8 +92,8 @@ protected: void resizeEvent(QResizeEvent *event); private: - void initImage(); - void paintImage(QPainter &painter, QTabletEvent *event); + void initPixmap(); + void paintPixmap(QPainter &painter, QTabletEvent *event); Qt::BrushStyle brushPattern(qreal value); void updateBrush(QTabletEvent *event); @@ -104,7 +104,7 @@ private: QTabletEvent::TabletDevice myTabletDevice; QColor myColor; - QImage image; + QPixmap pixmap; QBrush myBrush; QPen myPen; bool deviceDown; -- cgit v0.12 From 69460da0a67c76f508bf4c32d14ce00304cdfd98 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 25 Nov 2009 17:27:36 +0100 Subject: don't write context into field there is really no point in doing so Reviewed-by: hjk --- tools/linguist/shared/qph.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/linguist/shared/qph.cpp b/tools/linguist/shared/qph.cpp index a364037..24148fd 100644 --- a/tools/linguist/shared/qph.cpp +++ b/tools/linguist/shared/qph.cpp @@ -166,9 +166,8 @@ static bool saveQPH(const Translator &translator, QIODevice &dev, ConversionData QChar(Translator::TextVariantSeparator)); t << " " << protect(str) << "\n"; - if (!msg.context().isEmpty() || !msg.comment().isEmpty()) - t << " " << msg.context() << msg.comment() - << "\n"; + if (!msg.comment().isEmpty()) + t << " " << msg.comment() << "\n"; t << "\n"; } t << "\n"; -- cgit v0.12 From 9554e641af877ee08eeae9adae4acf4d8b1d198d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 25 Nov 2009 17:30:44 +0100 Subject: the definition needs xml escaping, too --- tools/linguist/shared/qph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/linguist/shared/qph.cpp b/tools/linguist/shared/qph.cpp index 24148fd..fb4fee9 100644 --- a/tools/linguist/shared/qph.cpp +++ b/tools/linguist/shared/qph.cpp @@ -167,7 +167,7 @@ static bool saveQPH(const Translator &translator, QIODevice &dev, ConversionData t << " " << protect(str) << "\n"; if (!msg.comment().isEmpty()) - t << " " << msg.comment() << "\n"; + t << " " << protect(msg.comment()) << "\n"; t << "\n"; } t << "\n"; -- cgit v0.12 From 5776ff26ec44bc6d10cff2a8f81e81c33c39570a Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 25 Nov 2009 17:13:30 +0100 Subject: Fixed round joins generated by the GL2 engine stroker. Complete circles were generated at every round join, so if the join were close to a flat cap, the circle would extend beyond the flat cap. This was fixed by generating arcs rather than complete circles. Likewise, round caps are now semi-circles instead of full circles. I also removed some unnecessary calculations when generating square caps. Reviewed-by: Trond --- .../gl2paintengineex/qtriangulatingstroker_p.h | 146 ++++++++++++++------- 1 file changed, 97 insertions(+), 49 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h index a0117d5..412e239 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h @@ -43,6 +43,7 @@ #define QTRIANGULATINGSTROKER_P_H #include +#include #include #include #include @@ -68,7 +69,7 @@ private: inline void join(const qreal *pts); inline void normalVector(float x1, float y1, float x2, float y2, float *nx, float *ny); inline void endCap(const qreal *pts); - inline void arc(float x, float y); + inline void arcPoints(float cx, float cy, float fromX, float fromY, float toX, float toY, QVarLengthArray &points); void endCapOrJoinClosed(const qreal *start, const qreal *cur, bool implicitClose, bool endsAtStart); @@ -149,43 +150,73 @@ inline void QTriangulatingStroker::emitLineSegment(float x, float y, float vx, f m_vertices.add(y - vy); } - - -// We draw a full circle for any round join or round cap which is a -// bit of overkill... -inline void QTriangulatingStroker::arc(float x, float y) +inline void QTriangulatingStroker::arcPoints(float cx, float cy, float fromX, float fromY, float toX, float toY, QVarLengthArray &points) { - float dx = m_width; - float dy = 0; - for (int i=0; i<=m_roundness; ++i) { - float tmpx = dx * m_cos_theta - dy * m_sin_theta; - float tmpy = dx * m_sin_theta + dy * m_cos_theta; - dx = tmpx; - dy = tmpy; - emitLineSegment(x, y, dx, dy); + float dx1 = fromX - cx; + float dy1 = fromY - cy; + float dx2 = toX - cx; + float dy2 = toY - cy; + + // while more than 180 degrees left: + while (dx1 * dy2 - dx2 * dy1 < 0) { + float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; + float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; + dx1 = tmpx; + dy1 = tmpy; + points.append(cx + dx1); + points.append(cy + dy1); } -} + // while more than 90 degrees left: + while (dx1 * dx2 + dy1 * dy2 < 0) { + float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; + float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; + dx1 = tmpx; + dy1 = tmpy; + points.append(cx + dx1); + points.append(cy + dy1); + } + + // while more than 0 degrees left: + while (dx1 * dy2 - dx2 * dy1 > 0) { + float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; + float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; + dx1 = tmpx; + dy1 = tmpy; + points.append(cx + dx1); + points.append(cy + dy1); + } + // remove last point which was rotated beyond [toX, toY]. + if (!points.isEmpty()) + points.resize(points.size() - 2); +} -inline void QTriangulatingStroker::endCap(const qreal *pts) +inline void QTriangulatingStroker::endCap(const qreal *) { switch (m_cap_style) { case Qt::FlatCap: break; - case Qt::SquareCap: { - float dx = m_cx - *(pts - 2); - float dy = m_cy - *(pts - 1); - - float len = m_width / sqrt(dx * dx + dy * dy); - dx = dx * len; - dy = dy * len; - - emitLineSegment(m_cx + dx, m_cy + dy, m_nvx, m_nvy); - break; } - case Qt::RoundCap: - arc(m_cx, m_cy); + case Qt::SquareCap: + emitLineSegment(m_cx + m_nvy, m_cy - m_nvx, m_nvx, m_nvy); break; + case Qt::RoundCap: { + QVarLengthArray points; + int count = m_vertices.size(); + arcPoints(m_cx, m_cy, m_vertices.at(count - 2), m_vertices.at(count - 1), m_vertices.at(count - 4), m_vertices.at(count - 3), points); + int front = 0; + int end = points.size() / 2; + while (front != end) { + m_vertices.add(points[2 * end - 2]); + m_vertices.add(points[2 * end - 1]); + --end; + if (front == end) + break; + m_vertices.add(points[2 * front + 0]); + m_vertices.add(points[2 * front + 1]); + ++front; + } + break; } default: break; // to shut gcc up... } } @@ -214,31 +245,37 @@ void QTriangulatingStroker::moveTo(const qreal *pts) } break; case Qt::SquareCap: { - float dx = x2 - m_cx; - float dy = y2 - m_cy; - float len = m_width / sqrt(dx * dx + dy * dy); - dx = dx * len; - dy = dy * len; - float sx = m_cx - dx; - float sy = m_cy - dy; + float sx = m_cx - m_nvy; + float sy = m_cy + m_nvx; if (invisibleJump) { m_vertices.add(sx + m_nvx); m_vertices.add(sy + m_nvy); } emitLineSegment(sx, sy, m_nvx, m_nvy); break; } - case Qt::RoundCap: - if (invisibleJump) { - m_vertices.add(m_cx + m_nvx); - m_vertices.add(m_cy + m_nvy); + case Qt::RoundCap: { + QVarLengthArray points; + arcPoints(m_cx, m_cy, m_cx + m_nvx, m_cy + m_nvy, m_cx - m_nvx, m_cy - m_nvy, points); + m_vertices.resize(m_vertices.size() + points.size() + 2 * int(invisibleJump)); + int count = m_vertices.size(); + int front = 0; + int end = points.size() / 2; + while (front != end) { + m_vertices.at(--count) = points[2 * end - 1]; + m_vertices.at(--count) = points[2 * end - 2]; + --end; + if (front == end) + break; + m_vertices.at(--count) = points[2 * front + 1]; + m_vertices.at(--count) = points[2 * front + 0]; + ++front; } - // This emitLineSegment is not needed for the arc, but we need - // to start where we put the invisibleJump vertex, otherwise - // we'll have visible triangles between subpaths. - emitLineSegment(m_cx, m_cy, m_nvx, m_nvy); - arc(m_cx, m_cy); - break; + if (invisibleJump) { + m_vertices.at(count - 1) = m_vertices.at(count + 1); + m_vertices.at(count - 2) = m_vertices.at(count + 0); + } + break; } default: break; // ssssh gcc... } emitLineSegment(m_cx, m_cy, m_nvx, m_nvy); @@ -289,10 +326,21 @@ void QTriangulatingStroker::join(const qreal *pts) // what some other graphics API's do. break; } - case Qt::RoundJoin: - arc(m_cx, m_cy); - break; - + case Qt::RoundJoin: { + QVarLengthArray points; + int count = m_vertices.size(); + float prevNvx = m_vertices.at(count - 2) - m_cx; + float prevNvy = m_vertices.at(count - 1) - m_cy; + if (m_nvx * prevNvy - m_nvy * prevNvx < 0) { + arcPoints(0, 0, m_nvx, m_nvy, -prevNvx, -prevNvy, points); + for (int i = points.size() / 2; i > 0; --i) + emitLineSegment(m_cx, m_cy, points[2 * i - 2], points[2 * i - 1]); + } else { + arcPoints(0, 0, -prevNvx, -prevNvy, m_nvx, m_nvy, points); + for (int i = 0; i < points.size() / 2; ++i) + emitLineSegment(m_cx, m_cy, points[2 * i + 0], points[2 * i + 1]); + } + break; } default: break; // gcc warn-- } -- cgit v0.12 From dab1b98d84293e863c920add25980393fad2e9cd Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 25 Nov 2009 17:41:34 +0100 Subject: Fixing background painting after orientation switch. Fixing previous fixes of QS60StylePrivate::setBackgroundTexture with commit SHAs a80e58335e69c8ce96d1596e0ed2d14e424a0d5e and d4089399a3ab7548a864d5a399e08df85c444783 Now, the palette gets the updated background brush and the palette is actually set as application palette. Also making sure that QS60StylePrivate::handleDynamicLayoutVariantSwitch does the right things in the right order. So that Table headers are not broken after orientaion switch. Task-number: QTBUG-6125 Task-number: QT-1478 Reviewed-by: Shane Kearns --- src/gui/styles/qs60style.cpp | 1 + src/gui/styles/qs60style_s60.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b5c0d4f..2137244 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -475,6 +475,7 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const QPalette applicationPalette = QApplication::palette(); applicationPalette.setBrush(QPalette::Window, backgroundTexture()); setThemePalette(&applicationPalette); + QApplication::setPalette(applicationPalette); } void QS60StylePrivate::deleteBackground() diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index a8dbf8d..48b8fad 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1324,9 +1324,9 @@ QS60Style::QS60Style() void QS60StylePrivate::handleDynamicLayoutVariantSwitch() { clearCaches(QS60StylePrivate::CC_LayoutChange); + setBackgroundTexture(qApp); setActiveLayout(); refreshUI(); - setBackgroundTexture(qApp); foreach (QWidget *widget, QApplication::allWidgets()) widget->ensurePolished(); } -- cgit v0.12 From 5c2783411ad4bcd2772b2dcbc0d38694af72e414 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 18 Nov 2009 20:32:12 +0100 Subject: Fixed key handling in the documentation index widget On Mac up/down arrow keys move the cursor to the beginning/end of the lineedit, however if the lineedit is used to control the indexwidget in assistant, we need to prevent it to get those events and move the text cursor. Reviewed-by: kh --- tools/assistant/tools/assistant/indexwindow.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/assistant/tools/assistant/indexwindow.cpp b/tools/assistant/tools/assistant/indexwindow.cpp index 6d35649..97828c1 100644 --- a/tools/assistant/tools/assistant/indexwindow.cpp +++ b/tools/assistant/tools/assistant/indexwindow.cpp @@ -112,18 +112,22 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e) case Qt::Key_Up: idx = m_indexWidget->model()->index(idx.row()-1, idx.column(), idx.parent()); - if (idx.isValid()) + if (idx.isValid()) { m_indexWidget->setCurrentIndex(idx); + return true; + } break; case Qt::Key_Down: idx = m_indexWidget->model()->index(idx.row()+1, idx.column(), idx.parent()); - if (idx.isValid()) + if (idx.isValid()) { m_indexWidget->setCurrentIndex(idx); + return true; + } break; case Qt::Key_Escape: emit escapePressed(); - break; + return true; default: ; // stop complaining } } else if (obj == m_indexWidget && e->type() == QEvent::ContextMenu) { -- cgit v0.12 From 0065225f9cb5c3be31fc03627f7178b158183abb Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 25 Nov 2009 18:15:15 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 27984c8c8d021a6bff604da57520959d420a642c ) --- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 10 +++++++++ .../JavaScriptCore/jit/ExecutableAllocator.h | 4 ++-- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 24 ++++++++++++++++++++++ .../platform/network/qt/QNetworkReplyHandler.cpp | 4 ++++ 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 382a8c7..1ef3b4d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,13 @@ +2009-11-18 Gabor Loki + + Reviewed by Darin Adler. + + Fix the clobber list of cacheFlush for ARM and Thumb2 on Linux + https://bugs.webkit.org/show_bug.cgi?id=31631 + + * jit/ExecutableAllocator.h: + (JSC::ExecutableAllocator::cacheFlush): + 2009-11-23 Laszlo Gombos Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h index 5c43eeb..9ca62c8 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h +++ b/src/3rdparty/webkit/JavaScriptCore/jit/ExecutableAllocator.h @@ -203,7 +203,7 @@ public: "pop {r7}\n" : : "r" (code), "r" (reinterpret_cast(code) + size) - : "r0", "r1"); + : "r0", "r1", "r2"); } #elif PLATFORM(SYMBIAN) static void cacheFlush(void* code, size_t size) @@ -224,7 +224,7 @@ public: "pop {r7}\n" : : "r" (code), "r" (reinterpret_cast(code) + size) - : "r0", "r1"); + : "r0", "r1", "r2"); } #else #error "The cacheFlush support is missing on this platform." diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 5818e83..772d8d0 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 - efa69b6181ce5c045097351cdcf6c158da3f4888 + 27984c8c8d021a6bff604da57520959d420a642c diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 9644470..268aaa1 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,27 @@ +2009-11-25 Jocelyn Turcotte + + Reviewed by Simon Hausmann. + + [Qt] Fix crash of QtWebKit on any page with Flash when compiled with MinGW. + + Fix inline assembly, don't dereference the function pointer twice. + + * plugins/win/PluginViewWin.cpp: + (WebCore::PluginView::hookedBeginPaint): + (WebCore::PluginView::hookedEndPaint): + +2009-11-22 Jakub Wieczorek + + Reviewed by Adam Barth. + + [Qt] Remove the Referer header when redirecting to a non-secure site + https://bugs.webkit.org/show_bug.cgi?id=31785 + + This makes Qt pass two tests introduced in r50226. + + * platform/network/qt/QNetworkReplyHandler.cpp: + (WebCore::QNetworkReplyHandler::sendResponseIfNeeded): + 2009-11-19 Olivier Goffart Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp index 2f4722f..1ac80f6 100644 --- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp +++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp @@ -325,6 +325,10 @@ void QNetworkReplyHandler::sendResponseIfNeeded() newRequest.setHTTPMethod("GET"); } + // Should not set Referer after a redirect from a secure resource to non-secure one. + if (!newRequest.url().protocolIs("https") && protocolIs(newRequest.httpReferrer(), "https")) + newRequest.clearHTTPReferrer(); + client->willSendRequest(m_resourceHandle, newRequest, response); m_redirected = true; m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_frame); -- cgit v0.12 From 70236685b09e76b48949cc16fa2a7a1f8350bbb7 Mon Sep 17 00:00:00 2001 From: Nils Christian Roscher-Nielsen Date: Wed, 25 Nov 2009 18:21:36 +0100 Subject: Checks for len = 0 in QIconvCodec::convertFromUnicode iconv hangs when len is initially 0 on some Solaris platforms. This can be seen in the standarddialogs example when calling QFileDialog::getOpenFileName() for instance. Reviewed-by: ddenis Task-number: QTBUG-4976 --- src/corelib/codecs/qiconvcodec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp index 8c4cc82..0fb78d5 100644 --- a/src/corelib/codecs/qiconvcodec.cpp +++ b/src/corelib/codecs/qiconvcodec.cpp @@ -378,7 +378,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt } int invalidCount = 0; - do { + while (inBytesLeft != 0) { if (iconv(state->cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) { if (errno == EINVAL && convState) { // buffer ends in a surrogate @@ -418,7 +418,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt } } } - } while (inBytesLeft != 0); + } // reset to initial state iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft); -- cgit v0.12 From aae664552f7e5fba96ab6f334ec354800ad83c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 25 Nov 2009 10:27:25 +0100 Subject: Remove caching of QGraphicsItem::clipPath(). The cache was added in 4.5 and was useful at that time. With 4.6 it is not relevant anymore since the only use case for it is item-lookup releated to mouse events and collision detection, so the overhead of maintaining the cache is more pain than gain. All existing auto tests pass. --- src/gui/graphicsview/qgraphicsitem.cpp | 165 ++----------------------------- src/gui/graphicsview/qgraphicsitem_p.h | 32 +----- src/gui/graphicsview/qgraphicswidget.cpp | 2 - 3 files changed, 8 insertions(+), 191 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 710048e..a42c1c3 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -755,7 +755,6 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch case QGraphicsItem::ItemClipsChildrenToShape: flag = AncestorClipsChildren; enabled = flags & QGraphicsItem::ItemClipsChildrenToShape; - invalidateCachedClipPathRecursively(/*childrenOnly=*/true); break; case QGraphicsItem::ItemIgnoresTransformations: flag = AncestorIgnoresTransformations; @@ -1732,9 +1731,6 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) d_ptr->updateAncestorFlag(ItemClipsChildrenToShape); } - if ((flags & ItemClipsToShape) != (oldFlags & ItemClipsToShape)) - d_ptr->invalidateCachedClipPath(); - if ((flags & ItemIgnoresTransformations) != (oldFlags & ItemIgnoresTransformations)) { // Item children clipping changes. Propagate the ancestor flag to // all children. @@ -3399,7 +3395,6 @@ void QGraphicsItemPrivate::setPosHelper(const QPointF &pos) { Q_Q(QGraphicsItem); inSetPosHelper = 1; - updateCachedClipPathFromSetPosHelper(pos); if (scene) q->prepareGeometryChange(); QPointF oldPos = this->pos; @@ -4535,22 +4530,12 @@ bool QGraphicsItem::isClipped() const QPainterPath QGraphicsItem::clipPath() const { Q_D(const QGraphicsItem); - if (!d->dirtyClipPath) - return d->emptyClipPath ? QPainterPath() : d->cachedClipPath; - - if (!isClipped()) { - d_ptr->setCachedClipPath(QPainterPath()); - return d->cachedClipPath; - } + if (!isClipped()) + return QPainterPath(); const QRectF thisBoundingRect(boundingRect()); - if (thisBoundingRect.isEmpty()) { - if (d_ptr->flags & ItemClipsChildrenToShape) - d_ptr->setEmptyCachedClipPathRecursively(); - else - d_ptr->setEmptyCachedClipPath(); + if (thisBoundingRect.isEmpty()) return QPainterPath(); - } QPainterPath clip; // Start with the item's bounding rect. @@ -4561,40 +4546,18 @@ QPainterPath QGraphicsItem::clipPath() const const QGraphicsItem *lastParent = this; // Intersect any in-between clips starting at the top and moving downwards. - bool foundValidClipPath = false; while ((parent = parent->d_ptr->parent)) { if (parent->d_ptr->flags & ItemClipsChildrenToShape) { // Map clip to the current parent and intersect with its shape/clipPath clip = lastParent->itemTransform(parent).map(clip); - if ((foundValidClipPath = !parent->d_ptr->dirtyClipPath && parent->isClipped())) { - if (parent->d_ptr->emptyClipPath) { - if (d_ptr->flags & ItemClipsChildrenToShape) - d_ptr->setEmptyCachedClipPathRecursively(); - else - d_ptr->setEmptyCachedClipPath(); - return QPainterPath(); - } - clip = clip.intersected(parent->d_ptr->cachedClipPath); - if (!(parent->d_ptr->flags & ItemClipsToShape)) - clip = clip.intersected(parent->shape()); - } else { - clip = clip.intersected(parent->shape()); - } - - if (clip.isEmpty()) { - if (d_ptr->flags & ItemClipsChildrenToShape) - d_ptr->setEmptyCachedClipPathRecursively(); - else - d_ptr->setEmptyCachedClipPath(); + clip = clip.intersected(parent->shape()); + if (clip.isEmpty()) return clip; - } lastParent = parent; } - if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) - || foundValidClipPath) { + if (!(parent->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) break; - } } if (lastParent != this) { @@ -4607,7 +4570,6 @@ QPainterPath QGraphicsItem::clipPath() const if (d->flags & ItemClipsToShape) clip = clip.intersected(shape()); - d_ptr->setCachedClipPath(clip); return clip; } @@ -5029,12 +4991,12 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity) bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, bool ignoreVisibleBit, bool ignoreDirtyBit, bool ignoreOpacity) const { + Q_UNUSED(ignoreClipping); // No scene, or if the scene is updating everything, means we have nothing // to do. The only exception is if the scene tracks the growing scene rect. return !scene || (!visible && !ignoreVisibleBit && !this->ignoreVisible) || (!ignoreDirtyBit && fullUpdatePending) - || (!ignoreClipping && (childrenClippedToShape() && isClippedAway())) || (!ignoreOpacity && !this->ignoreOpacity && childrenCombineOpacity() && isFullyTransparent()); } @@ -5169,109 +5131,6 @@ void QGraphicsItemPrivate::removeExtraItemCache() unsetExtra(ExtraCacheData); } -void QGraphicsItemPrivate::setEmptyCachedClipPathRecursively(const QRectF &emptyIfOutsideThisRect) -{ - setEmptyCachedClipPath(); - - const bool checkRect = !emptyIfOutsideThisRect.isNull() - && !(flags & QGraphicsItem::ItemClipsChildrenToShape); - for (int i = 0; i < children.size(); ++i) { - if (!checkRect) { - children.at(i)->d_ptr->setEmptyCachedClipPathRecursively(); - continue; - } - - QGraphicsItem *child = children.at(i); - const QRectF rect = child->mapRectFromParent(emptyIfOutsideThisRect); - if (rect.intersects(child->boundingRect())) - child->d_ptr->invalidateCachedClipPathRecursively(false, rect); - else - child->d_ptr->setEmptyCachedClipPathRecursively(rect); - } -} - -void QGraphicsItemPrivate::invalidateCachedClipPathRecursively(bool childrenOnly, const QRectF &emptyIfOutsideThisRect) -{ - if (!childrenOnly) - invalidateCachedClipPath(); - - const bool checkRect = !emptyIfOutsideThisRect.isNull(); - for (int i = 0; i < children.size(); ++i) { - if (!checkRect) { - children.at(i)->d_ptr->invalidateCachedClipPathRecursively(false); - continue; - } - - QGraphicsItem *child = children.at(i); - const QRectF rect = child->mapRectFromParent(emptyIfOutsideThisRect); - if (rect.intersects(child->boundingRect())) - child->d_ptr->invalidateCachedClipPathRecursively(false, rect); - else - child->d_ptr->setEmptyCachedClipPathRecursively(rect); - } -} - -void QGraphicsItemPrivate::updateCachedClipPathFromSetPosHelper(const QPointF &newPos) -{ - Q_ASSERT(inSetPosHelper); - - if (inDestructor || !(ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) - return; // Not clipped by any ancestor. - - // Find closest clip ancestor and transform. - Q_Q(QGraphicsItem); - // COMBINE - QTransform thisToParentTransform = QTransform::fromTranslate(newPos.x(), newPos.y()); - if (transformData) - thisToParentTransform = transformData->computedFullTransform(&thisToParentTransform); - QGraphicsItem *clipParent = parent; - while (clipParent && !clipParent->d_ptr->inDestructor && !(clipParent->d_ptr->flags & QGraphicsItem::ItemClipsChildrenToShape)) { - thisToParentTransform *= clipParent->d_ptr->transformToParent(); - clipParent = clipParent->d_ptr->parent; - } - - // Ensure no parents are currently being deleted. This can only - // happen if the item is moved by a dying ancestor. - QGraphicsItem *p = clipParent; - while (p) { - if (p->d_ptr->inDestructor) - return; - p = p->d_ptr->parent; - } - - // From here everything is calculated in clip parent's coordinates. - const QRectF parentBoundingRect(clipParent->boundingRect()); - const QRectF thisBoundingRect(thisToParentTransform.mapRect(q->boundingRect())); - - if (!parentBoundingRect.intersects(thisBoundingRect)) { - // Item is moved outside the clip parent's bounding rect, - // i.e. it is fully clipped and the clip path is empty. - if (flags & QGraphicsItem::ItemClipsChildrenToShape) - setEmptyCachedClipPathRecursively(); - else - setEmptyCachedClipPathRecursively(thisToParentTransform.inverted().mapRect(parentBoundingRect)); - return; - } - - const QPainterPath parentClip(clipParent->isClipped() ? clipParent->clipPath() : clipParent->shape()); - if (parentClip.contains(thisBoundingRect)) - return; // Item is inside the clip parent's shape. No update required. - - const QRectF parentClipRect(parentClip.controlPointRect()); - if (!parentClipRect.intersects(thisBoundingRect)) { - // Item is moved outside the clip parent's shape, - // i.e. it is fully clipped and the clip path is empty. - if (flags & QGraphicsItem::ItemClipsChildrenToShape) - setEmptyCachedClipPathRecursively(); - else - setEmptyCachedClipPathRecursively(thisToParentTransform.inverted().mapRect(parentClipRect)); - } else { - // Item is partially inside the clip parent's shape, - // i.e. the cached clip path must be invalidated. - invalidateCachedClipPathRecursively(false, thisToParentTransform.inverted().mapRect(parentClipRect)); - } -} - // Traverses all the ancestors up to the top-level and updates the pointer to // always point to the top-most item that has a dirty scene transform. // It then backtracks to the top-most dirty item and start calculating the @@ -7313,16 +7172,6 @@ void QGraphicsItem::prepareGeometryChange() // ### Only do this if the parent's effect applies to the entire subtree. parent->d_ptr->notifyBoundingRectChanged = 1; } - - if (d_ptr->inSetPosHelper) - return; - - if (d_ptr->flags & ItemClipsChildrenToShape - || d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) { - d_ptr->invalidateCachedClipPathRecursively(); - } else { - d_ptr->invalidateCachedClipPath(); - } } /*! diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 75c8246..013fce1 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -152,8 +152,6 @@ public: dirty(0), dirtyChildren(0), localCollisionHack(0), - dirtyClipPath(1), - emptyClipPath(0), inSetPosHelper(0), needSortChildren(1), // ### can be 0 by default? allChildrenDirty(0), @@ -307,26 +305,6 @@ public: QGraphicsItemCache *extraItemCache() const; void removeExtraItemCache(); - inline void setCachedClipPath(const QPainterPath &path) - { - cachedClipPath = path; - dirtyClipPath = 0; - emptyClipPath = 0; - } - - inline void setEmptyCachedClipPath() - { - emptyClipPath = 1; - dirtyClipPath = 0; - } - - void setEmptyCachedClipPathRecursively(const QRectF &emptyIfOutsideThisRect = QRectF()); - - inline void invalidateCachedClipPath() - { /*static int count = 0 ;qWarning("%i", ++count);*/ dirtyClipPath = 1; emptyClipPath = 0; } - - void invalidateCachedClipPathRecursively(bool childrenOnly = false, const QRectF &emptyIfOutsideThisRect = QRectF()); - void updateCachedClipPathFromSetPosHelper(const QPointF &newPos); void ensureSceneTransformRecursive(QGraphicsItem **topMostDirtyItem); inline void ensureSceneTransform() { @@ -409,17 +387,12 @@ public: return true; } - inline bool isClippedAway() const - { return !dirtyClipPath && q_func()->isClipped() && (emptyClipPath || cachedClipPath.isEmpty()); } - inline bool childrenClippedToShape() const { return (flags & QGraphicsItem::ItemClipsChildrenToShape) || children.isEmpty(); } inline bool isInvisible() const { - return !visible - || (childrenClippedToShape() && isClippedAway()) - || (childrenCombineOpacity() && isFullyTransparent()); + return !visible || (childrenCombineOpacity() && isFullyTransparent()); } void setFocusHelper(Qt::FocusReason focusReason, bool climb); @@ -435,7 +408,6 @@ public: inline void sendScenePosChange(); virtual void siblingOrderChange(); - QPainterPath cachedClipPath; QRectF childrenBoundingRect; QRectF needsRepaint; QMap paintedViewBoundingRects; @@ -480,8 +452,6 @@ public: quint32 dirty : 1; quint32 dirtyChildren : 1; quint32 localCollisionHack : 1; - quint32 dirtyClipPath : 1; - quint32 emptyClipPath : 1; quint32 inSetPosHelper : 1; quint32 needSortChildren : 1; quint32 allChildrenDirty : 1; diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index d9c65bb..f6c06d5 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -385,8 +385,6 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) QSizeF oldSize = size(); QGraphicsLayoutItem::setGeometry(newGeom); - wd->invalidateCachedClipPathRecursively(); - // Send resize event bool resized = newGeom.size() != oldSize; if (resized) { -- cgit v0.12 From 9638c1e076a6dac73dd6a5a4ffee10b1c71eedcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 25 Nov 2009 11:53:10 +0100 Subject: Remove unused variables in QGraphicsItem and QGraphicsScene. maybeDirtyClipPath and ingoreClipping is not relevant anymore now that the cached clip path is removed. --- src/gui/graphicsview/qgraphicsitem.cpp | 40 ++++++++++++--------------------- src/gui/graphicsview/qgraphicsitem_p.h | 2 +- src/gui/graphicsview/qgraphicsscene.cpp | 9 ++++---- src/gui/graphicsview/qgraphicsscene_p.h | 3 +-- 4 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index a42c1c3..34f42fb 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1103,9 +1103,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) parent->itemChange(QGraphicsItem::ItemChildAddedChange, thisPointerVariant); if (scene) { if (!implicitUpdate) - scene->d_func()->markDirty(q_ptr, QRect(), - /*invalidateChildren=*/false, - /*maybeDirtyClipPath=*/true); + scene->d_func()->markDirty(q_ptr); // Re-enable scene pos notifications for new ancestors if (scenePosDescendants || (flags & QGraphicsItem::ItemSendsScenePositionChanges)) @@ -1146,11 +1144,8 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent) setEnabledHelper(true, /* explicit = */ false); // If the item is being deleted, the whole scene will be updated. - if (scene) { - scene->d_func()->markDirty(q_ptr, QRect(), - /*invalidateChildren=*/false, - /*maybeDirtyClipPath=*/true); - } + if (scene) + scene->d_func()->markDirty(q_ptr); } } @@ -1773,9 +1768,7 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) else d_ptr->scene->d_func()->unregisterScenePosItem(this); } - d_ptr->scene->d_func()->markDirty(this, QRectF(), - /*invalidateChildren=*/true, - /*maybeDirtyClipPath*/true); + d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true); } // Notify change. @@ -2123,12 +2116,8 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo QGraphicsItemCache *c = (QGraphicsItemCache *)qVariantValue(extra(ExtraCacheData)); if (c) c->purge(); - if (scene) { - scene->d_func()->markDirty(q_ptr, QRectF(), - /*invalidateChildren=*/false, - /*maybeDirtyClipPath=*/false, - /*force=*/true); - } + if (scene) + scene->d_func()->markDirty(q_ptr, QRectF(), /*invalidateChildren=*/false, /*force=*/true); } // Certain properties are dropped as an item becomes invisible. @@ -2538,7 +2527,6 @@ void QGraphicsItem::setOpacity(qreal opacity) #endif //QT_NO_GRAPHICSEFFECT d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true, - /*maybeDirtyClipPath=*/false, /*force=*/false, /*ignoreOpacity=*/true); } @@ -2586,8 +2574,11 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect) d_ptr->graphicsEffect = 0; if (oldEffectPrivate) { oldEffectPrivate->setGraphicsEffectSource(0); // deletes the current source. - if (d_ptr->scene) // Update the views directly. - d_ptr->scene->d_func()->markDirty(this, QRectF(), false, false, false, false, true); + if (d_ptr->scene) { // Update the views directly. + d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/false, + /*force=*/false, /*ignoreOpacity=*/false, + /*removeItemFromScene=*/true); + } } } else { // Set new effect. @@ -4988,10 +4979,9 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity) \internal Returns true if we can discard an update request; otherwise false. */ -bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, bool ignoreVisibleBit, - bool ignoreDirtyBit, bool ignoreOpacity) const +bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreVisibleBit, bool ignoreDirtyBit, + bool ignoreOpacity) const { - Q_UNUSED(ignoreClipping); // No scene, or if the scene is updating everything, means we have nothing // to do. The only exception is if the scene tracks the growing scene rect. return !scene @@ -7147,9 +7137,7 @@ void QGraphicsItem::prepareGeometryChange() QGraphicsScenePrivate *scenePrivate = d_ptr->scene->d_func(); scenePrivate->index->prepareBoundingRectChange(this); - scenePrivate->markDirty(this, QRectF(), - /*invalidateChildren=*/true, - /*maybeDirtyClipPath=*/!d_ptr->inSetPosHelper); + scenePrivate->markDirty(this, QRectF(), /*invalidateChildren=*/true); // For compatibility reasons, we have to update the item's old geometry // if someone is connected to the changed signal or the scene has no views. diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 013fce1..d6ffb1a 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -219,7 +219,7 @@ public: void appendGraphicsTransform(QGraphicsTransform *t); void setVisibleHelper(bool newVisible, bool explicitly, bool update = true); void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true); - bool discardUpdateRequest(bool ignoreClipping = false, bool ignoreVisibleBit = false, + bool discardUpdateRequest(bool ignoreVisibleBit = false, bool ignoreDirtyBit = false, bool ignoreOpacity = false) const; int depth() const; #ifndef QT_NO_GRAPHICSEFFECT diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 10d251d..8777cdc 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -555,7 +555,8 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) // Clear focus on the item to remove any reference in the focusWidget chain. item->clearFocus(); - markDirty(item, QRectF(), false, false, false, false, /*removingItemFromScene=*/true); + markDirty(item, QRectF(), /*invalidateChildren=*/false, /*force=*/false, + /*ignoreOpacity=*/false, /*removingItemFromScene=*/true); if (item->d_ptr->inDestructor) { // The item is actually in its destructor, we call the special method in the index. @@ -4759,15 +4760,13 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q } void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, bool invalidateChildren, - bool maybeDirtyClipPath, bool force, bool ignoreOpacity, - bool removingItemFromScene) + bool force, bool ignoreOpacity, bool removingItemFromScene) { Q_ASSERT(item); if (updateAll) return; - if (item->d_ptr->discardUpdateRequest(/*ignoreClipping=*/maybeDirtyClipPath, - /*ignoreVisibleBit=*/force, + if (item->d_ptr->discardUpdateRequest(/*ignoreVisibleBit=*/force, /*ignoreDirtyBit=*/removingItemFromScene || invalidateChildren, /*ignoreOpacity=*/ignoreOpacity)) { if (item->d_ptr->dirty) { diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index fdec466..a1d0496 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -222,8 +222,7 @@ public: QRegion *, QWidget *, qreal, const QTransform *const, bool, bool); void markDirty(QGraphicsItem *item, const QRectF &rect = QRectF(), bool invalidateChildren = false, - bool maybeDirtyClipPath = false, bool force = false, bool ignoreOpacity = false, - bool removingItemFromScene = false); + bool force = false, bool ignoreOpacity = false, bool removingItemFromScene = false); void processDirtyItemsRecursive(QGraphicsItem *item, bool dirtyAncestorContainsChildren = false, qreal parentOpacity = qreal(1.0)); -- cgit v0.12 From 729d01352f7c6165228eab9e32d52becbb4258a5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 25 Nov 2009 20:53:21 +0100 Subject: make qph use language attributes --- tools/linguist/shared/qph.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tools/linguist/shared/qph.cpp b/tools/linguist/shared/qph.cpp index fb4fee9..32bdabb 100644 --- a/tools/linguist/shared/qph.cpp +++ b/tools/linguist/shared/qph.cpp @@ -81,14 +81,20 @@ bool QPHReader::read(Translator &translator) while (!atEnd()) { readNext(); if (isStartElement()) { - if (name() == QLatin1String("source")) + if (name() == QLatin1String("source")) { m_currentField = SourceField; - else if (name() == QLatin1String("target")) + } else if (name() == QLatin1String("target")) { m_currentField = TargetField; - else if (name() == QLatin1String("definition")) + } else if (name() == QLatin1String("definition")) { m_currentField = DefinitionField; - else + } else { m_currentField = NoField; + if (name() == QLatin1String("QPH")) { + QXmlStreamAttributes atts = attributes(); + translator.setLanguageCode(atts.value(QLatin1String("language")).toString()); + translator.setSourceLanguageCode(atts.value(QLatin1String("sourcelanguage")).toString()); + } + } } else if (isWhiteSpace()) { // ignore these } else if (isCharacters()) { @@ -157,7 +163,14 @@ static bool saveQPH(const Translator &translator, QIODevice &dev, ConversionData { QTextStream t(&dev); t.setCodec(QTextCodec::codecForName("UTF-8")); - t << "\n\n"; + t << "\n\n"; foreach (const TranslatorMessage &msg, translator.messages()) { t << "\n"; t << " " << protect(msg.sourceText()) << "\n"; -- cgit v0.12 From 67e031b196745e44a2edb608e18ddd8f5722d91b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 25 Nov 2009 20:52:55 +0100 Subject: add qph autotest --- tests/auto/linguist/lconvert/data/phrasebook.qph | 21 +++++++++++++++++++++ tests/auto/linguist/lconvert/tst_lconvert.cpp | 1 + 2 files changed, 22 insertions(+) create mode 100644 tests/auto/linguist/lconvert/data/phrasebook.qph diff --git a/tests/auto/linguist/lconvert/data/phrasebook.qph b/tests/auto/linguist/lconvert/data/phrasebook.qph new file mode 100644 index 0000000..847a53b --- /dev/null +++ b/tests/auto/linguist/lconvert/data/phrasebook.qph @@ -0,0 +1,21 @@ + + + + About + Info + + + adornment + Zubehör + + + barrel button + Pen-Knopf + pen + + + foo & bar + Foo & bar + <test>übergroß + + diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 10098a4..cf8f5c3 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -213,6 +213,7 @@ void tst_lconvert::readverifies_data() QTest::newRow("relative locations") << "relative.ts" << "ts"; QTest::newRow("message ids") << "msgid.ts" << "ts"; QTest::newRow("length variants") << "variants.ts" << "ts"; + QTest::newRow("qph") << "phrasebook.qph" << "qph"; } void tst_lconvert::readverifies() -- cgit v0.12 From f1ae6d0ecba250d83cf7e747868af32ceadc085f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 25 Nov 2009 23:12:26 +0100 Subject: offer only possible countries for each language otherwise qlocale will silently clobber the user's (most probably bogus) choice anyway. --- .../linguist/translationsettingsdialog.cpp | 33 ++++++++++++++++------ .../linguist/linguist/translationsettingsdialog.h | 2 ++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/tools/linguist/linguist/translationsettingsdialog.cpp b/tools/linguist/linguist/translationsettingsdialog.cpp index 0d94c3a..562f14e 100644 --- a/tools/linguist/linguist/translationsettingsdialog.cpp +++ b/tools/linguist/linguist/translationsettingsdialog.cpp @@ -60,15 +60,7 @@ TranslationSettingsDialog::TranslationSettingsDialog(QWidget *parent) m_ui.srcCbLanguageList->model()->sort(0, Qt::AscendingOrder); m_ui.srcCbLanguageList->insertItem(0, QLatin1String("POSIX"), QVariant(QLocale::C)); - for (int i = QLocale::AnyCountry + 1; i < QLocale::LastCountry; ++i) { - QString country = QLocale::countryToString(QLocale::Country(i)); - m_ui.srcCbCountryList->addItem(country, QVariant(i)); - } - m_ui.srcCbCountryList->model()->sort(0, Qt::AscendingOrder); - m_ui.srcCbCountryList->insertItem(0, tr("Any Country"), QVariant(QLocale::AnyCountry)); - m_ui.tgtCbLanguageList->setModel(m_ui.srcCbLanguageList->model()); - m_ui.tgtCbCountryList->setModel(m_ui.srcCbCountryList->model()); } void TranslationSettingsDialog::setDataModel(DataModel *dataModel) @@ -87,6 +79,31 @@ void TranslationSettingsDialog::setPhraseBook(PhraseBook *phraseBook) setWindowTitle(tr("Settings for '%1' - Qt Linguist").arg(fn)); } +static void fillCountryCombo(const QVariant &lng, QComboBox *combo) +{ + combo->clear(); + QLocale::Language lang = QLocale::Language(lng.toInt()); + if (lang != QLocale::C) { + foreach (QLocale::Country cntr, QLocale::countriesForLanguage(lang)) { + QString country = QLocale::countryToString(cntr); + combo->addItem(country, QVariant(cntr)); + } + combo->model()->sort(0, Qt::AscendingOrder); + } + combo->insertItem(0, TranslationSettingsDialog::tr("Any Country"), QVariant(QLocale::AnyCountry)); + combo->setCurrentIndex(0); +} + +void TranslationSettingsDialog::on_srcCbLanguageList_currentIndexChanged(int idx) +{ + fillCountryCombo(m_ui.srcCbLanguageList->itemData(idx), m_ui.srcCbCountryList); +} + +void TranslationSettingsDialog::on_tgtCbLanguageList_currentIndexChanged(int idx) +{ + fillCountryCombo(m_ui.tgtCbLanguageList->itemData(idx), m_ui.tgtCbCountryList); +} + void TranslationSettingsDialog::on_buttonBox_accepted() { int itemindex = m_ui.tgtCbLanguageList->currentIndex(); diff --git a/tools/linguist/linguist/translationsettingsdialog.h b/tools/linguist/linguist/translationsettingsdialog.h index 2408add..7908cd7 100644 --- a/tools/linguist/linguist/translationsettingsdialog.h +++ b/tools/linguist/linguist/translationsettingsdialog.h @@ -66,6 +66,8 @@ private: private slots: void on_buttonBox_accepted(); + void on_srcCbLanguageList_currentIndexChanged(int idx); + void on_tgtCbLanguageList_currentIndexChanged(int idx); private: Ui::TranslationSettingsDialog m_ui; -- cgit v0.12 From a0b17797b0d3ae5716d83eea36ea1adf51406730 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 26 Nov 2009 15:49:47 +1000 Subject: Don't ask for pbuffers when searching for an OpenVG configuration Reviewed-by: Sarah Smith --- src/openvg/qwindowsurface_vgegl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index 29d82c8..e7d8113 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -211,19 +211,19 @@ static QEglContext *createContext(QPaintDevice *device) configProps.setValue(EGL_ALPHA_MASK_SIZE, 1); #endif #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT - configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT | + configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_VG_ALPHA_FORMAT_PRE_BIT); configProps.setRenderableType(QEgl::OpenVG); if (!context->chooseConfig(configProps)) { // Try again without the "pre" bit. - configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT); + configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT); if (!context->chooseConfig(configProps)) { delete context; return 0; } } #else - configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT); + configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT); configProps.setRenderableType(QEgl::OpenVG); if (!context->chooseConfig(configProps)) { delete context; -- cgit v0.12 From 88c9a52646ef1c695ef0a7461ed1f6a7ce923375 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 26 Nov 2009 16:24:32 +1000 Subject: QT_VG_EGL_CONFIG env var to specify explicit EGL configs for OpenVG Reviewed-by: Sarah Smith --- src/openvg/qwindowsurface_vgegl.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index e7d8113..62871cf 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -200,6 +200,42 @@ static QEglContext *createContext(QPaintDevice *device) else eglSwapInterval(context->display(), 1); +#ifdef EGL_RENDERABLE_TYPE + // Has the user specified an explicit EGL configuration to use? + QByteArray configId = qgetenv("QT_VG_EGL_CONFIG"); + if (!configId.isEmpty()) { + EGLint cfgId = configId.toInt(); + EGLint properties[] = { + EGL_CONFIG_ID, cfgId, + EGL_NONE + }; + EGLint matching = 0; + EGLConfig cfg; + if (eglChooseConfig + (context->display(), properties, &cfg, 1, &matching) && + matching > 0) { + // Check that the selected configuration actually supports OpenVG + // and then create the context with it. + EGLint id = 0; + EGLint type = 0; + eglGetConfigAttrib + (context->display(), cfg, EGL_CONFIG_ID, &id); + eglGetConfigAttrib + (context->display(), cfg, EGL_RENDERABLE_TYPE, &type); + if (cfgId == id && (type & EGL_OPENVG_BIT) != 0) { + context->setConfig(cfg); + if (!context->createContext()) { + delete context; + return 0; + } + return context; + } else { + qWarning("QT_VG_EGL_CONFIG: %d is not a valid OpenVG configuration", int(cfgId)); + } + } + } +#endif + // Choose an appropriate configuration for rendering into the device. QEglProperties configProps; configProps.setPaintDeviceFormat(device); -- cgit v0.12 From 0f06d08a3c5eb4d0397406ed559cfaba6e137492 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 25 Nov 2009 21:38:39 +0100 Subject: Optimize QObjectPrivate::isSignalConnected It can be seen in the GraphicsView benchmark. This function has to be as fast as possible. Make the function inline. We do not need 64bit for the connectedSignals bit array because it is very unlikely that an object will have more than 32 signals. (In Qt 4.5 it could have hapenned as the slot were counting in the index) Reviewed-by: bnilsen Reviewed-by: Brad --- src/corelib/kernel/qobject.cpp | 47 +++------------- src/corelib/kernel/qobject_p.h | 21 ++++++- tests/auto/qobject/tst_qobject.cpp | 109 +++++++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+), 42 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 95602d9..4321c59 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -145,8 +145,7 @@ QObjectPrivate::QObjectPrivate(int version) receiveChildEvents = true; postedEvents = 0; extraData = 0; - for (uint i = 0; i < (sizeof connectedSignals / sizeof connectedSignals[0]); ++i) - connectedSignals[i] = 0; + connectedSignals = 0; inEventHandler = false; inThreadChangeEvent = false; deleteWatch = 0; @@ -2937,13 +2936,9 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index, QObjectPrivate *const sender_d = QObjectPrivate::get(s); if (signal_index < 0) { - for (uint i = 0; i < (sizeof sender_d->connectedSignals - / sizeof sender_d->connectedSignals[0] ); ++i) - sender_d->connectedSignals[i] = ~0u; - } else if (signal_index < (int)sizeof sender_d->connectedSignals * 8) { - uint n = (signal_index / (8 * sizeof sender_d->connectedSignals[0])); - sender_d->connectedSignals[n] |= (1 << (signal_index - n * 8 - * sizeof sender_d->connectedSignals[0])); + sender_d->connectedSignals = ~ulong(0); + } else if (signal_index < (int)sizeof(sender_d->connectedSignals) * 8) { + sender_d->connectedSignals |= ulong(1) << signal_index; } return true; @@ -3201,15 +3196,9 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign computeOffsets(m, &signalOffset, &methodOffset); int signal_index = signalOffset + local_signal_index; - if (signal_index < (int)sizeof(sender->d_func()->connectedSignals) * 8 - && !qt_signal_spy_callback_set.signal_begin_callback - && !qt_signal_spy_callback_set.signal_end_callback) { - uint n = (signal_index / (8 * sizeof sender->d_func()->connectedSignals[0])); - uint m = 1 << (signal_index - n * 8 * sizeof sender->d_func()->connectedSignals[0]); - if ((sender->d_func()->connectedSignals[n] & m) == 0) - // nothing connected to these signals, and no spy - return; - } + + if (!sender->d_func()->isSignalConnected(signal_index)) + return; // nothing connected to these signals, and no spy if (sender->d_func()->blockSig) return; @@ -3370,28 +3359,6 @@ int QObjectPrivate::signalIndex(const char *signalName) const return relative_index + signalOffset; } -/*! \internal - - Returns true if the signal with index \a signal_index from object \a sender is connected. - Signals with indices above a certain range are always considered connected (see connectedSignals - in QObjectPrivate). If a signal spy is installed, all signals are considered connected. - - \a signal_index must be the index returned by QObjectPrivate::signalIndex; -*/ -bool QObjectPrivate::isSignalConnected(int signal_index) const -{ - if (signal_index < (int)sizeof(connectedSignals) * 8 - && !qt_signal_spy_callback_set.signal_begin_callback - && !qt_signal_spy_callback_set.signal_end_callback) { - uint n = (signal_index / (8 * sizeof connectedSignals[0])); - uint m = 1 << (signal_index - n * 8 * sizeof connectedSignals[0]); - if ((connectedSignals[n] & m) == 0) - // nothing connected to these signals, and no spy - return false; - } - return true; -} - /***************************************************************************** Properties *****************************************************************************/ diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index f087407..f899c78 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -172,7 +172,7 @@ public: } int signalIndex(const char *signalName) const; - bool isSignalConnected(int signalIdx) const; + inline bool isSignalConnected(int signalIdx) const; public: QString objectName; @@ -183,7 +183,7 @@ public: Connection *senders; // linked list of connections connected to this object Sender *currentSender; // object currently activating the object - mutable quint32 connectedSignals[2]; // 64-bit, so doesn't cause padding on 64-bit platforms + mutable ulong connectedSignals; #ifdef QT3_SUPPORT QList pendingChildInsertedEvents; @@ -205,6 +205,23 @@ public: int *deleteWatch; }; +/*! \internal + + Returns true if the signal with index \a signal_index from object \a sender is connected. + Signals with indices above a certain range are always considered connected (see connectedSignals + in QObjectPrivate). If a signal spy is installed, all signals are considered connected. + + \a signal_index must be the index returned by QObjectPrivate::signalIndex; +*/ +inline bool QObjectPrivate::isSignalConnected(int signal_index) const +{ + return signal_index >= (int)sizeof(connectedSignals) * 8 + || qt_signal_spy_callback_set.signal_begin_callback + || qt_signal_spy_callback_set.signal_end_callback + || (connectedSignals & (ulong(1) << signal_index)); +} + + inline void q_guard_addGuard(QGuard *g) { QObjectPrivate *p = QObjectPrivate::get(g->o); diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 5035139..67a9c46 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -60,6 +60,10 @@ #include #include "qobject.h" +#ifdef QT_BUILD_INTERNAL +#include +#endif + #include @@ -121,6 +125,7 @@ private slots: void interfaceIid(); void deleteQObjectWhenDeletingEvent(); void overloads(); + void isSignalConnected(); protected: }; @@ -3016,5 +3021,109 @@ void tst_QObject::overloads() QCOMPARE(obj2.o4_obj, qApp); //default arg of the slot } +class ManySignals : public QObject +{ Q_OBJECT + friend class tst_QObject; +signals: + void sig00(); void sig01(); void sig02(); void sig03(); void sig04(); + void sig05(); void sig06(); void sig07(); void sig08(); void sig09(); + void sig10(); void sig11(); void sig12(); void sig13(); void sig14(); + void sig15(); void sig16(); void sig17(); void sig18(); void sig19(); + void sig20(); void sig21(); void sig22(); void sig23(); void sig24(); + void sig25(); void sig26(); void sig27(); void sig28(); void sig29(); + void sig30(); void sig31(); void sig32(); void sig33(); void sig34(); + void sig35(); void sig36(); void sig37(); void sig38(); void sig39(); + void sig40(); void sig41(); void sig42(); void sig43(); void sig44(); + void sig45(); void sig46(); void sig47(); void sig48(); void sig49(); + void sig50(); void sig51(); void sig52(); void sig53(); void sig54(); + void sig55(); void sig56(); void sig57(); void sig58(); void sig59(); + void sig60(); void sig61(); void sig62(); void sig63(); void sig64(); + void sig65(); void sig66(); void sig67(); void sig68(); void sig69(); + +public slots: + void received() { rec++; } +public: + int rec; +}; + + +void tst_QObject::isSignalConnected() +{ + ManySignals o; + o.rec = 0; +#ifdef QT_BUILD_INTERNAL + QObjectPrivate *priv = QObjectPrivate::get(&o); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("destroyed()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig00()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig05()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig15()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig29()"))); + if (sizeof(void *) >= 8) { //on 32bit isSignalConnected only works with the first 32 signals + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig60()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig61()"))); + } +#endif + + QObject::connect(&o, SIGNAL(sig00()), &o, SIGNAL(sig69())); + QObject::connect(&o, SIGNAL(sig34()), &o, SIGNAL(sig03())); + QObject::connect(&o, SIGNAL(sig69()), &o, SIGNAL(sig34())); + QObject::connect(&o, SIGNAL(sig03()), &o, SIGNAL(sig18())); + +#ifdef QT_BUILD_INTERNAL + QVERIFY(!priv->isSignalConnected(priv->signalIndex("destroyed()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig05()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig15()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig29()"))); + + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig00()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig03()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig34()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig69()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig18()"))); +#endif + + QObject::connect(&o, SIGNAL(sig18()), &o, SIGNAL(sig29())); + QObject::connect(&o, SIGNAL(sig29()), &o, SIGNAL(sig62())); + QObject::connect(&o, SIGNAL(sig62()), &o, SIGNAL(sig28())); + QObject::connect(&o, SIGNAL(sig28()), &o, SIGNAL(sig27())); + +#ifdef QT_BUILD_INTERNAL + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig18()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig62()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig28()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig69()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig27()"))); +#endif + + QCOMPARE(o.rec, 0); + emit o.sig01(); + emit o.sig34(); + QCOMPARE(o.rec, 0); + + QObject::connect(&o, SIGNAL(sig27()), &o, SLOT(received())); + +#ifdef QT_BUILD_INTERNAL + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig00()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig03()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig34()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig18()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig62()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig28()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig69()"))); + QVERIFY(priv->isSignalConnected(priv->signalIndex("sig27()"))); + + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig04()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig21()"))); + QVERIFY(!priv->isSignalConnected(priv->signalIndex("sig25()"))); +#endif + + emit o.sig00(); + QCOMPARE(o.rec, 1); + emit o.sig69(); + QCOMPARE(o.rec, 2); + emit o.sig36(); + QCOMPARE(o.rec, 2); +} + QTEST_MAIN(tst_QObject) #include "tst_qobject.moc" -- cgit v0.12 From c8494e085cd5abc3b30229409c7dacac676c81b9 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 26 Nov 2009 10:26:27 +0100 Subject: QGraphicsTextItem::setDefaultTextColor check change before calling update() Some applications call setDefaultTextColor in the paint event. Task-number: QTBUG-6242 Reviewed-by: Gabriel --- src/gui/graphicsview/qgraphicsitem.cpp | 4 +++- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 17 +++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 34f42fb..1f87cd9 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -9441,9 +9441,11 @@ void QGraphicsTextItem::setDefaultTextColor(const QColor &col) { QTextControl *c = dd->textControl(); QPalette pal = c->palette(); + QColor old = pal.color(QPalette::Text); pal.setColor(QPalette::Text, col); c->setPalette(pal); - update(); + if (old != col) + update(); } /*! diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index db80db6..565a3e7 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -9759,16 +9759,16 @@ void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor() { struct Item : public QGraphicsTextItem { - bool painted; + int painted; void paint(QPainter *painter, const QStyleOptionGraphicsItem *opt, QWidget *wid) { - painted = true; + painted++; QGraphicsTextItem::paint(painter, opt, wid); } }; Item *i = new Item; - i->painted = false; + i->painted = 0; i->setPlainText("I AM A TROLL"); QGraphicsScene scene; @@ -9780,11 +9780,11 @@ void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor() QTRY_VERIFY(i->painted); QApplication::processEvents(); - i->painted = false; + i->painted = 0; QColor col(Qt::red); i->setDefaultTextColor(col); QApplication::processEvents(); - QTRY_VERIFY(i->painted); //check that changing the color force an update + QTRY_COMPARE(i->painted, 1); //check that changing the color force an update i->painted = false; QImage image(400, 200, QImage::Format_RGB32); @@ -9792,7 +9792,7 @@ void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor() QPainter painter(&image); scene.render(&painter); painter.end(); - QVERIFY(i->painted); + QCOMPARE(i->painted, 1); int numRedPixel = 0; QRgb rgb = col.rgb(); @@ -9810,6 +9810,11 @@ void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor() } } QCOMPARE(numRedPixel, -1); //color not found, FAIL! + + i->painted = 0; + i->setDefaultTextColor(col); + QApplication::processEvents(); + QCOMPARE(i->painted, 0); //same color as before should not trigger an update (QTBUG-6242) } QTEST_MAIN(tst_QGraphicsItem) -- cgit v0.12 From 1d55c88b66013f86be9c7ef069f0f8cdb598d1e2 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 26 Nov 2009 11:34:44 +0100 Subject: rename .qs files to .js QtScript _is_ JavaScript, there's no need to use a custom extension. Most of the other examples were already using .js, but there were two files that still had the .qs extension. Agreed with Simon. Reviewed-by: TrustMe --- doc/src/examples/helloscript.qdoc | 6 +++--- examples/script/helloscript/helloscript.js | 5 +++++ examples/script/helloscript/helloscript.qrc | 2 +- examples/script/helloscript/helloscript.qs | 5 ----- examples/script/helloscript/main.cpp | 2 +- examples/script/qsdbg/example.js | 17 +++++++++++++++++ examples/script/qsdbg/example.qs | 17 ----------------- examples/script/qsdbg/main.cpp | 2 +- 8 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 examples/script/helloscript/helloscript.js delete mode 100644 examples/script/helloscript/helloscript.qs create mode 100644 examples/script/qsdbg/example.js delete mode 100644 examples/script/qsdbg/example.qs diff --git a/doc/src/examples/helloscript.qdoc b/doc/src/examples/helloscript.qdoc index 7142d8b..243b10f 100644 --- a/doc/src/examples/helloscript.qdoc +++ b/doc/src/examples/helloscript.qdoc @@ -69,7 +69,7 @@ The contents of the script file are read. - \snippet examples/script/helloscript/helloscript.qs 0 + \snippet examples/script/helloscript/helloscript.js 0 The script sets the \c text (note that the qTr() function is used to allow for translation) and \c styleSheet properties of the button, and calls the @@ -105,7 +105,7 @@ To generate the translation file, run \c lupdate as follows: \code - lupdate helloscript.qs -ts helloscript_la.ts + lupdate helloscript.js -ts helloscript_la.ts \endcode You should now have a file \c helloscript_la.ts in the current @@ -115,7 +115,7 @@ linguist helloscript_la.ts \endcode - You should now see the text "helloscript.qs" in the top left pane. + You should now see the text "helloscript.js" in the top left pane. Double-click it, then click on "Hello world!" and enter "Orbis, te saluto!" in the \gui Translation pane (the middle right of the window). Don't forget the exclamation mark! diff --git a/examples/script/helloscript/helloscript.js b/examples/script/helloscript/helloscript.js new file mode 100644 index 0000000..6d8e87c --- /dev/null +++ b/examples/script/helloscript/helloscript.js @@ -0,0 +1,5 @@ +//! [0] +button.text = qsTr('Hello World!'); +button.styleSheet = 'font-style: italic'; +button.show(); +//! [0] diff --git a/examples/script/helloscript/helloscript.qrc b/examples/script/helloscript/helloscript.qrc index dc93461..c52fa15 100644 --- a/examples/script/helloscript/helloscript.qrc +++ b/examples/script/helloscript/helloscript.qrc @@ -1,5 +1,5 @@ - helloscript.qs + helloscript.js diff --git a/examples/script/helloscript/helloscript.qs b/examples/script/helloscript/helloscript.qs deleted file mode 100644 index 6d8e87c..0000000 --- a/examples/script/helloscript/helloscript.qs +++ /dev/null @@ -1,5 +0,0 @@ -//! [0] -button.text = qsTr('Hello World!'); -button.styleSheet = 'font-style: italic'; -button.show(); -//! [0] diff --git a/examples/script/helloscript/main.cpp b/examples/script/helloscript/main.cpp index bc9a65e..55d63bf 100644 --- a/examples/script/helloscript/main.cpp +++ b/examples/script/helloscript/main.cpp @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) //! [2] //! [3] - QString fileName(":/helloscript.qs"); + QString fileName(":/helloscript.js"); QFile scriptFile(fileName); scriptFile.open(QIODevice::ReadOnly); QTextStream stream(&scriptFile); diff --git a/examples/script/qsdbg/example.js b/examples/script/qsdbg/example.js new file mode 100644 index 0000000..47c1363 --- /dev/null +++ b/examples/script/qsdbg/example.js @@ -0,0 +1,17 @@ +function bar() { + var x = 1; + var y = 2; + return x + y; +} + +function foo(a, b, c) { + var i = a + bar(); + var j = b - bar(); + var k = c * bar(); + return Math.cos(i) + Math.sin(j) - Math.atan(k); +} + +var first = foo(1, 2, 3); +var second = foo(4, 5, 6); +print("first was:", first, ", and second was:", second); + diff --git a/examples/script/qsdbg/example.qs b/examples/script/qsdbg/example.qs deleted file mode 100644 index 47c1363..0000000 --- a/examples/script/qsdbg/example.qs +++ /dev/null @@ -1,17 +0,0 @@ -function bar() { - var x = 1; - var y = 2; - return x + y; -} - -function foo(a, b, c) { - var i = a + bar(); - var j = b - bar(); - var k = c * bar(); - return Math.cos(i) + Math.sin(j) - Math.atan(k); -} - -var first = foo(1, 2, 3); -var second = foo(4, 5, 6); -print("first was:", first, ", and second was:", second); - diff --git a/examples/script/qsdbg/main.cpp b/examples/script/qsdbg/main.cpp index 526de0c..fdcc7cb 100644 --- a/examples/script/qsdbg/main.cpp +++ b/examples/script/qsdbg/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char **argv) { if (argc < 2) { - fprintf(stderr, "*** you must specify a script file to evaluate (try example.qs)\n"); + fprintf(stderr, "*** you must specify a script file to evaluate (try example.js)\n"); return(-1); } -- cgit v0.12 From 2f00c76081f261e6f357c279206a6a18fdadc472 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 26 Nov 2009 11:39:48 +0100 Subject: create application object in qsdbg example Since 4.6, it's required that the Q(Core)Application object is constructed before QScriptEngine objects. Reviewed-by: TrustMe --- examples/script/qsdbg/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/script/qsdbg/main.cpp b/examples/script/qsdbg/main.cpp index fdcc7cb..2a86c3d 100644 --- a/examples/script/qsdbg/main.cpp +++ b/examples/script/qsdbg/main.cpp @@ -39,12 +39,15 @@ ** ****************************************************************************/ +#include #include #include "scriptdebugger.h" int main(int argc, char **argv) { + QCoreApplication app(argc, argv); + if (argc < 2) { fprintf(stderr, "*** you must specify a script file to evaluate (try example.js)\n"); return(-1); -- cgit v0.12 From 8a6a554626b2362ef6a12faeb725a465eb33a9fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 26 Nov 2009 13:12:28 +0200 Subject: Remove some white-space from QS60Style Remove some white space from QS60Style classes. Reviewed-by: TrustMe --- src/gui/styles/qs60style.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 6c328b9..b71ec5d 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -643,7 +643,7 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0)); QHeaderView* header = qobject_cast(widget); widgetPalette.setColor(QPalette::Button, Qt::transparent ); - if ( header->viewport() ) + if (header->viewport()) header->viewport()->setPalette(widgetPalette); QApplication::setPalette(widgetPalette, "QHeaderView"); } @@ -864,7 +864,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag return result; } -bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush) +bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush) { //If brush is not changed from style's default values, draw theme graphics. return (backgroundBrush.color() == Qt::transparent || @@ -1782,7 +1782,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (qobject_cast(widget)) { //Make cornerButton slightly smaller so that it is not on top of table border graphic. QStyleOptionHeader subopt = *header; - const int borderTweak = + const int borderTweak = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth)>>1; if (subopt.direction == Qt::LeftToRight) subopt.rect.adjust(borderTweak, borderTweak, 0, -borderTweak); @@ -1875,7 +1875,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, adjustableFlags = (adjustableFlags | QS60StylePrivate::SF_PointWest); } else { const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); - if (option->direction == Qt::LeftToRight) + if (option->direction == Qt::LeftToRight) headerRect.adjust(-2*frameWidth, 0, 0, 0); else headerRect.adjust(0, 0, 2*frameWidth, 0); @@ -2590,7 +2590,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple const int indicatorRect = pixelMetric(PM_MenuButtonIndicator) + 2*pixelMetric(PM_ButtonMargin); const int border = pixelMetric(PM_ButtonMargin) + pixelMetric(PM_DefaultFrameWidth); ret = toolButton->rect; - const bool popup = (toolButton->features & + const bool popup = (toolButton->features & (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay)) == QStyleOptionToolButton::MenuButtonPopup; switch (scontrol) { -- cgit v0.12 From 92c2102f5b1f3ab5ee1ac7a56aaabcd656804d04 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 26 Nov 2009 13:15:00 +0200 Subject: Made layout of the Softkeys example more compact Softkeys example didn't fit on the screen in landscape mode due to the widget minimum size enforcement done by Qt. Changed the layout of the example from QVBoxLayout to QGridlayout to make better use of the available space. Also shortened button texts. Task-number: QTBUG-6126 Reviewed-by: Janne Anttila --- examples/widgets/softkeys/softkeys.cpp | 16 ++++++++-------- examples/widgets/softkeys/softkeys.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/widgets/softkeys/softkeys.cpp b/examples/widgets/softkeys/softkeys.cpp index 69b4941..d1586a5 100644 --- a/examples/widgets/softkeys/softkeys.cpp +++ b/examples/widgets/softkeys/softkeys.cpp @@ -66,11 +66,11 @@ MainWindow::MainWindow(QWidget *parent) infoLabel = new QLabel(tr(""), this); infoLabel->setContextMenuPolicy(Qt::NoContextMenu); - toggleButton = new QPushButton(tr("Custom softkeys"), this); + toggleButton = new QPushButton(tr("Custom"), this); toggleButton->setContextMenuPolicy(Qt::NoContextMenu); toggleButton->setCheckable(true); - pushButton = new QPushButton(tr("Open File Dialog"), this); + pushButton = new QPushButton(tr("File Dialog"), this); pushButton->setContextMenuPolicy(Qt::NoContextMenu); QComboBox* comboBox = new QComboBox(this); @@ -81,12 +81,12 @@ MainWindow::MainWindow(QWidget *parent) << QApplication::translate("MainWindow", "Selection3", 0, QApplication::UnicodeUTF8) ); - layout = new QVBoxLayout; - layout->addWidget(textEditor); - layout->addWidget(infoLabel); - layout->addWidget(toggleButton); - layout->addWidget(pushButton); - layout->addWidget(comboBox); + layout = new QGridLayout; + layout->addWidget(textEditor, 0, 0, 1, 2); + layout->addWidget(infoLabel, 1, 0, 1, 2); + layout->addWidget(toggleButton, 2, 0); + layout->addWidget(pushButton, 2, 1); + layout->addWidget(comboBox, 3, 0, 1, 2); central->setLayout(layout); fileMenu = menuBar()->addMenu(tr("&File")); diff --git a/examples/widgets/softkeys/softkeys.h b/examples/widgets/softkeys/softkeys.h index 178ae64..1372fa4 100644 --- a/examples/widgets/softkeys/softkeys.h +++ b/examples/widgets/softkeys/softkeys.h @@ -61,7 +61,7 @@ public: MainWindow(QWidget *parent = 0); ~MainWindow(); private: - QVBoxLayout *layout; + QGridLayout *layout; QWidget *central; QTextEdit* textEditor; QLabel *infoLabel; -- cgit v0.12 From a78e7a6e7a7d5725467d0538bf8e0ea50c2506cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 24 Nov 2009 11:38:57 +0100 Subject: Improved and optimized the WaveUnderline The WaveUnderline used to be a series of 180 degree arcs, that didn't always align very well between different text items and that could be clipped at the bottom since the font height got reduced. Now it uses quad beziers so that it is more like a sinus curve, and the alignment and clipping issues have been fixed. The painting of the WaveUnderline has been optimized using QPixmapCache. A 100 pixels wide sample of the wave is now cached as a pixmap and repeated to draw the WaveUnderline. This is an order of magnitude faster than rasterizing a QPainterPath. The QPlainTextEdit needs to set the brush origin since it draws the text items in local widget coordinates, rather than relying on a painter translation like the QTextEdit. Done with mae. --- src/gui/painting/qpainter.cpp | 92 +++++++++++++++++++++++++------------- src/gui/widgets/qplaintextedit.cpp | 3 ++ 2 files changed, 63 insertions(+), 32 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 48629d1..fc1863f 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5886,7 +5886,12 @@ void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption Draws the text item \a ti at position \a p. */ -/*! \internal +/*! + \fn void QPainter::drawTextItem(const QPointF &p, const QTextItem &ti) + + \internal + \since 4.1 + Draws the text item \a ti at position \a p. This method ignores the painters background mode and @@ -5899,34 +5904,57 @@ void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption ignored aswell. You'll need to pass in the correct flags to get underlining and strikeout. */ -static QPainterPath generateWavyPath(qreal minWidth, qreal maxRadius, QPaintDevice *device) + +static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen) { - extern int qt_defaultDpi(); + const qreal radiusBase = qMax(qreal(1), maxRadius); + + QString key = QLatin1String("WaveUnderline-"); + key += pen.color().name(); + key += QLatin1Char('-'); + key += QString::number(radiusBase); + + QPixmap pixmap; + if (QPixmapCache::find(key, pixmap)) + return pixmap; + + const qreal halfPeriod = qMax(qreal(2), radiusBase * 1.61803399); // the golden ratio + const int width = qCeil(100 / (2 * halfPeriod)) * (2 * halfPeriod); + const int radius = qFloor(radiusBase); + QPainterPath path; - bool up = true; - const qreal radius = qMax(qreal(.5), qMin(qreal(1.25 * device->logicalDpiY() / qt_defaultDpi()), maxRadius)); - qreal xs, ys; - int i = 0; - path.moveTo(0, radius); - do { - xs = i*(2*radius); - ys = 0; + qreal xs = 0; + qreal ys = radius; - qreal remaining = minWidth - xs; - qreal angle = 180; + while (xs < width) { + xs += halfPeriod; + ys = -ys; + path.quadTo(xs - halfPeriod / 2, ys, xs, 0); + } - // cut-off at the last arc segment - if (remaining < 2 * radius) - angle = 180 * remaining / (2 * radius); + pixmap = QPixmap(width, radius * 2); + pixmap.fill(Qt::transparent); + { + QPen wavePen = pen; + wavePen.setCapStyle(Qt::SquareCap); + + // This is to protect against making the line too fat, as happens on Mac OS X + // due to it having a rather thick width for the regular underline. + const qreal maxPenWidth = .8 * radius; + if (wavePen.widthF() > maxPenWidth) + wavePen.setWidth(maxPenWidth); - path.arcTo(xs, ys, 2*radius, 2*radius, 180, up ? angle : -angle); + QPainter imgPainter(&pixmap); + imgPainter.setPen(wavePen); + imgPainter.setRenderHint(QPainter::Antialiasing); + imgPainter.translate(0, radius); + imgPainter.drawPath(path); + } - up = !up; - ++i; - } while (xs + 2*radius < minWidth); + QPixmapCache::insert(key, pixmap); - return path; + return pixmap; } static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QTextItemInt &ti) @@ -5947,9 +5975,11 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const pen.setCapStyle(Qt::FlatCap); QLineF line(pos.x(), pos.y(), pos.x() + ti.width.toReal(), pos.y()); + + const qreal underlineOffset = fe->underlinePosition().toReal(); // deliberately ceil the offset to avoid the underline coming too close to // the text above it. - const qreal underlinePos = pos.y() + qCeil(fe->underlinePosition().toReal()); + const qreal underlinePos = pos.y() + qCeil(underlineOffset); if (underlineStyle == QTextCharFormat::SpellCheckUnderline) { underlineStyle = QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle)); @@ -5957,16 +5987,18 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const if (underlineStyle == QTextCharFormat::WaveUnderline) { painter->save(); - painter->setRenderHint(QPainter::Antialiasing); - painter->translate(pos.x(), underlinePos); + painter->translate(0, pos.y() + 1); QColor uc = ti.charFormat.underlineColor(); if (uc.isValid()) - painter->setPen(uc); + pen.setColor(uc); - painter->drawPath(generateWavyPath(ti.width.toReal(), - fe->underlinePosition().toReal(), - painter->device())); + // Adapt wave to underlineOffset or pen width, whatever is larger, to make it work on all platforms + const QPixmap wave = generateWavyPixmap(qMax(underlineOffset, pen.widthF()), pen); + const int descent = (int) ti.descent.toReal(); + + painter->setBrushOrigin(painter->brushOrigin().x(), 0); + painter->fillRect(pos.x(), 0, qCeil(ti.width.toReal()), qMin(wave.height(), descent), wave); painter->restore(); } else if (underlineStyle != QTextCharFormat::NoUnderline) { QLineF underLine(line.x1(), underlinePos, line.x2(), underlinePos); @@ -6001,10 +6033,6 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const painter->setBrush(oldBrush); } -/*! - \internal - \since 4.1 -*/ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti) { #ifdef QT_DEBUG_DRAW diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index c7759e8..eae8b7d 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -1802,6 +1802,9 @@ void QPlainTextEdit::paintEvent(QPaintEvent *e) QTextBlock block = firstVisibleBlock(); qreal maximumWidth = document()->documentLayout()->documentSize().width(); + // Set a brush origin so that the WaveUnderline knows where the wave started + painter.setBrushOrigin(offset); + // keep right margin clean from full-width selection int maxX = offset.x() + qMax((qreal)viewportRect.width(), maximumWidth) - document()->documentMargin(); -- cgit v0.12 From df83eaa02d9c1b697438d237daab3fb7aac02ab7 Mon Sep 17 00:00:00 2001 From: Gordon Schumacher Date: Sat, 21 Nov 2009 11:19:54 -0700 Subject: Fix uninitialized error variable if the stream doesn't exist Merge-request: 2174 Reviewed-by: Eskil --- src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index f3ec8e1..bfb03ab 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -975,7 +975,7 @@ HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc) face->glyphs_substituted = false; face->buffer = 0; - HB_Error error; + HB_Error error = HB_Err_Ok; HB_Stream stream; HB_Stream gdefStream; -- cgit v0.12 From c85d85b2a63cdbcf607789ed94ab5e4ac7ee560d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 26 Nov 2009 13:50:29 +0200 Subject: Background in landscape mode on S60 5.0 is broken After initial fix, 99% of widgets draw temselves properly after orientation switch. However, QScrollAreas lose their palette hash, which causes scrollarea background to re-start from theme background top-left. As a correction, we re-set the theme palette hash after calling QApplication::setPalette, since that clears palette hash. Task-number: QTBUG-6125 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b71ec5d..a9636b6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -471,6 +471,7 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const applicationPalette.setBrush(QPalette::Window, backgroundTexture()); setThemePalette(&applicationPalette); QApplication::setPalette(applicationPalette); + setThemePaletteHash(&applicationPalette); } void QS60StylePrivate::deleteBackground() -- cgit v0.12 From 0607d4e999da14a76d032103d9f459e95cb4ad89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 26 Nov 2009 13:50:29 +0200 Subject: Background in landscape mode on S60 5.0 is broken After initial fix, 99% of widgets draw temselves properly after orientation switch. However, QScrollAreas lose their palette hash, which causes scrollarea background to re-start from theme background top-left. As a correction, we re-set the theme palette hash after calling QApplication::setPalette, since that clears palette hash. Task-number: QTBUG-6125 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 2137244..ee10ff6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -476,6 +476,7 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const applicationPalette.setBrush(QPalette::Window, backgroundTexture()); setThemePalette(&applicationPalette); QApplication::setPalette(applicationPalette); + setThemePaletteHash(&applicationPalette); } void QS60StylePrivate::deleteBackground() -- cgit v0.12 From b56dcd0f2093c35b1d638eebe38d113e8d59ea0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 26 Nov 2009 14:17:11 +0200 Subject: Tidyup QS60Style - remove unused constants, replace magic values Basically this has three minor fixes: - remove unused style parts that were left over after unifying textEdit and lineEdit graphics - make radiobutton indicator one pixel smaller so it is perfect circle - replace magic "10" with calculated value Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 6 +++--- src/gui/styles/qs60style_p.h | 9 --------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index a9636b6..dca78ca 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -144,7 +144,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme {SE_ToolBarButtonPressed, QS60StyleEnums::SP_QsnFrSctrlButtonCenterPressed}, {SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter}, {SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive}, - {SE_Editor, QS60StyleEnums::SP_QsnFrNotepadCenter}, + {SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter}, }; static const int frameElementsCount = @@ -807,7 +807,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag case QS60StyleEnums::SP_QgnGrafTabActiveL: //Returned QSize for tabs must not be square, but narrow rectangle with width:height //ratio of 1:2 for horizontal tab bars (and 2:1 for vertical ones). - result.setWidth(10); + result.setWidth(result.height()>>1); break; case QS60StyleEnums::SP_QgnIndiSliderEdit: result.scale(pixelMetric(QStyle::PM_SliderLength), @@ -2022,7 +2022,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti buttonRect.setHeight((int)(buttonRect.height() * scaler)); // move the rect up for half of the new height-gain const int newY = (buttonRect.bottomRight().y() - option->rect.bottomRight().y()) >> 1 ; - buttonRect.adjust(0,-newY,0,-newY); + buttonRect.adjust(0, -newY, -1, -newY); painter->save(); QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnTextColors, 6, option); diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 36979a2..5ab2308 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -271,15 +271,6 @@ public: SP_QsnFrButtonSideLInactive, SP_QsnFrButtonSideRInactive, SP_QsnFrButtonCenterInactive, - SP_QsnFrNotepadCornerTl, - SP_QsnFrNotepadCornerTr, - SP_QsnFrNotepadCornerBl, - SP_QsnFrNotepadCornerBr, - SP_QsnFrNotepadSideT, - SP_QsnFrNotepadSideB, - SP_QsnFrNotepadSideL, - SP_QsnFrNotepadSideR, - SP_QsnFrNotepadCenter }; enum ColorLists { -- cgit v0.12 From 72d555e13e5c337bb298195441eec512bb070b7c Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 26 Nov 2009 12:27:51 +0100 Subject: Fixed miter joins generated by the GL2 engine stroker. The stroker generated two points for each miter join, one on the convex side of the join, and one on the concave side. For sharp joins between curved segments, the point on the concave side could end up poking out of the stroke. This was fixed by generating one point on the convex side only. Reviewed-by: Trond --- .../gl2paintengineex/qtriangulatingstroker_p.h | 53 +++++++++++++++------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h index 412e239..fd2972c 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h @@ -301,23 +301,42 @@ void QTriangulatingStroker::join(const qreal *pts) case Qt::BevelJoin: break; case Qt::MiterJoin: { - int p1 = m_vertices.size() - 6; - int p2 = m_vertices.size() - 2; - QLineF line(m_vertices.at(p1), m_vertices.at(p1+1), - m_vertices.at(p2), m_vertices.at(p2+1)); - QLineF nextLine(m_cx - m_nvx, m_cy - m_nvy, - pts[0] - m_nvx, pts[1] - m_nvy); - - QPointF isect; - if (line.intersect(nextLine, &isect) != QLineF::NoIntersection - && QLineF(line.p2(), isect).length() <= m_miter_limit) { - // The intersection point mirrored over the m_cx, m_cy point - m_vertices.add(m_cx - (isect.x() - m_cx)); - m_vertices.add(m_cy - (isect.y() - m_cy)); - - // The intersection point - m_vertices.add(isect.x()); - m_vertices.add(isect.y()); + // Find out on which side the join should be. + int count = m_vertices.size(); + float prevNvx = m_vertices.at(count - 2) - m_cx; + float prevNvy = m_vertices.at(count - 1) - m_cy; + float xprod = prevNvx * m_nvy - prevNvy * m_nvx; + float px, py, qx, qy; + + // If the segments are parallel, use bevel join. + if (qFuzzyIsNull(xprod)) + break; + + // Find the corners of the previous and next segment to join. + if (xprod < 0) { + px = m_vertices.at(count - 2); + py = m_vertices.at(count - 1); + qx = m_cx - m_nvx; + qy = m_cy - m_nvy; + } else { + px = m_vertices.at(count - 4); + py = m_vertices.at(count - 3); + qx = m_cx + m_nvx; + qy = m_cy + m_nvy; + } + + // Find intersection point. + float pu = px * prevNvx + py * prevNvy; + float qv = qx * m_nvx + qy * m_nvy; + float ix = (m_nvy * pu - prevNvy * qv) / xprod; + float iy = (prevNvx * qv - m_nvx * pu) / xprod; + + // Check that the distance to the intersection point is less than the miter limit. + if ((ix - px) * (ix - px) + (iy - py) * (iy - py) <= m_miter_limit * m_miter_limit) { + m_vertices.add(ix); + m_vertices.add(iy); + m_vertices.add(ix); + m_vertices.add(iy); } // else // Do a plain bevel join if the miter limit is exceeded or if -- cgit v0.12 From c77a556265847529bb1c55ce3c8ae21080161f38 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 26 Nov 2009 12:59:17 +0100 Subject: Moved functions from .h to .cpp in the GL2 engine stroker. Some of the functions had become too long to be inlined in my opinion. Reviewed-by: Trond --- .../gl2paintengineex/qtriangulatingstroker.cpp | 204 +++++++++++++++++++ .../gl2paintengineex/qtriangulatingstroker_p.h | 223 +-------------------- 2 files changed, 208 insertions(+), 219 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp index 1478b09..c78f73f 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp @@ -209,6 +209,65 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen) } } +void QTriangulatingStroker::moveTo(const qreal *pts) +{ + m_cx = pts[0]; + m_cy = pts[1]; + + float x2 = pts[2]; + float y2 = pts[3]; + normalVector(m_cx, m_cy, x2, y2, &m_nvx, &m_nvy); + + + // To acheive jumps we insert zero-area tringles. This is done by + // adding two identical points in both the end of previous strip + // and beginning of next strip + bool invisibleJump = m_vertices.size(); + + switch (m_cap_style) { + case Qt::FlatCap: + if (invisibleJump) { + m_vertices.add(m_cx + m_nvx); + m_vertices.add(m_cy + m_nvy); + } + break; + case Qt::SquareCap: { + float sx = m_cx - m_nvy; + float sy = m_cy + m_nvx; + if (invisibleJump) { + m_vertices.add(sx + m_nvx); + m_vertices.add(sy + m_nvy); + } + emitLineSegment(sx, sy, m_nvx, m_nvy); + break; } + case Qt::RoundCap: { + QVarLengthArray points; + arcPoints(m_cx, m_cy, m_cx + m_nvx, m_cy + m_nvy, m_cx - m_nvx, m_cy - m_nvy, points); + m_vertices.resize(m_vertices.size() + points.size() + 2 * int(invisibleJump)); + int count = m_vertices.size(); + int front = 0; + int end = points.size() / 2; + while (front != end) { + m_vertices.at(--count) = points[2 * end - 1]; + m_vertices.at(--count) = points[2 * end - 2]; + --end; + if (front == end) + break; + m_vertices.at(--count) = points[2 * front + 1]; + m_vertices.at(--count) = points[2 * front + 0]; + ++front; + } + + if (invisibleJump) { + m_vertices.at(count - 1) = m_vertices.at(count + 1); + m_vertices.at(count - 2) = m_vertices.at(count + 0); + } + break; } + default: break; // ssssh gcc... + } + emitLineSegment(m_cx, m_cy, m_nvx, m_nvy); +} + void QTriangulatingStroker::cubicTo(const qreal *pts) { const QPointF *p = (const QPointF *) pts; @@ -246,6 +305,151 @@ void QTriangulatingStroker::cubicTo(const qreal *pts) m_nvy = vy; } +void QTriangulatingStroker::join(const qreal *pts) +{ + // Creates a join to the next segment (m_cx, m_cy) -> (pts[0], pts[1]) + normalVector(m_cx, m_cy, pts[0], pts[1], &m_nvx, &m_nvy); + + switch (m_join_style) { + case Qt::BevelJoin: + break; + case Qt::MiterJoin: { + // Find out on which side the join should be. + int count = m_vertices.size(); + float prevNvx = m_vertices.at(count - 2) - m_cx; + float prevNvy = m_vertices.at(count - 1) - m_cy; + float xprod = prevNvx * m_nvy - prevNvy * m_nvx; + float px, py, qx, qy; + + // If the segments are parallel, use bevel join. + if (qFuzzyIsNull(xprod)) + break; + + // Find the corners of the previous and next segment to join. + if (xprod < 0) { + px = m_vertices.at(count - 2); + py = m_vertices.at(count - 1); + qx = m_cx - m_nvx; + qy = m_cy - m_nvy; + } else { + px = m_vertices.at(count - 4); + py = m_vertices.at(count - 3); + qx = m_cx + m_nvx; + qy = m_cy + m_nvy; + } + + // Find intersection point. + float pu = px * prevNvx + py * prevNvy; + float qv = qx * m_nvx + qy * m_nvy; + float ix = (m_nvy * pu - prevNvy * qv) / xprod; + float iy = (prevNvx * qv - m_nvx * pu) / xprod; + + // Check that the distance to the intersection point is less than the miter limit. + if ((ix - px) * (ix - px) + (iy - py) * (iy - py) <= m_miter_limit * m_miter_limit) { + m_vertices.add(ix); + m_vertices.add(iy); + m_vertices.add(ix); + m_vertices.add(iy); + } + // else + // Do a plain bevel join if the miter limit is exceeded or if + // the lines are parallel. This is not what the raster + // engine's stroker does, but it is both faster and similar to + // what some other graphics API's do. + + break; } + case Qt::RoundJoin: { + QVarLengthArray points; + int count = m_vertices.size(); + float prevNvx = m_vertices.at(count - 2) - m_cx; + float prevNvy = m_vertices.at(count - 1) - m_cy; + if (m_nvx * prevNvy - m_nvy * prevNvx < 0) { + arcPoints(0, 0, m_nvx, m_nvy, -prevNvx, -prevNvy, points); + for (int i = points.size() / 2; i > 0; --i) + emitLineSegment(m_cx, m_cy, points[2 * i - 2], points[2 * i - 1]); + } else { + arcPoints(0, 0, -prevNvx, -prevNvy, m_nvx, m_nvy, points); + for (int i = 0; i < points.size() / 2; ++i) + emitLineSegment(m_cx, m_cy, points[2 * i + 0], points[2 * i + 1]); + } + break; } + default: break; // gcc warn-- + } + + emitLineSegment(m_cx, m_cy, m_nvx, m_nvy); +} + +void QTriangulatingStroker::endCap(const qreal *) +{ + switch (m_cap_style) { + case Qt::FlatCap: + break; + case Qt::SquareCap: + emitLineSegment(m_cx + m_nvy, m_cy - m_nvx, m_nvx, m_nvy); + break; + case Qt::RoundCap: { + QVarLengthArray points; + int count = m_vertices.size(); + arcPoints(m_cx, m_cy, m_vertices.at(count - 2), m_vertices.at(count - 1), m_vertices.at(count - 4), m_vertices.at(count - 3), points); + int front = 0; + int end = points.size() / 2; + while (front != end) { + m_vertices.add(points[2 * end - 2]); + m_vertices.add(points[2 * end - 1]); + --end; + if (front == end) + break; + m_vertices.add(points[2 * front + 0]); + m_vertices.add(points[2 * front + 1]); + ++front; + } + break; } + default: break; // to shut gcc up... + } +} + +void QTriangulatingStroker::arcPoints(float cx, float cy, float fromX, float fromY, float toX, float toY, QVarLengthArray &points) +{ + float dx1 = fromX - cx; + float dy1 = fromY - cy; + float dx2 = toX - cx; + float dy2 = toY - cy; + + // while more than 180 degrees left: + while (dx1 * dy2 - dx2 * dy1 < 0) { + float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; + float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; + dx1 = tmpx; + dy1 = tmpy; + points.append(cx + dx1); + points.append(cy + dy1); + } + + // while more than 90 degrees left: + while (dx1 * dx2 + dy1 * dy2 < 0) { + float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; + float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; + dx1 = tmpx; + dy1 = tmpy; + points.append(cx + dx1); + points.append(cy + dy1); + } + + // while more than 0 degrees left: + while (dx1 * dy2 - dx2 * dy1 > 0) { + float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; + float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; + dx1 = tmpx; + dy1 = tmpy; + points.append(cx + dx1); + points.append(cy + dy1); + } + + // remove last point which was rotated beyond [toX, toY]. + if (!points.isEmpty()) + points.resize(points.size() - 2); +} + static void qdashprocessor_moveTo(qreal x, qreal y, void *data) { ((QDashedStrokeProcessor *) data)->addElement(QPainterPath::MoveToElement, x, y); diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h index fd2972c..2dba0ce 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h @@ -63,13 +63,13 @@ public: private: inline void emitLineSegment(float x, float y, float nx, float ny); - inline void moveTo(const qreal *pts); + void moveTo(const qreal *pts); inline void lineTo(const qreal *pts); void cubicTo(const qreal *pts); - inline void join(const qreal *pts); + void join(const qreal *pts); inline void normalVector(float x1, float y1, float x2, float y2, float *nx, float *ny); - inline void endCap(const qreal *pts); - inline void arcPoints(float cx, float cy, float fromX, float fromY, float toX, float toY, QVarLengthArray &points); + void endCap(const qreal *pts); + void arcPoints(float cx, float cy, float fromX, float fromY, float toX, float toY, QVarLengthArray &points); void endCapOrJoinClosed(const qreal *start, const qreal *cur, bool implicitClose, bool endsAtStart); @@ -117,10 +117,6 @@ private: qreal m_inv_scale; }; - - - - inline void QTriangulatingStroker::normalVector(float x1, float y1, float x2, float y2, float *nx, float *ny) { @@ -140,8 +136,6 @@ inline void QTriangulatingStroker::normalVector(float x1, float y1, float x2, fl *ny = dx * pw; } - - inline void QTriangulatingStroker::emitLineSegment(float x, float y, float vx, float vy) { m_vertices.add(x + vx); @@ -150,139 +144,6 @@ inline void QTriangulatingStroker::emitLineSegment(float x, float y, float vx, f m_vertices.add(y - vy); } -inline void QTriangulatingStroker::arcPoints(float cx, float cy, float fromX, float fromY, float toX, float toY, QVarLengthArray &points) -{ - float dx1 = fromX - cx; - float dy1 = fromY - cy; - float dx2 = toX - cx; - float dy2 = toY - cy; - - // while more than 180 degrees left: - while (dx1 * dy2 - dx2 * dy1 < 0) { - float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; - float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; - dx1 = tmpx; - dy1 = tmpy; - points.append(cx + dx1); - points.append(cy + dy1); - } - - // while more than 90 degrees left: - while (dx1 * dx2 + dy1 * dy2 < 0) { - float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; - float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; - dx1 = tmpx; - dy1 = tmpy; - points.append(cx + dx1); - points.append(cy + dy1); - } - - // while more than 0 degrees left: - while (dx1 * dy2 - dx2 * dy1 > 0) { - float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; - float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; - dx1 = tmpx; - dy1 = tmpy; - points.append(cx + dx1); - points.append(cy + dy1); - } - - // remove last point which was rotated beyond [toX, toY]. - if (!points.isEmpty()) - points.resize(points.size() - 2); -} - -inline void QTriangulatingStroker::endCap(const qreal *) -{ - switch (m_cap_style) { - case Qt::FlatCap: - break; - case Qt::SquareCap: - emitLineSegment(m_cx + m_nvy, m_cy - m_nvx, m_nvx, m_nvy); - break; - case Qt::RoundCap: { - QVarLengthArray points; - int count = m_vertices.size(); - arcPoints(m_cx, m_cy, m_vertices.at(count - 2), m_vertices.at(count - 1), m_vertices.at(count - 4), m_vertices.at(count - 3), points); - int front = 0; - int end = points.size() / 2; - while (front != end) { - m_vertices.add(points[2 * end - 2]); - m_vertices.add(points[2 * end - 1]); - --end; - if (front == end) - break; - m_vertices.add(points[2 * front + 0]); - m_vertices.add(points[2 * front + 1]); - ++front; - } - break; } - default: break; // to shut gcc up... - } -} - - -void QTriangulatingStroker::moveTo(const qreal *pts) -{ - m_cx = pts[0]; - m_cy = pts[1]; - - float x2 = pts[2]; - float y2 = pts[3]; - normalVector(m_cx, m_cy, x2, y2, &m_nvx, &m_nvy); - - - // To acheive jumps we insert zero-area tringles. This is done by - // adding two identical points in both the end of previous strip - // and beginning of next strip - bool invisibleJump = m_vertices.size(); - - switch (m_cap_style) { - case Qt::FlatCap: - if (invisibleJump) { - m_vertices.add(m_cx + m_nvx); - m_vertices.add(m_cy + m_nvy); - } - break; - case Qt::SquareCap: { - float sx = m_cx - m_nvy; - float sy = m_cy + m_nvx; - if (invisibleJump) { - m_vertices.add(sx + m_nvx); - m_vertices.add(sy + m_nvy); - } - emitLineSegment(sx, sy, m_nvx, m_nvy); - break; } - case Qt::RoundCap: { - QVarLengthArray points; - arcPoints(m_cx, m_cy, m_cx + m_nvx, m_cy + m_nvy, m_cx - m_nvx, m_cy - m_nvy, points); - m_vertices.resize(m_vertices.size() + points.size() + 2 * int(invisibleJump)); - int count = m_vertices.size(); - int front = 0; - int end = points.size() / 2; - while (front != end) { - m_vertices.at(--count) = points[2 * end - 1]; - m_vertices.at(--count) = points[2 * end - 2]; - --end; - if (front == end) - break; - m_vertices.at(--count) = points[2 * front + 1]; - m_vertices.at(--count) = points[2 * front + 0]; - ++front; - } - - if (invisibleJump) { - m_vertices.at(count - 1) = m_vertices.at(count + 1); - m_vertices.at(count - 2) = m_vertices.at(count + 0); - } - break; } - default: break; // ssssh gcc... - } - emitLineSegment(m_cx, m_cy, m_nvx, m_nvy); -} - - - void QTriangulatingStroker::lineTo(const qreal *pts) { emitLineSegment(pts[0], pts[1], m_nvx, m_nvy); @@ -290,82 +151,6 @@ void QTriangulatingStroker::lineTo(const qreal *pts) m_cy = pts[1]; } - - -void QTriangulatingStroker::join(const qreal *pts) -{ - // Creates a join to the next segment (m_cx, m_cy) -> (pts[0], pts[1]) - normalVector(m_cx, m_cy, pts[0], pts[1], &m_nvx, &m_nvy); - - switch (m_join_style) { - case Qt::BevelJoin: - break; - case Qt::MiterJoin: { - // Find out on which side the join should be. - int count = m_vertices.size(); - float prevNvx = m_vertices.at(count - 2) - m_cx; - float prevNvy = m_vertices.at(count - 1) - m_cy; - float xprod = prevNvx * m_nvy - prevNvy * m_nvx; - float px, py, qx, qy; - - // If the segments are parallel, use bevel join. - if (qFuzzyIsNull(xprod)) - break; - - // Find the corners of the previous and next segment to join. - if (xprod < 0) { - px = m_vertices.at(count - 2); - py = m_vertices.at(count - 1); - qx = m_cx - m_nvx; - qy = m_cy - m_nvy; - } else { - px = m_vertices.at(count - 4); - py = m_vertices.at(count - 3); - qx = m_cx + m_nvx; - qy = m_cy + m_nvy; - } - - // Find intersection point. - float pu = px * prevNvx + py * prevNvy; - float qv = qx * m_nvx + qy * m_nvy; - float ix = (m_nvy * pu - prevNvy * qv) / xprod; - float iy = (prevNvx * qv - m_nvx * pu) / xprod; - - // Check that the distance to the intersection point is less than the miter limit. - if ((ix - px) * (ix - px) + (iy - py) * (iy - py) <= m_miter_limit * m_miter_limit) { - m_vertices.add(ix); - m_vertices.add(iy); - m_vertices.add(ix); - m_vertices.add(iy); - } - // else - // Do a plain bevel join if the miter limit is exceeded or if - // the lines are parallel. This is not what the raster - // engine's stroker does, but it is both faster and similar to - // what some other graphics API's do. - - break; } - case Qt::RoundJoin: { - QVarLengthArray points; - int count = m_vertices.size(); - float prevNvx = m_vertices.at(count - 2) - m_cx; - float prevNvy = m_vertices.at(count - 1) - m_cy; - if (m_nvx * prevNvy - m_nvy * prevNvx < 0) { - arcPoints(0, 0, m_nvx, m_nvy, -prevNvx, -prevNvy, points); - for (int i = points.size() / 2; i > 0; --i) - emitLineSegment(m_cx, m_cy, points[2 * i - 2], points[2 * i - 1]); - } else { - arcPoints(0, 0, -prevNvx, -prevNvy, m_nvx, m_nvy, points); - for (int i = 0; i < points.size() / 2; ++i) - emitLineSegment(m_cx, m_cy, points[2 * i + 0], points[2 * i + 1]); - } - break; } - default: break; // gcc warn-- - } - - emitLineSegment(m_cx, m_cy, m_nvx, m_nvy); -} - QT_END_NAMESPACE #endif -- cgit v0.12 From 2b6af778f3b5bd32e95332f95b9eda7c26e63635 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 26 Nov 2009 13:02:44 +0100 Subject: ignore Alt+Space acelerators - useless and too many false positives Task-number: QTBUG-4429 --- tools/linguist/linguist/mainwindow.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 5c3aaa1..f56c966 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -2348,6 +2348,17 @@ void MainWindow::updatePhraseDicts() m_phraseView->update(); } +static bool haveMnemonic(const QString &str) +{ + QString mnemonic = QKeySequence::mnemonic(str); + if (mnemonic == QLatin1String("Alt+Space")) { + // "Nobody" ever really uses these, and they are highly annoying + // because we get a lot of false positives. + return false; + } + return !mnemonic.isEmpty(); +} + void MainWindow::updateDanger(const MultiDataIndex &index, bool verbose) { MultiDataIndex curIdx = index; @@ -2379,10 +2390,10 @@ void MainWindow::updateDanger(const MultiDataIndex &index, bool verbose) } if (m_ui.actionAccelerators->isChecked()) { - bool sk = !QKeySequence::mnemonic(source).isEmpty(); + bool sk = haveMnemonic(source); bool tk = true; for (int i = 0; i < translations.count() && tk; ++i) { - tk &= !QKeySequence::mnemonic(translations[i]).isEmpty(); + tk &= haveMnemonic(translations[i]); } if (!sk && tk) { -- cgit v0.12 From 4160adc44a512a97d333227cfdde0648fb4132a9 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 26 Nov 2009 14:50:37 +0200 Subject: Fixed context menu placement partially outside screen bug in Symbian. In style demo example when spinbox was long tapped, the context menu was placed partially outside screen. The preconditions for bug were: 1. Tap position is near screen right edge 2. Minimum space width requested by context menu is > sreen width The new (simplified) logic is as follows: 1. If menus right edge in requested position is outside screen right edge, the menu is moved to left enough to fit on screen. i.e. if (tap position + menu width > screen right ) x = screen right - menu width 2. As a result of above statement the x position might go outside left boundary of screen. This is fixed by next statements if( x < screen left ) x = screen left Task-number: QTBUG-6164 Reviewed-by: Alessandro Portale --- src/gui/widgets/qmenu.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 761a060..2e27226 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -229,7 +229,7 @@ void QMenuPrivate::updateActionRects() const Q_Q(const QMenu); if (!itemsDirty) return; - + q->ensurePolished(); //let's reinitialize the buffer @@ -292,7 +292,7 @@ void QMenuPrivate::updateActionRects() const if (!action->isVisible() || (collapsibleSeparators && previousWasSeparator && action->isSeparator())) continue; // we continue, this action will get an empty QRect - + previousWasSeparator = action->isSeparator(); //let the style modify the above size.. @@ -1139,7 +1139,7 @@ void QMenuPrivate::_q_actionTriggered() //we check the parent hierarchy QList< QPointer > list; for(QWidget *widget = q->parentWidget(); widget; ) { - if (qobject_cast(widget) + if (qobject_cast(widget) #ifndef QT_NO_MENUBAR || qobject_cast(widget) #endif @@ -1306,7 +1306,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) the addAction(), addActions() and insertAction() functions. An action is represented vertically and rendered by QStyle. In addition, actions can have a text label, an optional icon drawn on the very left side, - and shortcut key sequence such as "Ctrl+X". + and shortcut key sequence such as "Ctrl+X". The existing actions held by a menu can be found with actions(). @@ -1906,9 +1906,9 @@ void QMenu::popup(const QPoint &p, QAction *atAction) pos.setX(qMax(p.x()-size.width(), screen.right()-desktopFrame-size.width()+1)); } else { if (pos.x()+size.width()-1 > screen.right()-desktopFrame) - pos.setX(qMin(p.x()+size.width(), screen.right()-desktopFrame-size.width()+1)); + pos.setX(screen.right()-desktopFrame-size.width()+1); if (pos.x() < screen.left()+desktopFrame) - pos.setX(qMax(p.x(), screen.left() + desktopFrame)); + pos.setX(screen.left() + desktopFrame); } if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame) { if(snapToMouse) -- cgit v0.12 From 705880f0045ac39140f980d69aec68869213e379 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Thu, 26 Nov 2009 13:47:34 +0100 Subject: Fix a crash in KDE/Plasma with QGraphicsView. TopLevel list of items was corrupted. This nasty bug was triggered when the index sort the top level list of items. We forgot to set the flag topLevelSequentialOrdering to false so when an item was removed from the top level list it was using the sibling index which can be not valid anymore since the list is not sorted by sequential order. So it let some dangling pointers in the list which make processDirtyItemRecursive crash the next paint event. Reviewed-by:bnilsen Reviewed-by:andreas --- src/gui/graphicsview/qgraphicsscene_p.h | 3 ++- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 32 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index a1d0496..69e4d5b 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -78,7 +78,7 @@ class QGraphicsSceneIndex; class QGraphicsView; class QGraphicsWidget; -class QGraphicsScenePrivate : public QObjectPrivate +class Q_AUTOTEST_EXPORT QGraphicsScenePrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QGraphicsScene) public: @@ -265,6 +265,7 @@ public: { if (needSortTopLevelItems) { qSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf); + topLevelSequentialOrdering = false; needSortTopLevelItems = false; } } diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 20d9eb8..a8017ff 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -46,6 +46,8 @@ #endif #include +#include +#include #include #include "../../shared/util.h" @@ -269,6 +271,7 @@ private slots: void initialFocus(); void polishItems(); void isActive(); + void siblingIndexAlwaysValid(); // task specific tests below me void task139710_bspTreeCrash(); @@ -4181,6 +4184,35 @@ void tst_QGraphicsScene::isActive() } +void tst_QGraphicsScene::siblingIndexAlwaysValid() +{ + QGraphicsScene scene; + + QGraphicsWidget *parent = new QGraphicsWidget; + parent->setZValue(350); + parent->setGeometry(0, 0, 100, 100); + QGraphicsWidget *parent2 = new QGraphicsWidget; + parent2->setGeometry(10, 10, 50, 50); + QGraphicsWidget *child = new QGraphicsWidget(parent2); + child->setGeometry(15, 15, 25, 25); + child->setZValue(150); + //Both are top level + scene.addItem(parent); + scene.addItem(parent2); + + //Then we make the child a top level + child->setParentItem(0); + + //This is trigerred by a repaint... + QGraphicsScenePrivate::get(&scene)->index->estimateTopLevelItems(QRectF(), Qt::AscendingOrder); + + delete child; + + //If there are in the list that's bad, we crash... + QVERIFY(!QGraphicsScenePrivate::get(&scene)->topLevelItems.contains(static_cast(child))); + +} + void tst_QGraphicsScene::taskQTBUG_5904_crashWithDeviceCoordinateCache() { QGraphicsScene scene; -- cgit v0.12 From 89c537dbd1b4bfbfcb3a3e3644c093b5a6e85469 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 25 Nov 2009 17:41:34 +0100 Subject: Fixing background painting after orientation switch. Fixing previous fixes of QS60StylePrivate::setBackgroundTexture with commit SHAs a80e58335e69c8ce96d1596e0ed2d14e424a0d5e and d4089399a3ab7548a864d5a399e08df85c444783 Now, the palette gets the updated background brush and the palette is actually set as application palette. Also making sure that QS60StylePrivate::handleDynamicLayoutVariantSwitch does the right things in the right order. So that Table headers are not broken after orientaion switch. Task-number: QTBUG-6125 Task-number: QT-1478 Reviewed-by: Shane Kearns --- src/gui/styles/qs60style.cpp | 1 + src/gui/styles/qs60style_s60.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b5c0d4f..2137244 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -475,6 +475,7 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const QPalette applicationPalette = QApplication::palette(); applicationPalette.setBrush(QPalette::Window, backgroundTexture()); setThemePalette(&applicationPalette); + QApplication::setPalette(applicationPalette); } void QS60StylePrivate::deleteBackground() diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index a8dbf8d..48b8fad 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1324,9 +1324,9 @@ QS60Style::QS60Style() void QS60StylePrivate::handleDynamicLayoutVariantSwitch() { clearCaches(QS60StylePrivate::CC_LayoutChange); + setBackgroundTexture(qApp); setActiveLayout(); refreshUI(); - setBackgroundTexture(qApp); foreach (QWidget *widget, QApplication::allWidgets()) widget->ensurePolished(); } -- cgit v0.12 From 41f1276392444b9e46b30f3537a8a63af6fffc9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 26 Nov 2009 13:50:29 +0200 Subject: Background in landscape mode on S60 5.0 is broken After initial fix, 99% of widgets draw temselves properly after orientation switch. However, QScrollAreas lose their palette hash, which causes scrollarea background to re-start from theme background top-left. As a correction, we re-set the theme palette hash after calling QApplication::setPalette, since that clears palette hash. Task-number: QTBUG-6125 Reviewed-by: Alessandro Portale --- src/gui/styles/qs60style.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 2137244..ee10ff6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -476,6 +476,7 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const applicationPalette.setBrush(QPalette::Window, backgroundTexture()); setThemePalette(&applicationPalette); QApplication::setPalette(applicationPalette); + setThemePaletteHash(&applicationPalette); } void QS60StylePrivate::deleteBackground() -- cgit v0.12 From d014d49c88d4fa31c46afb2c252e481177b30a55 Mon Sep 17 00:00:00 2001 From: Daniil Ivanov Date: Thu, 26 Nov 2009 14:44:09 +0100 Subject: Fixes performance problem with scribble avoiding to redraw whole screen on every MotionNotify event. Merge-request: 2210 Reviewed-by: Eskil Abrahamsen Blomfeldt --- examples/widgets/scribble/scribblearea.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/widgets/scribble/scribblearea.cpp b/examples/widgets/scribble/scribblearea.cpp index 6c9d8aa..2bc2a69 100644 --- a/examples/widgets/scribble/scribblearea.cpp +++ b/examples/widgets/scribble/scribblearea.cpp @@ -139,11 +139,12 @@ void ScribbleArea::mouseReleaseEvent(QMouseEvent *event) } //! [12] //! [13] -void ScribbleArea::paintEvent(QPaintEvent * /* event */) +void ScribbleArea::paintEvent(QPaintEvent *event) //! [13] //! [14] { QPainter painter(this); - painter.drawImage(QPoint(0, 0), image); + QRect dirtyRect = event->rect(); + painter.drawImage(dirtyRect, image, dirtyRect); } //! [14] -- cgit v0.12 From 0cf58948ac9bb9c35835e18a00737c362b08f3c7 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Thu, 26 Nov 2009 14:59:09 +0100 Subject: Avoid using return value from a temporary object The temporary object goes away before the next line is executed, so the pointer to the const data is invalid. Just put it all on one line, and we're ok. Reviewed-by: Brad --- src/corelib/io/qfsfileengine.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 6aace2c..efc09a0 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -140,8 +140,7 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) #if defined(Q_OS_UNIX) || defined(Q_OS_SYMBIAN) // FIXME let's see if this stuff works, then we might be able to remove some of the other code - const char *fileName = path.toLocal8Bit().constData(); - char *ret = realpath(fileName, (char*)0); + char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); if (ret) { QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); free(ret); -- cgit v0.12 From 88b9c6eb3f1dde9997d5e824450c9eaa2a36f8d5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 26 Nov 2009 16:00:13 +0100 Subject: Don't crash via proxy model when moving QModelIndexes The layoutAboutToBeChanged signal gives proxies a chance to persist QModelIndexes. The d->itemsAboutToBeMoved method is part of the process of moving the persistent indexes. d->itemsAboutToBeMoved must be called after layoutAboutToBeChanged. Otherwise persistent indexes will not be updated. Merge-request: 2219 Reviewed-by: Olivier Goffart --- src/corelib/kernel/qabstractitemmodel.cpp | 2 +- .../qabstractitemmodel/tst_qabstractitemmodel.cpp | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 10a61ca..9335085 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -2546,9 +2546,9 @@ bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sour int destinationLast = destinationChild + (sourceLast - sourceFirst); d->changes.push(QAbstractItemModelPrivate::Change(destinationParent, destinationChild, destinationLast)); - d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical); emit rowsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild); emit layoutAboutToBeChanged(); + d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical); return true; } diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp index 413419d..3736813 100644 --- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -112,6 +112,8 @@ private slots: void testMoveWithinOwnRange_data(); void testMoveWithinOwnRange(); + void testMoveThroughProxy(); + void testReset(); @@ -1112,6 +1114,25 @@ void tst_QAbstractItemModel::testMoveSameParentUp() } } +void tst_QAbstractItemModel::testMoveThroughProxy() +{ + QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this); + proxy->setSourceModel(m_model); + + QList persistentList; + + persistentList.append(proxy->index(0, 0)); + persistentList.append(proxy->index(0, 0, proxy->mapFromSource(m_model->index(5, 0)))); + + ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this); + moveCommand->setNumCols(4); + moveCommand->setAncestorRowNumbers(QList() << 5); + moveCommand->setStartRow(0); + moveCommand->setEndRow(0); + moveCommand->setDestRow(0); + moveCommand->doCommand(); +} + void tst_QAbstractItemModel::testMoveToGrandParent_data() { QTest::addColumn("startRow"); -- cgit v0.12 From e8d7d2172627dd3cac8b0cc3165ed371b524feb4 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 26 Nov 2009 12:41:58 +0100 Subject: QSortProxyModel: Crash when changing model with 2-level proxy and selected items The index mapping to the base model was being cleared before the persistant model indices. Reviewed-by: Olivier Task-number: QTBUG-6237 --- src/gui/itemviews/qsortfilterproxymodel.cpp | 6 +++- .../tst_qsortfilterproxymodel.cpp | 37 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index f1ae3d2..fc82f30 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -1153,6 +1153,8 @@ void QSortFilterProxyModelPrivate::_q_sourceAboutToBeReset() { Q_Q(QSortFilterProxyModel); q->beginResetModel(); + invalidatePersistentIndexes(); + clear_mapping(); } void QSortFilterProxyModelPrivate::_q_sourceReset() @@ -1470,6 +1472,8 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) { Q_D(QSortFilterProxyModel); + beginResetModel(); + disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex))); @@ -1551,7 +1555,7 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) connect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset())); d->clear_mapping(); - reset(); + endResetModel(); if (d->update_source_sort_column() && d->dynamic_sortfilter) d->sort(); } diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index e99e9d6..b7839f7 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -135,6 +135,7 @@ private slots: void task251296_hiddenChildren(); void task252507_mapFromToSource(); void task255652_removeRowsRecursive(); + void taskQTBUG_6205_doubleProxySelectionSetSourceModel(); protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); @@ -2815,5 +2816,41 @@ void tst_QSortFilterProxyModel::task255652_removeRowsRecursive() delete pItem11; } +void tst_QSortFilterProxyModel::taskQTBUG_6205_doubleProxySelectionSetSourceModel() +{ + QStandardItemModel *model1 = new QStandardItemModel; + QStandardItem *parentItem = model1->invisibleRootItem(); + for (int i = 0; i < 4; ++i) { + QStandardItem *item = new QStandardItem(QString("model1 item %0").arg(i)); + parentItem->appendRow(item); + parentItem = item; + } + + QStandardItemModel *model2 = new QStandardItemModel; + QStandardItem *parentItem2 = model2->invisibleRootItem(); + for (int i = 0; i < 4; ++i) { + QStandardItem *item = new QStandardItem(QString("model2 item %0").arg(i)); + parentItem2->appendRow(item); + parentItem2 = item; + } + + QSortFilterProxyModel *toggleProxy = new QSortFilterProxyModel; + toggleProxy->setSourceModel(model1); + + QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel; + proxyModel->setSourceModel(toggleProxy); + + QModelIndex mi = proxyModel->index(0, 0, proxyModel->index(0, 0, proxyModel->index(0, 0))); + QItemSelectionModel ism(proxyModel); + ism.select(mi, QItemSelectionModel::Select); + QModelIndexList mil = ism.selectedIndexes(); + QCOMPARE(mil.count(), 1); + QCOMPARE(mil.first(), mi); + + toggleProxy->setSourceModel(model2); + // No crash, it's good news! + QVERIFY(ism.selection().isEmpty()); +} + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" -- cgit v0.12 From bc2b222148648354fe15a6f8da9e01743a1e3e3f Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Thu, 26 Nov 2009 15:44:08 +0100 Subject: On Mac OS X, QLineEdit should handle MoveToStart/EndOfBlock On Mac OS X, with a QLineEdit, QKeySequence::MoveToStartOfBlock should move the cursor to the beginning of the input, and QKeySequence::MoveToEndOfBlock to the end of the block Same for selection. The shortcuts also had to be updated. Task-number: QTBUG-4679 Reviewed-by: Olivier Goffart --- src/gui/kernel/qkeysequence.cpp | 6 ++++-- src/gui/widgets/qlinecontrol.cpp | 8 ++++---- tests/auto/qlineedit/tst_qlineedit.cpp | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index e3af683..2361dd0 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -282,8 +282,8 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \row \i SelectPreviousPage \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \row \i SelectStartOfLine \i Shift+Home \i Ctrl+Shift+Left \i Shift+Home \i Shift+Home \i Shift+Home \row \i SelectEndOfLine \i Shift+End \i Ctrl+Shift+Right \i Shift+End \i Shift+End \i Shift+End - \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up \i (none) \i (none) \i (none) - \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down \i (none) \i (none) \i (none) + \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up, Meta+Shift+A \i (none) \i (none) \i (none) + \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down, Meta+Shift+E \i (none) \i (none) \i (none) \row \i SelectStartOfDocument\i Ctrl+Shift+Home \i Ctrl+Shift+Up, Shift+Home \i Ctrl+Shift+Home\i Ctrl+Shift+Home \i Ctrl+Shift+Home \row \i SelectEndOfDocument \i Ctrl+Shift+End \i Ctrl+Shift+Down, Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End \row \i DeleteStartOfWord \i Ctrl+Backspace \i Alt+Backspace \i Ctrl+Backspace \i Ctrl+Backspace \i (none) @@ -732,6 +732,8 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QApplicationPrivate::KB_Mac}, {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QApplicationPrivate::KB_Mac}, {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QApplicationPrivate::KB_Mac}, + {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QApplicationPrivate::KB_Mac}, + {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QApplicationPrivate::KB_Mac}, {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac}, {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac} }; diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 9d533ae..06ef1db 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1581,16 +1581,16 @@ void QLineControl::processKeyEvent(QKeyEvent* event) } } #endif //QT_NO_CLIPBOARD - else if (event == QKeySequence::MoveToStartOfLine) { + else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) { home(0); } - else if (event == QKeySequence::MoveToEndOfLine) { + else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) { end(0); } - else if (event == QKeySequence::SelectStartOfLine) { + else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) { home(1); } - else if (event == QKeySequence::SelectEndOfLine) { + else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) { end(1); } else if (event == QKeySequence::MoveToNextChar) { diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index b4dfbba..26294ac 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -261,6 +261,8 @@ private slots: void task241436_passwordEchoOnEditRestoreEchoMode(); void task248948_redoRemovedSelection(); void taskQTBUG_4401_enterKeyClearsPassword(); + void taskQTBUG_4679_moveToStartEndOfBlock(); + void taskQTBUG_4679_selectToStartEndOfBlock(); protected slots: #ifdef QT3_SUPPORT @@ -3548,5 +3550,40 @@ void tst_QLineEdit::taskQTBUG_4401_enterKeyClearsPassword() QTRY_COMPARE(testWidget->text(), password); } +void tst_QLineEdit::taskQTBUG_4679_moveToStartEndOfBlock() +{ +#ifdef Q_OS_MAC + const QString text("there are no blocks for lineEdit"); + testWidget->setText(text); + testWidget->setCursorPosition(5); + QCOMPARE(testWidget->cursorPosition(), 5); + testWidget->setFocus(); + QTest::keyPress(testWidget, Qt::Key_A, Qt::MetaModifier); + QCOMPARE(testWidget->cursorPosition(), 0); + QTest::keyPress(testWidget, Qt::Key_E, Qt::MetaModifier); + QCOMPARE(testWidget->cursorPosition(), text.size()); +#endif // Q_OS_MAC +} + +void tst_QLineEdit::taskQTBUG_4679_selectToStartEndOfBlock() +{ +#ifdef Q_OS_MAC + const QString text("there are no blocks for lineEdit, select all"); + testWidget->setText(text); + testWidget->setCursorPosition(5); + QCOMPARE(testWidget->cursorPosition(), 5); + testWidget->setFocus(); + QTest::keyPress(testWidget, Qt::Key_A, Qt::MetaModifier | Qt::ShiftModifier); + QCOMPARE(testWidget->cursorPosition(), 0); + QVERIFY(testWidget->hasSelectedText()); + QCOMPARE(testWidget->selectedText(), text.mid(0, 5)); + + QTest::keyPress(testWidget, Qt::Key_E, Qt::MetaModifier | Qt::ShiftModifier); + QCOMPARE(testWidget->cursorPosition(), text.size()); + QVERIFY(testWidget->hasSelectedText()); + QCOMPARE(testWidget->selectedText(), text.mid(5)); +#endif // Q_OS_MAC +} + QTEST_MAIN(tst_QLineEdit) #include "tst_qlineedit.moc" -- cgit v0.12 From 6c50eb3cbd4857e830daa0cc043d834bdfa4bd06 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 26 Nov 2009 22:20:37 +0100 Subject: fix crash on closing all files under certain circumstances after all, it is no good idea to announce the removal of all columns just to let the view headers adjust themselves - it also makes the views emit currentItemChanged() which has some undesirable side effects. so don't do it an fix the header manually. --- tools/linguist/linguist/mainwindow.cpp | 14 ++++++++++---- tools/linguist/linguist/mainwindow.h | 1 + tools/linguist/linguist/messagemodel.cpp | 7 ------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index f56c966..383f5aa 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -305,8 +305,6 @@ MainWindow::MainWindow() m_contextView->setModel(m_sortedContextsModel); m_contextView->header()->setMovable(false); m_contextView->setColumnHidden(0, true); - m_contextView->header()->setResizeMode(1, QHeaderView::Stretch); - m_contextView->header()->setResizeMode(2, QHeaderView::ResizeToContents); m_contextView->header()->setStretchLastSection(false); m_contextDock->setWidget(m_contextView); @@ -335,8 +333,6 @@ MainWindow::MainWindow() m_messageView->setModel(m_sortedMessagesModel); m_messageView->header()->setMovable(false); m_messageView->setColumnHidden(0, true); - m_messageView->setColumnHidden(2, true); - // last visible column auto-stretches m_messagesDock->setWidget(m_messageView); @@ -443,6 +439,7 @@ MainWindow::MainWindow() statusBar()->addPermanentWidget(m_modifiedLabel); modelCountChanged(); + initViewHeaders(); resetSorting(); connect(m_dataModel, SIGNAL(modifiedChanged(bool)), @@ -509,6 +506,14 @@ MainWindow::~MainWindow() delete m_printer; } +void MainWindow::initViewHeaders() +{ + m_contextView->header()->setResizeMode(1, QHeaderView::Stretch); + m_contextView->header()->setResizeMode(2, QHeaderView::ResizeToContents); + m_messageView->setColumnHidden(2, true); + // last visible column auto-stretches +} + void MainWindow::modelCountChanged() { int mc = m_dataModel->modelCount(); @@ -740,6 +745,7 @@ bool MainWindow::closeAll() m_messageView->setUpdatesEnabled(false); m_dataModel->closeAll(); modelCountChanged(); + initViewHeaders(); recentFiles().closeGroup(); return true; } diff --git a/tools/linguist/linguist/mainwindow.h b/tools/linguist/linguist/mainwindow.h index 8b46893..dc711d8 100644 --- a/tools/linguist/linguist/mainwindow.h +++ b/tools/linguist/linguist/mainwindow.h @@ -179,6 +179,7 @@ private: bool prev(bool checkUnfinished); void updateStatistics(); + void initViewHeaders(); void modelCountChanged(); void setupMenuBar(); void setupToolBars(); diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp index 024fd91..49cd382 100644 --- a/tools/linguist/linguist/messagemodel.cpp +++ b/tools/linguist/linguist/messagemodel.cpp @@ -786,16 +786,9 @@ void MultiDataModel::closeAll() m_numFinished = 0; m_numEditable = 0; m_numMessages = 0; - int delCol = m_dataModels.count(); - m_msgModel->beginRemoveColumns(QModelIndex(), 1, delCol); - for (int i = m_multiContextList.size(); --i >= 0;) { - m_msgModel->beginRemoveColumns(m_msgModel->createIndex(i, 0, 0), 1, delCol); - m_msgModel->endRemoveColumns(); - } qDeleteAll(m_dataModels); m_dataModels.clear(); m_multiContextList.clear(); - m_msgModel->endRemoveColumns(); m_msgModel->reset(); emit allModelsDeleted(); onModifiedChanged(); -- cgit v0.12 From 55bc5eb8b4e5d758f12761e67e063a418afa14a0 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 27 Nov 2009 10:58:46 +1000 Subject: Fix infinite recursion in OpenVG scissor-only clipping When a complex transform was set, clip(QVectorPath) would call clip(QRect) with the control point rect, which would then turn around and say "transform is complex, call clip(QVectorPath)", causing an infinite loop until stack crash. Remove the "fall back to vector path" case as it isn't useful for scissor-only clipping. Doesn't affect mask-based clipping. Reviewed-by: Sarah Smith --- src/openvg/qpaintengine_vg.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index ba97d4f..6b829dd 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1570,12 +1570,6 @@ void QVGPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) d->dirty |= QPaintEngine::DirtyClipRegion; - // If we have a non-simple transform, then use path-based clipping. - if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) { - QPaintEngineEx::clip(rect, op); - return; - } - switch (op) { case Qt::NoClip: { @@ -1612,12 +1606,6 @@ void QVGPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) d->dirty |= QPaintEngine::DirtyClipRegion; - // If we have a non-simple transform, then use path-based clipping. - if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) { - QPaintEngineEx::clip(region, op); - return; - } - switch (op) { case Qt::NoClip: { -- cgit v0.12 From 19d0a365dd99dc1a108e58949f7d0f49bac72623 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 27 Nov 2009 10:59:25 +1000 Subject: Minor changelog updates Reviewed-by: Olivier Goffart --- dist/changes-4.6.0 | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 887c96f..3e7d33b 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -91,9 +91,14 @@ Optimizations QtCore ------ + - QAbstractItemModel + * [MR#972] Added API to move items + * [MR#1072] Added function beginResetModel() / endResetModel() + - QByteArray * New overloads for QByteArray::insert() and QByteArray::prepend(). + * [MR#1286] Added value_type typedef for STL compatibility - QEventDispatcherGlib (internal class) * Fix a regression introduced in 4.5.3 that would cause timers to not @@ -195,6 +200,8 @@ QtGui - QAbstractItemView * [256502] Fixes selectionModel::hasSelection return value after model::reset. + * [MR#1426] Fixes some issues with Shift-selection + * [MR#1668] New QAbstractItemView::setDefaultDropAction - QApplication * [QTBUG-739] Removed internal widgets from QApplication::topLevelWidgets(). @@ -317,6 +324,7 @@ QtGui - QListView * [243335] Fixed the visualRect to return correct values when the widget is not yet shown. + * [MR#666] Fixed selection with Shift-Arrow/Shift-Click in QListView's IconMode - QMainWindow * [226060] Adding actions to a toolbar would always make the next toolbar @@ -422,6 +430,9 @@ QtGui * [240325] Even with wrap mode set to Qt::TextWordWrap, the layout would sometimes break outside word boundaries when floating objects affected the width available to the text. + * [MR#681] Added support for roman numbering for lists + * [MR#1753] Fixed escaping HTML attributes QTextDocument::toHtml() + - QTextLayout * [QTBUG-4468] Count tabs as multiple characters when applying a fixed @@ -443,6 +454,7 @@ QtGui - QTreeWidget * [253109] Shows the widget when calling setItemWidget. + * [MR#1393] Use stable sorting. - QWidget * Added inputMethodHints property. @@ -612,7 +624,7 @@ QtWebKit - QWebElement * New class; introduced to implement DOM like operations on a web page. - + - QWebFrame * New properties for an URL and a focus management. * New signals delivering current loading status. @@ -860,17 +872,17 @@ Qt for Embedded Linux - Phonon on Windows * Now much more reliable when reading a file through a QIODevice. - * If Video Mixing Renderer 9 is not available, falls back to software + * If Video Mixing Renderer 9 is not available, falls back to software rendering. * Fixed a flicker issue when switching source with a transition time of 0 - - - [QTBUG-3620] Fixed bug on X11 that caused bitmap fonts to become so small - it was unreadable when printed or presented in a print preview widget. - - - [QTBUG-4445] Fixed bug on Windows that caused problems when printing - text where several characters were represented by a single glyph, e.g. + + - [QTBUG-3620] Fixed bug on X11 that caused bitmap fonts to become so small + it was unreadable when printed or presented in a print preview widget. + + - [QTBUG-4445] Fixed bug on Windows that caused problems when printing + text where several characters were represented by a single glyph, e.g. a double 't' with the Calibri font. - + - EGL and OpenGL/ES * Protect the use of version-specific EGL symbols with #ifdef's. * Make sure an EGL context is current when resolving GL extensions. -- cgit v0.12 From 55ed03bdc8a1c54ead6341deb6c5c2b0b14cdfa3 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Fri, 27 Nov 2009 07:53:56 +0200 Subject: Fixed typo in Symbian installation instructions. Task-number: QTBUG-6175 Reviewed-by: TrustMe --- doc/src/getting-started/installation.qdoc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 057629d..58059d1 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -423,7 +423,7 @@ in the \l{Qt for Windows CE Requirements} document. "Control Panel->System->Advanced->Environment variables" and for older versions by editing \c{c:\autoexec.bat}. - Make sure the enviroment variables for your compiler are set. + Make sure the enviroment variables for your compiler are set. Visual Studio includes \c{vcvars32.bat} for that purpose - or simply use the "Visual Studio Command Prompt" from the Start menu. @@ -530,7 +530,7 @@ in the \l{Qt for the Symbian platform Requirements} document. \snippet doc/src/snippets/code/doc_src_installation.qdoc 25 - To run the demos on the emulator simply navigate to the directory of the demo + To run the demos on the emulator simply navigate to the directory of the demo you want to see and run: \snippet doc/src/snippets/code/doc_src_installation.qdoc 27 @@ -554,7 +554,7 @@ Symbian platform, in the \l{Qt for the Symbian platform Requirements} document. \note \bold {This document describes how to install and configure Qt for -the Symbian platform from scratch. +the Symbian platform from scratch. If you are using pre-built binaries, follow the instructions given in the \l{Installing Qt on the Symbian platform from a Binary Package} document.} @@ -616,7 +616,7 @@ If you are using pre-built binaries, follow the instructions given in the \snippet doc/src/snippets/code/doc_src_installation.qdoc 31 to build the tools using MinGW, and the libraries using SBSv2. - SBSv2 also known as a (\l{http://developer.symbian.org/wiki/index.php/Introduction_to_RAPTOR} {Raptor}) + SBSv2 (also known as \l{http://developer.symbian.org/wiki/index.php/Introduction_to_RAPTOR} {Raptor}) is a next-generation Symbian build system. SBSv2 is not officially supported by any of the S60 SDKs currently available from Forum Nokia. @@ -641,8 +641,8 @@ If you are using pre-built binaries, follow the instructions given in the \snippet doc/src/snippets/code/doc_src_installation.qdoc 29 - \note You will need to supply certificate that allows installation - of binaries with "All -Tcb" capability to your device. + \note You will need to supply certificate that allows installation + of binaries with "All -Tcb" capability to your device. Similarly, install fluidlauncher to the device: @@ -651,7 +651,7 @@ If you are using pre-built binaries, follow the instructions given in the This will create a self-signed \c fluidlauncher_armv5_urel.sis and install it to your device. - To run the demos on the emulator simply navigate to the directory of the demo + To run the demos on the emulator simply navigate to the directory of the demo you want to see and run: \snippet doc/src/snippets/code/doc_src_installation.qdoc 27 @@ -827,7 +827,7 @@ If you are using pre-built binaries, follow the instructions given in the when building Qt from its source code. On Debian-based GNU/Linux systems, for example, we recommend that you install the following development packages: - + \list \o libfontconfig1-dev \o libfreetype6-dev @@ -850,7 +850,7 @@ If you are using pre-built binaries, follow the instructions given in the The configure script will autodetect if OpenGL headers and libraries are installed on your system, and if so, it will include the QtOpenGL module in the Qt library. - + If your OpenGL headers or libraries are placed in a non-standard directory, you may need to change the \c QMAKE_INCDIR_OPENGL and/or \c QMAKE_LIBDIR_OPENGL in the config file for your system. @@ -954,7 +954,7 @@ If you are using pre-built binaries, follow the instructions given in the \table \header \o{1,2} Architecture \o{1,2} Compiler \o{2,1} QtCore \o{2,1} QtGui \o{2,1} QtNetwork \o{2,1} QtWebKit - \header \o Minimal \o Normal \o Minimal \o Normal \o Minimal \o Normal \o Minimal \o Normal + \header \o Minimal \o Normal \o Minimal \o Normal \o Minimal \o Normal \o Minimal \o Normal \row \o linux-x86-g++ \o GCC 4.2.4 \o 1.7M \o 2.7M \o 3.3M \o 9.9M \o 653K \o 1.1M \o N/A \o 17M \row \o linux-arm-g++ \o GCC 4.1.1 \o 1.9M \o 3.2M \o 4.1M \o 11M \o 507K \o 1.0M \o N/A \o 17M \row \o linux-mips-g++ (MIPS32) @@ -984,7 +984,7 @@ If you are using pre-built binaries, follow the instructions given in the Qt for the Symbian platform requires the following software installed on your development PC: \list - \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/carbide_cpp/}{Carbide.c++ v2.0.0 or higher} + \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/carbide_cpp/}{Carbide.c++ v2.0.0 or higher} \list \o \bold{Note:} It may be necessary to update the Carbide compiler. See \l{http://pepper.troll.no/s60prereleases/patches/}{here} for instructions how to check your @@ -1006,7 +1006,7 @@ If you are using pre-built binaries, follow the instructions given in the \o \bold{Note:} This is not required if you are using pre-built binary package. \endlist \o Building Qt libraries requires \l{http://www.arm.com/products/DevTools/RVCT.html}{RVCT} 2.2 [build 686] or later, - which is not available free of charge. + which is not available free of charge. \endlist Running Qt on real device requires the following packages to be installed on your device. -- cgit v0.12 From 9401bfd65309da360df6c2bda5f910b1507e7888 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 27 Nov 2009 09:26:33 +0100 Subject: Fixed non-compiling Q*SpinBox auto-tests Reviewed-by: Olivier --- tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp | 3 ++- tests/auto/qspinbox/tst_qspinbox.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp index 7d7453b..00ebed0 100644 --- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp @@ -1050,7 +1050,6 @@ void tst_QDoubleSpinBox::taskQTBUG_5008_textFromValueAndValidate() { class DecoratedSpinBox : public QDoubleSpinBox { - friend class tst_QDoubleSpinBox; public: DecoratedSpinBox() { @@ -1064,6 +1063,8 @@ void tst_QDoubleSpinBox::taskQTBUG_5008_textFromValueAndValidate() { return locale().toString(value); } + + using QDoubleSpinBox::lineEdit; } spinbox; spinbox.show(); spinbox.activateWindow(); diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index d2fe2ac..655de15 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -1010,7 +1010,6 @@ void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate() { class DecoratedSpinBox : public QSpinBox { - friend class tst_QSpinBox; public: DecoratedSpinBox() { @@ -1024,6 +1023,8 @@ void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate() { return locale().toString(value); } + + using QSpinBox::lineEdit; } spinbox; spinbox.show(); spinbox.activateWindow(); -- cgit v0.12 From f50cfa3a5a6b8408276e540a52f4232568c871fa Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 27 Nov 2009 09:37:37 +0100 Subject: Fix compilation on Windows CE Commit 6ef5b4485b9fe5a9d25d2d9b5e67f110fb728a8b broke compilation on Windows CE by moving code out from a #ifndef Q_WS_WINCE block. Reviewed-by: Rohan McGovern --- src/gui/text/qfontengine_win.cpp | 2 ++ src/gui/text/qfontengine_win_p.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 18851b7..7ec8e31 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -485,6 +485,7 @@ glyph_metrics_t QFontEngineWin::boundingBox(const QGlyphLayout &glyphs) return glyph_metrics_t(0, -tm.tmAscent, w, tm.tmHeight, w, 0); } +#ifndef Q_WS_WINCE bool QFontEngineWin::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const { Q_ASSERT(metrics != 0); @@ -536,6 +537,7 @@ bool QFontEngineWin::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph return false; } } +#endif glyph_metrics_t QFontEngineWin::boundingBox(glyph_t glyph, const QTransform &t) { diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h index 43e1f12..bab71c9 100644 --- a/src/gui/text/qfontengine_win_p.h +++ b/src/gui/text/qfontengine_win_p.h @@ -109,7 +109,9 @@ public: int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, bool mirrored) const; void getCMap(); +#ifndef Q_WS_WINCE bool getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const; +#endif QString _name; HFONT hfont; -- cgit v0.12 From 583b1529894aca5e9ffa353f0547dfb4b8b0ab21 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 27 Nov 2009 10:42:47 +0100 Subject: Fixed memory leak in QImagePixmapCleanupHooks. The QImagePixmapCleanupHooks instance was never deleted. Fixed by making it a Q_GLOBAL_STATIC. Task-number: QTBUG-6116 Reviewed-by: Trond --- src/gui/image/qimagepixmapcleanuphooks.cpp | 28 ++++++++-------------------- src/gui/image/qimagepixmapcleanuphooks_p.h | 3 --- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index 35322e9..650075b 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -55,20 +55,11 @@ Q_GUI_EXPORT _qt_pixmap_cleanup_hook_64 qt_pixmap_cleanup_hook_64 = 0; Q_GUI_EXPORT _qt_image_cleanup_hook qt_image_cleanup_hook = 0; Q_GUI_EXPORT _qt_image_cleanup_hook_64 qt_image_cleanup_hook_64 = 0; - -QImagePixmapCleanupHooks* qt_image_and_pixmap_cleanup_hooks = 0; - - -QImagePixmapCleanupHooks::QImagePixmapCleanupHooks() -{ - qt_image_and_pixmap_cleanup_hooks = this; -} +Q_GLOBAL_STATIC(QImagePixmapCleanupHooks, qt_image_and_pixmap_cleanup_hooks) QImagePixmapCleanupHooks *QImagePixmapCleanupHooks::instance() { - if (!qt_image_and_pixmap_cleanup_hooks) - qt_image_and_pixmap_cleanup_hooks = new QImagePixmapCleanupHooks; - return qt_image_and_pixmap_cleanup_hooks; + return qt_image_and_pixmap_cleanup_hooks(); } void QImagePixmapCleanupHooks::addPixmapModificationHook(_qt_pixmap_cleanup_hook_pm hook) @@ -105,9 +96,8 @@ void QImagePixmapCleanupHooks::removeImageHook(_qt_image_cleanup_hook_64 hook) void QImagePixmapCleanupHooks::executePixmapModificationHooks(QPixmap* pm) { - Q_ASSERT(qt_image_and_pixmap_cleanup_hooks); - for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks->pixmapModificationHooks.count(); ++i) - qt_image_and_pixmap_cleanup_hooks->pixmapModificationHooks[i](pm); + for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->pixmapModificationHooks.count(); ++i) + qt_image_and_pixmap_cleanup_hooks()->pixmapModificationHooks[i](pm); if (qt_pixmap_cleanup_hook_64) qt_pixmap_cleanup_hook_64(pm->cacheKey()); @@ -115,9 +105,8 @@ void QImagePixmapCleanupHooks::executePixmapModificationHooks(QPixmap* pm) void QImagePixmapCleanupHooks::executePixmapDestructionHooks(QPixmap* pm) { - Q_ASSERT(qt_image_and_pixmap_cleanup_hooks); - for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks->pixmapDestructionHooks.count(); ++i) - qt_image_and_pixmap_cleanup_hooks->pixmapDestructionHooks[i](pm); + for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->pixmapDestructionHooks.count(); ++i) + qt_image_and_pixmap_cleanup_hooks()->pixmapDestructionHooks[i](pm); if (qt_pixmap_cleanup_hook_64) qt_pixmap_cleanup_hook_64(pm->cacheKey()); @@ -125,9 +114,8 @@ void QImagePixmapCleanupHooks::executePixmapDestructionHooks(QPixmap* pm) void QImagePixmapCleanupHooks::executeImageHooks(qint64 key) { - Q_ASSERT(qt_image_and_pixmap_cleanup_hooks); - for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks->imageHooks.count(); ++i) - qt_image_and_pixmap_cleanup_hooks->imageHooks[i](key); + for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->imageHooks.count(); ++i) + qt_image_and_pixmap_cleanup_hooks()->imageHooks[i](key); if (qt_image_cleanup_hook_64) qt_image_cleanup_hook_64(key); diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h index 9e490d7..dfc5f28 100644 --- a/src/gui/image/qimagepixmapcleanuphooks_p.h +++ b/src/gui/image/qimagepixmapcleanuphooks_p.h @@ -61,13 +61,10 @@ typedef void (*_qt_image_cleanup_hook_64)(qint64); typedef void (*_qt_pixmap_cleanup_hook_pm)(QPixmap*); class QImagePixmapCleanupHooks; -extern QImagePixmapCleanupHooks* qt_image_and_pixmap_cleanup_hooks; class Q_GUI_EXPORT QImagePixmapCleanupHooks { public: - QImagePixmapCleanupHooks(); - static QImagePixmapCleanupHooks *instance(); static void enableCleanupHooks(const QImage &image); -- cgit v0.12 From c8de2b42348eb8665bee3948895c397c4a364251 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 27 Nov 2009 10:47:07 +0100 Subject: Fix miracously exported WTF symbols in QtScript with the Maemo 5 toolchain. Rename the WTF namespace. Task-number: http://bugreports.qt.nokia.com/browse/QTBUG-5513 Reviewed-by: Simon Hausmann --- src/script/script.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/script.pro b/src/script/script.pro index 008c556..771047a 100644 --- a/src/script/script.pro +++ b/src/script/script.pro @@ -1,7 +1,7 @@ TARGET = QtScript QPRO_PWD = $$PWD QT = core -DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror +DEFINES += JSC=QTJSC jscyyparse=qtjscyyparse jscyylex=qtjscyylex jscyyerror=qtjscyyerror WTF=QTWTF DEFINES += QT_BUILD_SCRIPT_LIB DEFINES += QT_NO_USING_NAMESPACE DEFINES += QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO -- cgit v0.12 From ef17dac74688a8754aa4434a24ddb19d2ab4dcc5 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 27 Nov 2009 10:55:56 +0100 Subject: Improve QFileInfo benchmark Reviewed-by: TrustMe --- src/corelib/io/qfsfileengine_p.h | 2 +- tests/benchmarks/qfileinfo/main.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index 87f0737..41a6a1b 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE #define Q_USE_DEPRECATED_MAP_API 1 #endif -class QFSFileEnginePrivate : public QAbstractFileEnginePrivate +class Q_AUTOTEST_EXPORT QFSFileEnginePrivate : public QAbstractFileEnginePrivate { Q_DECLARE_PUBLIC(QFSFileEngine) diff --git a/tests/benchmarks/qfileinfo/main.cpp b/tests/benchmarks/qfileinfo/main.cpp index 7950f58..711209c 100644 --- a/tests/benchmarks/qfileinfo/main.cpp +++ b/tests/benchmarks/qfileinfo/main.cpp @@ -44,6 +44,7 @@ #include #include +#include "private/qfsfileengine_p.h" class qfileinfo : public QObject { @@ -67,11 +68,12 @@ void qfileinfo::cleanupTestCase() void qfileinfo::canonicalFileNamePerformance() { + QString appPath = QCoreApplication::applicationFilePath(); + QFSFileEnginePrivate::canonicalized(appPath); // warmup + QFSFileEnginePrivate::canonicalized(appPath); // more warmup QBENCHMARK { for (int i = 0; i < 5000; i++) { - // this actually calls canonicalFilePath twice, once inside QCoreApplication. - QFileInfo fi(QCoreApplication::applicationFilePath()); - fi.canonicalFilePath(); + QFSFileEnginePrivate::canonicalized(appPath); } } } -- cgit v0.12 From f21d183b26ea824fadb7c54a3ba9cdf66d99b726 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Fri, 27 Nov 2009 13:41:11 +0100 Subject: Fix performance regression of posted events Commit 31f1ff91028dd7f90925d5b3737e4d88b5fb07aa introduced a performance regression by using SetTimer() to delay the next call to sendPostedEvents(). SetTimer() has a minimum resolution, around 15-16ms, which is too slow for most uses. Fast timers and QWidget::update() use posted events to do their job, and suffered as a result. This commit goes away from using SetTimer() to using a GetMessage() hook that examines the input queue as soon as message are pulled from the queue. Now there is no large delay between calls to sendPostedEvents(), they are sent as quickly as possible (once all other input and timer messages have been delivered). Reviewed-by: Prasanth Ullattil Task-number: QTBUG-6083 --- src/corelib/kernel/qeventdispatcher_win.cpp | 68 +++++++++++++++++------------ src/corelib/kernel/qeventdispatcher_win_p.h | 1 + 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index b197b9d..c6eef5e 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -336,6 +336,7 @@ public: // internal window handle used for socketnotifiers/timers/etc HWND internalHwnd; + HHOOK getMessageHook; // for controlling when to send posted events QAtomicInt serialNumber; @@ -363,7 +364,7 @@ public: }; QEventDispatcherWin32Private::QEventDispatcherWin32Private() - : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), serialNumber(0), lastSerialNumber(0), wakeUps(0) + : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), wakeUps(0) { resolveTimerAPI(); } @@ -471,37 +472,11 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) } return 0; } else if (message == WM_TIMER) { - if (wp == SendPostedEventsTimerId) { - KillTimer(d->internalHwnd, wp); - int localSerialNumber = d->serialNumber; - (void) d->wakeUps.fetchAndStoreRelease(0); - if (localSerialNumber != d->lastSerialNumber) { - PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); - } - } else { - Q_ASSERT(d != 0); - d->sendTimerEvent(wp); - } + Q_ASSERT(d != 0); + d->sendTimerEvent(wp); return 0; } else if (message == WM_QT_SENDPOSTEDEVENTS) { int localSerialNumber = d->serialNumber; - - if (GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER) != 0) { - // delay the next pass of sendPostedEvents() until we get the special - // WM_TIMER, which allows all pending Windows messages to be processed - if (SetTimer(d->internalHwnd, SendPostedEventsTimerId, 0, 0) == 0) { - // failed to start the timer, oops, clear wakeUps in an attempt to keep things running - qErrnoWarning("Qt: INTERNAL ERROR: failed to start sendPostedEvents() timer"); - d->wakeUps.fetchAndStoreRelease(0); - } else { - // SetTimer() succeeded, nothing to do now - ; - } - } else { - // nothing pending in the queue, let sendPostedEvents go through - d->wakeUps.fetchAndStoreRelease(0); - } - if (localSerialNumber != d->lastSerialNumber) { d->lastSerialNumber = localSerialNumber; QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); @@ -512,6 +487,31 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) return DefWindowProc(hwnd, message, wp, lp); } +LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) +{ + if (wp == PM_REMOVE) { + QEventDispatcherWin32 *q = qobject_cast(QAbstractEventDispatcher::instance()); + Q_ASSERT(q != 0); + if (q) { + QEventDispatcherWin32Private *d = q->d_func(); + int localSerialNumber = d->serialNumber; + if (HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER)) == 0) { + // no more input or timer events in the message queue, we can allow posted events to be + // sent now + (void) d->wakeUps.fetchAndStoreRelease(0); + MSG *msg = (MSG *) lp; + if (localSerialNumber != d->lastSerialNumber + // if this message IS the one that triggers sendPostedEvents(), no need to post it again + && msg->hwnd != d->internalHwnd + && msg->message != WM_QT_SENDPOSTEDEVENTS) { + PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); + } + } + } + } + return CallNextHookEx(0, code, wp, lp); +} + static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatcher) { // make sure that multiple Qt's can coexist in the same process @@ -636,6 +636,12 @@ void QEventDispatcherWin32::createInternalHwnd() return; d->internalHwnd = qt_create_internal_window(this); + // setup GetMessage hook needed to drive our posted events + d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId()); + if (!d->getMessageHook) { + qFatal("Qt: INTERNALL ERROR: failed to install GetMessage hook"); + } + // register all socket notifiers QList sockets = (d->sn_read.keys().toSet() + d->sn_write.keys().toSet() @@ -1058,6 +1064,10 @@ void QEventDispatcherWin32::closingDown() d->unregisterTimer(d->timerVec.at(i), true); d->timerVec.clear(); d->timerDict.clear(); + + if (d->getMessageHook) + UnhookWindowsHookEx(d->getMessageHook); + d->getMessageHook = 0; } bool QEventDispatcherWin32::event(QEvent *e) diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index a5ef4d4..7f0e87d 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -102,6 +102,7 @@ public: private: friend LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); + friend LRESULT CALLBACK qt_GetMessageHook(int, WPARAM, LPARAM); }; QT_END_NAMESPACE -- cgit v0.12 From 71c3227ba260b964b0c9516f05ad4f2e6fa72f69 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Fri, 27 Nov 2009 15:10:16 +0100 Subject: Fix memory leak in the DNotify implementation of QFileSystemWatcher Make sure that all calls to opendir() are paired with a call closedir(). Reviewed-by: Marius Storm-Olsen Task-number: QTBUG-4840 --- src/corelib/io/qfilesystemwatcher_dnotify.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp index 17ac9c6..03172e5 100644 --- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp @@ -295,6 +295,9 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, pathToFD.insert(path, fd); if(parentFd) parentToFD.insert(parentFd, fd); + + ::closedir(d); + if(parent) ::closedir(parent); } Directory &directory = fdToDirectory[fd]; -- cgit v0.12 From 10b5653ad4f25c6f37d640facf4a5ef01fe25926 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 27 Nov 2009 15:14:45 +0100 Subject: QNetworkReply autotest: adapt to QNetworkCookieJar change with commit 0d20ec8604b318ceafd6c35dfe1d73519bf024d3 I changed QNetworkCookieJar behavior, this commit adapts the QNetworkReply autotest to it. Reviewed-by: TrustMe --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 5fe716a..6d43c1d 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3241,8 +3241,11 @@ void tst_QNetworkReply::receiveCookiesFromHttp_data() cookie = QNetworkCookie("a", "b"); cookie.setPath("/not/part-of-path"); header << cookie; + cookie.setDomain(QtNetworkSettings::serverName()); + jar << cookie; QTest::newRow("invalid-cookie-path") << "a=b; path=/not/part-of-path" << header << jar; + jar.clear(); cookie = QNetworkCookie("a", "b"); cookie.setDomain(".example.com"); header.clear(); -- cgit v0.12 From bdd34f907b919ea0742f28ba25b6a3c1ebe97e86 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 30 Nov 2009 00:00:26 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 37d059def88f94e4296a74dc524efda154c6bde6 ) Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-11-28 Simon Hausmann Reviewed by Kenneth Rohde Christiansen. [Qt] SoftwareInputPanelRequest event sent when clicking in newly loaded page https://bugs.webkit.org/show_bug.cgi?id=31401 Don't set the event unless there is a focused node we can use for editing afterwards. * Api/qwebpage.cpp: (QWebPagePrivate::handleSoftwareInputPanel): * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::inputMethods): 2009-11-23 David Boddie Reviewed by Simon Hausmann. Updated the QWebElement documentation with links to examples and external resources. Fixed the project file for the webelement snippet and tidied up the markers used for quoting the code. * Api/qwebelement.cpp: * docs/webkitsnippets/webelement/main.cpp: (findAll): * docs/webkitsnippets/webelement/webelement.pro: 2009-11-23 Simon Hausmann Reviewed by Kenneth Rohde Christiansen. [Qt] Wrong runtime instance objects of wrapped QObjects may be used if the wrapped object died before the gc removed the instance. https://bugs.webkit.org/show_bug.cgi?id=31681 Added a unit-test to verify that wrapping a QObject with the same identity as a previously but now dead object works. * tests/qwebframe/tst_qwebframe.cpp: --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 17 +++++++++ .../webkit/WebCore/bridge/qt/qt_instance.cpp | 15 ++++++-- .../webkit/WebCore/bridge/qt/qt_instance.h | 1 + src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp | 14 +++++-- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 5 +++ src/3rdparty/webkit/WebKit/qt/ChangeLog | 44 ++++++++++++++++++++++ .../qt/docs/webkitsnippets/webelement/main.cpp | 4 +- .../docs/webkitsnippets/webelement/webelement.pro | 3 ++ .../WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 38 +++++++++++++++++++ .../WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 15 ++++++++ 11 files changed, 147 insertions(+), 11 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 772d8d0..0a73e06 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 - 27984c8c8d021a6bff604da57520959d420a642c + 37d059def88f94e4296a74dc524efda154c6bde6 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 268aaa1..4f6146f 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2009-11-23 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Wrong runtime instance objects of wrapped QObjects may be used if + the wrapped object died before the gc removed the instance. + + https://bugs.webkit.org/show_bug.cgi?id=31681 + + Before using a cached instance, verify that its wrapped QObject is + still alive. + + * bridge/qt/qt_instance.cpp: + (JSC::Bindings::QtInstance::getQtInstance): + * bridge/qt/qt_instance.h: + (JSC::Bindings::QtInstance::hashKey): + 2009-11-25 Jocelyn Turcotte 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 0546014..ec362ec 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp @@ -111,10 +111,17 @@ PassRefPtr QtInstance::getQtInstance(QObject* o, PassRefPtrrootObject() == rootObject) - return instance; - } + foreach(QtInstance* instance, cachedInstances.values(o)) + if (instance->rootObject() == rootObject) { + // The garbage collector removes instances, but it may happen that the wrapped + // QObject dies before the gc kicks in. To handle that case we have to do an additional + // check if to see if the instance's wrapped object is still alive. If it isn't, then + // we have to create a new wrapper. + if (!instance->getObject()) + cachedInstances.remove(instance->hashKey()); + else + return instance; + } RefPtr ret = QtInstance::create(o, rootObject, ownership); cachedInstances.insert(o, ret.get()); diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h index 00aaa5b..0afc6c7 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.h @@ -59,6 +59,7 @@ public: JSValue booleanValue() const; QObject* getObject() const { return m_object; } + QObject* hashKey() const { return m_hashkey; } static PassRefPtr getQtInstance(QObject*, PassRefPtr, QScriptEngine::ValueOwnership ownership); diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp index 8922150..441bec7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp @@ -99,6 +99,14 @@ public: It is possible to replace the contents of child elements using setPlainText() and setInnerXml(). To replace the element itself and its contents, use setOuterXml(). + + \section1 Examples + + The \l{DOM Traversal Example} shows one way to traverse documents in a running + example. + + The \l{Simple Selector Example} can be used to experiment with the searching + features of this class and provides sample code you can start working with. */ /*! @@ -195,8 +203,7 @@ bool QWebElement::isNull() const \a selectorQuery. If there are no matching elements, an empty list is returned. - \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} - syntax is used for the query. + \l{Standard CSS2 selector} syntax is used for the query. \note This search is performed recursively. @@ -211,8 +218,7 @@ QWebElementCollection QWebElement::findAll(const QString &selectorQuery) const Returns the first child element that matches the given CSS selector \a selectorQuery. - \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{Standard CSS2 selector} - syntax is used for the query. + \l{Standard CSS2 selector} syntax is used for the query. \note This search is performed recursively. diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index aedf95a..1bdc3ed 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -864,7 +864,12 @@ void QWebPagePrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) void QWebPagePrivate::handleSoftwareInputPanel(Qt::MouseButton button) { #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + Frame* frame = page->focusController()->focusedFrame(); + if (!frame) + return; + if (client && client->inputMethodEnabled() + && frame->document()->focusedNode() && button == Qt::LeftButton && qApp->autoSipEnabled()) { QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( client->ownerWidget()->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 2408dd4..2f0bf17 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,47 @@ +2009-11-28 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] SoftwareInputPanelRequest event sent when clicking in newly loaded page + + https://bugs.webkit.org/show_bug.cgi?id=31401 + + Don't set the event unless there is a focused node we can use + for editing afterwards. + + * Api/qwebpage.cpp: + (QWebPagePrivate::handleSoftwareInputPanel): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + +2009-11-23 David Boddie + + Reviewed by Simon Hausmann. + + Updated the QWebElement documentation with links to examples and + external resources. + Fixed the project file for the webelement snippet and tidied up the + markers used for quoting the code. + + * Api/qwebelement.cpp: + * docs/webkitsnippets/webelement/main.cpp: + (findAll): + * docs/webkitsnippets/webelement/webelement.pro: + +2009-11-23 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Wrong runtime instance objects of wrapped QObjects may be used if + the wrapped object died before the gc removed the instance. + + https://bugs.webkit.org/show_bug.cgi?id=31681 + + Added a unit-test to verify that wrapping a QObject with the + same identity as a previously but now dead object works. + + * tests/qwebframe/tst_qwebframe.cpp: + 2009-11-19 Olivier Goffart Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp index d437a6f..2707ffb 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp +++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp @@ -22,7 +22,6 @@ #include #include #include -#include static QWebFrame *frame; @@ -53,9 +52,10 @@ static void findAll()

*/ +//! [FindAll intro] QList allSpans = document.findAll("span"); QList introSpans = document.findAll("p.intro span"); -//! [FindAll] +//! [FindAll intro] //! [FindAll] } int main(int argc, char *argv[]) diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro index f9b403b..8ca4b59 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro +++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro @@ -1,5 +1,8 @@ TEMPLATE = app CONFIG -= app_bundle +CONFIG(QTDIR_build) { + QT += webkit +} SOURCES = main.cpp include(../../../../../WebKit.pri) QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index d88d905..8cc7953 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -605,6 +605,7 @@ private slots: void render(); void scrollPosition(); void evaluateWillCauseRepaint(); + void qObjectWrapperWithSameIdentity(); private: QString evalJS(const QString&s) { @@ -2785,6 +2786,43 @@ void tst_QWebFrame::evaluateWillCauseRepaint() QTest::qWait(2000); } +class TestFactory : public QObject +{ + Q_OBJECT +public: + TestFactory() + : obj(0), counter(0) + {} + + Q_INVOKABLE QObject* getNewObject() + { + delete obj; + obj = new QObject(this); + obj->setObjectName(QLatin1String("test") + QString::number(++counter)); + return obj; + + } + + QObject* obj; + int counter; +}; + +void tst_QWebFrame::qObjectWrapperWithSameIdentity() +{ + m_view->setHtml("" + "test"); + + QWebFrame* mainFrame = m_view->page()->mainFrame(); + QCOMPARE(mainFrame->toPlainText(), QString("test")); + + mainFrame->addToJavaScriptWindowObject("test", new TestFactory, QScriptEngine::ScriptOwnership); + + mainFrame->evaluateJavaScript("triggerBug();"); + QCOMPARE(mainFrame->toPlainText(), QString("test1")); + + mainFrame->evaluateJavaScript("triggerBug();"); + QCOMPARE(mainFrame->toPlainText(), QString("test2")); +} QTEST_MAIN(tst_QWebFrame) #include "tst_qwebframe.moc" diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 32002e7..ee1969d 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1487,6 +1487,21 @@ void tst_QWebPage::inputMethods() QVERIFY(!(inputMethodHints(view) & Qt::ImhHiddenText)); #endif + page->mainFrame()->setHtml("

nothing to input here"); + viewEventSpy.clear(); + + QWebElement para = page->mainFrame()->findFirstElement("p"); + { + QMouseEvent evpres(QEvent::MouseButtonPress, para.geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + page->event(&evpres); + QMouseEvent evrel(QEvent::MouseButtonRelease, para.geometry().center(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier); + page->event(&evrel); + } + +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel)); +#endif + delete container; } -- cgit v0.12 From 61f2b450560887651b3350e63bdd75609e3b6752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Mon, 30 Nov 2009 11:40:27 +0100 Subject: Fixed build on S60 and WinCE Since qreal is a float on these targets, it was having trouble picking the right version of qMax. --- src/gui/painting/qpainter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index fc1863f..443c9c5 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5918,7 +5918,7 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen) if (QPixmapCache::find(key, pixmap)) return pixmap; - const qreal halfPeriod = qMax(qreal(2), radiusBase * 1.61803399); // the golden ratio + const qreal halfPeriod = qMax(qreal(2), qreal(radiusBase * 1.61803399)); // the golden ratio const int width = qCeil(100 / (2 * halfPeriod)) * (2 * halfPeriod); const int radius = qFloor(radiusBase); -- cgit v0.12 From 84794dee63d9f90fc3e2d579644a6a2835513e9e Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 30 Nov 2009 11:33:39 +0100 Subject: Enable YARR when YARR_JIT is enabled Import fix for https://bugs.webkit.org/show_bug.cgi?id=30730 The fix was already applied for src/3rdparty/webkit but not for src/3rdparty/javascriptcore. Task-number: QTBUG-6311 Reviewed-by: Simon Hausmann --- src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri index 28328e7..a6fb2f8 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri @@ -39,10 +39,12 @@ win32-* { contains(JAVASCRIPTCORE_JIT,yes) { DEFINES+=ENABLE_JIT=1 DEFINES+=ENABLE_YARR_JIT=1 + DEFINES+=ENABLE_YARR=1 } contains(JAVASCRIPTCORE_JIT,no) { DEFINES+=ENABLE_JIT=0 DEFINES+=ENABLE_YARR_JIT=0 + DEFINES+=ENABLE_YARR=0 } # In debug mode JIT disabled until crash fixed -- cgit v0.12 From bd1370f577f486ac994c7856373f52306de23068 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 30 Nov 2009 13:16:14 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 9de63cde0ac8aa08e207d4ffce2846df1a44a364 ) Changes in WebKit/qt since the last update: --- src/3rdparty/webkit/ChangeLog | 10 +++++++++ src/3rdparty/webkit/JavaScriptCore/ChangeLog | 26 ++++++++++++++++++++++ .../webkit/JavaScriptCore/runtime/MarkStack.h | 2 +- .../webkit/JavaScriptCore/wtf/TypeTraits.h | 2 +- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebKit.pri | 2 +- 6 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index 26dbaf7..1e89d1e 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,13 @@ +2009-11-30 Jan-Arve Sæther + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation with win32-icc + + Include os-win32 for stdint.h since MS does not ship that in their PSDK. + + * WebKit.pri: + 2009-10-30 Adam Barth Reviewed by Mark Rowe. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 1ef3b4d..d7d2d57 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,29 @@ +2009-11-30 Jan-Arve Sæther + + Reviewed by Simon Hausmann. + + [Qt] Fix compilation with win32-icc + + The Intel compiler does not support the __has_trivial_constructor type + trait. The Intel Compiler can report itself as _MSC_VER >= 1400. The + reason for that is that the Intel Compiler depends on the Microsoft + Platform SDK, and in order to try to be "fully" MS compatible it will + "pretend" to be the same MS compiler as was shipped with the MS PSDK. + (Thus, compiling with win32-icc with VC8 SDK will make the source code + "think" the compiler at hand supports this type trait). + + * wtf/TypeTraits.h: + +2009-11-28 Laszlo Gombos + + Reviewed by Eric Seidel. + + Apply workaround for the limitation of VirtualFree with MEM_RELEASE to all ports running on Windows + https://bugs.webkit.org/show_bug.cgi?id=31943 + + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStackArray::shrinkAllocation): + 2009-11-18 Gabor Loki Reviewed by Darin Adler. diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h index ea09f54..a114ae0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/MarkStack.h @@ -153,7 +153,7 @@ namespace JSC { ASSERT(0 == (size % MarkStack::pageSize())); if (size == m_allocated) return; -#if PLATFORM(WIN) || PLATFORM(SYMBIAN) +#if PLATFORM(WIN_OS) || PLATFORM(SYMBIAN) // We cannot release a part of a region with VirtualFree. To get around this, // we'll release the entire region and reallocate the size that we want. releaseStack(m_data, m_allocated); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h index 6ce6a3e..9e75e7a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h @@ -155,7 +155,7 @@ namespace WTF { typedef IntegralConstant true_type; typedef IntegralConstant false_type; -#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) // VC8 (VS2005) and later have built-in compiler support for HasTrivialConstructor / HasTrivialDestructor, // but for some unexplained reason it doesn't work on built-in types. template struct HasTrivialConstructor : public IntegralConstant{ }; diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 0a73e06..62acbdf 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 - 37d059def88f94e4296a74dc524efda154c6bde6 + 9de63cde0ac8aa08e207d4ffce2846df1a44a364 diff --git a/src/3rdparty/webkit/WebKit.pri b/src/3rdparty/webkit/WebKit.pri index 10291b4..5188662 100644 --- a/src/3rdparty/webkit/WebKit.pri +++ b/src/3rdparty/webkit/WebKit.pri @@ -11,7 +11,7 @@ isEmpty(OUTPUT_DIR) { DEFINES += BUILDING_QT__=1 building-libs { - win32-msvc*: INCLUDEPATH += $$PWD/JavaScriptCore/os-win32 + win32-msvc*|win32-icc: INCLUDEPATH += $$PWD/JavaScriptCore/os-win32 } else { CONFIG(QTDIR_build) { QT += webkit -- cgit v0.12 From 634a2c456732903b116a73e674f1391f77d530d8 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Mon, 30 Nov 2009 14:23:47 +0100 Subject: Make sure that cleanupTestCase() do not stat The benchmark of QDir is also used to minimize the number of stats(). The test initialization and cleanup should avoid stats(). Reviewed-by: Markus Goetz --- tests/benchmarks/qdir/tst_qdir.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/benchmarks/qdir/tst_qdir.cpp b/tests/benchmarks/qdir/tst_qdir.cpp index 2e4a28a..fd558d3 100644 --- a/tests/benchmarks/qdir/tst_qdir.cpp +++ b/tests/benchmarks/qdir/tst_qdir.cpp @@ -68,7 +68,8 @@ public slots: void cleanupTestCase() { { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); - + testdir.setSorting(QDir::Unsorted); + testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden); foreach (const QString &filename, testdir.entryList()) { testdir.remove(filename); } -- cgit v0.12 From 132eccca92a90e4d67ba8b5a4052384a2b2cfdf9 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Mon, 30 Nov 2009 14:15:50 +0100 Subject: Fix garbage collection issue with script-owned objects with connections This reinstates the pre-4.6 behavior: A script-owned C++ object that's not referenced anymore should be garbage collected, even if it has connections. In order to achieve this, the "weak" reference to the C++ object's wrapper must be invalidated. Task-number: QTBUG-6366 Reviewed-by: Simon Hausmann --- src/script/api/qscriptengine.cpp | 21 ++++++++++---------- src/script/bridge/qscriptqobject.cpp | 27 +++++++++++++------------- tests/auto/qscriptengine/tst_qscriptengine.cpp | 18 +++++++++++++++++ 3 files changed, 43 insertions(+), 23 deletions(-) diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index dc0e0d0..b6aa872 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1101,16 +1101,6 @@ void QScriptEnginePrivate::mark(JSC::MarkStack& markStack) } } -#ifndef QT_NO_QOBJECT - { - QHash::const_iterator it; - for (it = m_qobjectData.constBegin(); it != m_qobjectData.constEnd(); ++it) { - QScript::QObjectData *qdata = it.value(); - qdata->mark(markStack); - } - } -#endif - { QHash::const_iterator it; for (it = m_typeInfos.constBegin(); it != m_typeInfos.constEnd(); ++it) { @@ -1134,6 +1124,17 @@ void QScriptEnginePrivate::mark(JSC::MarkStack& markStack) context = context->parentContext(); } } + +#ifndef QT_NO_QOBJECT + markStack.drain(); // make sure everything is marked before marking qobject data + { + QHash::const_iterator it; + for (it = m_qobjectData.constBegin(); it != m_qobjectData.constEnd(); ++it) { + QScript::QObjectData *qdata = it.value(); + qdata->mark(markStack); + } + } +#endif } bool QScriptEnginePrivate::isCollecting() const diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index 559fcd3..63ba9ec 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -83,22 +83,23 @@ struct QObjectConnection void mark(JSC::MarkStack& markStack) { - // ### need to find out if senderWrapper is marked if (senderWrapper) { - // see if the sender should be marked or not + // see if the sender should be marked or not; + // if the C++ object is owned by script, we don't want + // it to stay alive due to a script connection. Q_ASSERT(senderWrapper.inherits(&QScriptObject::info)); QScriptObject *scriptObject = static_cast(JSC::asObject(senderWrapper)); - QScriptObjectDelegate *delegate = scriptObject->delegate(); - Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject)); - QObjectDelegate *inst = static_cast(delegate); - if ((inst->ownership() == QScriptEngine::ScriptOwnership) - || ((inst->ownership() == QScriptEngine::AutoOwnership) - && inst->value() && !inst->value()->parent())) { - // #### don't mark if not marked otherwise - //senderWrapper = JSC::JSValue(); - markStack.append(senderWrapper); - } else { - markStack.append(senderWrapper); + if (!JSC::Heap::isCellMarked(scriptObject)) { + QScriptObjectDelegate *delegate = scriptObject->delegate(); + Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject)); + QObjectDelegate *inst = static_cast(delegate); + if ((inst->ownership() == QScriptEngine::ScriptOwnership) + || ((inst->ownership() == QScriptEngine::AutoOwnership) + && inst->value() && !inst->value()->parent())) { + senderWrapper = JSC::JSValue(); + } else { + markStack.append(senderWrapper); + } } } if (receiver) diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 3bc2443..2d629b7 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -154,6 +154,7 @@ private slots: void functionScopes(); void nativeFunctionScopes(); void evaluateProgram(); + void collectGarbageAfterConnect(); void qRegExpInport_data(); void qRegExpInport(); @@ -4443,6 +4444,23 @@ void tst_QScriptEngine::evaluateProgram() } } +void tst_QScriptEngine::collectGarbageAfterConnect() +{ + // QTBUG-6366 + QScriptEngine engine; + QPointer widget = new QWidget; + engine.globalObject().setProperty( + "widget", engine.newQObject(widget, QScriptEngine::ScriptOwnership)); + QVERIFY(engine.evaluate("widget.customContextMenuRequested.connect(\n" + " function() { print('hello'); }\n" + ");") + .isUndefined()); + QVERIFY(widget != 0); + engine.evaluate("widget = null;"); + collectGarbage_helper(engine); + QVERIFY(widget == 0); +} + static QRegExp minimal(QRegExp r) { r.setMinimal(true); return r; } void tst_QScriptEngine::qRegExpInport_data() -- cgit v0.12 From b5bf6d68bdde5f5db1d72179f4e20dc1e21d20c4 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 30 Nov 2009 15:28:47 +0100 Subject: Unix: Avoid stat() when opening a file The open() syscall can open directories for reading, which we in QFile and file engines don't support. However, there is no need for stat() to find out if it is a directory if we open() with a write flag because then the syscall will fail anyway. Reviewed-by: joao --- src/corelib/io/qfsfileengine_unix.cpp | 32 ++++++++++++++++++++------------ tests/auto/qfile/tst_qfile.cpp | 13 ++++++++++++- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 8cbf6a3..71414ce 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -191,12 +191,16 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode) return false; } - QT_STATBUF statBuf; - if (QT_FSTAT(fd, &statBuf) != -1) { - if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { - q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); - QT_CLOSE(fd); - return false; + if (!(openMode & QIODevice::WriteOnly)) { + // we don't need this check if we tried to open for writing because then + // we had received EISDIR anyway. + QT_STATBUF statBuf; + if (QT_FSTAT(fd, &statBuf) != -1) { + if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { + q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); + QT_CLOSE(fd); + return false; + } } } @@ -230,12 +234,16 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode) return false; } - QT_STATBUF statBuf; - if (QT_FSTAT(fileno(fh), &statBuf) != -1) { - if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { - q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); - fclose(fh); - return false; + if (!(openMode & QIODevice::WriteOnly)) { + // we don't need this check if we tried to open for writing because then + // we had received EISDIR anyway. + QT_STATBUF statBuf; + if (QT_FSTAT(fileno(fh), &statBuf) != -1) { + if ((statBuf.st_mode & S_IFMT) == S_IFDIR) { + q->setError(QFile::OpenError, QLatin1String("file to open is a directory")); + fclose(fh); + return false; + } } } diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index cf46ce1..7ee5665 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -2783,10 +2783,21 @@ void tst_QFile::mapOpenMode() void tst_QFile::openDirectory() { - QFile f1("resources"); + QFile f1(SRCDIR "resources"); + // it's a directory, it must exist + QVERIFY(f1.exists()); + + // ...but not be openable QVERIFY(!f1.open(QIODevice::ReadOnly)); f1.close(); QVERIFY(!f1.open(QIODevice::ReadOnly|QIODevice::Unbuffered)); + f1.close(); + QVERIFY(!f1.open(QIODevice::ReadWrite)); + f1.close(); + QVERIFY(!f1.open(QIODevice::WriteOnly)); + f1.close(); + QVERIFY(!f1.open(QIODevice::WriteOnly|QIODevice::Unbuffered)); + f1.close(); } void tst_QFile::openStandardStreams() -- cgit v0.12 From da3bf86ecea14a8658601803e14820a28e7470d6 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 30 Nov 2009 17:08:53 +0100 Subject: Fixes a crash on Mac with QFileInfo. realpath() crashes on mac if the input file path is the root ("/") - on 10.6 calling a free on the returned value shows a warning saying the memory was not allocated. To workaround that just added a special case - if the input string is '/', we don't need to use realpath as we already know that the path is canonical. Reviewed-by: Prasanth --- src/corelib/io/qfsfileengine.cpp | 6 +++++- tests/auto/qfileinfo/tst_qfileinfo.cpp | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index efc09a0..b8f6e2c 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -139,7 +139,11 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) return path; #if defined(Q_OS_UNIX) || defined(Q_OS_SYMBIAN) - // FIXME let's see if this stuff works, then we might be able to remove some of the other code + // FIXME let's see if this stuff works, then we might be able to remove some of the other code. + // baaad Mac: 10.5 and 10.6 crash if trying to free a value returned by + // realpath() if the input path is just the root component. + if (path.size() == 1 && path.at(0) == QLatin1Char('/')) + return path; char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); if (ret) { QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index 21edbcf..cd58fd6 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -513,6 +513,10 @@ void tst_QFileInfo::canonicalFilePath() QFileInfo info("/tmp/../../../../../../../../../../../../../../../../../"); info.canonicalFilePath(); + // This used to crash on Mac + QFileInfo dontCrash(QLatin1String("/")); + QCOMPARE(dontCrash.canonicalFilePath(), QLatin1String("/")); + #ifndef Q_OS_WIN // test symlinks QFile::remove("link.lnk"); -- cgit v0.12