diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-05-29 07:47:09 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2009-05-29 07:47:09 (GMT) |
commit | 484b204e76607723a88a15de545db1646cdec023 (patch) | |
tree | 9fa3cae23d4afecc58a13d7557d8d2603a1d7595 | |
parent | 777c504bb7858bf5e7073f7efbe58db33b93673a (diff) | |
parent | dcf5d568aba893d690eedbe1e18148b504de2abb (diff) | |
download | Qt-484b204e76607723a88a15de545db1646cdec023.zip Qt-484b204e76607723a88a15de545db1646cdec023.tar.gz Qt-484b204e76607723a88a15de545db1646cdec023.tar.bz2 |
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
48 files changed, 505 insertions, 402 deletions
diff --git a/configure.exe b/configure.exe Binary files differindex 30383d8..65db048 100755 --- a/configure.exe +++ b/configure.exe diff --git a/doc/src/installation.qdoc b/doc/src/installation.qdoc index 85ea20c..3270dae 100644 --- a/doc/src/installation.qdoc +++ b/doc/src/installation.qdoc @@ -505,7 +505,6 @@ in the \l{Qt for Windows CE Requirements} document. \ingroup installation \ingroup qts60 \brief How to install Qt on S60. - \list 1 \o Install needed IDE and SDKs @@ -522,9 +521,84 @@ in the \l{Qt for Windows CE Requirements} document. \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}. - \note The wsini.ini provided with the \bold{S60 Platform SDK 5th Edition v0.9} - needs to be updated for correct font rendering in the emulator. The update can be found - \l{http://pepper.troll.no/s60prereleases/patches/}{here}. + \o Depending on how you obtained the Qt for S60 release, follow the instructions in one of these pages: + \list + \o \l{Installing Qt for S60 with installer} + \o \l{Installing Qt for S60 from source package} + \endlist +\endlist +*/ + +/*! \page install-S60-installer.html + +\title Installing Qt for S60 with installer +\ingroup installation +\ingroup qts60 +\brief How to install Qt on S60 using installer. +\list 1 + + \o Install Qt + + Run the \c{qt-s60-%VERSION%.exe} to install Qt. + + \note Qt must be installed on the same drive as the S60 SDK you are + using, and the install path must not contain any spaces. + + \o Environment variables + + In order to build and use Qt, the \c PATH environment variable needs + to be extended: + + \snippet doc/src/snippets/code/doc_src_installation.qdoc 18 + + This is done by adding \c{c:\Qt\%VERSION%\bin} to the \c PATH variable. + + On Windows the PATH can be extended by navigating to + "Control Panel->System->Advanced->Environment variables". + + \note Instead of modifying system path, you can also use the "Qt S60 Command Prompt" + to build your applications. It can be launched from start menu. + + In addition, you must configure the environment for use with the S60 + emulator. This is done by locating the Carbide.c++ submenu on the Start + menu, and choosing "Configure environment for WINSCW command line". + + \o Running Qt demos + + We've included a subset of the Qt demos in this package for you + to try out. An excellent starting point is the "fluidlauncher" + demo. To run the demo on a real device, you first have to install + the Qt libraries and the demo on the device. + Install \c{qt_libs.sis} and \c{fluidlauncher.sis} + found at Qt installation folder to the device. + + To run the demos on the emulator, navigate to + \c{%EPOCROOT%\Epoc32\release\winscw\udeb\} and start any of the + Qt demos located there, for example: + + \snippet doc/src/snippets/code/doc_src_installation.qdoc 26 + + For more information about building and running Qt programs on S60, + see \l{S60 - Introduction to using Qt}. + + We hope you will enjoy using Qt. + +\endlist + +*/ +/*! \page install-S60-sources.html + +\title Installing Qt for S60 from source package +\ingroup installation +\ingroup qts60 +\brief How to install Qt on S60 from source package. + +\list 1 + + \o Install needed tools + + Building Qt libraries requires \l{http://www.arm.com/products/DevTools/RVCT.html}{RVCT} 2.2 [build 616] or later, + which is not available free of charge. \o Install Qt @@ -561,11 +635,9 @@ in the \l{Qt for Windows CE Requirements} document. \o Build Qt - The Qt libraries comes pre-built for real devices. - If you are using a 3.x S60 SDK, install \c{qts60binaries\3.x\qtlibs-%VERSION%.exe} - into the S60 SDK root directory. For example: \c{C:\Symbian\9.2\S60_3rd_FP1_2\} - If you are using a 5.0 S60 SDK, install \c{qts60binaries\5.0\qtlibs-%VERSION%.exe} - into the S60 SDK root directory. For example: \c{C:\S60\devices\S60_5th_Edition_SDK_v0.9\} + To build Qt for the device, type: + + \snippet doc/src/snippets/code/doc_src_installation.qdoc 28 To build Qt for the emulator, type: @@ -576,33 +648,34 @@ in the \l{Qt for Windows CE Requirements} document. \o Running Qt demos We've included a subset of the Qt demos in this package for you - to try out. An excellent starting point is the "fluidlauncher" - demo. To run the demo on a real device, you first have to install - the Qt libraries on the device. - For 3.x devices install \c{qts60binaries\3.x\qt_libs_armv5_udeb.sisx} - For 5.0 devices install \c{qts60binaries\5.0\qt_libs_armv5_udeb.sisx} - included in this package to the device. Then type: + to try out. An excellent starting point is the "fluidlauncher" + demo. To run the demo on a real device, you first have to install + the Qt libraries on the device: + + \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. + + Similarly, install fluidlauncher to the device: - \snippet doc/src/snippets/code/doc_src_installation.qdoc 25 + \snippet doc/src/snippets/code/doc_src_installation.qdoc 30 - This will create a self-signed \c fluidlauncher_gcce_udeb.sisx and + This will create a self-signed \c fluidlauncher_armv5_urel.sisx and install it to your device. - \note You can specify your own certificate and key files as additional parameters to - \c createpackage if default ones are not suitable. - - To run the demos on the emulator simply run: + To run the demos on the emulator simply run: - \snippet doc/src/snippets/code/doc_src_installation.qdoc 27 + \snippet doc/src/snippets/code/doc_src_installation.qdoc 27 - Or, if you need to supply arguments to the program, navigate to - \c{%EPOCROOT%\Epoc32\release\winscw\udeb\} and start any of the - Qt demos located there, for example: + Or, if you need to supply arguments to the program, navigate to + \c{%EPOCROOT%\Epoc32\release\winscw\udeb\} and start any of the + Qt demos located there, for example: - \snippet doc/src/snippets/code/doc_src_installation.qdoc 26 + \snippet doc/src/snippets/code/doc_src_installation.qdoc 26 - For more information about building and running Qt programs on S60, - see \l{S60 - Introduction to using Qt}. + For more information about building and running Qt programs on S60, + see \l{S60 - Introduction to using Qt}. We hope you will enjoy using Qt. diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index 84b3a01..fc0598f 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -2412,6 +2412,8 @@ \value ImhNoPredictiveText Do not use predictive text (i.e. dictionary lookup) while typing. \value ImhDialableCharactersOnly Only characters suitable for phone dialling are allowed. + \value ImhExclusiveInputMask A mask to test for the presence of any flags ending with \c Only. + \note If several flags ending with \c Only are ORed together, the resulting character set will consist of the union of the specified sets. For instance specifying \c ImhNumbersOnly and \c ImhUppercaseOnly would yield a set consisting of numbers and uppercase letters. diff --git a/doc/src/s60-introduction.qdoc b/doc/src/s60-introduction.qdoc index a574355..e6e6b7e 100644 --- a/doc/src/s60-introduction.qdoc +++ b/doc/src/s60-introduction.qdoc @@ -19,19 +19,14 @@ \tableofcontents - \section1 Required tools - - In order to use Qt for S60 you need to have a typical S60 development - setup. See \l{Qt for S60 Requirements} for the details. - \section1 Installing Qt Follow the instructions found in \l{Installing Qt on S60}. \section1 Building your own applications - If you are new to Qt development, have a look at \l{How to Learn Qt} - and \l{Qt Tutorial}. In general, the difference between developing a + 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 S60 compared to any of the other platforms supported by Qt is not that big. diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc index 2930317..8730125 100644 --- a/doc/src/snippets/code/doc_src_installation.qdoc +++ b/doc/src/snippets/code/doc_src_installation.qdoc @@ -138,17 +138,6 @@ make debug-winscw //! [24] -//! [25] -cd examples -make debug-gcce -cd ..\demos - -make debug-gcce -cd embedded\fluidlauncher -createpackage -i fluidlauncher_gcce_udeb.pkg -//! [25] - - //! [26] wiggly.exe -small-screen //! [26] @@ -156,3 +145,17 @@ wiggly.exe -small-screen //! [27] make run //! [27] + +//! [28] +make release-armv5 +//! [28] + +//! [29] +cd src\s60installs +createpackage -i qt_libs_armv5_urel.pkg <certificate file> <certificate key file> +//! [29] + +//! [30] +cd embedded\fluidlauncher +createpackage -i fluidlauncher_armv5_urel.pkg +//! [30] diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index dd1dbd2..4538dc4 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -69,6 +69,7 @@ #endif #if defined(Q_OS_SYMBIAN) +#include <e32def.h> #include <e32debug.h> #endif @@ -2150,6 +2151,7 @@ void qt_message_output(QtMsgType msgType, const char *buf) #endif #if defined(Q_OS_SYMBIAN) + __DEBUGGER(); // on the emulator, get the debugger to kick in if there's one around User::Invariant(); // Panic the current thread #elif (defined(Q_OS_UNIX) || defined(Q_CC_MINGW)) abort(); // trap; generates core dump diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index e0ca27c..75524a0 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1401,16 +1401,19 @@ public: enum InputMethodHint { ImhNone = 0x0, ImhHiddenText = 0x1, - ImhDigitsOnly = 0x2, - ImhFormattedNumbersOnly = 0x4, - ImhUppercaseOnly = 0x8, - ImhLowercaseOnly = 0x10, - ImhNoAutoUppercase = 0x20, - ImhPreferNumbers = 0x40, - ImhPreferUppercase = 0x80, - ImhPreferLowercase = 0x100, - ImhNoPredictiveText = 0x200, - ImhDialableCharactersOnly = 0x400 + ImhNoAutoUppercase = 0x2, + ImhPreferNumbers = 0x4, + ImhPreferUppercase = 0x8, + ImhPreferLowercase = 0x10, + ImhNoPredictiveText = 0x20, + + ImhDigitsOnly = 0x10000, + ImhFormattedNumbersOnly = 0x20000, + ImhUppercaseOnly = 0x40000, + ImhLowercaseOnly = 0x80000, + ImhDialableCharactersOnly = 0x100000, + + ImhExclusiveInputMask = 0xffff0000 }; Q_DECLARE_FLAGS(InputMethodHints, InputMethodHint) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 7d8a77a..d99164b 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -311,6 +311,11 @@ void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver) Q_UNUSED(currentThread); Q_UNUSED(thr); } +#elif defined(Q_OS_SYMBIAN) && defined (QT_NO_DEBUG) +// no implementation in release builds, but keep the symbol present +void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver) +{ +} #endif void QCoreApplicationPrivate::appendApplicationPathToLibraryPaths() diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 9490ad7..c1118d1 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -92,7 +92,7 @@ public: static void sendPostedEvents(QObject *receiver, int event_type, QThreadData *data); static void removePostedEvents_unlocked(QObject *receiver, int type, QThreadData *data); -#if !defined (QT_NO_DEBUG) || defined (QT_MAC_FRAMEWORK_BUILD) +#if !defined (QT_NO_DEBUG) || defined (QT_MAC_FRAMEWORK_BUILD) || defined (Q_OS_SYMBIAN) void checkReceiverThread(QObject *receiver); #endif int &argc; diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index ce38b73..6aa3b56 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -54,7 +54,7 @@ #include <stdio.h> #include <stdlib.h> -#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED) && !defined(Q_OS_SYMBIAN) +#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED) # include <sys/times.h> #endif @@ -65,7 +65,7 @@ Q_CORE_EXPORT bool qt_disable_lowpriority_timers=false; /***************************************************************************** UNIX signal handling *****************************************************************************/ -#if !defined(Q_OS_SYMBIAN) + static sig_atomic_t signal_received; static sig_atomic_t signals_fired[NSIG]; @@ -74,7 +74,7 @@ static void signalHandler(int sig) signals_fired[sig] = 1; signal_received = 1; } -#endif + static void initThreadPipeFD(int fd) { @@ -134,7 +134,6 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, int nsel; do { -#if !defined(Q_OS_SYMBIAN) if (mainThread) { while (signal_received) { signal_received = 0; @@ -146,7 +145,7 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, } } } -#endif + // Process timers and socket notifiers - the common UNIX stuff int highest = 0; if (! (flags & QEventLoop::ExcludeSocketNotifiers) && (sn_highest >= 0)) { @@ -258,7 +257,7 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, QTimerInfoList::QTimerInfoList() { -#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_SYMBIAN) +#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) useMonotonicTimers = false; # if (_POSIX_MONOTONIC_CLOCK == 0) @@ -299,7 +298,7 @@ timeval QTimerInfoList::updateCurrentTime() return currentTime; } -#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED)) && !defined(Q_OS_SYMBIAN) +#if (_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED) /* Returns true if the real time clock has changed by more than 10% @@ -375,11 +374,7 @@ void QTimerInfoList::repairTimersIfNeeded() void QTimerInfoList::getTime(timeval &t) { timespec ts; -#if !defined(Q_OS_SYMBIAN) clock_gettime(CLOCK_MONOTONIC, &ts); -#else - clock_gettime(CLOCK_REALTIME, &ts); -#endif t.tv_sec = ts.tv_sec; t.tv_usec = ts.tv_nsec / 1000; } @@ -944,7 +939,7 @@ void QEventDispatcherUNIX::flush() -#if !defined(Q_OS_SYMBIAN) + void QCoreApplication::watchUnixSignal(int sig, bool watch) { if (sig < NSIG) { @@ -958,10 +953,5 @@ void QCoreApplication::watchUnixSignal(int sig, bool watch) sigaction(sig, &sa, 0); } } -#else -void QCoreApplication::watchUnixSignal(int, bool) -{ -} -#endif QT_END_NAMESPACE diff --git a/src/gui/gui.pro b/src/gui/gui.pro index d3b7388..30aaa51 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -42,4 +42,7 @@ QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist DEFINES += Q_INTERNAL_QAPP_SRC -symbian:TARGET.UID3=0x2001B2DD
\ No newline at end of file +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"
\ No newline at end of file diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index dd51fcd..5b2c1fb 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -14,6 +14,7 @@ #include "qevent.h" #include "qeventdispatcher_s60_p.h" #include "qwidget.h" +#include "qdesktopwidget.h" #include "private/qbackingstore_p.h" #include "qt_s60_p.h" #include "private/qevent_p.h" @@ -49,6 +50,8 @@ static bool appNoGrab = false; // Grabbing enabled Q_GUI_EXPORT QS60Data *qt_s60Data = 0; extern bool qt_sendSpontaneousEvent(QObject*,QEvent*); +extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp + QWidget *qt_button_down = 0; // widget got last button-down bool qt_nograb() // application no-grab option @@ -988,6 +991,13 @@ int QApplication::s60ProcessEvent(TWsEvent *event) case EEventScreenDeviceChanged: if (S60) S60->updateScreenSize(); + if (qt_desktopWidget) { + QSize oldSize = qt_desktopWidget->size(); + qt_desktopWidget->data->crect.setWidth(S60->screenWidthInPixels); + qt_desktopWidget->data->crect.setHeight(S60->screenHeightInPixels); + QResizeEvent e(qt_desktopWidget->size(), oldSize); + QApplication::sendEvent(qt_desktopWidget, &e); + } return 0; // Propagate to CONE case EEventWindowVisibilityChanged: if (controlInMap) { diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp index 029892e..d57d289 100644 --- a/src/gui/kernel/qdesktopwidget_s60.cpp +++ b/src/gui/kernel/qdesktopwidget_s60.cpp @@ -32,34 +32,58 @@ public: static int screenCount; static int primaryScreen; + + static QVector<QRect> *rects; + static QVector<QRect> *workrects; + + static int refcount; }; int QDesktopWidgetPrivate::screenCount = 1; int QDesktopWidgetPrivate::primaryScreen = 0; +QVector<QRect> *QDesktopWidgetPrivate::rects = 0; +QVector<QRect> *QDesktopWidgetPrivate::workrects = 0; +int QDesktopWidgetPrivate::refcount = 0; QDesktopWidgetPrivate::QDesktopWidgetPrivate() { + ++refcount; } QDesktopWidgetPrivate::~QDesktopWidgetPrivate() { + if (!--refcount) + cleanup(); } void QDesktopWidgetPrivate::init(QDesktopWidget *that) { - TInt screenCount=0; - TInt result=0; + int screenCount=0; + + if (HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount) == KErrNone) + QDesktopWidgetPrivate::screenCount = screenCount; + else + QDesktopWidgetPrivate::screenCount = 0; - result = HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount); - QDesktopWidgetPrivate::screenCount = screenCount; - if( result != KErrNone) - { - // ### What to do if no screens found? - } + rects = new QVector<QRect>(); + workrects = new QVector<QRect>(); + + rects->resize(QDesktopWidgetPrivate::screenCount); + workrects->resize(QDesktopWidgetPrivate::screenCount); + + // ### TODO: Implement proper multi-display support + rects->resize(1); + rects->replace(0, that->rect()); + workrects->resize(1); + workrects->replace(0, that->rect()); } void QDesktopWidgetPrivate::cleanup() { + delete rects; + rects = 0; + delete workrects; + workrects = 0; } @@ -120,6 +144,29 @@ int QDesktopWidget::screenNumber(const QPoint &point) const void QDesktopWidget::resizeEvent(QResizeEvent *) { + Q_D(QDesktopWidget); + QVector<QRect> oldrects; + oldrects = *d->rects; + QVector<QRect> oldworkrects; + oldworkrects = *d->workrects; + int oldscreencount = d->screenCount; + + QDesktopWidgetPrivate::cleanup(); + QDesktopWidgetPrivate::init(this); + + for (int i = 0; i < qMin(oldscreencount, d->screenCount); ++i) { + QRect oldrect = oldrects[i]; + QRect newrect = d->rects->at(i); + if (oldrect != newrect) + emit resized(i); + } + + for (int j = 0; j < qMin(oldscreencount, d->screenCount); ++j) { + QRect oldrect = oldworkrects[j]; + QRect newrect = d->workrects->at(j); + if (oldrect != newrect) + emit workAreaResized(j); + } } QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index dae4179..4fcedb4 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2046,17 +2046,20 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QPoin // Defined in qmacstyle_mac.cpp extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush); qt_mac_fill_background(painter, rgn, offset, brush); -#elif defined(Q_WS_S60) - // Defined in qs60style_symbian.cpp - extern void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, - const QPoint &offset, const QBrush &brush); - qt_s60_fill_background(painter, rgn, offset, brush); #else - const QRegion translated = rgn.translated(offset); - const QRect rect(translated.boundingRect()); - painter->setClipRegion(translated); - painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); -#endif +#if !defined(QT_NO_STYLE_S60) + // Defined in qs60style.cpp + extern bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, + const QPoint &offset, const QBrush &brush); + if (!qt_s60_fill_background(painter, rgn, offset, brush)) +#endif // !defined(QT_NO_STYLE_S60) + { + const QRegion translated = rgn.translated(offset); + const QRect rect(translated.boundingRect()); + painter->setClipRegion(translated); + painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); + } +#endif // Q_WS_MAC } else { const QVector<QRect> &rects = rgn.rects(); for (int i = 0; i < rects.size(); ++i) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index f8cf885..930602b 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -57,7 +57,6 @@ const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFl static const QByteArray propertyKeyLayouts = "layouts"; static const QByteArray propertyKeyCurrentlayout = "currentlayout"; -#if defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** {240,320,1,14,true,QLatin1String("QVGA Landscape Mirrored")}, @@ -93,9 +92,9 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { }; const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0]; -#endif // defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) -bool QS60StylePrivate::m_backgroundValid = false; +// theme background texture +QPixmap *QS60StylePrivate::m_background = 0; const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = { {SE_ButtonNormal, QS60StyleEnums::SP_QsnFrButtonTbCenter}, @@ -118,6 +117,11 @@ static const int frameElementsCount = const int KNotFound = -1; +QS60StylePrivate::~QS60StylePrivate() +{ + deleteBackground(); +} + void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, const QRect &rect, SkinElementFlags flags) { @@ -251,10 +255,18 @@ void QS60StylePrivate::drawSkinPart(QS60StyleEnums::SkinParts part, drawPart(part, painter, rect, flags); } +short QS60StylePrivate::pixelMetric(int metric) +{ + Q_ASSERT(metric < MAX_PIXELMETRICS); + const short returnValue = m_pmPointer[metric]; + if (returnValue==-909) + return -1; + return returnValue; +} + void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value) { if (name == propertyKeyCurrentlayout) { -#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) static const QStringList layouts = styleProperty(propertyKeyLayouts).toStringList(); const QString layout = value.toString(); Q_ASSERT(layouts.contains(layout)); @@ -264,24 +276,17 @@ void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value) clearCaches(); refreshUI(); return; -#else - qFatal("Cannot set static layout. Dynamic layouts are used!"); -#endif } } QVariant QS60StylePrivate::styleProperty(const char *name) const { if (name == propertyKeyLayouts) { -#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) static QStringList layouts; if (layouts.isEmpty()) for (int i = 0; i < QS60StylePrivate::m_numberOfLayouts; i++) layouts.append(QS60StylePrivate::m_layoutHeaders[i].layoutName); return layouts; -#else - qFatal("Cannot return list of 'canned' static layouts. Dynamic layouts are used!"); -#endif } return QVariant(); } @@ -350,14 +355,28 @@ QFont QS60StylePrivate::s60Font( return result; } -//todo: you could pass a reason to clear cache here, so that we could -// deduce whether or not the specific cache needs to be cleared -void QS60StylePrivate::clearCaches() +void QS60StylePrivate::clearCaches(QS60StylePrivate::CacheClearReason reason) { - m_colorCache.clear(); - m_mappedFontsCache.clear(); - QPixmapCache::clear(); - m_backgroundValid = false; + switch(reason){ + case CC_LayoutChange: + // when layout changes, the colors remain in cache, but graphics and fonts can change + m_mappedFontsCache.clear(); + deleteBackground(); + QPixmapCache::clear(); + break; + case CC_ThemeChange: + m_colorCache.clear(); + QPixmapCache::clear(); + deleteBackground(); + break; + case CC_UndefinedChange: + default: + m_colorCache.clear(); + m_mappedFontsCache.clear(); + QPixmapCache::clear(); + deleteBackground(); + break; + } } // Since S60Style has 'button' and 'tooltip' as a graphic, we don't have any native color which to use @@ -381,7 +400,6 @@ QColor QS60StylePrivate::colorFromFrameGraphics(QS60StylePrivate::SkinFrameEleme const int pixels = frameImage.numBytes()/sizeof(QRgb); const int bytesPerLine = frameImage.bytesPerLine(); Q_ASSERT(bytesPerLine); - const int rows = frameImage.numBytes()/(sizeof(QRgb)*bytesPerLine); int estimatedRed = 0; int estimatedGreen = 0; @@ -549,18 +567,23 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const app->setPalette(applicationPalette); } +void QS60StylePrivate::deleteBackground() +{ + if (QS60StylePrivate::m_background) { + delete QS60StylePrivate::m_background; + QS60StylePrivate::m_background = 0; + } +} + int QS60StylePrivate::focusRectPenWidth() { return pixelMetric(QS60Style::PM_DefaultFrameWidth); } -#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) void QS60StylePrivate::setCurrentLayout(int index) { m_pmPointer = data[index]; } -#endif - void QS60StylePrivate::drawPart(QS60StyleEnums::SkinParts skinPart, QPainter *painter, const QRect &rect, SkinElementFlags flags) @@ -761,8 +784,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled; SubControls sub = option->subControls; - Q_D(const QS60Style); - switch (control) { #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: @@ -832,7 +853,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom const bool direction = cmb->direction == Qt::LeftToRight; // Button frame - //todo: why calc rect here for button? Is there no suitable SE_xxx for that? QStyleOptionFrame buttonOption; buttonOption.QStyleOption::operator=(*cmb); const int maxHeight = cmbxFrame.height(); @@ -842,7 +862,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom buttonOption.rect = buttonRect; buttonOption.state = cmb->state & (State_Enabled | State_MouseOver); drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget); - // todo: we could draw qgn_prop_set_button skin item here // draw label background - label itself is drawn separately const QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_FrameLineEdit; @@ -1092,23 +1111,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom } break; #endif //QT_NO_GROUPBOX -#ifndef QT_NO_DIAL - case CC_Dial: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - QStyleOptionSlider optionSlider = *slider; - QCommonStyle::drawComplexControl(control, &optionSlider, painter, widget); - } - break; -#endif //QT_NO_DIAL - - //todo: remove non-used complex widgets in final version - case CC_TitleBar: -#ifdef QT3_SUPPORT - case CC_Q3ListView: -#endif //QT3_SUPPORT -#ifndef QT_NO_WORKSPACE - case CC_MdiControls: -#endif //QT_NO_WORKSPACE default: QCommonStyle::drawComplexControl(control, option, painter, widget); } @@ -1166,24 +1168,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags); } break; - case CE_PushButtonLabel: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QStyleOptionButton optionButton = *button; - QCommonStyle::drawControl(element, &optionButton, painter, widget); - } - break; - case CE_CheckBoxLabel: - if (const QStyleOptionButton *checkBox = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QStyleOptionButton optionCheckBox = *checkBox; - QCommonStyle::drawControl(element, &optionCheckBox, painter, widget); - } - break; - case CE_RadioButtonLabel: - if (const QStyleOptionButton *radioButton = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QStyleOptionButton optionRadioButton = *radioButton; - QCommonStyle::drawControl(element, &optionRadioButton, painter, widget); - } - break; #ifndef QT_NO_TOOLBUTTON case CE_ToolButtonLabel: if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { @@ -1202,12 +1186,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } break; #endif //QT_NO_TOOLBUTTON - case CE_HeaderLabel: - if (const QStyleOptionHeader *headerLabel = qstyleoption_cast<const QStyleOptionHeader *>(option)) { - QStyleOptionHeader optionHeaderLabel = *headerLabel; - QCommonStyle::drawControl(element, &optionHeaderLabel, painter, widget); - } - break; #ifndef QT_NO_COMBOBOX case CE_ComboBoxLabel: if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { @@ -1314,16 +1292,14 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, (listView->selectionMode() == QAbstractItemView::SingleSelection || listView->selectionMode() == QAbstractItemView::NoSelection); QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); - if (voptAdj.state & QStyle::State_Selected && - !singleSelection) { + if (voptAdj.state & QStyle::State_Selected && !singleSelection) { QStyleOptionViewItemV4 option(voptAdj); option.rect = selectionRect; // Draw selection mark. drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, painter, widget); if ( textRect.right() > selectionRect.left() ) textRect.setRight(selectionRect.left()); - } - else if (singleSelection && + } else if (singleSelection && voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) { // draw the check mark if (selectionRect.isValid()) { @@ -1406,7 +1382,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, const int tabOverlap = QS60StylePrivate::pixelMetric(QStyle::PM_TabBarTabOverlap) - borderThickness; //todo: draw navi wipe behind tabbar - must be drawn with first draw - //QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, windowRect, flags); if (skinElement==QS60StylePrivate::SE_TabBarTabEastInactive|| skinElement==QS60StylePrivate::SE_TabBarTabEastActive|| @@ -1572,12 +1547,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, break; #endif // QT_NO_PROGRESSBAR #ifndef QT_NO_MENUBAR - case CE_MenuBarItem: - if (const QStyleOptionMenuItem *menuBarItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { - QStyleOptionMenuItem optionMenuBarItem = *menuBarItem; - QCommonStyle::drawControl(element, &optionMenuBarItem, painter, widget); - } - break; #endif //QT_NO_MENUBAR #ifndef QT_NO_MENU case CE_MenuItem: @@ -1683,7 +1652,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, break; #endif //QT_NO_MENU - //todo: remove non-used widgets in final version case CE_MenuEmptyArea: #ifndef QT_NO_MENUBAR case CE_MenuBarEmptyArea: @@ -1791,48 +1759,6 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } break; #endif //QT_NO_TOOLBAR - - case CE_ShapedFrame: - case CE_MenuVMargin: - case CE_MenuHMargin: -#ifndef QT_NO_MENU - case CE_MenuScroller: - case CE_MenuTearoff: -#endif //QT_NO_MENU - - case CE_CheckBox: - case CE_RadioButton: -#ifndef QT_NO_TABBAR - case CE_TabBarTab: -#endif //QT_NO_TABBAR -#ifndef QT_NO_PROGRESSBAR - case CE_ProgressBar: -#endif // QT_NO_PROGRESSBAR - case CE_Q3DockWindowEmptyArea: -#ifndef QT_NO_SIZEGRIP - case CE_SizeGrip: -#endif //QT_NO_SIZEGRIP - case CE_Splitter: -#ifndef QT_NO_RUBBERBAND - case CE_RubberBand: -#endif //QT_NO_RUBBERBAND -#ifndef QT_NO_DOCKWIDGET - case CE_DockWidgetTitle: -#endif //QT_NO_DOCKWIDGET - case CE_ScrollBarAddLine: - case CE_ScrollBarSubLine: - case CE_ScrollBarAddPage: - case CE_ScrollBarSubPage: - case CE_ScrollBarSlider: - case CE_ScrollBarFirst: - case CE_ScrollBarLast: - case CE_FocusFrame: -#ifndef QT_NO_TOOLBOX - case CE_ToolBoxTab: - case CE_ToolBoxTabShape: - case CE_ToolBoxTabLabel: -#endif //QT_NO_TOOLBOX - case CE_ColumnViewGrip: default: QCommonStyle::drawControl(element, option, painter, widget); } @@ -2161,15 +2087,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti } /*! - \reimp - sets the default colors -*/ -void QS60Style::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette & palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const -{ - QPalette override = palette; - QCommonStyle::drawItemText(painter, rectangle, alignment, override, enabled, text, textRole); -} - -/*! \reimp */ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const @@ -2179,7 +2096,6 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const metricValue = QCommonStyle::pixelMetric(metric, option, widget); if (metric == PM_SubMenuOverlap && widget){ - const int widgetWidth = widget->width(); const QMenu *menu = qobject_cast<const QMenu *>(widget); if (menu && menu->activeAction() && menu->activeAction()->menu()) { const int menuWidth = menu->activeAction()->menu()->sizeHint().width(); @@ -2409,12 +2325,12 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple ret = QCommonStyle::subControlRect(control, option, scontrol, widget); switch (scontrol) { case SC_GroupBoxCheckBox: //fallthrough - case SC_GroupBoxLabel: + case SC_GroupBoxLabel: { //slightly indent text and boxes, so that dialog border does not mess with them. const int horizontalSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing); - const int bottomMargin = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutBottomMargin); ret.adjust(2,horizontalSpacing-3,0,0); + } break; case SC_GroupBoxFrame: { const QRect textBox = subControlRect(control, option, SC_GroupBoxLabel, widget); @@ -2444,7 +2360,6 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con case SE_LineEditContents: { // in S60 the input text box doesn't start from line Edit's TL, but // a bit indented. - // todo: Should we NOT do this for combo boxes and spin boxes? QRect lineEditRect = opt->rect; int adjustment = opt->rect.height()>>2; lineEditRect.adjust(adjustment,0,0,0); @@ -2518,13 +2433,10 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con } } else if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { const bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable; - const bool subMenu = menuItem->menuItemType == QStyleOptionMenuItem::SubMenu; int indicatorWidth = checkable ? pixelMetric(PM_ListViewIconSize, opt, widget) : pixelMetric(PM_SmallIconSize, opt, widget); ret = menuItem->rect; - const int verticalSpacing = - QS60StylePrivate::pixelMetric(QStyle::PM_LayoutVerticalSpacing); if (element == SE_ItemViewItemDecoration) { if (menuItem->direction == Qt::RightToLeft) @@ -2684,6 +2596,7 @@ void QS60Style::polish(QApplication *application) void QS60Style::unpolish(QApplication *application) { + Q_UNUSED(application) QPalette newPalette = qApp->style()->standardPalette(); application->setPalette(newPalette); QApplicationPrivate::setSystemPalette(originalPalette); @@ -2786,6 +2699,29 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, QCommonStyle::standardIconImplementation(standardIcon, option, widget) : QIcon(cachedPixMap); } +extern QPoint qt_s60_fill_background_offset(const QWidget *targetWidget); + +bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, + const QBrush &brush) +{ + const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); + if (backgroundTexture.cacheKey() != brush.texture().cacheKey()) + return false; + + const QPaintDevice *target = painter->device(); + if (target->devType() == QInternal::Widget) { + const QWidget *widget = static_cast<const QWidget *>(target); + const QRegion translated = rgn.translated(offset); + const QVector<QRect> &rects = translated.rects(); + for (int i = 0; i < rects.size(); ++i) { + const QRect rect(rects.at(i)); + painter->drawPixmap(rect.topLeft(), backgroundTexture, + rect.translated(qt_s60_fill_background_offset(widget))); + } + } + return true; +} + QT_END_NAMESPACE #endif // QT_NO_STYLE_S60 || QT_PLUGIN diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index 945e182..09c6b00 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -36,7 +36,6 @@ public: void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const; void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; - void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w = 0) const; int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = 0, diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 37c6ec7..c93d271 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -331,6 +331,13 @@ public: SF_StateDisabled = 0x0020, SF_ColorSkinned = 0x0040, }; + + enum CacheClearReason { + CC_UndefinedChange = 0, + CC_LayoutChange, + CC_ThemeChange + }; + Q_DECLARE_FLAGS(SkinElementFlags, SkinElementFlag) // draws skin element @@ -359,15 +366,15 @@ public: static QColor lighterColor(const QColor &baseColor); //deduces if the given widget should have separately themeable background static bool drawsOwnThemeBackground(const QWidget *widget); - // gets layout - static const QHash<QStyle::PixelMetric, int> &s60StyleLayout(); QFont s60Font(QS60StyleEnums::FontCategories fontCategory, int pointSize = -1) const; // clears all style caches (fonts, colors, pixmaps) - void clearCaches(); - // returns themed background texture - static QPixmap backgroundTexture(); + void clearCaches(CacheClearReason reason = CC_UndefinedChange); + + // themed main background oprations + void setBackgroundTexture(QApplication *application) const; + static void deleteBackground(); static bool isTouchSupported(); static bool isToolBarBackground(); @@ -376,11 +383,9 @@ public: QColor colorFromFrameGraphics(QS60StylePrivate::SkinFrameElements frame) const; void setThemePalette(QApplication *application) const; void setThemePalette(QWidget *widget) const; - void setBackgroundTexture(QApplication *application) const; static int focusRectPenWidth(); -#if defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) static const layoutHeader m_layoutHeaders[]; static const short data[][MAX_PIXELMETRICS]; @@ -390,7 +395,6 @@ public: static short const *m_pmPointer; // number of layouts supported by the style static const int m_numberOfLayouts; -#endif // defined(QT_S60STYLE_LAYOUTDATA_SIMULATED) mutable QHash<QPair<QS60StyleEnums::FontCategories , int>, QFont> m_mappedFontsCache; mutable QHash<QS60StylePrivate::SkinFrameElements, QColor> m_colorCache; @@ -404,6 +408,8 @@ public: static QPixmap frame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags = KDefaultSkinElementFlags); + static QPixmap backgroundTexture(); + private: static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter, const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); @@ -417,9 +423,9 @@ private: SkinElementFlags flags = KDefaultSkinElementFlags); static QPixmap cachedFrame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags = KDefaultSkinElementFlags); - + static void refreshUI(); - + static QSize partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags = KDefaultSkinElementFlags); static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size, @@ -429,7 +435,8 @@ private: static QSize screenSize(); - static bool m_backgroundValid; + // Contains background texture. + static QPixmap *m_background; const static SkinElementFlags KDefaultSkinElementFlags; }; diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_s60.cpp index 48b759a..ddee4ba 100644 --- a/src/gui/styles/qs60style_symbian.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -583,26 +583,6 @@ QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask return QPixmap::fromImage(iconImage); } -QPixmap QS60StylePrivate::backgroundTexture() -{ - static QPixmap result; - // Poor mans caching. + Making sure that there is always only one background image in memory at a time - -/* - TODO: 1) Hold the background QPixmap as pointer in a static class member. - Also add a deleteBackground() function and call that in ~QS60StylePrivate() - 2) Don't cache the background at all as soon as we have native pixmap support -*/ - - if (!m_backgroundValid) { - result = QPixmap(); - result = part(QS60StyleEnums::SP_QsnBgScreen, - QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), SkinElementFlags()); - m_backgroundValid = true; - } - return result; -} - bool QS60StylePrivate::isTouchSupported() { return bool(AknLayoutUtils::PenEnabled()); @@ -613,30 +593,11 @@ bool QS60StylePrivate::isToolBarBackground() return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2); } -void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, - const QBrush &brush) +QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) { - const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture()); - if (backgroundTexture.cacheKey() == brush.texture().cacheKey()) { - const QPaintDevice *target = painter->device(); - if (target->devType() == QInternal::Widget) { - const QWidget *widget = static_cast<const QWidget *>(target); - CCoeControl *control = widget->effectiveWinId(); - TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0); - const QRegion translated = rgn.translated(offset); - const QVector<QRect> &rects = translated.rects(); - for (int i = 0; i < rects.size(); ++i) { - const QRect rect(rects.at(i)); - painter->drawPixmap(rect.topLeft(), backgroundTexture, - rect.translated(globalPos.iX, globalPos.iY)); - } - } - } else { - const QRegion translated = rgn.translated(offset); - const QRect rect(translated.boundingRect()); - painter->setClipRegion(translated); - painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft()); - } + CCoeControl *control = targetWidget->effectiveWinId(); + TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0); + return QPoint(globalPos.iX, globalPos.iY); } QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL( @@ -959,7 +920,6 @@ QFont QS60StylePrivate::s60Font_specific( return result; } -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED void QS60StylePrivate::setActiveLayout() { const QSize activeScreenSize(screenSize()); @@ -975,7 +935,7 @@ void QS60StylePrivate::setActiveLayout() break; } } - + //not found, lets try without mirroring info if (activeLayoutIndex==-1){ for (int i=0; i<m_numberOfLayouts; i++) { @@ -999,19 +959,11 @@ void QS60StylePrivate::setActiveLayout() m_pmPointer = data[activeLayoutIndex]; } -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED QS60StylePrivate::QS60StylePrivate() { -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED // No need to set active layout, if dynamic metrics API is available setActiveLayout(); -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED -} - -QS60StylePrivate::~QS60StylePrivate() -{ - m_backgroundValid = false; } void QS60StylePrivate::setStyleProperty_specific(const char *name, const QVariant &value) @@ -1031,20 +983,6 @@ QVariant QS60StylePrivate::styleProperty_specific(const char *name) const return styleProperty(name); } -short QS60StylePrivate::pixelMetric(int metric) -{ -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED - Q_ASSERT(metric < MAX_PIXELMETRICS); - const short returnValue = m_pmPointer[metric]; - if (returnValue==-909) - return -1; - return returnValue; -#else - //todo - call the pixelmetrics API directly - return 0; -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED -} - QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list, int index, const QStyleOption *option) { @@ -1183,6 +1121,16 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, Skin return result; } +QPixmap QS60StylePrivate::backgroundTexture() +{ + if (!m_background) { + QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, + QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), SkinElementFlags()); + m_background = new QPixmap(background); + } + return *m_background; +} + // If the public SDK returns compressed images, please let us also uncompress those! void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap) { @@ -1352,10 +1300,8 @@ void QS60StyleModeSpecifics::colorGroupAndIndex( void QS60Style::handleDynamicLayoutVariantSwitch() { Q_D(QS60Style); - d->clearCaches(); -#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED + d->clearCaches(QS60StylePrivate::CC_LayoutChange); d->setActiveLayout(); -#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED d->refreshUI(); d->setBackgroundTexture(qApp); foreach (QWidget *widget, QApplication::allWidgets()) @@ -1365,7 +1311,7 @@ void QS60Style::handleDynamicLayoutVariantSwitch() void QS60Style::handleSkinChange() { Q_D(QS60Style); - d->clearCaches(); + d->clearCaches(QS60StylePrivate::CC_ThemeChange); d->setThemePalette(qApp); foreach (QWidget *topLevelWidget, QApplication::allWidgets()){ QEvent e(QEvent::StyleChange); diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index f10da2b..b6ad0ac 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -42,19 +42,6 @@ QS60StylePrivate::QS60StylePrivate() setCurrentLayout(0); } -QS60StylePrivate::~QS60StylePrivate() -{ -} - -short QS60StylePrivate::pixelMetric(int metric) -{ - Q_ASSERT(metric < MAX_PIXELMETRICS); - const short returnValue = m_pmPointer[metric]; - if (returnValue==-909) - return -1; - return returnValue; -} - QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list, int index, const QStyleOption *option) { @@ -193,24 +180,15 @@ QVariant QS60StylePrivate::styleProperty_specific(const char *name) const QPixmap QS60StylePrivate::backgroundTexture() { - static QPixmap result; - // Poor mans caching. + Making sure that there is always only one background image in memory at a time - -/* - TODO: 1) Hold the background QPixmap as pointer in a static class member. - Also add a deleteBackground() function and call that in ~QS60StylePrivate() - 2) Don't cache the background at all as soon as we have native pixmap support -*/ - - if (!m_backgroundValid) { - result = QPixmap(); - const QSize size = QApplication::activeWindow()?QApplication::activeWindow()->size():QSize(100, 100); - result = part(QS60StyleEnums::SP_QsnBgScreen, size); - m_backgroundValid = true; + if (!m_background) { + const QSize size = QApplication::desktop()->screen()->size(); + QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size); + m_background = new QPixmap(background); } - return result; + return *m_background; } + bool QS60StylePrivate::isTouchSupported() { #ifdef QT_KEYPAD_NAVIGATION @@ -225,7 +203,6 @@ bool QS60StylePrivate::isToolBarBackground() return true; } - QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize) { QFont result; @@ -289,7 +266,14 @@ void QS60Style::setS60Theme(const QHash<QString, QPicture> &parts, Q_D(QS60Style); QS60StyleModeSpecifics::m_partPictures = parts; QS60StyleModeSpecifics::m_colors = colors; - d->clearCaches(); + d->clearCaches(QS60StylePrivate::CC_ThemeChange); + d->setBackgroundTexture(qApp); +} + +QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) +{ + Q_UNUSED(targetWidget) + return QPoint(); } QT_END_NAMESPACE diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 9aa170e..050d81d 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -160,9 +160,8 @@ contains( styles, s60 ) { styles/qs60style.h \ styles/qs60style_p.h SOURCES += styles/qs60style.cpp - DEFINES += QT_S60STYLE_LAYOUTDATA_SIMULATED symbian { - SOURCES += styles/qs60style_symbian.cpp + SOURCES += styles/qs60style_s60.cpp # TODO: fix the following LIBS hack. Line 1 is for armv5, 2 for winscw LIBS += aknicon aknskins aknskinsrv fontutils LIBS += -laknicon -laknskins -laknskinsrv -lfontutils diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 4d316f6..930e8af 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -173,8 +173,7 @@ Q_GUI_EXPORT int qt_defaultDpiX() screen = subScreens.at(0); dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4))); #elif defined(Q_WS_S60) - const TReal inchWidth = (TReal)S60->screenWidthInTwips / KTwipsPerInch; - dpi = S60->screenWidthInPixels / inchWidth; + dpi = S60->defaultDpiX; #endif // Q_WS_X11 return dpi; @@ -202,8 +201,7 @@ Q_GUI_EXPORT int qt_defaultDpiY() screen = subScreens.at(0); dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4))); #elif defined(Q_WS_S60) - const TReal inchHeight = (TReal)S60->screenHeightInTwips / KTwipsPerInch; - dpi = S60->screenHeightInPixels / inchHeight; + dpi = S60->defaultDpiY; #endif // Q_WS_X11 return dpi; diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp index 347f89a..2bf1cda 100644 --- a/src/gui/widgets/qabstractspinbox.cpp +++ b/src/gui/widgets/qabstractspinbox.cpp @@ -659,7 +659,6 @@ void QAbstractSpinBox::setLineEdit(QLineEdit *lineEdit) d->edit->setParent(this); d->edit->setFrame(false); - d->edit->setAttribute(Qt::WA_InputMethodEnabled, false); d->edit->setFocusProxy(this); d->edit->setAcceptDrops(false); @@ -690,6 +689,18 @@ void QAbstractSpinBox::interpretText() d->interpret(EmitIfChanged); } +/* + Reimplemented in 4.6, so be careful. + */ +/*! + \reimp +*/ +QVariant QAbstractSpinBox::inputMethodQuery(Qt::InputMethodQuery query) const +{ + Q_D(const QAbstractSpinBox); + return d->edit->inputMethodQuery(query); +} + /*! \reimp */ diff --git a/src/gui/widgets/qabstractspinbox.h b/src/gui/widgets/qabstractspinbox.h index 4e7fc3f..aa8905f 100644 --- a/src/gui/widgets/qabstractspinbox.h +++ b/src/gui/widgets/qabstractspinbox.h @@ -122,6 +122,8 @@ public: void interpretText(); bool event(QEvent *event); + QVariant inputMethodQuery(Qt::InputMethodQuery) const; + virtual QValidator::State validate(QString &input, int &pos) const; virtual void fixup(QString &input) const; diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index 83bec68..4d34691 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -2390,6 +2390,7 @@ void QDateTimeEditPrivate::init(const QVariant &var) q->setCalendarPopup(true); #endif updateTimeSpec(); + q->setInputMethodHints(Qt::ImhPreferNumbers); setLayoutItemMargins(QStyle::SE_DateTimeEditLayoutItem); } diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index e563fa1..3d2c4f5 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -72,6 +72,11 @@ QT_BEGIN_NAMESPACE +static inline bool shouldEnableInputMethod(QPlainTextEdit *plaintextedit) +{ + return !plaintextedit->isReadOnly(); +} + class QPlainTextDocumentLayoutPrivate : public QAbstractTextDocumentLayoutPrivate { Q_DECLARE_PUBLIC(QPlainTextDocumentLayout) @@ -705,7 +710,8 @@ QPlainTextEditPrivate::QPlainTextEditPrivate() tabChangesFocus(false), lineWrap(QPlainTextEdit::WidgetWidth), wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), - topLine(0), pageUpDownLastCursorYIsValid(false) + clickCausedFocus(0),topLine(0), + pageUpDownLastCursorYIsValid(false) { showCursorOnInitialShow = true; backgroundVisible = false; @@ -1905,6 +1911,13 @@ void QPlainTextEdit::mouseReleaseEvent(QMouseEvent *e) d->autoScrollTimer.stop(); d->ensureCursorVisible(); } + + if (e->button() == Qt::LeftButton && qApp->autoSipEnabled() + && (!d->clickCausedFocus || qApp->autoSipOnMouseFocus())) { + QEvent event(QEvent::RequestSoftwareInputPanel); + QApplication::sendEvent(this, &event); + } + d->clickCausedFocus = 0; } /*! \reimp @@ -2038,6 +2051,9 @@ QVariant QPlainTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const void QPlainTextEdit::focusInEvent(QFocusEvent *e) { Q_D(QPlainTextEdit); + if (e->reason() == Qt::MouseFocusReason) { + d->clickCausedFocus = 1; + } QAbstractScrollArea::focusInEvent(e); d->sendControlEvent(e); } @@ -2304,7 +2320,7 @@ void QPlainTextEdit::setReadOnly(bool ro) } else { flags = Qt::TextEditorInteraction; } - setAttribute(Qt::WA_InputMethodEnabled, !ro); + setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); d->control->setTextInteractionFlags(flags); } diff --git a/src/gui/widgets/qplaintextedit_p.h b/src/gui/widgets/qplaintextedit_p.h index 0739d53..56a3aa9 100644 --- a/src/gui/widgets/qplaintextedit_p.h +++ b/src/gui/widgets/qplaintextedit_p.h @@ -91,7 +91,10 @@ public: return r; } inline QRectF cursorRect() { return cursorRect(textCursor()); } - void ensureCursorVisible() { textEdit->ensureCursorVisible(); } + void ensureCursorVisible() { + textEdit->ensureCursorVisible(); + emit microFocusChanged(); + } QPlainTextEdit *textEdit; @@ -148,6 +151,7 @@ public: uint backgroundVisible : 1; uint centerOnScroll : 1; uint inDrag : 1; + uint clickCausedFocus : 1; int topLine; diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp index c691eaf..295bf48 100644 --- a/src/gui/widgets/qspinbox.cpp +++ b/src/gui/widgets/qspinbox.cpp @@ -77,6 +77,8 @@ public: QChar thousand; inline void init() { + Q_Q(QSpinBox); + q->setInputMethodHints(Qt::ImhDigitsOnly); setLayoutItemMargins(QStyle::SE_SpinBoxLayoutItem); } }; @@ -97,6 +99,11 @@ public: // variables int decimals; QChar delimiter, thousand; + + inline void init() { + Q_Q(QDoubleSpinBox); + q->setInputMethodHints(Qt::ImhFormattedNumbersOnly); + } }; @@ -592,6 +599,8 @@ void QSpinBox::fixup(QString &input) const QDoubleSpinBox::QDoubleSpinBox(QWidget *parent) : QAbstractSpinBox(*new QDoubleSpinBoxPrivate(parent), parent) { + Q_D(QDoubleSpinBox); + d->init(); } /*! diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index 1c4df93..c1ec5c2 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -74,6 +74,10 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_TEXTEDIT +static inline bool shouldEnableInputMethod(QTextEdit *textedit) +{ + return !textedit->isReadOnly(); +} class QTextEditControl : public QTextControl { @@ -104,7 +108,7 @@ public: QTextEditPrivate::QTextEditPrivate() : control(0), autoFormatting(QTextEdit::AutoNone), tabChangesFocus(false), - lineWrap(QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0), + lineWrap(QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0), clickCausedFocus(0), wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere), textFormat(Qt::AutoText) { ignoreAutomaticScrollbarAdjustment = false; @@ -1559,6 +1563,12 @@ void QTextEdit::mouseReleaseEvent(QMouseEvent *e) d->autoScrollTimer.stop(); ensureCursorVisible(); } + if (e->button() == Qt::LeftButton && qApp->autoSipEnabled() + && (!d->clickCausedFocus || qApp->autoSipOnMouseFocus())) { + QEvent event(QEvent::RequestSoftwareInputPanel); + QApplication::sendEvent(this, &event); + } + d->clickCausedFocus = 0; } /*! \reimp @@ -1694,6 +1704,9 @@ QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const void QTextEdit::focusInEvent(QFocusEvent *e) { Q_D(QTextEdit); + if (e->reason() == Qt::MouseFocusReason) { + d->clickCausedFocus = 1; + } QAbstractScrollArea::focusInEvent(e); d->sendControlEvent(e); } @@ -2058,7 +2071,7 @@ void QTextEdit::setReadOnly(bool ro) } else { flags = Qt::TextEditorInteraction; } - setAttribute(Qt::WA_InputMethodEnabled, !ro); + setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this)); d->control->setTextInteractionFlags(flags); } diff --git a/src/gui/widgets/qtextedit_p.h b/src/gui/widgets/qtextedit_p.h index 3c37868..594174a 100644 --- a/src/gui/widgets/qtextedit_p.h +++ b/src/gui/widgets/qtextedit_p.h @@ -123,6 +123,7 @@ public: uint preferRichText : 1; uint showCursorOnInitialShow : 1; uint inDrag : 1; + uint clickCausedFocus : 1; // Qt3 COMPAT only, for setText Qt::TextFormat textFormat; diff --git a/src/plugins/s60/src/qdesktopservices_3_2.cpp b/src/plugins/s60/src/qdesktopservices_3_2.cpp index e563c14..679b370 100644 --- a/src/plugins/s60/src/qdesktopservices_3_2.cpp +++ b/src/plugins/s60/src/qdesktopservices_3_2.cpp @@ -10,10 +10,12 @@ ****************************************************************************/ #include <private/qcore_symbian_p.h> -#include <cdirectorylocalizer.h> // CDirectoryLocalizer #include <qstring.h> #include <qdir.h> +#include <e32base.h> // CBase -> Required by cdirectorylocalizer.h +#include <cdirectorylocalizer.h> // CDirectoryLocalizer + EXPORT_C QString localizedDirectoryName(QString& rawPath) { QString ret; diff --git a/src/plugins/s60/src/qlocale_3_2.cpp b/src/plugins/s60/src/qlocale_3_2.cpp index 027eefc..fe1d642 100644 --- a/src/plugins/s60/src/qlocale_3_2.cpp +++ b/src/plugins/s60/src/qlocale_3_2.cpp @@ -10,6 +10,7 @@ ****************************************************************************/ #include <e32std.h> +#include <e32base.h> EXPORT_C TPtrC defaultGetLongDateFormatSpec(TExtendedLocale& locale) { diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp index c3aca7a..0395ca0 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp @@ -92,7 +92,6 @@ //TESTED_CLASS= //TESTED_FILES= -const char * const lupinellaIp = "10.3.4.6"; class tst_QHostInfo : public QObject { diff --git a/tests/auto/qlibrary/qlibrary.pro b/tests/auto/qlibrary/qlibrary.pro index 9ba49ee..fd5790b 100644 --- a/tests/auto/qlibrary/qlibrary.pro +++ b/tests/auto/qlibrary/qlibrary.pro @@ -1,9 +1,16 @@ QT -= gui TEMPLATE = subdirs CONFIG += ordered -SUBDIRS = lib \ - lib2 \ - tst + +symbian: { +# Can't build two versions of lib with same name in symbian, so just build one +SUBDIRS = lib2 \ + tst +} else { +SUBDIRS = lib \ + lib2 \ + tst +} TARGET = tst_qlibrary # no special install rule for subdir diff --git a/tests/auto/qlocalsocket/lackey/lackey.pro b/tests/auto/qlocalsocket/lackey/lackey.pro index 7460d8c..f073e7a 100644 --- a/tests/auto/qlocalsocket/lackey/lackey.pro +++ b/tests/auto/qlocalsocket/lackey/lackey.pro @@ -15,4 +15,4 @@ DEFINES += QLOCALSOCKET_DEBUG SOURCES += main.cpp TARGET = lackey - +symbian:TARGET.CAPABILITY = ALL -TCB
\ No newline at end of file diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro index c58bfee..b3f0a69 100644 --- a/tests/auto/qlocalsocket/test/test.pro +++ b/tests/auto/qlocalsocket/test/test.pro @@ -3,7 +3,7 @@ load(qttest_p4) DEFINES += QLOCALSERVER_DEBUG DEFINES += QLOCALSOCKET_DEBUG -symbian* { +symbian { # nothing } else:wince* { DEFINES += QT_LOCALSOCKET_TCP @@ -34,5 +34,6 @@ wince* | symbian* { scriptFiles.path = lackey/scripts DEPLOYMENT = additionalFiles scriptFiles QT += script # for easy deployment of QtScript + DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x","")) } diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index b272716..97058d3 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -53,7 +53,9 @@ //TESTED_CLASS=QLocalServer, QLocalSocket //TESTED_FILES=network/socket/qlocalserver.cpp network/socket/qlocalsocket.cpp #ifdef Q_OS_SYMBIAN - #define SRCDIR "" + #define STRINGIFY(x) #x + #define TOSTRING(x) STRINGIFY(x) + #define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/" #endif Q_DECLARE_METATYPE(QLocalSocket::LocalSocketError) Q_DECLARE_METATYPE(QLocalSocket::LocalSocketState) diff --git a/tests/auto/qpen/tst_qpen.cpp b/tests/auto/qpen/tst_qpen.cpp index 0327629..4fc19c4 100644 --- a/tests/auto/qpen/tst_qpen.cpp +++ b/tests/auto/qpen/tst_qpen.cpp @@ -111,22 +111,22 @@ void tst_QPen::operator_eq_eq_data() QTest::newRow("differentColor") << QPen(Qt::red) << QPen(Qt::blue) - << FALSE; + << bool(FALSE); QTest::newRow("differentWidth") << QPen(Qt::red, 2) << QPen(Qt::red, 3) - << FALSE; + << bool(FALSE); QTest::newRow("differentPenStyle") << QPen(Qt::red, 2, Qt::DashLine) << QPen(Qt::red, 2, Qt::DotLine) - << FALSE; + << bool(FALSE); QTest::newRow("differentCapStyle") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) << QPen(Qt::red, 2, Qt::DashLine, Qt::SquareCap, Qt::BevelJoin) - << FALSE; + << bool(FALSE); QTest::newRow("differentJoinStyle") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::MiterJoin) - << FALSE; + << bool(FALSE); QTest::newRow("same") << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) << QPen(Qt::red, 2, Qt::DashLine, Qt::RoundCap, Qt::BevelJoin) - << TRUE; + << bool(TRUE); } diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index 2610af9..8101708 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -1623,12 +1623,10 @@ void tst_QProcess::spaceArgsTest() //----------------------------------------------------------------------------- void tst_QProcess::exitCodeTest() { -#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86) - // WINSCW builds in Symbian panic somewhere deep inside Symbian codes - // when eventdispather is deleted if too many test iterations are used. - // Reason for this is unclear. - // TODO: Remove special case when eventdispatcher is fixed. - for (int i = 0; i < 25; ++i) { +#if defined(Q_OS_SYMBIAN) + // Kernel will run out of process handles on some hw, as there is some + // delay before they are recycled, so limit the amount of processes. + for (int i = 0; i < 50; ++i) { #else for (int i = 0; i < 255; ++i) { #endif diff --git a/tests/auto/qresourceengine/qresourceengine.pro b/tests/auto/qresourceengine/qresourceengine.pro index f487b97..d98c2db 100644 --- a/tests/auto/qresourceengine/qresourceengine.pro +++ b/tests/auto/qresourceengine/qresourceengine.pro @@ -9,7 +9,11 @@ load(resources) SOURCES += tst_resourceengine.cpp RESOURCES += testqrc/test.qrc -runtime_resource.target = $$PWD/runtime_resource.rcc +symbian-sbsv2 { + runtime_resource.target = $$PWD/runtime_resource.rcc +} else { + runtime_resource.target = runtime_resource.rcc +} runtime_resource.depends = $$PWD/testqrc/test.qrc runtime_resource.commands = $$QMAKE_RCC -root /runtime_resource/ -binary $${runtime_resource.depends} -o $${runtime_resource.target} QMAKE_EXTRA_TARGETS = runtime_resource diff --git a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro index 9e35801..9976bb2 100644 --- a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro +++ b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro @@ -2,10 +2,10 @@ load(qttest_p4) QT = core script SOURCES += tst_qscriptv8testsuite.cpp -wince*: { +wince*|symbian: { testFiles.sources = tests testFiles.path = . DEPLOYMENT += testFiles } - +symbian:TARGET.EPOCHEAPSIZE = 0x00020000 0x02000000 diff --git a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp index 435af41..5811938 100644 --- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp +++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp @@ -256,6 +256,11 @@ tst_Suite::tst_Suite() addTestExclusion("mul-exhaustive", "Demands too much memory on WinCE"); #endif +#ifdef Q_OS_SYMBIAN + addTestExclusion("nested-repetition-count-overflow", "Demands too much memory on Symbian"); + addTestExclusion("unicode-test", "Demands too much memory on Symbian"); +#endif + QVector<uint> *data = qt_meta_data_tst_Suite(); // content: *data << 1 // revision diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 66cf81f..4fa3dc4 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -1058,7 +1058,6 @@ void tst_QSqlDatabase::recordMySQL() specifically: Before MySQL 5.0.15, the pad value is space. Values are right-padded with space on insert, and trailing spaces are removed on select. */ -#ifdef QT3_SUPPORT if ( major >5 || ( major == 5 && minor > 0) || ( major == 5 && minor == 0 && revision >= 15) ) { bin10 = FieldDef("binary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abc "))); varbin10 = FieldDef("varbinary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abcv "))); diff --git a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro index 6acb0b4..7babe25 100644 --- a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro +++ b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro @@ -1,14 +1,4 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Wed Apr 26 13:53:24 2006 -###################################################################### - -TEMPLATE = app -TARGET = tst_qstylesheetstyle -DEPENDPATH += . -INCLUDEPATH += . .. - -CONFIG += console qtestlib -contains(QT_CONFIG, qt3support): QT += qt3support +load(qttest_p4) # Input SOURCES += tst_qstylesheetstyle.cpp diff --git a/tests/auto/qtemporaryfile/qtemporaryfile.pro b/tests/auto/qtemporaryfile/qtemporaryfile.pro index bde990a..a3a3910 100644 --- a/tests/auto/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/qtemporaryfile/qtemporaryfile.pro @@ -2,4 +2,4 @@ load(qttest_p4) SOURCES += tst_qtemporaryfile.cpp QT = core -DEFINES += SRCDIR=\\\"$$PWD/\\\" +!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index 543a116..b9f1cc5 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -59,6 +59,10 @@ # include <unistd.h> // close(2) #endif +#ifdef Q_OS_SYMBIAN +#define SRCDIR "" +#endif + //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 0051a9b..694ea33 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -146,6 +146,13 @@ void tst_QTimer::singleShotTimeout() QCOMPARE(helper.count, 1); } +#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86) +// Increase wait as emulator startup can cause unexpected delays +#define TIMEOUT_TIMEOUT 2000 +#else +#define TIMEOUT_TIMEOUT 200 +#endif + void tst_QTimer::timeout() { TimerHelper helper; @@ -156,11 +163,11 @@ void tst_QTimer::timeout() QCOMPARE(helper.count, 0); - QTest::qWait(200); + QTest::qWait(TIMEOUT_TIMEOUT); QVERIFY(helper.count > 0); int oldCount = helper.count; - QTest::qWait(200); + QTest::qWait(TIMEOUT_TIMEOUT); QVERIFY(helper.count > oldCount); } @@ -391,29 +398,38 @@ void tst_QTimer::deleteLaterOnQTimer() QVERIFY(pointer.isNull()); } +#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86) +// Increase wait as emulator startup can cause unexpected delays +#define MOVETOTHREAD_TIMEOUT 200 +#define MOVETOTHREAD_WAIT 5000 +#else +#define MOVETOTHREAD_TIMEOUT 200 +#define MOVETOTHREAD_WAIT 300 +#endif + void tst_QTimer::moveToThread() { QTimer ti1; QTimer ti2; - ti1.start(200); - ti2.start(200); + ti1.start(MOVETOTHREAD_TIMEOUT); + ti2.start(MOVETOTHREAD_TIMEOUT); QVERIFY((ti1.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff)); QThread tr; ti1.moveToThread(&tr); connect(&ti1,SIGNAL(timeout()), &tr, SLOT(quit())); tr.start(); QTimer ti3; - ti3.start(200); + ti3.start(MOVETOTHREAD_TIMEOUT); QVERIFY((ti3.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff)); QVERIFY((ti3.timerId() & 0xffffff) != (ti1.timerId() & 0xffffff)); - QTest::qWait(300); + QTest::qWait(MOVETOTHREAD_WAIT); QVERIFY(tr.wait()); ti2.stop(); QTimer ti4; - ti4.start(200); + ti4.start(MOVETOTHREAD_TIMEOUT); ti3.stop(); - ti2.start(200); - ti3.start(200); + ti2.start(MOVETOTHREAD_TIMEOUT); + ti3.start(MOVETOTHREAD_TIMEOUT); QVERIFY((ti4.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff)); QVERIFY((ti3.timerId() & 0xffffff) != (ti2.timerId() & 0xffffff)); QVERIFY((ti3.timerId() & 0xffffff) != (ti1.timerId() & 0xffffff)); @@ -533,4 +549,4 @@ void tst_QTimer::timerFiresOnlyOncePerProcessEvents() QTEST_MAIN(tst_QTimer) #include "tst_qtimer.moc" -\ + diff --git a/tests/auto/qtwidgets/tst_qtwidgets.cpp b/tests/auto/qtwidgets/tst_qtwidgets.cpp index a6a3be1..6a79242 100644 --- a/tests/auto/qtwidgets/tst_qtwidgets.cpp +++ b/tests/auto/qtwidgets/tst_qtwidgets.cpp @@ -47,15 +47,28 @@ #include "mainwindow.h" +#include "../network-settings.h" class tst_QtWidgets: public QObject { Q_OBJECT +public: + tst_QtWidgets(); + virtual ~tst_QtWidgets(); + private slots: void snapshot(); }; +tst_QtWidgets::tst_QtWidgets() +{ + Q_SET_DEFAULT_IAP +} + +tst_QtWidgets::~tst_QtWidgets() +{ +} void tst_QtWidgets::snapshot() { diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index a879e5d..40caff0 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1405,7 +1405,7 @@ void Configure::applySpecSpecifics() dictionary[ "QT3SUPPORT" ] = "no"; dictionary[ "OPENGL" ] = "no"; dictionary[ "OPENSSL" ] = "no"; - dictionary[ "STL" ] = "no"; + dictionary[ "STL" ] = "yes"; dictionary[ "EXCEPTIONS" ] = "no"; dictionary[ "RTTI" ] = "no"; dictionary[ "ARCHITECTURE" ] = "symbian"; |