diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-06-09 06:32:07 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-06-09 06:32:07 (GMT) |
commit | f2eab026602a0608e036018eeacf3fa6c8ca3fa7 (patch) | |
tree | 97be8a8e269ea49fb68d4908d8f7d0f47afbd1d6 | |
parent | 22d7c82b71f34df637efd0ed39b3d63719a2bf67 (diff) | |
parent | 17fcc84e5ebcf09f80a4bbebafde913d0422a91e (diff) | |
download | Qt-f2eab026602a0608e036018eeacf3fa6c8ca3fa7.zip Qt-f2eab026602a0608e036018eeacf3fa6c8ca3fa7.tar.gz Qt-f2eab026602a0608e036018eeacf3fa6c8ca3fa7.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
73 files changed, 1155 insertions, 149 deletions
@@ -3203,15 +3203,25 @@ fi #prefix if [ -z "$QT_INSTALL_PREFIX" ]; then - if [ "$CFG_DEV" = "yes" ]; then - QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default - elif [ "$PLATFORM_QWS" = "yes" ]; then - QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}" - if [ "$PLATFORM" != "$XPLATFORM" ]; then - QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}" + if [ -d "$EPOCROOT" ]; then + case "$XPLATFORM" in *symbian*) + QT_INSTALL_PREFIX="$EPOCROOT/epoc32/" + QT_INSTALL_LIBS="$EPOCROOT/epoc32/release/armv5/lib/" + ;; + esac + fi + + if [ -z "$QT_INSTALL_PREFIX" ]; then # still empty + if [ "$CFG_DEV" = "yes" ]; then + QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default + elif [ "$PLATFORM_QWS" = "yes" ]; then + QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}" + if [ "$PLATFORM" != "$XPLATFORM" ]; then + QT_INSTALL_PREFIX="${QT_INSTALL_PREFIX}-${CFG_ARCH}" + fi + else + QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION fi - else - QT_INSTALL_PREFIX="/usr/local/Trolltech/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Trolltech/Qt-$QT_VERSION fi fi QT_INSTALL_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_PREFIX"` @@ -8039,7 +8049,7 @@ if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then echo "NOTE: When linking against OpenSSL, you can override the default" echo "library names through OPENSSL_LIBS." echo "For example:" - echo " ./configure -openssl-linked OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto'" + echo " OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked" echo fi if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then diff --git a/demos/declarative/snake/content/HighScoreModel.qml b/demos/declarative/snake/content/HighScoreModel.qml index 99799c8..42482f8 100644 --- a/demos/declarative/snake/content/HighScoreModel.qml +++ b/demos/declarative/snake/content/HighScoreModel.qml @@ -106,7 +106,7 @@ ListModel { } if (rs.rows.length > maxScores) tx.executeSql("DELETE FROM HighScores WHERE game=? AND score <= ?", - [rs.rows.item(maxScores).score]); + [game, rs.rows.item(maxScores).score]); } } ) diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index 6f78b33..4d05e33 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -37,6 +37,7 @@ function startNewGame() startNewGameTimer.running = true; return; } + numRows = numRowsAvailable; numColumns = numColumnsAvailable; board = new Array(numRows * numColumns); diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 565e92c..46114f5 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -86,7 +86,7 @@ Rectangle { onTriggered: { Logic.moveSkull() } } Timer { - + id: startNewGameTimer; interval: 700; onTriggered: { Logic.startNewGame(); } } @@ -177,7 +177,6 @@ Rectangle { id: progressIndicator color: "#221edd"; width: 0; - Behavior on width { NumberAnimation { duration: startHeartbeatTimer.running ? 1000 : 0}} height: 30; } } @@ -227,4 +226,13 @@ Rectangle { } ] + transitions: [ + Transition { + from: "*" + to: "starting" + NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 } + + } + ] + } diff --git a/demos/embedded/fluidlauncher/fluidlauncher.pro b/demos/embedded/fluidlauncher/fluidlauncher.pro index 21f3819..416e58b 100644 --- a/demos/embedded/fluidlauncher/fluidlauncher.pro +++ b/demos/embedded/fluidlauncher/fluidlauncher.pro @@ -2,6 +2,7 @@ TEMPLATE = app TARGET = DEPENDPATH += . INCLUDEPATH += . +VERSION = $$QT_VERSION # Input HEADERS += \ diff --git a/demos/spectrum/app/spectrum.sh b/demos/spectrum/app/spectrum.sh index 75ad6c2..2a230ed 100644 --- a/demos/spectrum/app/spectrum.sh +++ b/demos/spectrum/app/spectrum.sh @@ -1,4 +1,45 @@ #!/bin/sh +############################################################################# +## +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## Contact: Nokia Corporation (qt-info@nokia.com) +## +## This file is part of the examples of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL$ +## No Commercial Usage +## This file contains pre-release code and may not be distributed. +## You may use this file in accordance with the terms and conditions +## contained in the Technology Preview License Agreement accompanying +## this package. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 2.1 requirements +## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## In addition, as a special exception, Nokia gives you certain additional +## rights. These rights are described in the Nokia Qt LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## If you have questions regarding the use of this file, please contact +## Nokia at qt-info@nokia.com. +## +## +## +## +## +## +## +## +## $QT_END_LICENSE$ +## +############################################################################# + # Shell script for launching spectrum application on Unix systems other than Mac OSX diff --git a/demos/spectrum/spectrum.pro b/demos/spectrum/spectrum.pro index 8736ba7..a8f09de 100644 --- a/demos/spectrum/spectrum.pro +++ b/demos/spectrum/spectrum.pro @@ -1,4 +1,3 @@ -load(data_caging_paths) include(spectrum.pri) TEMPLATE = subdirs @@ -15,6 +14,8 @@ SUBDIRS += app TARGET = spectrum symbian { + load(data_caging_paths) + # Create a 'make sis' rule which can be run from the top-level include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) diff --git a/doc/src/howtos/openvg.qdoc b/doc/src/howtos/openvg.qdoc index e448d9c..f4a34cd 100644 --- a/doc/src/howtos/openvg.qdoc +++ b/doc/src/howtos/openvg.qdoc @@ -262,7 +262,10 @@ The QVG_SCISSOR_CLIP define will disable clipping with vgMask() or vgRenderToMask() and instead use the scissor rectangle list to perform - clipping. Clipping with an arbitrary QPainterPath will not be supported. + clipping. Clipping with an arbitrary QPainterPath will need to convert + the path into a series of rectangles. If the number of rectangles + exceeds VG_MAX_SCISSOR_RECTS, then the results will not be exact. + The QVG_SCISSOR_CLIP define should only be used if the OpenVG engine does not support vgMask() or vgRenderToMask(). diff --git a/doc/src/platforms/emb-openvg.qdocinc b/doc/src/platforms/emb-openvg.qdocinc index 579af67..877d70c 100644 --- a/doc/src/platforms/emb-openvg.qdocinc +++ b/doc/src/platforms/emb-openvg.qdocinc @@ -225,7 +225,9 @@ The QVG_NO_RENDER_TO_MASK define will disable the use of vgRenderToMask(). The QVG_SCISSOR_CLIP define will disable clipping with vgMask() or vgRenderToMask() and instead use the scissor rectangle list to perform -clipping. Clipping with an arbitrary QPainterPath will not be supported. +clipping. Clipping with an arbitrary QPainterPath will need to convert +the path into a series of rectangles. If the number of rectangles +exceeds VG_MAX_SCISSOR_RECTS, then the results will not be exact. The QVG_SCISSOR_CLIP define should only be used if the OpenVG engine does not support vgMask() or vgRenderToMask(). diff --git a/mkspecs/linux-g++-maemo/qmake.conf b/mkspecs/linux-g++-maemo/qmake.conf index ca201bc..cced090 100644 --- a/mkspecs/linux-g++-maemo/qmake.conf +++ b/mkspecs/linux-g++-maemo/qmake.conf @@ -13,9 +13,6 @@ QMAKE_INCREMENTAL_STYLE = sublib include(../common/g++.conf) include(../common/linux.conf) -# Work round scratchbox not having standard paths in it's default search path -QMAKE_LFLAGS += -Wl,-rpath-link=/lib -QMAKE_LFLAGS += -Wl,-rpath-link=/usr/lib # Override the default lib/include directories for scratchbox: QMAKE_INCDIR_X11 = /usr/include/X11 diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 1a7391b..aa55f51 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -540,7 +540,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("name", "Qt Qmake") << ";" << "\n" << "\t\t\t" << writeSettings("neededFileNames", QStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";" << "\n" - << "\t\t\t" << writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f " + escapeFilePath(mkfile))) << ";" << "\n" + << "\t\t\t" << writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f '" + escapeFilePath(mkfile) + "'")) << ";" << "\n" << "\t\t" << "};" << "\n"; } @@ -789,7 +789,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("name", "Qt Preprocessors") << ";" << "\n" << "\t\t\t" << writeSettings("neededFileNames", fixListForOutput("QMAKE_PBX_OBJ"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";" << "\n" - << "\t\t\t" << writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f " + escapeFilePath(mkfile))) << ";" << "\n" + << "\t\t\t" << writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f '" + escapeFilePath(mkfile) + "'")) << ";" << "\n" << "\t\t" << "};" << "\n"; } @@ -968,7 +968,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("name", "Qt Sublibs") << ";" << "\n" << "\t\t\t" << writeSettings("neededFileNames", QStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << "\n" - << "\t\t\t" << writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f " + escapeFilePath(mkfile))) << ";" << "\n" + << "\t\t\t" << writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f '" + escapeFilePath(mkfile) + "'")) << ";" << "\n" << "\t\t" << "};" << "\n"; } //LIBRARY BUILDPHASE diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index f8b3aa5..58729d2 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -503,7 +503,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB // Wrapped files deployment QString currentPath = qmake_getpwd(); QString sisName = QString("%1.sis").arg(pkgTarget); - twf << "\"" << currentPath << "/" << sisName << "\" - \"c:\\adm\\" << sisName << "\"" << endl; + twf << "\"" << currentPath << "/" << sisName << "\" - \"c:\\private\\2002CCCE\\import\\" << sisName << "\"" << endl; QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath); bootStrapPath.append("/smartinstaller.sis"); diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 604aa8a..1e060a0 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -674,6 +674,12 @@ bool VCCLCompilerTool::parseOption(const char* option) if(third == 'd') RuntimeLibrary = rtMultiThreadedDebug; break; + } else if (second == 'P') { + if (config->CompilerVersion >= NET2005) + AdditionalOptions += option; + else + warn_msg(WarnLogic, "/MP option is not supported in Visual C++ < 2005, ignoring."); + break; } found = false; break; case 'O': diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp index 6cfeb76..9b64ab3 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp @@ -184,6 +184,8 @@ int AbstractAudioEffect::effectParameterChanged( const EffectParameter ¶m, const QVariant &value) { // Default implementation + Q_UNUSED(param) + Q_UNUSED(value) Q_ASSERT_X(false, Q_FUNC_INFO, "Effect has no parameters"); return 0; } diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index d71993b..70adcf6 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -118,6 +118,10 @@ private: // for each of the effects. Using this reduces repetition of boilerplate // in the implementations of the backend effect nodes. +#ifdef Q_CC_NOKIAX86 +# pragma warn_illtokenpasting off +#endif + #define PHONON_MMF_DEFINE_EFFECT_FUNCTIONS(Effect) \ \ void Effect##::createEffect(AudioPlayer::NativePlayer *player) \ diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp index c6be20b..3588683 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.cpp +++ b/src/3rdparty/phonon/mmf/audiooutput.cpp @@ -78,6 +78,9 @@ bool MMF::AudioOutput::setOutputDevice(int index) { Q_ASSERT_X(index == AudioOutputDeviceID, Q_FUNC_INFO, "We only support one output device, with id 0"); +#ifdef QT_NO_DEBUG + Q_UNUSED(index) +#endif return true; } diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index c7af939..67076f6 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -49,6 +49,7 @@ const char* BassBoost::description() bool BassBoost::getParameters(CMdaAudioOutputStream *stream, QList<EffectParameter> ¶meters) { + Q_UNUSED(parameters) QScopedPointer<CBassBoost> effect; TRAPD(err, effect.reset(CBassBoost::NewL(*stream))); return (KErrNone == err); diff --git a/src/3rdparty/phonon/mmf/effectfactory.cpp b/src/3rdparty/phonon/mmf/effectfactory.cpp index c5e33d5..4643978 100644 --- a/src/3rdparty/phonon/mmf/effectfactory.cpp +++ b/src/3rdparty/phonon/mmf/effectfactory.cpp @@ -183,8 +183,9 @@ EffectFactory::EffectData EffectFactory::getData() /* defaultValue */ QVariant(bool(true))); data.m_parameters.append(param); - if (data.m_supported = BackendNode::getParameters - (stream.data(), data.m_parameters)) { + data.m_supported = BackendNode::getParameters(stream.data(), + data.m_parameters); + if (data.m_supported) { const QString description = QCoreApplication::translate ("Phonon::MMF::EffectFactory", BackendNode::description()); data.m_descriptions.insert("name", description); diff --git a/src/3rdparty/phonon/mmf/loudness.cpp b/src/3rdparty/phonon/mmf/loudness.cpp index 1079a35..ca05ab0 100644 --- a/src/3rdparty/phonon/mmf/loudness.cpp +++ b/src/3rdparty/phonon/mmf/loudness.cpp @@ -49,6 +49,7 @@ const char* Loudness::description() bool Loudness::getParameters(CMdaAudioOutputStream *stream, QList<EffectParameter> ¶meters) { + Q_UNUSED(parameters) QScopedPointer<CLoudness> effect; TRAPD(err, effect.reset(CLoudness::NewL(*stream))); return (KErrNone == err); diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 607ab52..a9c56f6 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -948,6 +948,8 @@ public: #endif Key_MediaNext = 0x01000083, Key_MediaRecord = 0x01000084, + Key_MediaPause = 0x1000085, + Key_MediaTogglePlayPause = 0x1000086, Key_HomePage = 0x01000090, Key_Favorites = 0x01000091, Key_Search = 0x01000092, @@ -1090,11 +1092,15 @@ public: Key_Context2 = 0x01100001, Key_Context3 = 0x01100002, Key_Context4 = 0x01100003, - Key_Call = 0x01100004, - Key_Hangup = 0x01100005, + Key_Call = 0x01100004, // set absolute state to in a call (do not toggle state) + Key_Hangup = 0x01100005, // set absolute state to hang up (do not toggle state) Key_Flip = 0x01100006, - Key_Camera = 0x01100007, - Key_CameraFocus = 0x01100008, + Key_ToggleCallHangup = 0x01100007, // a toggle key for answering, or hanging up, based on current call state + Key_VoiceDial = 0x01100008, + Key_LastNumberRedial = 0x01100009, + + Key_Camera = 0x01100020, + Key_CameraFocus = 0x01100021, Key_unknown = 0x01ffffff }; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index f71ba9d..7eae3a5 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1317,7 +1317,7 @@ \value Key_Enter Typically located on the keypad. \value Key_Insert \value Key_Delete - \value Key_Pause + \value Key_Pause The Pause/Break key (\note Not anything to do with pausing media) \value Key_Print \value Key_SysReq \value Key_Clear @@ -1615,12 +1615,14 @@ \value Key_BassDown \value Key_TrebleUp \value Key_TrebleDown - \value Key_MediaPlay - \value Key_MediaStop + \value Key_MediaPlay A key setting the state of the media player to play + \value Key_MediaStop A key setting the state of the media player to stop \value Key_MediaPrevious \omitvalue Key_MediaPrev \value Key_MediaNext \value Key_MediaRecord + \value Key_MediaPause A key setting the state of the media player to pause (\note not the pause/break key) + \value Key_MediaTogglePlayPause A key to toggle the play/pause state in the media player (rather than setting an absolute state) \value Key_HomePage \value Key_Favorites \value Key_Search @@ -1741,18 +1743,21 @@ \value Key_MediaLast \value Key_unknown - \value Key_Call - \value Key_Camera - \value Key_CameraFocus + \value Key_Call A key to answer or initiate a call (\see Key_ToggleCallHangup for a key to toggle current call state) + \value Key_Camera A key to activate the camera shutter + \value Key_CameraFocus A key to focus the camera \value Key_Context1 \value Key_Context2 \value Key_Context3 \value Key_Context4 \value Key_Flip - \value Key_Hangup + \value Key_Hangup A key to end an ongoing call (\see Key_ToggleCallHangup for a key to toggle current call state) \value Key_No \value Key_Select \value Key_Yes + \value Key_ToggleCallHangup A key to toggle the current call state (ie. either answer, or hangup) depending on current call state + \value Key_VoiceDial + \value Key_LastNumberRedial \value Key_Execute \value Key_Printer diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 1cb8455..9d8ee5a 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -484,9 +484,9 @@ void QSelectThread::run() } // end for // traversed all, so update + updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); updateActivatedNotifiers(QSocketNotifier::Read, &readfds); updateActivatedNotifiers(QSocketNotifier::Write, &writefds); - updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); break; case EINTR: // Should never occur on Symbian, but this is future proof! @@ -496,9 +496,9 @@ void QSelectThread::run() break; } } else { + updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); updateActivatedNotifiers(QSocketNotifier::Read, &readfds); updateActivatedNotifiers(QSocketNotifier::Write, &writefds); - updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); } m_waitCond.wait(&m_mutex); diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 3374c80..0777f06 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -931,7 +931,7 @@ public: { return QHash<Key, T>::insertMulti(key, value); } inline QMultiHash &operator+=(const QMultiHash &other) - { unite(other); return *this; } + { this->unite(other); return *this; } inline QMultiHash operator+(const QMultiHash &other) const { QMultiHash result = *this; result += other; return result; } @@ -1006,12 +1006,7 @@ Q_INLINE_TEMPLATE int QMultiHash<Key, T>::remove(const Key &key, const T &value) typename QHash<Key, T>::iterator end(QHash<Key, T>::end()); while (i != end && i.key() == key) { if (i.value() == value) { -#if defined(Q_CC_RVCT) - // RVCT has problems with scoping, apparently. - i = QHash<Key, T>::erase(i); -#else - i = erase(i); -#endif + i = this->erase(i); ++n; } else { ++i; diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 5696ba6..e4b73a1 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -977,7 +977,7 @@ public: { return QMap<Key, T>::insertMulti(key, value); } inline QMultiMap &operator+=(const QMultiMap &other) - { unite(other); return *this; } + { this->unite(other); return *this; } inline QMultiMap operator+(const QMultiMap &other) const { QMultiMap result = *this; result += other; return result; } @@ -1052,12 +1052,7 @@ Q_INLINE_TEMPLATE int QMultiMap<Key, T>::remove(const Key &key, const T &value) typename QMap<Key, T>::iterator end(QMap<Key, T>::end()); while (i != end && !qMapLessThanKey<Key>(key, i.key())) { if (i.value() == value) { -#if defined(Q_CC_RVCT) - // RVCT has problems with scoping, apparently. - i = QMap<Key, T>::erase(i); -#else - i = erase(i); -#endif + i = this->erase(i); ++n; } else { ++i; diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 5735b1e..8b6b83f 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,6 +1,8 @@ ============================================================================= The changes below are pre Qt 4.7.0 RC +QDeclarativeView + - initialSize() function added TextInput and TextEdit: - openSoftwareInputPanel() and closeSoftwareInputPanel() functions added Flickable: diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 9949e65..bef09bb 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1633,7 +1633,7 @@ void QDeclarativeItemPrivate::data_append(QDeclarativeListProperty<QObject> *pro QObject *QDeclarativeItemPrivate::resources_at(QDeclarativeListProperty<QObject> *prop, int index) { - QObjectList children = prop->object->children(); + const QObjectList children = prop->object->children(); if (index < children.count()) return children.at(index); else @@ -2391,6 +2391,28 @@ void QDeclarativeItem::forceFocus() } } + +/*! + \qmlmethod Item::childAt(real x, real y) + + Returns the visible child item at point (\a x, \a y), which is in this + item's coordinate system, or \c null if there is no such item. + */ +QDeclarativeItem *QDeclarativeItem::childAt(qreal x, qreal y) const +{ + const QList<QGraphicsItem *> children = childItems(); + for (int i = children.count()-1; i >= 0; --i) { + if (QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(i))) { + if (child->isVisible() && child->x() <= x + && child->x() + child->width() >= x + && child->y() <= y + && child->y() + child->height() >= y) + return child; + } + } + return 0; +} + void QDeclarativeItemPrivate::focusChanged(bool flag) { Q_Q(QDeclarativeItem); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h index 77e316b..4f420f8 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.h +++ b/src/declarative/graphicsitems/qdeclarativeitem.h @@ -148,6 +148,7 @@ public: Q_INVOKABLE QScriptValue mapFromItem(const QScriptValue &item, qreal x, qreal y) const; Q_INVOKABLE QScriptValue mapToItem(const QScriptValue &item, qreal x, qreal y) const; Q_INVOKABLE void forceFocus(); + Q_INVOKABLE QDeclarativeItem *childAt(qreal x, qreal y) const; Q_SIGNALS: void childrenChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 6fca283..a68e664 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -410,7 +410,7 @@ void QDeclarativeMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event) setHovered(true); d->startScene = event->scenePos(); // we should only start timer if pressAndHold is connected to. - if (d->isConnected("pressAndHold(QDeclarativeMouseEvent*)")) + if (d->isPressAndHoldConnected()) d->pressAndHoldTimer.start(PressAndHoldDelay, this); setKeepMouseGrab(false); event->setAccepted(setPressed(true)); diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h index 4e909ff..3d7bd1e 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h @@ -88,9 +88,9 @@ public: lastModifiers = event->modifiers(); } - bool isConnected(const char *signal) { + bool isPressAndHoldConnected() { Q_Q(QDeclarativeMouseArea); - int idx = QObjectPrivate::get(q)->signalIndex(signal); + static int idx = QObjectPrivate::get(q)->signalIndex("pressAndHold(QDeclarativeMouseEvent*)"); return QObjectPrivate::get(q)->isSignalConnected(idx); } diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 6059ad6..0414e65 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -131,7 +131,7 @@ class QDeclarativeViewPrivate : public QGraphicsViewPrivate, public QDeclarative Q_DECLARE_PUBLIC(QDeclarativeView) public: QDeclarativeViewPrivate() - : root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {} + : root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject), initialSize(0,0) {} ~QDeclarativeViewPrivate() { delete root; } void execute(); void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); @@ -150,6 +150,7 @@ public: QBasicTimer resizetimer; QDeclarativeView::ResizeMode resizeMode; + QSize initialSize; QElapsedTimer frameTimer; void init(); @@ -586,9 +587,11 @@ void QDeclarativeView::setRootObject(QObject *obj) } if (d->root) { - QSize initialSize = d->rootObjectSize(); - if (initialSize != size()) { - resize(initialSize); + d->initialSize = d->rootObjectSize(); + if (d->initialSize != size()) { + if (!(parentWidget() && parentWidget()->layout())) { + resize(d->initialSize); + } } d->initResize(); } @@ -638,6 +641,15 @@ QSize QDeclarativeView::sizeHint() const } /*! + Returns the initial size of the root object +*/ +QSize QDeclarativeView::initialSize() const +{ + Q_D(const QDeclarativeView); + return d->initialSize; +} + +/*! Returns the view's root \l {QGraphicsObject} {item}. */ QGraphicsObject *QDeclarativeView::rootObject() const diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h index e9cff32..cdcf134 100644 --- a/src/declarative/util/qdeclarativeview.h +++ b/src/declarative/util/qdeclarativeview.h @@ -90,6 +90,7 @@ public: QList<QDeclarativeError> errors() const; QSize sizeHint() const; + QSize initialSize() const; Q_SIGNALS: void sceneResized(QSize size); // ??? diff --git a/src/gui/embedded/qwsmanager_qws.cpp b/src/gui/embedded/qwsmanager_qws.cpp index 79076c5..b0259b9 100644 --- a/src/gui/embedded/qwsmanager_qws.cpp +++ b/src/gui/embedded/qwsmanager_qws.cpp @@ -394,7 +394,7 @@ void QWSManagerPrivate::dirtyRegion(int decorationRegion, const QRegion &clip) { QTLWExtra *topextra = managed->d_func()->extra->topextra; - QWidgetBackingStore *bs = topextra->backingStore; + QWidgetBackingStore *bs = topextra->backingStore.data(); const bool pendingUpdateRequest = bs->isDirty(); if (decorationRegion == QDecoration::All) { diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 98f235e..d89ffe6 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -272,6 +272,8 @@ bool QImageData::checkForAlphaPixels() const switch (format) { + case QImage::Format_Mono: + case QImage::Format_MonoLSB: case QImage::Format_Indexed8: has_alpha_pixels = has_alpha_clut; break; diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 8ab82c9..a50fd95 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1032,6 +1032,9 @@ void QSymbianControl::SizeChanged() qwidget->d_func()->syncBackingStore(); if (!slowResize && tlwExtra) tlwExtra->inTopLevelResize = false; + } else { + QResizeEvent *e = new QResizeEvent(newSize, oldSize); + QApplication::postEvent(qwidget, e); } } @@ -1800,19 +1803,27 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent return 1; const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged(); QWidget *w = QWidgetPrivate::mapper->value(control); - if (!w->d_func()->maybeTopData()) + QWidget *const window = w->window(); + if (!window->d_func()->maybeTopData()) break; + QRefCountedWidgetBackingStore &backingStore = window->d_func()->maybeTopData()->backingStore; if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) { - delete w->d_func()->topData()->backingStore; - w->d_func()->topData()->backingStore = 0; + // Decrement backing store reference count + backingStore.deref(); // In order to ensure that any resources used by the window surface // are immediately freed, we flush the WSERV command buffer. S60->wsSession().Flush(); - } else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) - && !w->d_func()->maybeBackingStore()) { - w->d_func()->topData()->backingStore = new QWidgetBackingStore(w); - w->d_func()->invalidateBuffer(w->rect()); - w->repaint(); + } else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) { + if (backingStore.data()) { + // Increment backing store reference count + backingStore.ref(); + } else { + // Create backing store with an initial reference count of 1 + backingStore.create(window); + backingStore.ref(); + w->d_func()->invalidateBuffer(w->rect()); + w->repaint(); + } } return 1; } diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index c52fbdf..09535fa 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1550,7 +1550,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa case WM_SETTINGCHANGE: #ifdef Q_WS_WINCE // CE SIP hide/show - if (wParam == SPI_SETSIPINFO) { + if (qt_desktopWidget && wParam == SPI_SETSIPINFO) { QResizeEvent re(QSize(0, 0), QSize(0, 0)); // Calculated by QDesktopWidget QApplication::sendEvent(qt_desktopWidget, &re); break; diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 78fc704..3664743 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -5268,7 +5268,7 @@ bool QETWidget::translateConfigEvent(const XEvent *event) if (isVisible() && data->crect.size() != oldSize) { Q_ASSERT(d->extra->topextra); - QWidgetBackingStore *bs = d->extra->topextra->backingStore; + QWidgetBackingStore *bs = d->extra->topextra->backingStore.data(); const bool hasStaticContents = bs && bs->hasStaticContents(); // If we have a backing store with static contents, we have to disable the top-level // resize optimization in order to get invalidated regions for resized widgets. diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 931bc33..c2f275a 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -439,6 +439,10 @@ static const struct { { Qt::Key_MediaPrevious, QT_TRANSLATE_NOOP("QShortcut", "Media Previous") }, { Qt::Key_MediaNext, QT_TRANSLATE_NOOP("QShortcut", "Media Next") }, { Qt::Key_MediaRecord, QT_TRANSLATE_NOOP("QShortcut", "Media Record") }, + //: Media player pause button + { Qt::Key_MediaPause, QT_TRANSLATE_NOOP("QShortcut", "Media Pause") }, + //: Media player button to toggle between playing and paused + { Qt::Key_MediaTogglePlayPause, QT_TRANSLATE_NOOP("QShortcut", "Toggle Media Play/Pause") }, { Qt::Key_HomePage, QT_TRANSLATE_NOOP("QShortcut", "Home Page") }, { Qt::Key_Favorites, QT_TRANSLATE_NOOP("QShortcut", "Favorites") }, { Qt::Key_Search, QT_TRANSLATE_NOOP("QShortcut", "Search") }, @@ -575,13 +579,25 @@ static const struct { // -------------------------------------------------------------- // Device keys - { Qt::Key_Context1, QT_TRANSLATE_NOOP("QShortcut", "Context1") }, - { Qt::Key_Context2, QT_TRANSLATE_NOOP("QShortcut", "Context2") }, - { Qt::Key_Context3, QT_TRANSLATE_NOOP("QShortcut", "Context3") }, - { Qt::Key_Context4, QT_TRANSLATE_NOOP("QShortcut", "Context4") }, - { Qt::Key_Call, QT_TRANSLATE_NOOP("QShortcut", "Call") }, - { Qt::Key_Hangup, QT_TRANSLATE_NOOP("QShortcut", "Hangup") }, - { Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") }, + { Qt::Key_Context1, QT_TRANSLATE_NOOP("QShortcut", "Context1") }, + { Qt::Key_Context2, QT_TRANSLATE_NOOP("QShortcut", "Context2") }, + { Qt::Key_Context3, QT_TRANSLATE_NOOP("QShortcut", "Context3") }, + { Qt::Key_Context4, QT_TRANSLATE_NOOP("QShortcut", "Context4") }, + //: Button to start a call (note: a separate button is used to end the call) + { Qt::Key_Call, QT_TRANSLATE_NOOP("QShortcut", "Call") }, + //: Button to end a call (note: a separate button is used to start the call) + { Qt::Key_Hangup, QT_TRANSLATE_NOOP("QShortcut", "Hangup") }, + //: Button that will hang up if we're in call, or make a call if we're not. + { Qt::Key_ToggleCallHangup, QT_TRANSLATE_NOOP("QShortcut", "Toggle Call/Hangup") }, + { Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") }, + //: Button to trigger voice dialling + { Qt::Key_VoiceDial, QT_TRANSLATE_NOOP("QShortcut", "Voice Dial") }, + //: Button to redial the last number called + { Qt::Key_LastNumberRedial, QT_TRANSLATE_NOOP("QShortcut", "Last Number Redial") }, + //: Button to trigger the camera shutter (take a picture) + { Qt::Key_Camera, QT_TRANSLATE_NOOP("QShortcut", "Camera Shutter") }, + //: Button to focus the camera + { Qt::Key_CameraFocus, QT_TRANSLATE_NOOP("QShortcut", "Camera Focus") }, // -------------------------------------------------------------- // Japanese keyboard support diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 2fc76ed..895c85d 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -161,6 +161,51 @@ static inline bool hasBackingStoreSupport() extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp + +QRefCountedWidgetBackingStore::QRefCountedWidgetBackingStore() + : m_ptr(0) + , m_count(0) +{ + +} + +QRefCountedWidgetBackingStore::~QRefCountedWidgetBackingStore() +{ + delete m_ptr; +} + +void QRefCountedWidgetBackingStore::create(QWidget *widget) +{ + destroy(); + m_ptr = new QWidgetBackingStore(widget); + m_count = 0; +} + +void QRefCountedWidgetBackingStore::destroy() +{ + delete m_ptr; + m_ptr = 0; + m_count = 0; +} + +void QRefCountedWidgetBackingStore::ref() +{ + Q_ASSERT(m_ptr); + ++m_count; +} + +void QRefCountedWidgetBackingStore::deref() +{ + if (m_count) { + Q_ASSERT(m_ptr); + if (0 == --m_count) { + delete m_ptr; + m_ptr = 0; + } + } +} + + QWidgetPrivate::QWidgetPrivate(int version) : QObjectPrivate(version) , extra(0) @@ -1350,11 +1395,9 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) // a real toplevel window needs a backing store if (isWindow() && windowType() != Qt::Desktop) { - delete d->topData()->backingStore; - // QWidgetBackingStore will check this variable, hence it must be 0 - d->topData()->backingStore = 0; + d->topData()->backingStore.destroy(); if (hasBackingStoreSupport()) - d->topData()->backingStore = new QWidgetBackingStore(this); + d->topData()->backingStore.create(this); } d->setModal_sys(); @@ -1482,8 +1525,7 @@ QWidget::~QWidget() // the backing store will delete its window surface, which may or may // not have a reference to this widget that will be used later to // notify the window it no longer has a surface. - delete d->extra->topextra->backingStore; - d->extra->topextra->backingStore = 0; + d->extra->topextra->backingStore.destroy(); } #endif if (QWidgetBackingStore *bs = d->maybeBackingStore()) { @@ -1580,7 +1622,6 @@ void QWidgetPrivate::createTLExtra() QTLWExtra* x = extra->topextra = new QTLWExtra; x->icon = 0; x->iconPixmap = 0; - x->backingStore = 0; x->windowSurface = 0; x->sharedPainter = 0; x->incw = x->inch = 0; @@ -1664,7 +1705,7 @@ void QWidgetPrivate::deleteExtra() #endif if (extra->topextra) { deleteTLSysExtra(); - delete extra->topextra->backingStore; + extra->topextra->backingStore.destroy(); delete extra->topextra->icon; delete extra->topextra->iconPixmap; #if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER) diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index f23a94c..49a2dc8 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -110,13 +110,53 @@ class QWidgetItemV2; class QStyle; +class Q_AUTOTEST_EXPORT QRefCountedWidgetBackingStore +{ +public: + QRefCountedWidgetBackingStore(); + ~QRefCountedWidgetBackingStore(); + + void create(QWidget *tlw); + void destroy(); + + void ref(); + void deref(); + + inline QWidgetBackingStore* data() + { + return m_ptr; + } + + inline QWidgetBackingStore* operator->() + { + return m_ptr; + } + + inline QWidgetBackingStore& operator*() + { + return *m_ptr; + } + + inline operator bool() const + { + return (0 != m_ptr); + } + +private: + Q_DISABLE_COPY(QRefCountedWidgetBackingStore) + +private: + QWidgetBackingStore* m_ptr; + int m_count; +}; + struct QTLWExtra { // *************************** Cross-platform variables ***************************** // Regular pointers (keep them together to avoid gaps on 64 bits architectures). QIcon *icon; // widget icon QPixmap *iconPixmap; - QWidgetBackingStore *backingStore; + QRefCountedWidgetBackingStore backingStore; QWindowSurface *windowSurface; QPainter *sharedPainter; @@ -932,7 +972,7 @@ inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const { Q_Q(const QWidget); QTLWExtra *x = q->window()->d_func()->maybeTopData(); - return x ? x->backingStore : 0; + return x ? x->backingStore.data() : 0; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 02e7cb8..86b858d 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -433,6 +433,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de // Request mouse move events. drawableWindow->PointerFilter(EPointerFilterEnterExit | EPointerFilterMove | EPointerFilterDrag, 0); + drawableWindow->EnableVisibilityChangeEvents(); if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) { activateSymbianWindow(control.data()); @@ -487,11 +488,8 @@ void QWidgetPrivate::show_sys() && !S60->buttonGroupContainer() && !S60->statusPane()) { bool isFullscreen = q->windowState() & Qt::WindowFullScreen; - bool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint; - // If the window is fullscreen and has not explicitly requested that the CBA be visible - // we delay the creation even more. - if ((!isFullscreen || cbaRequested) && !q->testAttribute(Qt::WA_DontShowOnScreen)) { + if (!q->testAttribute(Qt::WA_DontShowOnScreen)) { // Create the status pane and CBA here CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi()); @@ -911,14 +909,12 @@ void QWidgetPrivate::registerDropSite(bool /* on */) void QWidgetPrivate::createTLSysExtra() { - extra->topextra->backingStore = 0; extra->topextra->inExpose = 0; } void QWidgetPrivate::deleteTLSysExtra() { - delete extra->topextra->backingStore; - extra->topextra->backingStore = 0; + extra->topextra->backingStore.destroy(); } void QWidgetPrivate::createSysExtra() diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index f9cd59b..83751ed 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -909,7 +909,7 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) QWidgetPrivate *pd = pw->d_func(); QRect clipR(pd->clipRect()); #ifdef Q_WS_QWS - QWidgetBackingStore *wbs = x->backingStore; + QWidgetBackingStore *wbs = x->backingStore.data(); QWSWindowSurface *surface = static_cast<QWSWindowSurface*>(wbs->windowSurface); clipR = clipR.intersected(surface->clipRegion().translated(-toplevelOffset).boundingRect()); #endif @@ -939,7 +939,7 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) invalidateBuffer((newRect & clipR).translated(-data.crect.topLeft())); } else { - QWidgetBackingStore *wbs = x->backingStore; + QWidgetBackingStore *wbs = x->backingStore.data(); QRegion childExpose(newRect & clipR); if (sourceRect.isValid() && wbs->bltRect(sourceRect, dx, dy, pw)) @@ -982,7 +982,7 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy) if (x->inTopLevelResize) return; - QWidgetBackingStore *wbs = x->backingStore; + QWidgetBackingStore *wbs = x->backingStore.data(); if (!wbs) return; diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 515b6c7..43fa4b9 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3190,7 +3190,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC subRule2.drawRule(p, r); } - handleSubRule.drawRule(p, grooveSubRule.boxRect(hr, Margin)); + handleSubRule.drawRule(p, handleSubRule.boxRect(hr, Margin)); } if (slider->subControls & SC_SliderTickmarks) { diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 52a2c3c..925b3bf 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -50,9 +50,9 @@ #include <e32std.h> #include <eikenv.h> #include <gdi.h> -#ifdef Q_SYMBIAN_HAS_FONTTABLE_API +#if defined(Q_SYMBIAN_HAS_FONTTABLE_API) || defined(Q_SYMBIAN_HAS_GLYPHOUTLINE_API) #include <graphics/gdi/gdiplatapi.h> -#endif // Q_SYMBIAN_HAS_FONTTABLE_API +#endif // Q_SYMBIAN_HAS_FONTTABLE_API || Q_SYMBIAN_HAS_GLYPHOUTLINE_API QT_BEGIN_NAMESPACE @@ -279,6 +279,35 @@ void QFontEngineS60::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla } } +#ifdef Q_SYMBIAN_HAS_GLYPHOUTLINE_API +static bool parseGlyphPathData(const char *dataStr, const char *dataEnd, QPainterPath &path, + qreal fontPixelSize, const QPointF &offset, bool hinted); +#endif //Q_SYMBIAN_HAS_GLYPHOUTLINE_API + +void QFontEngineS60::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, + int nglyphs, QPainterPath *path, + QTextItem::RenderFlags flags) +{ +#ifdef Q_SYMBIAN_HAS_GLYPHOUTLINE_API + Q_UNUSED(flags) + RGlyphOutlineIterator iterator; + const TInt error = iterator.Open(*m_activeFont, glyphs, nglyphs); + if (KErrNone != error) + return; + const qreal fontSizeInPixels = qreal(m_activeFont->HeightInPixels()); + int count = 0; + do { + const TUint8* outlineUint8 = iterator.Outline(); + const char* const outlineChar = reinterpret_cast<const char*>(outlineUint8); + const char* const outlineEnd = outlineChar + iterator.OutlineLength(); + parseGlyphPathData(outlineChar, outlineEnd, *path, fontSizeInPixels, + positions[count++].toPointF(), false); + } while(KErrNone == iterator.Next() && count <= nglyphs); +#else // Q_SYMBIAN_HAS_GLYPHOUTLINE_API + QFontEngine::addGlyphsToPath(glyphs, positions, nglyphs, path, flags); +#endif //Q_SYMBIAN_HAS_GLYPHOUTLINE_API +} + QImage QFontEngineS60::alphaMapForGlyph(glyph_t glyph) { TOpenFontCharMetrics metrics; @@ -410,4 +439,69 @@ void QFontEngineS60::getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metri } } +#ifdef Q_SYMBIAN_HAS_GLYPHOUTLINE_API +static inline void skipSpacesAndComma(const char* &str, const char* const strEnd) +{ + while (str <= strEnd && (*str == ' ' || *str == ',')) + ++str; +} + +static bool parseGlyphPathData(const char *svgPath, const char *svgPathEnd, QPainterPath &path, + qreal fontPixelSize, const QPointF &offset, bool hinted) +{ + Q_UNUSED(hinted) + QPointF p1, p2, firstSubPathPoint; + qreal *elementValues[] = + {&p1.rx(), &p1.ry(), &p2.rx(), &p2.ry()}; + const int unitsPerEm = 2048; // See: http://en.wikipedia.org/wiki/Em_%28typography%29 + const qreal resizeFactor = fontPixelSize / unitsPerEm; + + while (svgPath < svgPathEnd) { + skipSpacesAndComma(svgPath, svgPathEnd); + const char pathElem = *svgPath++; + skipSpacesAndComma(svgPath, svgPathEnd); + + if (pathElem != 'Z') { + char *endStr = 0; + int elementValuesCount = 0; + for (int i = 0; i < 4; ++i) { // 4 = size of elementValues[] + qreal coordinateValue = strtod(svgPath, &endStr); + if (svgPath == endStr) + break; + if (i % 2) // Flip vertically + coordinateValue = -coordinateValue; + *elementValues[i] = coordinateValue * resizeFactor; + elementValuesCount++; + svgPath = endStr; + skipSpacesAndComma(svgPath, svgPathEnd); + } + p1 += offset; + if (elementValuesCount == 2) + p2 = firstSubPathPoint; + else + p2 += offset; + } + + switch (pathElem) { + case 'M': + firstSubPathPoint = p1; + path.moveTo(p1); + break; + case 'Z': + path.closeSubpath(); + break; + case 'L': + path.lineTo(p1); + break; + case 'Q': + path.quadTo(p1, p2); + break; + default: + return false; + } + } + return true; +} +#endif // Q_SYMBIAN_HAS_GLYPHOUTLINE_API + QT_END_NAMESPACE diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index dea32c4..beeb4cc 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -62,6 +62,10 @@ #define Q_SYMBIAN_HAS_FONTTABLE_API #endif +#ifdef Q_SYMBIAN_HAS_FONTTABLE_API +#define Q_SYMBIAN_HAS_GLYPHOUTLINE_API +#endif // Q_SYMBIAN_HAS_FONTTABLE_API + class CFont; QT_BEGIN_NAMESPACE @@ -97,6 +101,9 @@ public: bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const; + void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, + QPainterPath *path, QTextItem::RenderFlags flags); + QImage alphaMapForGlyph(glyph_t glyph); glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index d6ac3aa..3db66ce 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -2437,6 +2437,9 @@ void QTextCursor::beginEditBlock() if (!d || !d->priv) return; + if (d->priv->editBlock == 0) // we are the initial edit block, store current cursor position for undo + d->priv->editBlockCursorPosition = d->position; + d->priv->beginEditBlock(); } diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index e2bca04..f3cd481 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -192,6 +192,7 @@ QTextDocumentPrivate::QTextDocumentPrivate() initialBlockCharFormatIndex(-1) // set correctly later in init() { editBlock = 0; + editBlockCursorPosition = -1; docChangeFrom = -1; undoState = 0; @@ -967,6 +968,10 @@ int QTextDocumentPrivate::undoRedo(bool undo) editPos = -1; break; } + case QTextUndoCommand::CursorMoved: + editPos = c.pos; + editLength = 0; + break; case QTextUndoCommand::Custom: resetBlockRevision = -1; // ## TODO if (undo) @@ -1046,6 +1051,18 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c) if (undoState < undoStack.size()) clearUndoRedoStacks(QTextDocument::RedoStack); + if (editBlock != 0 && editBlockCursorPosition >= 0) { // we had a beginEditBlock() with a cursor position + if (c.pos != (quint32) editBlockCursorPosition) { // and that cursor position is different from the command + // generate a CursorMoved undo item + QT_INIT_TEXTUNDOCOMMAND(cc, QTextUndoCommand::CursorMoved, true, QTextUndoCommand::MoveCursor, + 0, 0, editBlockCursorPosition, 0, 0); + undoStack.append(cc); + undoState++; + editBlockCursorPosition = -1; + } + } + + if (!undoStack.isEmpty() && modified) { QTextUndoCommand &last = undoStack[undoState - 1]; @@ -1167,6 +1184,8 @@ void QTextDocumentPrivate::endEditBlock() } } + editBlockCursorPosition = -1; + finishEdit(); } diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index ac5ed3c..d1bd698 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -132,6 +132,7 @@ public: BlockAdded = 6, BlockDeleted = 7, GroupFormatChange = 8, + CursorMoved = 9, Custom = 256 }; enum Operation { @@ -315,6 +316,7 @@ private: bool modified; int editBlock; + int editBlockCursorPosition; int docChangeFrom; int docChangeOldLength; int docChangeLength; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 3f67408..f5e252c 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -89,9 +89,9 @@ static QFixed alignLine(QTextEngine *eng, const QScriptLine &line) if (align & Qt::AlignJustify && eng->option.textDirection() == Qt::RightToLeft) align = Qt::AlignRight; if (align & Qt::AlignRight) - x = line.width - (line.textWidth + leadingSpaceWidth(eng, line)); + x = line.width - (line.textAdvance + leadingSpaceWidth(eng, line)); else if (align & Qt::AlignHCenter) - x = (line.width - line.textWidth)/2; + x = (line.width - line.textAdvance)/2; } return x; } diff --git a/src/imports/qimportbase.pri b/src/imports/qimportbase.pri index 91f6552..02364af 100644 --- a/src/imports/qimportbase.pri +++ b/src/imports/qimportbase.pri @@ -17,6 +17,8 @@ copy2build.output = $$QT_BUILD_TREE/imports/$$TARGETPATH/qmldir copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} copy2build.name = COPY ${QMAKE_FILE_IN} copy2build.CONFIG += no_link +# `clean' should leave the build in a runnable state, which means it shouldn't delete qmldir +copy2build.CONFIG += no_clean QMAKE_EXTRA_COMPILERS += copy2build TARGET = $$qtLibraryTarget($$TARGET) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 410cf21..5371c5e 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -276,6 +276,11 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) } } +int QGLTextureGlyphCache::glyphMargin() const +{ + return 1; +} + int QGLTextureGlyphCache::glyphPadding() const { return 1; diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h index 6bcd655..84e9021 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h @@ -72,6 +72,7 @@ public: virtual void createTextureData(int width, int height); virtual void resizeTextureData(int width, int height); virtual void fillTexture(const Coord &c, glyph_t glyph); + virtual int glyphMargin() const; virtual int glyphPadding() const; inline GLuint texture() const { return m_texture; } diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index d203646..9491f14 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1773,6 +1773,9 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons glXBindTexImageEXT(x11Info.display(), (GLXPixmap)pixmapData->gl_surface, GLX_FRONT_LEFT_EXT, 0); glBindTexture(GL_TEXTURE_2D, textureId); + GLuint filtering = (options & QGLContext::LinearFilteringBindOption) ? GL_LINEAR : GL_NEAREST; + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering); if (!((hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted))) options &= ~QGLContext::InvertedYBindOption; diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 76a605a..4b22d5e 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1622,11 +1622,48 @@ void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) QRectF rect(points[0], points[1], points[2] - points[0], points[5] - points[1]); clip(rect.toRect(), op); - } else { - // The best we can do is clip to the bounding rectangle - // of all control points. - clip(path.controlPointRect().toRect(), op); + return; + } + + // Try converting the path into a QRegion that tightly follows + // the outline of the path we want to clip with. + QRegion region(path.convertToPainterPath().toFillPolygon(QTransform()).toPolygon()); + switch (op) { + case Qt::NoClip: + { + region = defaultClipRegion(); + } + break; + + case Qt::ReplaceClip: + { + region = d->transform.map(region); + } + break; + + case Qt::IntersectClip: + { + region = s->clipRegion.intersect(d->transform.map(region)); + } + break; + + case Qt::UniteClip: + { + region = s->clipRegion.unite(d->transform.map(region)); + } + break; } + if (region.numRects() <= d->maxScissorRects) { + // We haven't reached the maximum scissor count yet, so we can + // still make use of this region. + s->clipRegion = region; + updateScissor(); + return; + } + + // The best we can do is clip to the bounding rectangle + // of all control points. + clip(path.controlPointRect().toRect(), op); } void QVGPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) diff --git a/src/qbase.pri b/src/qbase.pri index 4a75565..83ae069 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -1,4 +1,4 @@ -isEmpty(TARGET):error(You must set TARGET before include()'ing $${_FILE_}) +isEmpty(TARGET):error("You must set TARGET before include()'ing $${_FILE_}") INCLUDEPATH *= $$QMAKE_INCDIR_QT/$$TARGET #just for today to have some compat !isEmpty(RCC_DIR): INCLUDEPATH += $$RCC_DIR isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700 diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 532269d..d3d9eed 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -151,9 +151,9 @@ symbian: { contains(QT_CONFIG, declarative): { qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtDeclarative$${QT_LIBINFIX}.dll - folderlistmodelImport.sources = $$QMAKE_LIBDIR_QT/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll - gesturesImport.sources = $$QMAKE_LIBDIR_QT/qmlgesturesplugin$${QT_LIBINFIX}.dll - particlesImport.sources = $$QMAKE_LIBDIR_QT/qmlparticlesplugin$${QT_LIBINFIX}.dll + folderlistmodelImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/folderlistmodel/qmlfolderlistmodelplugin$${QT_LIBINFIX}.dll + gesturesImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/gestures/qmlgesturesplugin$${QT_LIBINFIX}.dll + particlesImport.sources = $$QT_BUILD_TREE/imports/Qt/labs/particles/qmlparticlesplugin$${QT_LIBINFIX}.dll folderlistmodelImport.sources += $$QT_SOURCE_TREE/src/imports/folderlistmodel/qmldir gesturesImport.sources += $$QT_SOURCE_TREE/src/imports/gestures/qmldir @@ -166,11 +166,11 @@ symbian: { DEPLOYMENT += folderlistmodelImport gesturesImport particlesImport contains(QT_CONFIG, webkit): { - webkitImport.sources = $$QMAKE_LIBDIR_QT/qmlwebkitplugin$${QT_LIBINFIX}.dll + webkitImport.sources = $$QT_BUILD_TREE/imports/org/webkit/qmlwebkitplugin$${QT_LIBINFIX}.dll webkitImport.sources += $$QT_SOURCE_TREE/src/imports/webkit/qmldir webkitImport.path = $$QT_IMPORTS_BASE_DIR/org/webkit DEPLOYMENT += webkitImport - } + } } graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index 237d020..81334f2 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -51,7 +51,9 @@ #define SRCDIR "." #endif +QT_BEGIN_NAMESPACE extern int qt_defaultDpi(); +QT_END_NAMESPACE class tst_qdeclarativevaluetypes : public QObject { diff --git a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp index cc48bd0..6450e38 100644 --- a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp +++ b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp @@ -80,6 +80,7 @@ void tst_QDeclarativeView::resizemodedeclarativeitem() QVERIFY(canvas); QSignalSpy sceneResizedSpy(canvas, SIGNAL(sceneResized(QSize))); canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); + QCOMPARE(QSize(0,0), canvas->initialSize()); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodedeclarativeitem.qml")); QDeclarativeItem* declarativeItem = qobject_cast<QDeclarativeItem*>(canvas->rootObject()); QVERIFY(declarativeItem); @@ -90,6 +91,7 @@ void tst_QDeclarativeView::resizemodedeclarativeitem() QCOMPARE(declarativeItem->height(), 200.0); QCOMPARE(canvas->size(), QSize(200, 200)); QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(canvas->size(), canvas->initialSize()); QCOMPARE(sceneResizedSpy.count(), 1); // size update from view @@ -135,6 +137,7 @@ void tst_QDeclarativeView::resizemodedeclarativeitem() QCOMPARE(declarativeItem->width(), 200.0); QCOMPARE(declarativeItem->height(), 200.0); QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(canvas->size(), canvas->initialSize()); QCOMPARE(sceneResizedSpy2.count(), 1); // size update from root object @@ -184,6 +187,7 @@ void tst_QDeclarativeView::resizemodegraphicswidget() QCOMPARE(canvas->size(), QSize(200, 200)); QCOMPARE(canvas->size(), QSize(200, 200)); QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(canvas->size(), canvas->initialSize()); QCOMPARE(sceneResizedSpy.count(), 1); // size update from view @@ -223,6 +227,7 @@ void tst_QDeclarativeView::resizemodegraphicswidget() QCOMPARE(graphicsWidget->size(), QSizeF(200.0, 200.0)); QCOMPARE(canvas->size(), QSize(200, 200)); QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(canvas->size(), canvas->initialSize()); QCOMPARE(sceneResizedSpy2.count(), 1); // size update from root object diff --git a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp index 49273ea..91b7cf8 100644 --- a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp +++ b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp @@ -59,6 +59,11 @@ public: private slots: void orientation(); + void loading(); + void fileBrowser(); + void resizing(); + void paths(); + void slowMode(); private: QDeclarativeEngine engine; @@ -108,6 +113,188 @@ void tst_QDeclarativeViewer::orientation() QCOMPARE(viewer->size(), viewer->sizeHint()); } +void tst_QDeclarativeViewer::loading() +{ + QDeclarativeViewer *viewer = new QDeclarativeViewer(); + QVERIFY(viewer); + viewer->setSizeToView(true); + viewer->open(SRCDIR "/data/orientation.qml"); + QVERIFY(viewer->view()); + QVERIFY(viewer->menuBar()); + QDeclarativeItem* rootItem = qobject_cast<QDeclarativeItem*>(viewer->view()->rootObject()); + QVERIFY(rootItem); + viewer->show(); + + // initial size + QCOMPARE(rootItem->width(), 200.0); + QCOMPARE(rootItem->height(), 300.0); + QCOMPARE(viewer->view()->size(), QSize(200, 300)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(200, 300)); + QCOMPARE(viewer->size(), QSize(200, 300+viewer->menuBar()->height())); + QCOMPARE(viewer->size(), viewer->sizeHint()); + + viewer->resize(QSize(400, 500)); + qApp->processEvents(); + + // window resized + QCOMPARE(rootItem->width(), 400.0); + QCOMPARE(rootItem->height(), 500.0-viewer->menuBar()->height()); + QCOMPARE(viewer->view()->size(), QSize(400, 500-viewer->menuBar()->height())); + QCOMPARE(viewer->view()->initialSize(), QSize(200, 300)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(400, 500-viewer->menuBar()->height())); + QCOMPARE(viewer->size(), QSize(400, 500)); + QCOMPARE(viewer->size(), viewer->sizeHint()); + + viewer->reload(); + rootItem = qobject_cast<QDeclarativeItem*>(viewer->view()->rootObject()); + QVERIFY(rootItem); + + // reload cause the window to return back to initial size + QCOMPARE(rootItem->width(), 200.0); + QCOMPARE(rootItem->height(), 300.0); + QCOMPARE(viewer->view()->size(), QSize(200, 300)); + QCOMPARE(viewer->view()->initialSize(), QSize(200, 300)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(200, 300)); + QCOMPARE(viewer->size(), QSize(200, 300+viewer->menuBar()->height())); + QCOMPARE(viewer->size(), viewer->sizeHint()); + + viewer->resize(QSize(400, 500)); + qApp->processEvents(); + + // window resized again + QCOMPARE(rootItem->width(), 400.0); + QCOMPARE(rootItem->height(), 500.0-viewer->menuBar()->height()); + QCOMPARE(viewer->view()->size(), QSize(400, 500-viewer->menuBar()->height())); + QCOMPARE(viewer->view()->initialSize(), QSize(200, 300)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(400, 500-viewer->menuBar()->height())); + QCOMPARE(viewer->size(), QSize(400, 500)); + QCOMPARE(viewer->size(), viewer->sizeHint()); + + viewer->open(SRCDIR "/data/orientation.qml"); + rootItem = qobject_cast<QDeclarativeItem*>(viewer->view()->rootObject()); + QVERIFY(rootItem); + + // open also causes the window to return back to initial size + QCOMPARE(rootItem->width(), 200.0); + QCOMPARE(rootItem->height(), 300.0); + QCOMPARE(viewer->view()->size(), QSize(200, 300)); + QCOMPARE(viewer->view()->initialSize(), QSize(200, 300)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(200, 300)); + QCOMPARE(viewer->size(), QSize(200, 300+viewer->menuBar()->height())); + QCOMPARE(viewer->size(), viewer->sizeHint()); +} + +void tst_QDeclarativeViewer::fileBrowser() +{ + QDeclarativeViewer *viewer = new QDeclarativeViewer(); + QVERIFY(viewer); + viewer->setUseNativeFileBrowser(false); + viewer->openFile(); + viewer->show(); + + // Browser.qml successfully loaded + QDeclarativeItem* browserItem = qobject_cast<QDeclarativeItem*>(viewer->view()->rootObject()); + QVERIFY(viewer->view()); + QVERIFY(viewer->menuBar()); + QVERIFY(browserItem); + + // load something + viewer->open(SRCDIR "/data/orientation.qml"); + QVERIFY(viewer->view()); + QVERIFY(viewer->menuBar()); + QDeclarativeItem* rootItem = qobject_cast<QDeclarativeItem*>(viewer->view()->rootObject()); + QVERIFY(rootItem); + QVERIFY(browserItem != rootItem); + + // go back to Browser.qml + viewer->openFile(); + browserItem = qobject_cast<QDeclarativeItem*>(viewer->view()->rootObject()); + QVERIFY(viewer->view()); + QVERIFY(viewer->menuBar()); + QVERIFY(browserItem); +} + +void tst_QDeclarativeViewer::resizing() +{ + QDeclarativeViewer *viewer = new QDeclarativeViewer(); + QVERIFY(viewer); + viewer->open(SRCDIR "/data/orientation.qml"); + QVERIFY(viewer->view()); + QVERIFY(viewer->menuBar()); + QDeclarativeItem* rootItem = qobject_cast<QDeclarativeItem*>(viewer->view()->rootObject()); + QVERIFY(rootItem); + viewer->show(); + + // initial size + QCOMPARE(rootItem->width(), 200.0); + QCOMPARE(rootItem->height(), 300.0); + QCOMPARE(viewer->view()->size(), QSize(200, 300)); + QCOMPARE(viewer->view()->initialSize(), QSize(200, 300)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(200, 300)); + QCOMPARE(viewer->size(), QSize(200, 300+viewer->menuBar()->height())); + QCOMPARE(viewer->size(), viewer->sizeHint()); + + viewer->setSizeToView(false); + + // size view to root object + rootItem->setWidth(100); + rootItem->setHeight(200); + qApp->processEvents(); + + QCOMPARE(rootItem->width(), 100.0); + QCOMPARE(rootItem->height(), 200.0); + QCOMPARE(viewer->view()->size(), QSize(100, 200)); + QCOMPARE(viewer->view()->initialSize(), QSize(200, 300)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(100, 200)); + QCOMPARE(viewer->size(), QSize(100, 200+viewer->menuBar()->height())); + QCOMPARE(viewer->size(), viewer->sizeHint()); + + // do not size root object to view + viewer->resize(QSize(150,250)); + QCOMPARE(rootItem->width(), 100.0); + QCOMPARE(rootItem->height(), 200.0); + + viewer->setSizeToView(true); + + // size root object to view + viewer->resize(QSize(250,350)); + qApp->processEvents(); + + QCOMPARE(rootItem->width(), 250.0); + QCOMPARE(rootItem->height(), 350.0-viewer->menuBar()->height()); + QCOMPARE(viewer->view()->size(), QSize(250, 350-viewer->menuBar()->height())); + QCOMPARE(viewer->view()->initialSize(), QSize(200, 300)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(250, 350-viewer->menuBar()->height())); + QCOMPARE(viewer->size(), QSize(250, 350)); + QCOMPARE(viewer->size(), viewer->sizeHint()); + + // do not size view to root object + rootItem->setWidth(100); + rootItem->setHeight(200); + QCOMPARE(viewer->size(), QSize(250, 350)); +} + +void tst_QDeclarativeViewer::paths() +{ + QDeclarativeViewer *viewer = new QDeclarativeViewer(); + QVERIFY(viewer); + + viewer->addLibraryPath("miscImportPath"); + viewer->view()->engine()->importPathList().contains("miscImportPath"); + + viewer->addPluginPath("miscPluginPath"); + viewer->view()->engine()->pluginPathList().contains("miscPluginPath"); +} + +void tst_QDeclarativeViewer::slowMode() +{ + QDeclarativeViewer *viewer = new QDeclarativeViewer(); + QVERIFY(viewer); + + viewer->setSlowMode(true); + viewer->setSlowMode(false); +} + QTEST_MAIN(tst_QDeclarativeViewer) #include "tst_qdeclarativeviewer.moc" diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h new file mode 100644 index 0000000..7059132 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/a.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#define XX QT_TRANSLATE_NOOP("aaa", "some text") diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h new file mode 100644 index 0000000..ce3e1a2 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/b.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "a.h" + +#define YY QT_TRANSLATE_NOOP("bbb", "some text") diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/lupdatecmd new file mode 100644 index 0000000..edd91f7 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/lupdatecmd @@ -0,0 +1 @@ +lupdate b.h a.h -ts project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/cmdline_order/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/project.ts.result new file mode 100644 index 0000000..6028cbb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/cmdline_order/project.ts.result @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name>aaa</name> + <message> + <location filename="a.h" line="42"/> + <source>some text</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>bbb</name> + <message> + <location filename="b.h" line="44"/> + <source>some text</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tests/auto/maketestselftest/tst_maketestselftest.cpp b/tests/auto/maketestselftest/tst_maketestselftest.cpp index 3d1bbed..a9077e3 100644 --- a/tests/auto/maketestselftest/tst_maketestselftest.cpp +++ b/tests/auto/maketestselftest/tst_maketestselftest.cpp @@ -457,10 +457,13 @@ void tst_MakeTestSelfTest::make_check() QString testsDir(SRCDIR "/.."); QString checktest(SRCDIR "/checktest/checktest"); -#ifdef Q_OS_WIN32 +#if defined(Q_OS_WIN32) || defined(Q_OS_MAC) if (qgetenv("RUN_SLOW_TESTS").isEmpty()) { - QSKIP("This test is too slow to run by default on Windows. Set RUN_SLOW_TESTS=1 to run it.", SkipAll); + QSKIP("This test is too slow to run by default on this OS. Set RUN_SLOW_TESTS=1 to run it.", SkipAll); } +#endif + +#ifdef Q_OS_WIN32 checktest.replace("/", "\\"); checktest += ".exe"; #endif diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp index 2567a41..a22d624 100644 --- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp @@ -74,7 +74,6 @@ private slots: void bypassShaping(); void elidedMultiLength(); void elidedMultiLengthF(); - void bearingIncludedInBoundingRect(); }; tst_QFontMetrics::tst_QFontMetrics() @@ -267,16 +266,5 @@ void tst_QFontMetrics::elidedMultiLengthF() elidedMultiLength_helper<QFontMetricsF>(); } -void tst_QFontMetrics::bearingIncludedInBoundingRect() -{ - QFont font; - font.setItalic(true); - QRect brectItalic = QFontMetrics(font).boundingRect("ITALIC"); - font.setItalic(false); - QRect brectNormal = QFontMetrics(font).boundingRect("ITALIC"); - - QVERIFY(brectItalic.width() >= brectNormal.width()); -} - QTEST_MAIN(tst_QFontMetrics) #include "tst_qfontmetrics.moc" diff --git a/tests/auto/qhash/tst_qhash.cpp b/tests/auto/qhash/tst_qhash.cpp index 59576d9..3a7b54a 100644 --- a/tests/auto/qhash/tst_qhash.cpp +++ b/tests/auto/qhash/tst_qhash.cpp @@ -1154,6 +1154,26 @@ void tst_QHash::qmultihash_specific() QVERIFY(i.key() == 9); QVERIFY(i.value() == 98); } + + { + QMultiHash<int, int> map1; + map1.insert(42, 1); + map1.insert(10, 2); + map1.insert(48, 3); + QMultiHash<int, int> map2; + map2.insert(8, 4); + map2.insert(42, 5); + map2.insert(95, 12); + + map1+=map2; + map2.insert(42, 1); + map2.insert(10, 2); + map2.insert(48, 3); + QCOMPARE(map1.count(), map2.count()); + QVERIFY(map1.remove(42,5)); + QVERIFY(map2.remove(42,5)); + QVERIFY(map1 == map2); + } } template <typename T> diff --git a/tests/auto/qmap/tst_qmap.cpp b/tests/auto/qmap/tst_qmap.cpp index d3ed76d..a1b8de7 100644 --- a/tests/auto/qmap/tst_qmap.cpp +++ b/tests/auto/qmap/tst_qmap.cpp @@ -837,6 +837,26 @@ void tst_QMap::qmultimap_specific() QVERIFY(i.key() == 9); QVERIFY(i.value() == 98); } + + { + QMultiMap<int, int> map1; + map1.insert(42, 1); + map1.insert(10, 2); + map1.insert(48, 3); + QMultiMap<int, int> map2; + map2.insert(8, 4); + map2.insert(42, 5); + map2.insert(95, 12); + + map1+=map2; + map2.insert(42, 1); + map2.insert(10, 2); + map2.insert(48, 3); + QCOMPARE(map1.count(), map2.count()); + QVERIFY(map1.remove(42,5)); + QVERIFY(map2.remove(42,5)); + QVERIFY(map1 == map2); + } } QTEST_APPLESS_MAIN(tst_QMap) diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp index 99babac..41835bb 100644 --- a/tests/auto/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp @@ -151,6 +151,7 @@ private slots: void cursorPositionWithBlockUndoAndRedo(); void cursorPositionWithBlockUndoAndRedo2(); + void cursorPositionWithBlockUndoAndRedo3(); private: int blockCount(); @@ -1756,9 +1757,9 @@ void tst_QTextCursor::adjustCursorsOnInsert() void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo() { cursor.insertText("AAAABBBBCCCCDDDD"); - cursor.beginEditBlock(); cursor.setPosition(12); int cursorPositionBefore = cursor.position(); + cursor.beginEditBlock(); cursor.insertText("*"); cursor.setPosition(8); cursor.insertText("*"); @@ -1814,5 +1815,20 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo2() QCOMPARE(cursor.position(), cursorPositionBefore); } +void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo3() +{ + // verify that it's the position of the beginEditBlock that counts, and not the last edit position + cursor.insertText("AAAABBBB"); + int cursorPositionBefore = cursor.position(); + cursor.beginEditBlock(); + cursor.setPosition(4); + QVERIFY(cursor.position() != cursorPositionBefore); + cursor.insertText("*"); + cursor.endEditBlock(); + QCOMPARE(cursor.position(), 5); + doc->undo(&cursor); + QCOMPARE(cursor.position(), cursorPositionBefore); +} + QTEST_MAIN(tst_QTextCursor) #include "tst_qtextcursor.moc" diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 5d47aed..a1fc607 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -385,6 +385,7 @@ private slots: void setGraphicsEffect(); void destroyBackingStore(); + void destroyBackingStoreWhenHidden(); void activateWindow(); @@ -9499,9 +9500,7 @@ void tst_QWidget::destroyBackingStore() QTRY_VERIFY(w.numPaintEvents > 0); w.reset(); w.update(); - delete qt_widget_private(&w)->topData()->backingStore; - qt_widget_private(&w)->topData()->backingStore = 0; - qt_widget_private(&w)->topData()->backingStore = new QWidgetBackingStore(&w); + qt_widget_private(&w)->topData()->backingStore.create(&w); w.update(); QApplication::processEvents(); @@ -9519,6 +9518,252 @@ void tst_QWidget::destroyBackingStore() #endif } +// Helper function +QWidgetBackingStore* backingStore(QWidget &widget) +{ + QWidgetBackingStore *backingStore = 0; +#ifdef QT_BUILD_INTERNAL + if (QTLWExtra *topExtra = qt_widget_private(&widget)->maybeTopData()) + backingStore = topExtra->backingStore.data(); +#endif + return backingStore; +} + +// Wait for a condition to be true, timing out after 1 second +// This is used following calls to QWidget::show() and QWidget::hide(), which are +// expected to asynchronously trigger native window visibility events. +#define WAIT_AND_VERIFY(condition) \ + do { \ + QTime start = QTime::currentTime(); \ + while (!(condition) && (start.elapsed() < 1000)) { \ + qApp->processEvents(); \ + QTest::qWait(50); \ + } \ + if (!QTest::qVerify((condition), #condition, "", __FILE__, __LINE__)) \ + return; \ + } while (0) + +void tst_QWidget::destroyBackingStoreWhenHidden() +{ +#ifndef QT_BUILD_INTERNAL + QSKIP("Test step requires access to Q_AUTOTEST_EXPORT", SkipAll); +#endif + +#ifndef Q_OS_SYMBIAN + QSKIP("Only Symbian destroys backing store when native window becomes invisible", SkipAll); +#endif + + testWidget->hide(); + QTest::qWait(1000); + + // 1. Single top-level QWidget + { + QWidget w; + w.setAutoFillBackground(true); + w.setPalette(Qt::yellow); + w.setGeometry(0, 0, 100, 100); + w.show(); + QTest::qWaitForWindowShown(&w); + QVERIFY(0 != backingStore(w)); + + w.hide(); + WAIT_AND_VERIFY(0 == backingStore(w)); + + w.show(); + QTest::qWaitForWindowShown(&w); + QVERIFY(0 != backingStore(w)); + } + + // 2. Two top-level widgets + { + QWidget w1; + w1.setGeometry(0, 0, 100, 100); + w1.setAutoFillBackground(true); + w1.setPalette(Qt::red); + w1.show(); + QTest::qWaitForWindowShown(&w1); + QVERIFY(0 != backingStore(w1)); + + QWidget w2; + w2.setGeometry(w1.geometry()); + w1.setAutoFillBackground(true); + w1.setPalette(Qt::blue); + w2.show(); + QTest::qWaitForWindowShown(&w2); + QVERIFY(0 != backingStore(w2)); + + // Check that w1 deleted its backing store when obscured by w2 + QVERIFY(0 == backingStore(w1)); + + w2.move(w2.pos() + QPoint(10, 10)); + + // Check that w1 recreates its backing store when partially revealed + WAIT_AND_VERIFY(0 != backingStore(w1)); + } + + // 3. Native child widget + { + QWidget parent; + parent.setGeometry(0, 0, 100, 100); + parent.setAutoFillBackground(true); + parent.setPalette(Qt::yellow); + + QWidget child(&parent); + child.setAutoFillBackground(true); + child.setPalette(Qt::green); + + QVBoxLayout layout(&parent); + layout.setContentsMargins(10, 10, 10, 10); + layout.addWidget(&child); + parent.setLayout(&layout); + + child.winId(); + + parent.show(); + QTest::qWaitForWindowShown(&parent); + + // Check that child window does not obscure parent window + QVERIFY(!parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + + // Native child widget should share parent's backing store + QWidgetBackingStore *const parentBs = backingStore(parent); + QVERIFY(0 != parentBs); + QVERIFY(0 == backingStore(child)); + + // Set margins to zero so that child widget totally obscures parent + layout.setContentsMargins(0, 0, 0, 0); + + WAIT_AND_VERIFY(parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + + // Backing store should remain unchanged despite child window obscuring + // parent window + QVERIFY(parentBs == backingStore(parent)); + QVERIFY(0 == backingStore(child)); + } + + // 4. Alien child widget which is made full-screen + { + QWidget parent; + parent.setGeometry(0, 0, 100, 100); + parent.setAutoFillBackground(true); + parent.setPalette(Qt::red); + + QWidget child(&parent); + child.setAutoFillBackground(true); + child.setPalette(Qt::blue); + + QVBoxLayout layout(&parent); + layout.setContentsMargins(10, 10, 10, 10); + layout.addWidget(&child); + parent.setLayout(&layout); + + parent.show(); + QTest::qWaitForWindowShown(&parent); + + // Check that child window does not obscure parent window + QVERIFY(!parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + + // Native child widget should share parent's backing store + QVERIFY(0 != backingStore(parent)); + QVERIFY(0 == backingStore(child)); + + // Make child widget full screen + child.setWindowFlags((child.windowFlags() | Qt::Window) ^ Qt::SubWindow); + child.setWindowState(child.windowState() | Qt::WindowFullScreen); + child.show(); + QTest::qWaitForWindowShown(&child); + + // Check that child window obscures parent window + QVERIFY(parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + + // Now that extent of child widget goes beyond parent's extent, + // a new backing store should be created for the child widget. + QVERIFY(0 != backingStore(child)); + + // Parent is obscured, therefore its backing store should be destroyed + QVERIFY(0 == backingStore(parent)); + + // Disable full screen + child.setWindowFlags(child.windowFlags() ^ (Qt::Window | Qt::SubWindow)); + child.setWindowState(child.windowState() ^ Qt::WindowFullScreen); + child.show(); + QTest::qWaitForWindowShown(&child); + + // Check that parent is now visible again + QVERIFY(!parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + + // Native child widget should once again share parent's backing store + QVERIFY(0 != backingStore(parent)); + QEXPECT_FAIL("", "QTBUG-10643", Continue); + QVERIFY(0 == backingStore(child)); + } + + // 5. Native child widget which is made full-screen + { + QWidget parent; + parent.setGeometry(0, 0, 100, 100); + parent.setAutoFillBackground(true); + parent.setPalette(Qt::red); + + QWidget child(&parent); + child.setAutoFillBackground(true); + child.setPalette(Qt::blue); + + QVBoxLayout layout(&parent); + layout.setContentsMargins(10, 10, 10, 10); + layout.addWidget(&child); + parent.setLayout(&layout); + + child.winId(); + + parent.show(); + QTest::qWaitForWindowShown(&parent); + + // Check that child window does not obscure parent window + QVERIFY(!parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + + // Native child widget should share parent's backing store + QVERIFY(0 != backingStore(parent)); + QVERIFY(0 == backingStore(child)); + + // Make child widget full screen + child.setWindowFlags((child.windowFlags() | Qt::Window) ^ Qt::SubWindow); + child.setWindowState(child.windowState() | Qt::WindowFullScreen); + child.show(); + QTest::qWaitForWindowShown(&child); + + // Ensure that 'window hidden' event is received by parent + qApp->processEvents(); + + // Check that child window obscures parent window + QVERIFY(parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + + // Now that extent of child widget goes beyond parent's extent, + // a new backing store should be created for the child widget. + QVERIFY(0 != backingStore(child)); + + // Parent is obscured, therefore its backing store should be destroyed + QEXPECT_FAIL("", "QTBUG-10643", Continue); + QVERIFY(0 == backingStore(parent)); + + // Disable full screen + child.setWindowFlags(child.windowFlags() ^ (Qt::Window | Qt::SubWindow)); + child.setWindowState(child.windowState() ^ Qt::WindowFullScreen); + child.show(); + QTest::qWaitForWindowShown(&child); + + // Check that parent is now visible again + QVERIFY(!parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty()); + + // Native child widget should once again share parent's backing store + QVERIFY(0 != backingStore(parent)); + QEXPECT_FAIL("", "QTBUG-10643", Continue); + QVERIFY(0 == backingStore(child)); + } +} + +#undef WAIT_AND_VERIFY + void tst_QWidget::rectOutsideCoordinatesLimit_task144779() { #ifdef Q_OS_WINCE_WM @@ -10000,15 +10245,12 @@ class scrollWidgetWBS : public QWidget public: void deleteBackingStore() { - if (static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) { - delete static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore; - static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore = 0; - } + static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore.destroy(); } void enableBackingStore() { if (!static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) { - static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore = new QWidgetBackingStore(this); + static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore.create(this); static_cast<QWidgetPrivate*>(d_ptr.data())->invalidateBuffer(this->rect()); repaint(); } diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp index 1715b79..6e3ab5c 100644 --- a/tools/linguist/lupdate/main.cpp +++ b/tools/linguist/lupdate/main.cpp @@ -651,6 +651,7 @@ int main(int argc, char **argv) } } else { sourceFiles << QDir::cleanPath(fi.absoluteFilePath());; + projectRoots.insert(fi.absolutePath() + QLatin1Char('/')); } } numFiles++; diff --git a/tools/linguist/lupdate/qscript.g b/tools/linguist/lupdate/qscript.g index a07753c..857c58a 100644 --- a/tools/linguist/lupdate/qscript.g +++ b/tools/linguist/lupdate/qscript.g @@ -108,7 +108,7 @@ static void recordMessage( fileName, lineNo, QStringList(), TranslatorMessage::Unfinished, plural); msg.setExtraComment(extracomment.simplified()); - tor->replace(msg); + tor->extend(msg); } diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 5b0139f..676881d 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -281,7 +281,12 @@ public: ret << httpProxy; return ret; } +#ifdef Q_OS_WIN + // systemProxyForQuery can take insanely long on Windows (QTBUG-10106) + return QNetworkProxyFactory::proxyForQuery(query); +#else return QNetworkProxyFactory::systemProxyForQuery(query); +#endif } void setHttpProxy (QNetworkProxy proxy) { @@ -799,11 +804,11 @@ void QDeclarativeViewer::statusChanged() tester->executefailure(); if (canvas->status() == QDeclarativeView::Ready) { - initialSize = canvas->sizeHint(); + initialSize = canvas->initialSize(); if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) { - updateSizeHints(); if (!isFullScreen() && !isMaximized()) { resize(QSize(initialSize.width(), initialSize.height()+menuBarHeight())); + updateSizeHints(); } } } @@ -936,7 +941,7 @@ void QDeclarativeViewer::sceneResized(QSize size) if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) { updateSizeHints(); } - } + } } void QDeclarativeViewer::keyPressEvent(QKeyEvent *event) @@ -1259,7 +1264,6 @@ void QDeclarativeViewer::updateSizeHints() setMinimumSize(QSize(0,0)); setMaximumSize(QSize(16777215,16777215)); } - updateGeometry(); } void QDeclarativeViewer::registerTypes() diff --git a/util/s60theme/main.cpp b/util/s60theme/main.cpp index 7f38d5c..1234fd2 100644 --- a/util/s60theme/main.cpp +++ b/util/s60theme/main.cpp @@ -70,9 +70,9 @@ int main(int argc, char *argv[]) const QFileInfo inputInfo(input); const QString output = QString::fromLatin1(argv[2]); if (inputInfo.isDir()) - return S60ThemeConvert::convertDefaultThemeToBlob(input, output); + return S60ThemeConvert::convertDefaultThemeToBlob(input, output) ? 0 : 1; else if (inputInfo.suffix().compare(QString::fromLatin1("tdf"), Qt::CaseInsensitive) == 0) - return S60ThemeConvert::convertTdfToBlob(input, output); + return S60ThemeConvert::convertTdfToBlob(input, output) ? 0 : 1; return help(); } diff --git a/util/s60theme/s60themeconvert.cpp b/util/s60theme/s60themeconvert.cpp index 7908055..b1e8022 100644 --- a/util/s60theme/s60themeconvert.cpp +++ b/util/s60theme/s60themeconvert.cpp @@ -45,6 +45,8 @@ #include <QtWebKit> static const int pictureSize = 256; +static const char* const msgPartNotInTdf = " Warning: The .tdf file does not have a part for "; +static const char* const msgSvgNotFound = " Fatal: Could not find part .svg "; void dumpPartPictures(const QHash<QString, QPicture> &partPictures) { foreach (const QString &partKey, partPictures.keys()) { @@ -84,6 +86,7 @@ private: WebKitSVGRenderer::WebKitSVGRenderer(QWidget *parent) : QWebView(parent) { + connect(this, SIGNAL(loadFinished(bool)), SLOT(loadFinishedSlot(bool))); setFixedSize(pictureSize, pictureSize); QPalette pal = palette(); @@ -202,11 +205,19 @@ bool loadThemeFromTdf(const QString &tdfFile, return false; const QString tdfBasePath = QFileInfo(tdfFile).absolutePath(); WebKitSVGRenderer renderer; - foreach(const QString& partKey, parsedPartSvgs.keys()) { - const QString tdfFullName = - tdfBasePath + QDir::separator() + parsedPartSvgs.value(partKey); - if (!QFile(tdfFullName).exists()) - qWarning() << "Could not find part:" << parsedPartSvgs.value(partKey); + foreach (const QString &partKey, QS60Style::partKeys()) { + qDebug() << partKey; + QString tdfFullName; + if (parsedPartSvgs.contains(partKey)) { + tdfFullName = tdfBasePath + QDir::separator() + parsedPartSvgs.value(partKey); + } else { + qWarning() << msgPartNotInTdf << partKey; + tdfFullName = tdfBasePath + QDir::separator() + partKey + QLatin1String(".svg"); + } + if (!QFile(tdfFullName).exists()) { + qWarning() << msgSvgNotFound << QDir::toNativeSeparators(tdfFullName); + return false; + } const QPicture partPicture = renderer.svgToQPicture(tdfFullName); parsedPartPictures.insert(partKey, partPicture); } @@ -276,8 +287,8 @@ bool loadDefaultTheme(const QString &themePath, const QString partFileName = partKey + QLatin1String(".svg"); const QString partFile(dir.absolutePath() + QDir::separator() + partFileName); if (!QFile::exists(partFile)) { - qWarning() << "Could not find part:" << partFileName; - continue; + qWarning() << msgSvgNotFound << partFileName; + return false; } const QPicture partPicture = renderer.svgToQPicture(partFile); partPictures.insert(partKey, partPicture); |