summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure7
-rw-r--r--demos/demos.pro21
-rw-r--r--doc/src/examples/fademessage.qdoc10
-rw-r--r--doc/src/frameworks-technologies/dnd.qdoc9
-rw-r--r--doc/src/getting-started/examples.qdoc16
-rw-r--r--doc/src/modules.qdoc91
-rw-r--r--doc/src/objectmodel/signalsandslots.qdoc39
-rw-r--r--examples/multimedia/audiodevices/audiodevices.cpp81
-rw-r--r--examples/multimedia/audiodevices/audiodevices.h6
-rw-r--r--examples/multimedia/audiodevices/audiodevices.pro2
-rw-r--r--examples/multimedia/audiodevices/audiodevicesbase.ui64
-rw-r--r--examples/webkit/fancybrowser/main.cpp4
-rw-r--r--examples/webkit/googlechat/main.cpp4
-rw-r--r--examples/webkit/previewer/main.cpp4
-rw-r--r--mkspecs/features/unix/separate_debug_info.prf2
-rw-r--r--mkspecs/hpux-g++-64/qmake.conf4
-rw-r--r--mkspecs/hpux-g++-64/qplatformdefs.h2
-rw-r--r--mkspecs/unsupported/linux-host-g++/qmake.conf2
-rw-r--r--qmake/generators/symbian/symmake_abld.cpp24
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.cpp2
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp4
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h3
-rw-r--r--src/3rdparty/easing/easing.cpp22
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp4
-rw-r--r--src/corelib/io/qtextstream.cpp9
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp5
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib_p.h2
-rw-r--r--src/corelib/kernel/qmath.h154
-rw-r--r--src/corelib/kernel/qmetaobject.cpp1
-rw-r--r--src/corelib/kernel/qobject.cpp43
-rw-r--r--src/corelib/thread/qthread_unix.cpp4
-rw-r--r--src/corelib/tools/qline.cpp4
-rw-r--r--src/corelib/tools/qlocale.cpp8
-rw-r--r--src/dbus/qdbuspendingcall.cpp2
-rw-r--r--src/dbus/qdbuspendingreply.h1
-rw-r--r--src/gui/dialogs/qcolordialog_mac.mm35
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm4
-rw-r--r--src/gui/dialogs/qmessagebox.cpp17
-rw-r--r--src/gui/effects/qgraphicseffect.cpp26
-rw-r--r--src/gui/effects/qgraphicseffect_p.h11
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp29
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp7
-rw-r--r--src/gui/graphicsview/qgridlayoutengine.cpp3
-rw-r--r--src/gui/image/qpixmap_s60.cpp103
-rw-r--r--src/gui/image/qpixmap_s60_p.h6
-rw-r--r--src/gui/image/qpixmapfilter.cpp364
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp28
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h1
-rw-r--r--src/gui/kernel/qapplication.cpp46
-rw-r--r--src/gui/kernel/qapplication_s60.cpp170
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm2
-rw-r--r--src/gui/kernel/qevent.cpp8
-rw-r--r--src/gui/kernel/qgesturemanager.cpp42
-rw-r--r--src/gui/kernel/qgesturemanager_p.h4
-rw-r--r--src/gui/kernel/qguieventdispatcher_glib.cpp2
-rw-r--r--src/gui/kernel/qt_s60_p.h14
-rw-r--r--src/gui/painting/qbezier.cpp20
-rw-r--r--src/gui/painting/qdrawhelper.cpp12
-rw-r--r--src/gui/painting/qmemrotate.cpp21
-rw-r--r--src/gui/painting/qmemrotate_p.h2
-rw-r--r--src/gui/painting/qpathclipper.cpp2
-rw-r--r--src/gui/painting/qstroker.cpp4
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp8
-rw-r--r--src/gui/styles/qcommonstyle.cpp2
-rw-r--r--src/gui/styles/qs60style.cpp106
-rw-r--r--src/gui/styles/qs60style_p.h11
-rw-r--r--src/gui/styles/qs60style_s60.cpp121
-rw-r--r--src/gui/styles/qs60style_simulated.cpp5
-rw-r--r--src/gui/styles/qstylehelper.cpp2
-rw-r--r--src/gui/text/qfontdatabase.cpp14
-rw-r--r--src/gui/text/qfontengine_mac.mm8
-rw-r--r--src/gui/util/qsystemtrayicon_win.cpp21
-rw-r--r--src/gui/widgets/qabstractspinbox.cpp67
-rw-r--r--src/gui/widgets/qabstractspinbox_p.h3
-rw-r--r--src/gui/widgets/qcombobox.cpp5
-rw-r--r--src/gui/widgets/qdial.cpp3
-rw-r--r--src/gui/widgets/qlineedit.h1
-rw-r--r--src/gui/widgets/qlineedit_p.cpp20
-rw-r--r--src/gui/widgets/qlineedit_p.h2
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm3
-rw-r--r--src/gui/widgets/qplaintextedit.cpp1
-rw-r--r--src/gui/widgets/qtextedit.cpp2
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp4
-rw-r--r--src/opengl/gl2paintengineex/qglcustomshaderstage_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h3
-rw-r--r--src/opengl/qgl.cpp58
-rw-r--r--src/opengl/qgl.h1
-rw-r--r--src/opengl/qgl_egl.cpp34
-rw-r--r--src/opengl/qgl_p.h1
-rw-r--r--src/opengl/qgl_x11egl.cpp48
-rw-r--r--src/opengl/qglframebufferobject.cpp6
-rw-r--r--src/opengl/qglpixmapfilter.cpp754
-rw-r--r--src/openvg/openvg.pro6
-rw-r--r--src/openvg/qpaintengine_vg.cpp16
-rw-r--r--src/openvg/qpixmapdata_vg.cpp92
-rw-r--r--src/openvg/qpixmapdata_vg_p.h17
-rw-r--r--src/openvg/qpixmapfilter_vg.cpp25
-rw-r--r--src/openvg/qvgimagepool.cpp215
-rw-r--r--src/openvg/qvgimagepool_p.h157
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp4
-rw-r--r--src/s60installs/bwins/QtGuiu.def19
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp4
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp23
-rw-r--r--src/svg/qsvghandler.cpp16
-rw-r--r--src/svg/qsvgstyle.cpp4
-rw-r--r--src/tools/moc/generator.cpp11
-rw-r--r--tests/auto/moc/tst_moc.cpp35
-rw-r--r--tests/auto/qabstractitemview/tst_qabstractitemview.cpp23
-rw-r--r--tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp25
-rw-r--r--tests/auto/qdbusreply/tst_qdbusreply.cpp16
-rw-r--r--tests/auto/qfile/tst_qfile.cpp75
-rw-r--r--tests/auto/qgl/tst_qgl.cpp19
-rw-r--r--tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp49
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp20
-rw-r--r--tests/auto/qobject/tst_qobject.cpp144
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp6
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp6
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp24
-rw-r--r--tests/auto/selftests/tst_selftests.cpp6
-rw-r--r--tests/benchmarks/containers-sequential/main.cpp17
-rw-r--r--tests/benchmarks/events/main.cpp15
-rw-r--r--tests/benchmarks/qbytearray/main.cpp5
-rw-r--r--tests/benchmarks/qdiriterator/main.cpp10
-rwxr-xr-xtests/benchmarks/qdiriterator/qdiriterator.pro2
-rw-r--r--tests/benchmarks/qfile/main.cpp58
-rw-r--r--tests/benchmarks/qgraphicsview/qgraphicsview.pro8
-rw-r--r--tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp238
-rw-r--r--tests/benchmarks/qstringlist/qstringlist.pro2
-rw-r--r--tests/benchmarks/qstylesheetstyle/main.cpp19
-rw-r--r--tools/qdoc3/generator.cpp45
-rw-r--r--tools/qdoc3/generator.h2
-rw-r--r--tools/qdoc3/htmlgenerator.cpp4
-rw-r--r--util/s60pixelmetrics/pm_mapper.hrh9
-rw-r--r--util/s60pixelmetrics/pm_mapper.rss4
-rw-r--r--util/s60pixelmetrics/pm_mapperapp.cpp138
-rw-r--r--util/s60pixelmetrics/pm_mapperapp.h14
-rw-r--r--util/s60pixelmetrics/pm_mapperview.cpp12
-rw-r--r--util/s60pixelmetrics/pm_mapperview.h2
138 files changed, 2887 insertions, 1733 deletions
diff --git a/configure b/configure
index 1b1799c..2114863 100755
--- a/configure
+++ b/configure
@@ -727,6 +727,7 @@ CFG_PTMALLOC=no
CFG_STL=auto
CFG_PRECOMPILE=auto
CFG_SEPARATE_DEBUG_INFO=auto
+CFG_SEPARATE_DEBUG_INFO_NOCOPY=no
CFG_REDUCE_EXPORTS=auto
CFG_MMX=auto
CFG_3DNOW=auto
@@ -1558,6 +1559,9 @@ while [ "$#" -gt 0 ]; do
separate-debug-info)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_SEPARATE_DEBUG_INFO="$VAL"
+ elif [ "$VAL" = "nocopy" ] ; then
+ CFG_SEPARATE_DEBUG_INFO="yes"
+ CFG_SEPARATE_DEBUG_INFO_NOCOPY="yes"
else
UNKNOWN_OPT=yes
fi
@@ -6112,6 +6116,9 @@ if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
QMakeVar add QMAKE_CXXFLAGS -g
QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info"
fi
+if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
+ QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info_nocopy"
+fi
[ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
[ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
[ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
diff --git a/demos/demos.pro b/demos/demos.pro
index a943bfd..5a9b6db 100644
--- a/demos/demos.pro
+++ b/demos/demos.pro
@@ -20,7 +20,24 @@ symbian: SUBDIRS = \
demos_shared \
demos_deform \
demos_pathstroke
-
+
+wince*: SUBDIRS = \
+ demos_shared \
+ demos_deform \
+ demos_gradients \
+ demos_pathstroke \
+ demos_affine \
+ demos_composition \
+ demos_books \
+ demos_interview \
+ demos_mainwindow \
+ demos_spreadsheet \
+ demos_textedit \
+ # demos_chip \
+ demos_embeddeddialogs \
+ demos_undo \
+ demos_sub-attaq
+
contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles1cl):!contains(QT_CONFIG, opengles2):{
SUBDIRS += demos_boxes
}
@@ -33,7 +50,7 @@ wince*|symbian|embedded|x11: SUBDIRS += embedded
!cross_compile:{
contains(QT_BUILD_PARTS, tools):{
!wince*:SUBDIRS += demos_sqlbrowser demos_qtdemo
-wince*: SUBDIRS += demos_sqlbrowser
+wince*:SUBDIRS += demos_sqlbrowser
}
}
contains(QT_CONFIG, phonon):!static:SUBDIRS += demos_mediaplayer
diff --git a/doc/src/examples/fademessage.qdoc b/doc/src/examples/fademessage.qdoc
index ecea095..6063fa7 100644
--- a/doc/src/examples/fademessage.qdoc
+++ b/doc/src/examples/fademessage.qdoc
@@ -43,5 +43,13 @@
\example effects/fademessage
\title Fade Message Effect Example
- \image fademessageeffect-example.png
+ \raw HTML
+ <div style="text-align: center">
+ \endraw
+ \inlineimage fademessageeffect-example.png
+ \inlineimage fademessageeffect-example-faded.png
+ \raw HTML
+ </div>
+ \endraw
+
*/
diff --git a/doc/src/frameworks-technologies/dnd.qdoc b/doc/src/frameworks-technologies/dnd.qdoc
index a7b1622..65fddfb 100644
--- a/doc/src/frameworks-technologies/dnd.qdoc
+++ b/doc/src/frameworks-technologies/dnd.qdoc
@@ -426,6 +426,7 @@
\legalese
Copyright 1996 Daniel Dardailler.
+ Copyright 1999 Matt Koss
Permission to use, copy, modify, distribute, and sell this software
for any purpose is hereby granted without fee, provided that the above
@@ -436,13 +437,11 @@
written prior permission. Daniel Dardailler makes no representations
about the suitability of this software for any purpose. It is
provided "as is" without express or implied warranty.
-
- Modifications Copyright 1999 Matt Koss, under the same license as
- above.
\endlegalese
- \omit NOTE: The copyright notice is from qmotifdnd_x11.cpp. \endomit
+ \omit NOTE: The original version of this copyright notice can be found
+ in qmotifdnd_x11.cpp. \endomit
- Note: The Motif Drag \& Drop Protocol only allows receivers to
+ \note The Motif Drag \& Drop Protocol only allows receivers to
request data in response to a QDropEvent. If you attempt to
request data in response to e.g. a QDragMoveEvent, an empty
QByteArray is returned.
diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc
index f0a6799..2d4f5c9 100644
--- a/doc/src/getting-started/examples.qdoc
+++ b/doc/src/getting-started/examples.qdoc
@@ -546,6 +546,14 @@
\o \l{graphicsview/portedcanvas}{Ported Canvas}
\endlist
+ Some examples demonstrate the use of graphics effects with canvas items.
+
+ \list
+ \o \l{effects/blurpicker}{Blur Picker Effect}
+ \o \l{effects/fademessage}{Fade Message Effect}
+ \o \l{effects/lighting}{Lighting Effect}
+ \endlist
+
Examples marked with an asterisk (*) are fully documented.
*/
@@ -851,11 +859,13 @@
\section1 Multimedia
- Qt provides low-level audio support on linux,windows and mac platforms by default and
- an audio plugin API to allow developers to implement there own audio support for
+ Qt provides low-level audio support on Linux, Windows and Mac OS X by default and
+ an audio plugin API to allow developers to implement their own audio support for
custom devices and platforms.
- These examples demonstrate the basic techniques used to take advantage of
+ \section1 Audio Handling
+
+ These examples demonstrate the basic techniques used to take advantage of the
Audio API in Qt applications.
\list
diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc
index 3058b84..5e759db 100644
--- a/doc/src/modules.qdoc
+++ b/doc/src/modules.qdoc
@@ -409,59 +409,58 @@
*/
/*!
- \module QtSvg
- \title QtSvg Module
- \since 4.1
- \contentspage All Qt Modules
- \previouspage QtSql
- \nextpage QtWebKit
- \ingroup modules
+ \module QtSvg
+ \title QtSvg Module
+ \since 4.1
+ \contentspage All Qt Modules
+ \previouspage QtSql
+ \nextpage QtWebKit
+ \ingroup modules
- \brief The QtSvg module provides classes for displaying the contents of SVG
- files.
+ \brief The QtSvg module provides classes for displaying and creating SVG files.
- To include the definitions of the module's classes, use the
- following directive:
+ To include the definitions of the module's classes, use the
+ following directive:
- \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 0
+ \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 0
- To link against the module, add this line to your \l qmake \c
- .pro file:
+ To link against the module, add this line to your \l qmake \c
+ .pro file:
- \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 1
+ \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 1
- The QtSvg module is part of the \l{Qt Full Framework Edition} and the
- \l{Open Source Versions of Qt}.
+ The QtSvg module is part of the \l{Qt Full Framework Edition} and the
+ \l{Open Source Versions of Qt}.
- \section1 License Information
-
- Some code for arc handling in this module is derived from code with
- the following license:
-
- \legalese
- Copyright 2002 USC/Information Sciences Institute
-
- Permission to use, copy, modify, distribute, and sell this software
- and its documentation for any purpose is hereby granted without
- fee, provided that the above copyright notice appear in all copies
- and that both that copyright notice and this permission notice
- appear in supporting documentation, and that the name of
- Information Sciences Institute not be used in advertising or
- publicity pertaining to distribution of the software without
- specific, written prior permission. Information Sciences Institute
- makes no representations about the suitability of this software for
- any purpose. It is provided "as is" without express or implied
- warranty.
-
- INFORMATION SCIENCES INSTITUTE DISCLAIMS ALL WARRANTIES WITH REGARD
- TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL INFORMATION SCIENCES
- INSTITUTE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
- OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- \endlegalese
+ \section1 License Information
+
+ Some code for arc handling in this module is derived from code with
+ the following license:
+
+ \legalese
+ Copyright 2002 USC/Information Sciences Institute
+
+ Permission to use, copy, modify, distribute, and sell this software
+ and its documentation for any purpose is hereby granted without
+ fee, provided that the above copyright notice appear in all copies
+ and that both that copyright notice and this permission notice
+ appear in supporting documentation, and that the name of
+ Information Sciences Institute not be used in advertising or
+ publicity pertaining to distribution of the software without
+ specific, written prior permission. Information Sciences Institute
+ makes no representations about the suitability of this software for
+ any purpose. It is provided "as is" without express or implied
+ warranty.
+
+ INFORMATION SCIENCES INSTITUTE DISCLAIMS ALL WARRANTIES WITH REGARD
+ TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL INFORMATION SCIENCES
+ INSTITUTE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
+ OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE.
+ \endlegalese
*/
/*!
diff --git a/doc/src/objectmodel/signalsandslots.qdoc b/doc/src/objectmodel/signalsandslots.qdoc
index 9515904..d5e3280 100644
--- a/doc/src/objectmodel/signalsandslots.qdoc
+++ b/doc/src/objectmodel/signalsandslots.qdoc
@@ -376,6 +376,45 @@
Some irrelevant member functions have been omitted from this
example.
+ \section1 Signals And Slots With Default Arguments
+
+ The signatures of signals and slots may contain arguments, and the
+ arguments can have defualt values. Consider QObject::destroyed():
+
+ \code
+ void destroyed(QObject* = 0);
+ \endcode
+
+ When a QObject is deleted, it emits this QObject::destroyed()
+ signal. We want to catch this signal, wherever we might have a
+ dangling reference to the deleted QObject, so we can clean it up.
+ A suitable slot signature might be:
+
+ \code
+ void objectDestroyed(QObject* obj = 0);
+ \endcode
+
+ To connect the signal to the slot, we use QObject::connect() and
+ the \c{SIGNAL()} and \c{SLOT()} macros. The rule about whether to
+ include arguments or not in the \c{SIGNAL()} and \c{SLOT()}
+ macros, if the arguments have default values, is that the
+ signature passed to the \c{SIGNAL()} macro must \e not have fewer
+ arguments than the signature passed to the \c{SLOT()} macro.
+
+ All of these would work:
+ \code
+ connect(sender, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(Qbject*)));
+ connect(sender, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed()));
+ connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed()));
+ \endcode
+ But this one won't work:
+ \code
+ connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed(QObject*)));
+ \endcode
+
+ ...because the slot will be expecting a QObject that the signal
+ will not send. This connection will report a runtime error.
+
\section1 Advanced Signals and Slots Usage
For cases where you may require information on the sender of the
diff --git a/examples/multimedia/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp
index e205e03..45c7a53 100644
--- a/examples/multimedia/audiodevices/audiodevices.cpp
+++ b/examples/multimedia/audiodevices/audiodevices.cpp
@@ -40,45 +40,33 @@
****************************************************************************/
-#include <QDebug>
#include <QAudioDeviceInfo>
#include "audiodevices.h"
-AudioDevicesBase::AudioDevicesBase( QMainWindow *parent, Qt::WFlags f )
+AudioDevicesBase::AudioDevicesBase(QWidget *parent, Qt::WFlags f)
+ : QMainWindow(parent, f)
{
- Q_UNUSED(parent)
- Q_UNUSED(f)
- setupUi( this );
+ setupUi(this);
}
AudioDevicesBase::~AudioDevicesBase() {}
-AudioTest::AudioTest( QMainWindow *parent, Qt::WFlags f )
- : AudioDevicesBase( parent, f )
+AudioTest::AudioTest(QWidget *parent, Qt::WFlags f)
+ : AudioDevicesBase(parent, f)
{
- nearestFreq->setDisabled(true);
- nearestChannel->setDisabled(true);
- nearestCodec->setDisabled(true);
- nearestSampleSize->setDisabled(true);
- nearestSampleType->setDisabled(true);
- nearestEndian->setDisabled(true);
- logOutput->setDisabled(true);
-
mode = QAudio::AudioOutput;
- modeBox->addItem("Input");
- modeBox->addItem("Output");
- connect(testButton,SIGNAL(clicked()),SLOT(test()));
- connect(modeBox,SIGNAL(activated(int)),SLOT(modeChanged(int)));
- connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
- connect(frequencyBox,SIGNAL(activated(int)),SLOT(freqChanged(int)));
- connect(channelsBox,SIGNAL(activated(int)),SLOT(channelChanged(int)));
- connect(codecsBox,SIGNAL(activated(int)),SLOT(codecChanged(int)));
- connect(sampleSizesBox,SIGNAL(activated(int)),SLOT(sampleSizeChanged(int)));
- connect(sampleTypesBox,SIGNAL(activated(int)),SLOT(sampleTypeChanged(int)));
- connect(endianBox,SIGNAL(activated(int)),SLOT(endianChanged(int)));
+ connect(testButton, SIGNAL(clicked()), SLOT(test()));
+ connect(modeBox, SIGNAL(activated(int)), SLOT(modeChanged(int)));
+ connect(deviceBox, SIGNAL(activated(int)), SLOT(deviceChanged(int)));
+ connect(frequencyBox, SIGNAL(activated(int)), SLOT(freqChanged(int)));
+ connect(channelsBox, SIGNAL(activated(int)), SLOT(channelChanged(int)));
+ connect(codecsBox, SIGNAL(activated(int)), SLOT(codecChanged(int)));
+ connect(sampleSizesBox, SIGNAL(activated(int)), SLOT(sampleSizeChanged(int)));
+ connect(sampleTypesBox, SIGNAL(activated(int)), SLOT(sampleTypeChanged(int)));
+ connect(endianBox, SIGNAL(activated(int)), SLOT(endianChanged(int)));
modeBox->setCurrentIndex(0);
modeChanged(0);
@@ -98,7 +86,7 @@ void AudioTest::test()
if (!deviceInfo.isNull()) {
if (deviceInfo.isFormatSupported(settings)) {
- logOutput->append("Success");
+ logOutput->append(tr("Success"));
nearestFreq->setText("");
nearestChannel->setText("");
nearestCodec->setText("");
@@ -136,16 +124,16 @@ void AudioTest::test()
}
}
else
- logOutput->append("No Device");
+ logOutput->append(tr("No Device"));
}
void AudioTest::modeChanged(int idx)
{
// mode has changed
- if(idx == 0)
- mode=QAudio::AudioInput;
+ if (idx == 0)
+ mode = QAudio::AudioInput;
else
- mode=QAudio::AudioOutput;
+ mode = QAudio::AudioOutput;
deviceBox->clear();
foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(mode))
@@ -162,37 +150,37 @@ void AudioTest::deviceChanged(int idx)
frequencyBox->clear();
QList<int> freqz = deviceInfo.supportedFrequencies();
- for(int i = 0; i < freqz.size(); ++i)
+ for (int i = 0; i < freqz.size(); ++i)
frequencyBox->addItem(QString("%1").arg(freqz.at(i)));
- if(freqz.size())
+ if (freqz.size())
settings.setFrequency(freqz.at(0));
channelsBox->clear();
QList<int> chz = deviceInfo.supportedChannels();
- for(int i = 0; i < chz.size(); ++i)
+ for (int i = 0; i < chz.size(); ++i)
channelsBox->addItem(QString("%1").arg(chz.at(i)));
- if(chz.size())
+ if (chz.size())
settings.setChannels(chz.at(0));
codecsBox->clear();
QStringList codecz = deviceInfo.supportedCodecs();
- for(int i = 0; i < codecz.size(); ++i)
+ for (int i = 0; i < codecz.size(); ++i)
codecsBox->addItem(QString("%1").arg(codecz.at(i)));
- if(codecz.size())
+ if (codecz.size())
settings.setCodec(codecz.at(0));
// Add false to create failed condition!
codecsBox->addItem("audio/test");
sampleSizesBox->clear();
QList<int> sampleSizez = deviceInfo.supportedSampleSizes();
- for(int i = 0; i < sampleSizez.size(); ++i)
+ for (int i = 0; i < sampleSizez.size(); ++i)
sampleSizesBox->addItem(QString("%1").arg(sampleSizez.at(i)));
- if(sampleSizez.size())
+ if (sampleSizez.size())
settings.setSampleSize(sampleSizez.at(0));
sampleTypesBox->clear();
QList<QAudioFormat::SampleType> sampleTypez = deviceInfo.supportedSampleTypes();
- for(int i = 0; i < sampleTypez.size(); ++i) {
+ for (int i = 0; i < sampleTypez.size(); ++i) {
switch(sampleTypez.at(i)) {
case QAudioFormat::SignedInt:
sampleTypesBox->addItem("SignedInt");
@@ -206,14 +194,14 @@ void AudioTest::deviceChanged(int idx)
case QAudioFormat::Unknown:
sampleTypesBox->addItem("Unknown");
}
- if(sampleTypez.size())
+ if (sampleTypez.size())
settings.setSampleType(sampleTypez.at(0));
}
endianBox->clear();
QList<QAudioFormat::Endian> endianz = deviceInfo.supportedByteOrders();
- for(int i = 0; i < endianz.size(); ++i) {
- switch(endianz.at(i)) {
+ for (int i = 0; i < endianz.size(); ++i) {
+ switch (endianz.at(i)) {
case QAudioFormat::LittleEndian:
endianBox->addItem("Little Endian");
break;
@@ -222,7 +210,7 @@ void AudioTest::deviceChanged(int idx)
break;
}
}
- if(endianz.size())
+ if (endianz.size())
settings.setByteOrder(endianz.at(0));
}
@@ -249,7 +237,7 @@ void AudioTest::sampleSizeChanged(int idx)
void AudioTest::sampleTypeChanged(int idx)
{
- switch(sampleTypesBox->itemText(idx).toInt()) {
+ switch (sampleTypesBox->itemText(idx).toInt()) {
case QAudioFormat::SignedInt:
settings.setSampleType(QAudioFormat::SignedInt);
break;
@@ -263,7 +251,7 @@ void AudioTest::sampleTypeChanged(int idx)
void AudioTest::endianChanged(int idx)
{
- switch(endianBox->itemText(idx).toInt()) {
+ switch (endianBox->itemText(idx).toInt()) {
case QAudioFormat::LittleEndian:
settings.setByteOrder(QAudioFormat::LittleEndian);
break;
@@ -271,4 +259,3 @@ void AudioTest::endianChanged(int idx)
settings.setByteOrder(QAudioFormat::BigEndian);
}
}
-
diff --git a/examples/multimedia/audiodevices/audiodevices.h b/examples/multimedia/audiodevices/audiodevices.h
index 5fe5547..bd4b7c4 100644
--- a/examples/multimedia/audiodevices/audiodevices.h
+++ b/examples/multimedia/audiodevices/audiodevices.h
@@ -49,7 +49,7 @@
class AudioDevicesBase : public QMainWindow, public Ui::AudioDevicesBase
{
public:
- AudioDevicesBase( QMainWindow *parent = 0, Qt::WFlags f = 0 );
+ AudioDevicesBase(QWidget *parent = 0, Qt::WFlags f = 0);
virtual ~AudioDevicesBase();
};
@@ -57,10 +57,10 @@ class AudioTest : public AudioDevicesBase
{
Q_OBJECT
public:
- AudioTest( QMainWindow *parent = 0, Qt::WFlags f = 0 );
+ AudioTest(QWidget *parent = 0, Qt::WFlags f = 0);
virtual ~AudioTest();
- QAudioDeviceInfo deviceInfo;
+ QAudioDeviceInfo deviceInfo;
QAudioFormat settings;
QAudio::Mode mode;
diff --git a/examples/multimedia/audiodevices/audiodevices.pro b/examples/multimedia/audiodevices/audiodevices.pro
index 232da09..1cb4679 100644
--- a/examples/multimedia/audiodevices/audiodevices.pro
+++ b/examples/multimedia/audiodevices/audiodevices.pro
@@ -1,7 +1,7 @@
HEADERS = audiodevices.h
SOURCES = audiodevices.cpp \
main.cpp
-FORMS += audiodevicesbase.ui
+FORMS += audiodevicesbase.ui
QT += multimedia
diff --git a/examples/multimedia/audiodevices/audiodevicesbase.ui b/examples/multimedia/audiodevices/audiodevicesbase.ui
index 5207338..faa39dc 100644
--- a/examples/multimedia/audiodevices/audiodevicesbase.ui
+++ b/examples/multimedia/audiodevices/audiodevicesbase.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>AudioDevicesBase</string>
+ <string>Audio Devices</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
@@ -41,7 +41,18 @@
<widget class="QComboBox" name="deviceBox"/>
</item>
<item row="1" column="1">
- <widget class="QComboBox" name="modeBox"/>
+ <widget class="QComboBox" name="modeBox">
+ <item>
+ <property name="text">
+ <string>Input</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Output</string>
+ </property>
+ </item>
+ </widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="actualLabel">
@@ -93,7 +104,11 @@
<widget class="QComboBox" name="frequencyBox"/>
</item>
<item row="4" column="1">
- <widget class="QLineEdit" name="nearestFreq"/>
+ <widget class="QLineEdit" name="nearestFreq">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="actualChannelsLabel">
@@ -113,7 +128,11 @@
<widget class="QComboBox" name="channelsBox"/>
</item>
<item row="6" column="1">
- <widget class="QLineEdit" name="nearestChannel"/>
+ <widget class="QLineEdit" name="nearestChannel">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="actualCodecLabel">
@@ -133,7 +152,11 @@
<widget class="QComboBox" name="codecsBox"/>
</item>
<item row="8" column="1">
- <widget class="QLineEdit" name="nearestCodec"/>
+ <widget class="QLineEdit" name="nearestCodec">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="actualSampleSizeLabel">
@@ -153,7 +176,11 @@
<widget class="QComboBox" name="sampleSizesBox"/>
</item>
<item row="10" column="1">
- <widget class="QLineEdit" name="nearestSampleSize"/>
+ <widget class="QLineEdit" name="nearestSampleSize">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="actualSampleTypeLabel">
@@ -173,7 +200,11 @@
<widget class="QComboBox" name="sampleTypesBox"/>
</item>
<item row="12" column="1">
- <widget class="QLineEdit" name="nearestSampleType"/>
+ <widget class="QLineEdit" name="nearestSampleType">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="actualEndianLabel">
@@ -193,10 +224,17 @@
<widget class="QComboBox" name="endianBox"/>
</item>
<item row="14" column="1">
- <widget class="QLineEdit" name="nearestEndian"/>
+ <widget class="QLineEdit" name="nearestEndian">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="15" column="0" colspan="2">
<widget class="QTextEdit" name="logOutput">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="minimumSize">
<size>
<width>0</width>
@@ -216,16 +254,6 @@
</item>
</layout>
</widget>
- <widget class="QMenuBar" name="menubar">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>504</width>
- <height>19</height>
- </rect>
- </property>
- </widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
diff --git a/examples/webkit/fancybrowser/main.cpp b/examples/webkit/fancybrowser/main.cpp
index 7f3c983..7ca862d 100644
--- a/examples/webkit/fancybrowser/main.cpp
+++ b/examples/webkit/fancybrowser/main.cpp
@@ -45,7 +45,7 @@
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
- MainWindow *browser = new MainWindow;
- browser->show();
+ MainWindow browser;
+ browser.show();
return app.exec();
}
diff --git a/examples/webkit/googlechat/main.cpp b/examples/webkit/googlechat/main.cpp
index 6b5e11f..ca94131 100644
--- a/examples/webkit/googlechat/main.cpp
+++ b/examples/webkit/googlechat/main.cpp
@@ -49,7 +49,7 @@ int main(int argc, char * argv[])
QNetworkProxyFactory::setUseSystemConfiguration(true);
- GoogleChat *chat = new GoogleChat;
- chat->show();
+ GoogleChat chat;
+ chat.show();
return app.exec();
}
diff --git a/examples/webkit/previewer/main.cpp b/examples/webkit/previewer/main.cpp
index 183b03f..1c80c19 100644
--- a/examples/webkit/previewer/main.cpp
+++ b/examples/webkit/previewer/main.cpp
@@ -46,8 +46,8 @@
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
- MainWindow *mainWindow = new MainWindow;
- mainWindow->show();
+ MainWindow mainWindow;
+ mainWindow.show();
return app.exec();
}
//! [0]
diff --git a/mkspecs/features/unix/separate_debug_info.prf b/mkspecs/features/unix/separate_debug_info.prf
index 0c95baf..c675828 100644
--- a/mkspecs/features/unix/separate_debug_info.prf
+++ b/mkspecs/features/unix/separate_debug_info.prf
@@ -1,5 +1,5 @@
-!staticlib:!static:!contains(TEMPLATE, subdirs):!isEmpty(QMAKE_OBJCOPY) {
+!separate_debug_info_nocopy:!staticlib:!static:!contains(TEMPLATE, subdirs):!isEmpty(QMAKE_OBJCOPY) {
QMAKE_SEPARATE_DEBUG_INFO = (test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; targ=`basename $(TARGET)`; $$QMAKE_OBJCOPY --only-keep-debug \"\$\$targ\" \"\$\$targ.debug\" && $$QMAKE_OBJCOPY --strip-debug \"\$\$targ\" && $$QMAKE_OBJCOPY --add-gnu-debuglink=\"\$\$targ.debug\" \"\$\$targ\" && chmod -x \"\$\$targ.debug\" ) ;
QMAKE_INSTALL_SEPARATE_DEBUG_INFO = test -z "$(DESTDIR)" || cd \"$(DESTDIR)\" ; $(INSTALL_FILE) `basename $(TARGET)`.debug $(INSTALL_ROOT)/\$\$target_path/
diff --git a/mkspecs/hpux-g++-64/qmake.conf b/mkspecs/hpux-g++-64/qmake.conf
index 38595c9..f76bd4e 100644
--- a/mkspecs/hpux-g++-64/qmake.conf
+++ b/mkspecs/hpux-g++-64/qmake.conf
@@ -15,7 +15,7 @@ QMAKE_LEX = flex
QMAKE_LEXFLAGS =
QMAKE_YACC = yacc
QMAKE_YACCFLAGS = -d
-QMAKE_CFLAGS = +DA2.0W
+QMAKE_CFLAGS =
QMAKE_CFLAGS_DEPS = -M
QMAKE_CFLAGS_WARN_ON = -Wall -W
QMAKE_CFLAGS_WARN_OFF = -w
@@ -51,7 +51,7 @@ QMAKE_LINK = g++
QMAKE_LINK_SHLIB = g++
QMAKE_LINK_C = gcc
QMAKE_LINK_C_SHLIB = gcc
-QMAKE_LFLAGS = +DA2.0W -Wl,+s -lpthread
+QMAKE_LFLAGS = -Wl,+s -lpthread
QMAKE_LFLAGS_RELEASE =
QMAKE_LFLAGS_DEBUG =
QMAKE_LFLAGS_SHLIB = -fPIC -shared
diff --git a/mkspecs/hpux-g++-64/qplatformdefs.h b/mkspecs/hpux-g++-64/qplatformdefs.h
index a8d06d8..ac13799 100644
--- a/mkspecs/hpux-g++-64/qplatformdefs.h
+++ b/mkspecs/hpux-g++-64/qplatformdefs.h
@@ -145,7 +145,7 @@
#define QT_SIGNAL_ARGS int
#define QT_SIGNAL_IGNORE SIG_IGN
-#define QT_SOCKLEN_T int
+#define QT_SOCKLEN_T socklen_t
#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/unsupported/linux-host-g++/qmake.conf b/mkspecs/unsupported/linux-host-g++/qmake.conf
index 237477c..8a480c4 100644
--- a/mkspecs/unsupported/linux-host-g++/qmake.conf
+++ b/mkspecs/unsupported/linux-host-g++/qmake.conf
@@ -134,5 +134,5 @@ QMAKE_MKDIR = mkdir -p
QMAKE_INSTALL_FILE = install -m 644 -p
QMAKE_INSTALL_PROGRAM = install -m 755 -p
-include(../common/unix.conf)
+include(../../common/unix.conf)
load(qt_config)
diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp
index 6225720..f2baf46 100644
--- a/qmake/generators/symbian/symmake_abld.cpp
+++ b/qmake/generators/symbian/symmake_abld.cpp
@@ -88,15 +88,15 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b
t << "# ==============================================================================" << "\n" << endl;
t << endl << endl;
-
+
t << "MAKE = make" << endl;
t << endl;
-
+
t << "VISUAL_CFG = RELEASE" << endl;
- t << "ifeq \"$(CFG)\" \"UDEB\"" << endl;
- t << "VISUAL_CFG = DEBUG" << endl;
- t << "endif" << endl;
- t << endl;
+ t << "ifeq \"$(CFG)\" \"UDEB\"" << endl;
+ t << "VISUAL_CFG = DEBUG" << endl;
+ t << "endif" << endl;
+ t << endl;
t << DO_NOTHING_TARGET " :" << endl;
t << "\t" << "@rem " DO_NOTHING_TARGET << endl << endl;
@@ -113,8 +113,8 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b
cleanDepsWinscw.append(WINSCW_DEPLOYMENT_CLEAN_TARGET);
finalDeps.append(DO_NOTHING_TARGET);
finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET);
- wrapperTargets << WINSCW_DEPLOYMENT_TARGET
- << WINSCW_DEPLOYMENT_CLEAN_TARGET
+ wrapperTargets << WINSCW_DEPLOYMENT_TARGET
+ << WINSCW_DEPLOYMENT_CLEAN_TARGET
<< STORE_BUILD_TARGET;
} else {
buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_TARGET);
@@ -153,9 +153,9 @@ void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, b
QString makefile(Option::fixPathToTargetOS(fileInfo(wrapperFileName).canonicalFilePath()));
foreach(QString target, wrapperTargets) {
t << target << " : " << makefile << endl;
- t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << " QT_SIS_TARGET=$(VISUAL_CFG)-$(PLATFORM)" << endl << endl;
- }
-
+ t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << " QT_SIS_TARGET=$(VISUAL_CFG)-$(PLATFORM)" << endl << endl;
+ }
+
t << endl;
} // if(ft.open(QIODevice::WriteOnly))
}
@@ -375,7 +375,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
// Create execution target
if (debugPlatforms.contains("winscw") && targetType == TypeExe) {
t << "run:" << endl;
- t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl;
+ t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << fixedTarget << ".exe" << endl << endl;
}
}
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp
index c7eae64..ad22cfd 100644
--- a/qmake/generators/symbian/symmake_sbsv2.cpp
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp
@@ -234,7 +234,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo
// create execution target
if (debugPlatforms.contains("winscw") && targetType == TypeExe) {
t << "run:" << endl;
- t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl;
+ t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << fixedTarget << ".exe" << endl << endl;
}
}
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 7dc456e..593a075 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -1394,8 +1394,10 @@ bool VCLinkerTool::parseOption(const char* option)
case 0x0005bb6: // X86
TargetMachine = machineX86;
break;
- // so we put the others in AdditionalOptions...
case 0x0005b94: // X64
+ TargetMachine = machineX64;
+ break;
+ // so we put the others in AdditionalOptions...
case 0x0046063: // AM33
case 0x000466d: // ARM
case 0x0004795: // CEE
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index d178d30..f7fdf3a 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -298,7 +298,8 @@ enum linkProgressOption {
};
enum machineTypeOption {
machineNotSet,
- machineX86
+ machineX86,
+ machineX64 = 17
};
enum midlCharOption {
midlCharUnsigned,
diff --git a/src/3rdparty/easing/easing.cpp b/src/3rdparty/easing/easing.cpp
index 81af40f..7d70a4d 100644
--- a/src/3rdparty/easing/easing.cpp
+++ b/src/3rdparty/easing/easing.cpp
@@ -252,7 +252,7 @@ static qreal easeOutInQuint(qreal t)
*/
static qreal easeInSine(qreal t)
{
- return (t == 1.0) ? 1.0 : -::cos(t * M_PI_2) + 1.0;
+ return (t == 1.0) ? 1.0 : -::qCos(t * M_PI_2) + 1.0;
}
/**
@@ -263,7 +263,7 @@ static qreal easeInSine(qreal t)
*/
static qreal easeOutSine(qreal t)
{
- return ::sin(t* M_PI_2);
+ return ::qSin(t* M_PI_2);
}
/**
@@ -274,7 +274,7 @@ static qreal easeOutSine(qreal t)
*/
static qreal easeInOutSine(qreal t)
{
- return -0.5 * (::cos(M_PI*t) - 1);
+ return -0.5 * (::qCos(M_PI*t) - 1);
}
/**
@@ -397,15 +397,15 @@ static qreal easeInElastic_helper(qreal t, qreal b, qreal c, qreal d, qreal a, q
if (t_adj==1) return b+c;
qreal s;
- if(a < ::fabs(c)) {
+ if(a < ::qFabs(c)) {
a = c;
s = p / 4.0f;
} else {
- s = p / (2 * M_PI) * ::asin(c / a);
+ s = p / (2 * M_PI) * ::qAsin(c / a);
}
t_adj -= 1.0f;
- return -(a*::qPow(2.0f,10*t_adj) * ::sin( (t_adj*d-s)*(2*M_PI)/p )) + b;
+ return -(a*::qPow(2.0f,10*t_adj) * ::qSin( (t_adj*d-s)*(2*M_PI)/p )) + b;
}
/**
@@ -431,10 +431,10 @@ static qreal easeOutElastic_helper(qreal t, qreal /*b*/, qreal c, qreal /*d*/, q
a = c;
s = p / 4.0f;
} else {
- s = p / (2 * M_PI) * ::asin(c / a);
+ s = p / (2 * M_PI) * ::qAsin(c / a);
}
- return (a*::qPow(2.0f,-10*t) * ::sin( (t-s)*(2*M_PI)/p ) + c);
+ return (a*::qPow(2.0f,-10*t) * ::qSin( (t-s)*(2*M_PI)/p ) + c);
}
/**
@@ -469,11 +469,11 @@ static qreal easeInOutElastic(qreal t, qreal a, qreal p)
a = 1.0;
s = p / 4.0f;
} else {
- s = p / (2 * M_PI) * ::asin(1.0 / a);
+ s = p / (2 * M_PI) * ::qAsin(1.0 / a);
}
- if (t < 1) return -.5*(a*::qPow(2.0f,10*(t-1)) * ::sin( (t-1-s)*(2*M_PI)/p ));
- return a*::qPow(2.0f,-10*(t-1)) * ::sin( (t-1-s)*(2*M_PI)/p )*.5 + 1.0;
+ if (t < 1) return -.5*(a*::qPow(2.0f,10*(t-1)) * ::qSin( (t-1-s)*(2*M_PI)/p ));
+ return a*::qPow(2.0f,-10*(t-1)) * ::qSin( (t-1-s)*(2*M_PI)/p )*.5 + 1.0;
}
/**
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 1bdc3ed..88b7271 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -3407,9 +3407,9 @@ quint64 QWebPage::bytesReceived() const
/*!
\fn void QWebPage::unsupportedContent(QNetworkReply *reply)
- This signals is emitted when webkit cannot handle a link the user navigated to.
+ This signal is emitted when WebKit cannot handle a link the user navigated to.
- At signal emissions time the meta data of the QNetworkReply \a reply is available.
+ At signal emission time the meta-data of the QNetworkReply \a reply is available.
\note This signal is only emitted if the forwardUnsupportedContent property is set to true.
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 594718e..47f340c 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -440,7 +440,7 @@ QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr)
readConverterSavedState(0),
#endif
readConverterSavedStateOffset(0),
- locale(QLocale::C)
+ locale(QLocale::c())
{
this->q_ptr = q_ptr;
reset();
@@ -1806,8 +1806,7 @@ QTextStreamPrivate::NumberParsingStatus QTextStreamPrivate::getNumber(qulonglong
if (ch.isDigit()) {
val *= 10;
val += ch.digitValue();
- } else if (locale.language() != QLocale::C
- && ch == locale.groupSeparator()) {
+ } else if (locale != QLocale::c() && ch == locale.groupSeparator()) {
continue;
} else {
ungetChar(ch);
@@ -1958,7 +1957,7 @@ bool QTextStreamPrivate::getReal(double *f)
else if (lc == locale.negativeSign().toLower()
|| lc == locale.positiveSign().toLower())
input = InputSign;
- else if (locale.language() != QLocale::C // backward-compatibility
+ else if (locale != QLocale::c() // backward-compatibility
&& lc == locale.groupSeparator().toLower())
input = InputDigit; // well, it isn't a digit, but no one cares.
else
@@ -2283,7 +2282,7 @@ bool QTextStreamPrivate::putNumber(qulonglong number, bool negative)
// add thousands group separators. For backward compatibility we
// don't add a group separator for C locale.
- if (locale.language() != QLocale::C)
+ if (locale != QLocale::c())
flags |= QLocalePrivate::ThousandsGroup;
const QLocalePrivate *dd = locale.d();
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 665b73e..16871c3 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -341,6 +341,11 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
g_source_attach(&idleTimerSource->source, mainContext);
}
+void QEventDispatcherGlibPrivate::runTimersOnceWithNormalPriority()
+{
+ timerSource->runWithIdlePriority = false;
+}
+
QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent)
: QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate), parent)
{
diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h
index 6a4e726..57cbf94 100644
--- a/src/corelib/kernel/qeventdispatcher_glib_p.h
+++ b/src/corelib/kernel/qeventdispatcher_glib_p.h
@@ -110,6 +110,8 @@ public:
GSocketNotifierSource *socketNotifierSource;
GTimerSource *timerSource;
GIdleTimerSource *idleTimerSource;
+
+ void runTimersOnceWithNormalPriority();
};
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h
index 820f424..16e6bb7 100644
--- a/src/corelib/kernel/qmath.h
+++ b/src/corelib/kernel/qmath.h
@@ -46,6 +46,10 @@
#include <QtCore/qglobal.h>
+#ifdef Q_OS_SYMBIAN
+# include <e32math.h>
+#endif
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -88,82 +92,130 @@ inline qreal qFabs(qreal v)
inline qreal qSin(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return sinf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal sin_v;
+ Math::Sin(sin_v, static_cast<TReal>(v));
+ return static_cast<qreal>(sin_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return sinf(float(v));
+ else
+# endif
+ return sin(v);
#endif
- return sin(v);
}
inline qreal qCos(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return cosf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal cos_v;
+ Math::Cos(cos_v, static_cast<TReal>(v));
+ return static_cast<qreal>(cos_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return cosf(float(v));
+ else
+# endif
+ return cos(v);
#endif
- return cos(v);
}
inline qreal qTan(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return tanf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal tan_v;
+ Math::Tan(tan_v, static_cast<TReal>(v));
+ return static_cast<qreal>(tan_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return tanf(float(v));
+ else
+# endif
+ return tan(v);
#endif
- return tan(v);
}
inline qreal qAcos(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return acosf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal acos_v;
+ Math::ACos(acos_v, static_cast<TReal>(v));
+ return static_cast<qreal>(acos_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return acosf(float(v));
+ else
+# endif
+ return acos(v);
#endif
- return acos(v);
}
inline qreal qAsin(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return asinf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal asin_v;
+ Math::ASin(asin_v, static_cast<TReal>(v));
+ return static_cast<qreal>(asin_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return asinf(float(v));
+ else
+# endif
+ return asin(v);
#endif
- return asin(v);
}
inline qreal qAtan(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if(sizeof(qreal) == sizeof(float))
- return atanf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal atan_v;
+ Math::ATan(atan_v, static_cast<TReal>(v));
+ return static_cast<qreal>(atan_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if(sizeof(qreal) == sizeof(float))
+ return atanf(float(v));
+ else
+# endif
+ return atan(v);
#endif
- return atan(v);
}
inline qreal qAtan2(qreal x, qreal y)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if(sizeof(qreal) == sizeof(float))
- return atan2f(float(x), float(y));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal atan2_v;
+ Math::ATan(atan2_v, static_cast<TReal>(x), static_cast<TReal>(y));
+ return static_cast<qreal>(atan2_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if(sizeof(qreal) == sizeof(float))
+ return atan2f(float(x), float(y));
+ else
+# endif
+ return atan2(x, y);
#endif
- return atan2(x, y);
}
inline qreal qSqrt(qreal v)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return sqrtf(float(v));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal sqrt_v;
+ Math::Sqrt(sqrt_v, static_cast<TReal>(v));
+ return static_cast<qreal>(sqrt_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return sqrtf(float(v));
+ else
+# endif
+ return sqrt(v);
#endif
- return sqrt(v);
}
inline qreal qLn(qreal v)
@@ -178,19 +230,31 @@ inline qreal qLn(qreal v)
inline qreal qExp(qreal v)
{
+#ifdef Q_OS_SYMBIAN
+ TReal exp_v;
+ Math::Exp(exp_v, static_cast<TReal>(v));
+ return static_cast<qreal>(exp_v);
+#else
// only one signature
// exists, exp(double)
return exp(v);
+#endif
}
inline qreal qPow(qreal x, qreal y)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return powf(float(x), float(y));
- else
+#ifdef Q_OS_SYMBIAN
+ TReal pow_v;
+ Math::Pow(pow_v, static_cast<TReal>(x), static_cast<TReal>(y));
+ return static_cast<qreal>(pow_v);
+#else
+# ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return powf(float(x), float(y));
+ else
+# endif
+ return pow(x, y);
#endif
- return pow(x, y);
}
#ifndef M_PI
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 6e6da19..72d6786 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -2648,6 +2648,7 @@ const char* QMetaClassInfo::value() const
*/
int QMetaObjectPrivate::originalClone(const QMetaObject *mobj, int local_method_index)
{
+ Q_ASSERT(local_method_index < get(mobj)->methodCount);
int handle = get(mobj)->methodData + 5 * local_method_index;
while (mobj->d.data[handle + 4] & MethodCloned) {
Q_ASSERT(local_method_index > 0);
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 85915c2..4370ee0 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2850,6 +2850,27 @@ void QObject::disconnectNotify(const char *)
{
}
+/* \internal
+ convert a signal index from the method range to the signal range
+ */
+static int methodIndexToSignalIndex(const QMetaObject *metaObject, int signal_index)
+{
+ if (signal_index < 0)
+ return signal_index;
+ while (metaObject && metaObject->methodOffset() > signal_index)
+ metaObject = metaObject->superClass();
+
+ if (metaObject) {
+ int signalOffset, methodOffset;
+ computeOffsets(metaObject, &signalOffset, &methodOffset);
+ if (signal_index < metaObject->methodCount())
+ signal_index = QMetaObjectPrivate::originalClone(metaObject, signal_index - methodOffset) + signalOffset;
+ else
+ signal_index = signal_index - methodOffset + signalOffset;
+ }
+ return signal_index;
+}
+
/*!\internal
\a types is a 0-terminated vector of meta types for queued
connections.
@@ -2860,16 +2881,7 @@ void QObject::disconnectNotify(const char *)
bool QMetaObject::connect(const QObject *sender, int signal_index,
const QObject *receiver, int method_index, int type, int *types)
{
- if (signal_index > 0) {
- const QMetaObject *mo = sender->metaObject();
- while (mo && mo->methodOffset() > signal_index)
- mo = mo->superClass();
- if (mo) {
- int signalOffset, methodOffset;
- computeOffsets(mo, &signalOffset, &methodOffset);
- signal_index = QMetaObjectPrivate::originalClone(mo, signal_index - methodOffset) + signalOffset;
- }
- }
+ signal_index = methodIndexToSignalIndex(sender->metaObject(), signal_index);
return QMetaObjectPrivate::connect(sender, signal_index,
receiver, method_index, type, types);
}
@@ -2938,16 +2950,7 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
bool QMetaObject::disconnect(const QObject *sender, int signal_index,
const QObject *receiver, int method_index)
{
- if (signal_index > 0) {
- const QMetaObject *mo = sender->metaObject();
- while (mo && mo->methodOffset() > signal_index)
- mo = mo->superClass();
- if (mo) {
- int signalOffset, methodOffset;
- computeOffsets(mo, &signalOffset, &methodOffset);
- signal_index = QMetaObjectPrivate::originalClone(mo, signal_index - methodOffset) + signalOffset;
- }
- }
+ signal_index = methodIndexToSignalIndex(sender->metaObject(), signal_index);
return QMetaObjectPrivate::disconnect(sender, signal_index,
receiver, method_index);
}
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 21b5e65..0309c67 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -74,6 +74,10 @@
# endif
#endif
+#ifdef Q_OS_HPUX
+#include <sys/pstat.h>
+#endif
+
#if defined(Q_OS_MAC)
# ifdef qDebug
# define old_qDebug qDebug
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index d0afb7a..8112757 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -574,7 +574,7 @@ qreal QLineF::angle() const
const qreal dx = pt2.x() - pt1.x();
const qreal dy = pt2.y() - pt1.y();
- const qreal theta = atan2(-dy, dx) * 360.0 / M_2PI;
+ const qreal theta = qAtan2(-dy, dx) * 360.0 / M_2PI;
const qreal theta_normalized = theta < 0 ? theta + 360 : theta;
@@ -814,7 +814,7 @@ qreal QLineF::angle(const QLineF &l) const
qreal cos_line = (dx()*l.dx() + dy()*l.dy()) / (length()*l.length());
qreal rad = 0;
// only accept cos_line in the range [-1,1], if it is outside, use 0 (we return 0 rather than PI for those cases)
- if (cos_line >= -1.0 && cos_line <= 1.0) rad = acos( cos_line );
+ if (cos_line >= -1.0 && cos_line <= 1.0) rad = qAcos( cos_line );
return rad * 360 / M_2PI;
}
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 4a66b92..8645f17 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -1187,14 +1187,14 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
}
case DateFormatLong:
case DateFormatShort:
- return macToQtFormat(getMacDateFormat(type == DateFormatShort
+ return getMacDateFormat(type == DateFormatShort
? kCFDateFormatterShortStyle
- : kCFDateFormatterLongStyle));
+ : kCFDateFormatterLongStyle);
case TimeFormatLong:
case TimeFormatShort:
- return macToQtFormat(getMacTimeFormat(type == TimeFormatShort
+ return getMacTimeFormat(type == TimeFormatShort
? kCFDateFormatterShortStyle
- : kCFDateFormatterLongStyle));
+ : kCFDateFormatterLongStyle);
case DayNameLong:
case DayNameShort:
return macDayName(in.toInt(), (type == DayNameShort));
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index ef50b04..9c768ed 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -310,7 +310,7 @@ QDBusPendingCall &QDBusPendingCall::operator=(const QDBusPendingCall &other)
bool QDBusPendingCall::isFinished() const
{
- return d && (d->replyMessage.type() != QDBusMessage::InvalidMessage);
+ return !d || (d->replyMessage.type() != QDBusMessage::InvalidMessage);
}
void QDBusPendingCall::waitForFinished()
diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h
index b7f54e4..4f90c98 100644
--- a/src/dbus/qdbuspendingreply.h
+++ b/src/dbus/qdbuspendingreply.h
@@ -188,6 +188,7 @@ public:
private:
inline void calculateMetaTypes()
{
+ if (!d) return;
int typeIds[Count > 0 ? Count : 1]; // use at least one since zero-sized arrays aren't valid
ForEach::fillMetaTypes(typeIds);
setMetaTypes(Count, typeIds);
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm
index 53d2e1e..5753954 100644
--- a/src/gui/dialogs/qcolordialog_mac.mm
+++ b/src/gui/dialogs/qcolordialog_mac.mm
@@ -79,6 +79,7 @@ QT_USE_NAMESPACE
BOOL mHackedPanel;
NSInteger mResultCode;
BOOL mDialogIsExecuting;
+ BOOL mResultSet;
}
- (id)initWithColorPanel:(NSColorPanel *)panel
stolenContentView:(NSView *)stolenContentView
@@ -116,6 +117,7 @@ QT_USE_NAMESPACE
mHackedPanel = (okButton != 0);
mResultCode = NSCancelButton;
mDialogIsExecuting = false;
+ mResultSet = false;
if (mHackedPanel) {
[self relayout];
@@ -159,11 +161,13 @@ QT_USE_NAMESPACE
- (BOOL)windowShouldClose:(id)window
{
Q_UNUSED(window);
- if (mHackedPanel) {
- [self onCancelClicked];
- } else {
+ if (!mHackedPanel)
[self updateQtColor];
+ if (mDialogIsExecuting) {
[self finishOffWithCode:NSCancelButton];
+ } else {
+ mResultSet = true;
+ mPriv->colorDialog()->reject();
}
return true;
}
@@ -240,11 +244,12 @@ QT_USE_NAMESPACE
- (void)onCancelClicked
{
- Q_ASSERT(mHackedPanel);
- [[mStolenContentView window] close];
- delete mQtColor;
- mQtColor = new QColor();
- [self finishOffWithCode:NSCancelButton];
+ if (mHackedPanel) {
+ [[mStolenContentView window] close];
+ delete mQtColor;
+ mQtColor = new QColor();
+ [self finishOffWithCode:NSCancelButton];
+ }
}
- (void)updateQtColor
@@ -306,10 +311,16 @@ QT_USE_NAMESPACE
} else {
// Since we are not in a modal event loop, we can safely close
// down QColorDialog
- if (mResultCode == NSCancelButton)
- mPriv->colorDialog()->reject();
- else
- mPriv->colorDialog()->accept();
+ // Calling accept() or reject() can in turn call closeCocoaColorPanel.
+ // This check will prevent any such recursion.
+ if (!mResultSet) {
+ mResultSet = true;
+ if (mResultCode == NSCancelButton) {
+ mPriv->colorDialog()->reject();
+ } else {
+ mPriv->colorDialog()->accept();
+ }
+ }
}
}
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index 0c467cd..31bab2b 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -394,7 +394,9 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
}
[mFontPanel setDelegate:nil];
[[NSFontManager sharedFontManager] setDelegate:nil];
+#ifdef QT_MAC_USE_COCOA
[[NSFontManager sharedFontManager] setTarget:nil];
+#endif
}
@end
@@ -518,7 +520,9 @@ void *QFontDialogPrivate::openCocoaFontPanel(const QFont &initial,
extraHeight:dialogExtraHeight];
[ourPanel setDelegate:delegate];
[[NSFontManager sharedFontManager] setDelegate:delegate];
+#ifdef QT_MAC_USE_COCOA
[[NSFontManager sharedFontManager] setTarget:delegate];
+#endif
setFont(delegate, initial);
// hack to get correct initial layout
diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp
index a318c43..8ec8d1c 100644
--- a/src/gui/dialogs/qmessagebox.cpp
+++ b/src/gui/dialogs/qmessagebox.cpp
@@ -188,6 +188,9 @@ public:
bool autoAddOkButton;
QAbstractButton *detectedEscapeButton;
QLabel *informativeLabel;
+#ifdef Q_OS_SYMBIAN
+ QTextEdit *textEdit;
+#endif
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
QByteArray signalToDisconnectOnClose;
@@ -2459,10 +2462,24 @@ void QMessageBox::setInformativeText(const QString &text)
#endif
label->setWordWrap(true);
QGridLayout *grid = static_cast<QGridLayout *>(layout());
+#ifdef Q_OS_SYMBIAN
+ label->hide();
+ QTextEdit *textEdit = new QTextEdit(this);
+ textEdit->setReadOnly(true);
+ grid->addWidget(textEdit, 1, 1, 1, 1);
+ d->textEdit = textEdit;
+#else
grid->addWidget(label, 1, 1, 1, 1);
+#endif
d->informativeLabel = label;
}
d->informativeLabel->setText(text);
+
+#ifdef Q_OS_SYMBIAN
+ //We need to put the informative label inside textEdit to enable scrolling of long texts.
+ d->textEdit->setText(d->informativeLabel->text());
+#endif
+
d->updateSize();
}
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index d6cabaa..a523bab 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -313,7 +313,10 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse
// Shortcut, no cache for childless pixmap items...
const QGraphicsItem *item = graphicsItem();
if (system == Qt::LogicalCoordinates && mode == QGraphicsEffect::NoPad && item && isPixmap()) {
- return ((QGraphicsPixmapItem *) item)->pixmap();
+ const QGraphicsPixmapItem *pixmapItem = static_cast<const QGraphicsPixmapItem *>(item);
+ if (offset)
+ *offset = pixmapItem->offset().toPoint();
+ return pixmapItem->pixmap();
}
if (system == Qt::DeviceCoordinates && item
@@ -371,10 +374,14 @@ QGraphicsEffectSourcePrivate::~QGraphicsEffectSourcePrivate()
invalidateCache();
}
-void QGraphicsEffectSourcePrivate::invalidateCache(bool effectRectChanged) const
+void QGraphicsEffectSourcePrivate::invalidateCache(InvalidateReason reason) const
{
- if (effectRectChanged && m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect)
+ if (m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect
+ && (reason == EffectRectChanged
+ || reason == TransformChanged
+ && m_cachedSystem == Qt::LogicalCoordinates))
return;
+
QPixmapCache::remove(m_cacheKey);
}
@@ -520,7 +527,7 @@ void QGraphicsEffect::updateBoundingRect()
Q_D(QGraphicsEffect);
if (d->source) {
d->source->d_func()->effectBoundingRectChanged();
- d->source->d_func()->invalidateCache(true);
+ d->source->d_func()->invalidateCache(QGraphicsEffectSourcePrivate::EffectRectChanged);
}
}
@@ -837,22 +844,19 @@ QRectF QGraphicsBlurEffect::boundingRectFor(const QRectF &rect) const
void QGraphicsBlurEffect::draw(QPainter *painter)
{
Q_D(QGraphicsBlurEffect);
- if (d->filter->radius() <= 0) {
+ if (d->filter->radius() < 1) {
drawSource(painter);
return;
}
PixmapPadMode mode = PadToEffectiveBoundingRect;
if (painter->paintEngine()->type() == QPaintEngine::OpenGL2)
- mode = PadToTransparentBorder;
+ mode = NoPad;
// Draw pixmap in device coordinates to avoid pixmap scaling.
QPoint offset;
- const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, mode);
- QTransform restoreTransform = painter->worldTransform();
- painter->setWorldTransform(QTransform());
+ QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset, mode);
d->filter->draw(painter, offset, pixmap);
- painter->setWorldTransform(restoreTransform);
}
/*!
@@ -1033,7 +1037,7 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter)
PixmapPadMode mode = PadToEffectiveBoundingRect;
if (painter->paintEngine()->type() == QPaintEngine::OpenGL2)
- mode = PadToTransparentBorder;
+ mode = NoPad;
// Draw pixmap in device coordinates to avoid pixmap scaling.
QPoint offset;
diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h
index 0011eef..cab7a48 100644
--- a/src/gui/effects/qgraphicseffect_p.h
+++ b/src/gui/effects/qgraphicseffect_p.h
@@ -108,6 +108,13 @@ public:
, m_cachedMode(QGraphicsEffect::PadToTransparentBorder)
{}
+ enum InvalidateReason
+ {
+ TransformChanged,
+ EffectRectChanged,
+ SourceChanged
+ };
+
virtual ~QGraphicsEffectSourcePrivate();
virtual void detach() = 0;
virtual QRectF boundingRect(Qt::CoordinateSystem system) const = 0;
@@ -121,7 +128,9 @@ public:
virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0,
QGraphicsEffect::PixmapPadMode mode = QGraphicsEffect::PadToTransparentBorder) const = 0;
virtual void effectBoundingRectChanged() = 0;
- void invalidateCache(bool effectRectChanged = false) const;
+
+ void invalidateCache(InvalidateReason reason = SourceChanged) const;
+ Qt::CoordinateSystem currentCachedSystem() const { return m_cachedSystem; }
friend class QGraphicsScenePrivate;
friend class QGraphicsItem;
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index d955f16..fbfd8e6 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7177,9 +7177,16 @@ void QGraphicsItem::prepareGeometryChange()
QGraphicsItem *parent = this;
while ((parent = parent->d_ptr->parent)) {
- parent->d_ptr->dirtyChildrenBoundingRect = 1;
+ QGraphicsItemPrivate *parentp = parent->d_ptr.data();
+ parentp->dirtyChildrenBoundingRect = 1;
// ### Only do this if the parent's effect applies to the entire subtree.
- parent->d_ptr->notifyBoundingRectChanged = 1;
+ parentp->notifyBoundingRectChanged = 1;
+#ifndef QT_NO_GRAPHICSEFFECT
+ if (parentp->scene && parentp->graphicsEffect) {
+ parentp->notifyInvalidated = 1;
+ static_cast<QGraphicsItemEffectSourcePrivate *>(parentp->graphicsEffect->d_func()->source->d_func())->invalidateCache();
+ }
+#endif
}
}
@@ -10717,7 +10724,6 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context");
return QPixmap();
}
-
if (!item->d_ptr->scene)
return QPixmap();
QGraphicsScenePrivate *scened = item->d_ptr->scene->d_func();
@@ -10725,9 +10731,11 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
const QRectF sourceRect = boundingRect(system);
QRectF effectRectF;
+ bool unpadded = false;
if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) {
if (info) {
effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates));
+ unpadded = (effectRectF.size() == sourceRect.size());
if (info && system == Qt::LogicalCoordinates)
effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
} else {
@@ -10739,6 +10747,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5);
} else {
effectRectF = sourceRect;
+ unpadded = true;
}
QRect effectRect = effectRectF.toAlignedRect();
@@ -10746,6 +10755,14 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
if (offset)
*offset = effectRect.topLeft();
+ bool untransformed = !deviceCoordinates
+ || info->painter->worldTransform().type() <= QTransform::TxTranslate;
+ if (untransformed && unpadded && isPixmap()) {
+ if (offset)
+ *offset = boundingRect(system).topLeft().toPoint();
+ return static_cast<QGraphicsPixmapItem *>(item)->pixmap();
+ }
+
if (deviceCoordinates) {
// Clip to viewport rect.
int left, top, right, bottom;
@@ -10773,12 +10790,6 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
if (effectRect.isEmpty())
return QPixmap();
- if (system == Qt::LogicalCoordinates
- && effectRect.size() == sourceRect.size()
- && isPixmap()) {
- return static_cast<QGraphicsPixmapItem *>(item)->pixmap();
- }
-
QPixmap pixmap(effectRect.size());
pixmap.fill(Qt::transparent);
QPainter pixmapPainter(&pixmap);
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 6176f2d..182a3f5 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4671,10 +4671,13 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
painter->setWorldTransform(*transformPtr);
painter->setOpacity(opacity);
- if (sourced->lastEffectTransform != painter->worldTransform()) {
+ if (sourced->currentCachedSystem() != Qt::LogicalCoordinates
+ && sourced->lastEffectTransform != painter->worldTransform())
+ {
sourced->lastEffectTransform = painter->worldTransform();
- sourced->invalidateCache();
+ sourced->invalidateCache(QGraphicsEffectSourcePrivate::TransformChanged);
}
+
item->d_ptr->graphicsEffect->draw(painter);
painter->setWorldTransform(restoreTransform);
sourced->info = 0;
diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp
index f61360a..9497a2f 100644
--- a/src/gui/graphicsview/qgridlayoutengine.cpp
+++ b/src/gui/graphicsview/qgridlayoutengine.cpp
@@ -51,6 +51,7 @@
#include "qvarlengtharray.h"
#include <QtDebug>
+#include <QtCore/qmath.h>
QT_BEGIN_NAMESPACE
@@ -70,7 +71,7 @@ static void insertOrRemoveItems(QVector<T> &items, int index, int delta)
static qreal growthFactorBelowPreferredSize(qreal desired, qreal sumAvailable, qreal sumDesired)
{
Q_ASSERT(sumDesired != 0.0);
- return desired * ::pow(sumAvailable / sumDesired, desired / sumDesired);
+ return desired * qPow(sumAvailable / sumDesired, desired / sumDesired);
}
static qreal fixedDescent(qreal descent, qreal ascent, qreal targetSize)
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index dc33ade..8194db5 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -235,7 +235,7 @@ static CFbsBitmap* uncompress(CFbsBitmap* bitmap)
QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
bitmapGc->Activate(bitmapDevice);
- bitmapGc->DrawBitmap(TPoint(), bitmap);
+ bitmapGc->BitBlt(TPoint(), bitmap);
delete bitmapGc;
delete bitmapDevice;
@@ -346,8 +346,6 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap)
QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
symbianBitmapDataAccess(new QSymbianBitmapDataAccess),
cfbsBitmap(0),
- bitmapDevice(0),
- bitmapGc(0),
pengine(0),
bytes(0),
formatLocked(false)
@@ -385,8 +383,6 @@ void QS60PixmapData::resize(int width, int height)
if(cfbsBitmap->SizeInPixels() != newSize) {
cfbsBitmap->Resize(TSize(width, height));
- bitmapDevice->Resize(TSize(width, height));
- bitmapGc->Resized();
if(pengine) {
delete pengine;
pengine = 0;
@@ -397,21 +393,10 @@ void QS60PixmapData::resize(int width, int height)
}
}
-bool QS60PixmapData::initSymbianBitmapContext()
-{
- QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(cfbsBitmap));
- QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL());
- bitmapGc->Activate(bitmapDevice);
-
- return true;
-}
-
void QS60PixmapData::release()
{
if (cfbsBitmap) {
QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- delete bitmapGc;
- delete bitmapDevice;
delete cfbsBitmap;
lock.relock();
}
@@ -419,8 +404,6 @@ void QS60PixmapData::release()
delete pengine;
image = QImage();
cfbsBitmap = 0;
- bitmapGc = 0;
- bitmapDevice = 0;
pengine = 0;
bytes = 0;
}
@@ -428,42 +411,52 @@ void QS60PixmapData::release()
/*!
* Takes ownership of bitmap. Used by window surface
*/
-void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap)
+void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat)
{
- cfbsBitmap = bitmap;
- formatLocked = true;
+ Q_ASSERT(bitmap);
- if(!initSymbianBitmapContext()) {
- qWarning("Could not create CBitmapContext");
- release();
- return;
- }
+ release();
+
+ cfbsBitmap = bitmap;
+ formatLocked = lockFormat;
- setSerialNumber(cfbsBitmap->Handle());
+ setSerialNumber(cfbsBitmap->Handle());
- UPDATE_BUFFER();
+ UPDATE_BUFFER();
- // Create default palette if needed
- if (cfbsBitmap->DisplayMode() == EGray2) {
- image.setColorCount(2);
- image.setColor(0, QColor(Qt::color0).rgba());
- image.setColor(1, QColor(Qt::color1).rgba());
+ // Create default palette if needed
+ if (cfbsBitmap->DisplayMode() == EGray2) {
+ image.setColorCount(2);
+ image.setColor(0, QColor(Qt::color0).rgba());
+ image.setColor(1, QColor(Qt::color1).rgba());
//Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
//So invert mono bitmaps so that masks work correctly.
image.invertPixels();
- } else if (cfbsBitmap->DisplayMode() == EGray256) {
- for (int i=0; i < 256; ++i)
- image.setColor(i, qRgb(i, i, i));
- }else if (cfbsBitmap->DisplayMode() == EColor256) {
- const TColor256Util *palette = TColor256Util::Default();
- for (int i=0; i < 256; ++i)
- image.setColor(i, (QRgb)(palette->Color256(i).Value()));
- }
+ } else if (cfbsBitmap->DisplayMode() == EGray256) {
+ for (int i=0; i < 256; ++i)
+ image.setColor(i, qRgb(i, i, i));
+ } else if (cfbsBitmap->DisplayMode() == EColor256) {
+ const TColor256Util *palette = TColor256Util::Default();
+ for (int i=0; i < 256; ++i)
+ image.setColor(i, (QRgb)(palette->Color256(i).Value()));
+ }
+}
+
+QImage QS60PixmapData::toImage(const QRect &r) const
+{
+ QS60PixmapData *that = const_cast<QS60PixmapData*>(this);
+ that->beginDataAccess();
+ QImage copy = that->image.copy(r);
+ that->endDataAccess();
+
+ return copy;
}
void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
{
+ release();
+
QImage sourceImage;
if (pixelType() == BitmapType) {
@@ -517,8 +510,8 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags
}
cfbsBitmap = createSymbianCFbsBitmap(TSize(sourceImage.width(), sourceImage.height()), mode);
- if (!(cfbsBitmap && initSymbianBitmapContext())) {
- qWarning("Could not create CFbsBitmap and/or CBitmapContext");
+ if (!cfbsBitmap) {
+ qWarning("Could not create CFbsBitmap");
release();
return;
}
@@ -544,17 +537,8 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags
void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect)
{
- if (data->pixelType() == BitmapType) {
- QBitmap::fromImage(data->toImage().copy(rect));
- return;
- }
-
const QS60PixmapData *s60Data = static_cast<const QS60PixmapData*>(data);
-
- resize(rect.width(), rect.height());
- cfbsBitmap->SetDisplayMode(s60Data->cfbsBitmap->DisplayMode());
-
- bitmapGc->BitBlt(TPoint(0, 0), s60Data->cfbsBitmap, qt_QRect2TRect(rect));
+ fromImage(s60Data->toImage(rect), Qt::AutoColor | Qt::OrderedAlphaDither);
}
bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect)
@@ -661,12 +645,7 @@ void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel)
QImage QS60PixmapData::toImage() const
{
- QS60PixmapData *that = const_cast<QS60PixmapData*>(this);
- that->beginDataAccess();
- QImage copy = that->image.copy();
- that->endDataAccess();
-
- return copy;
+ return toImage(QRect());
}
QPaintEngine* QS60PixmapData::paintEngine() const
@@ -820,7 +799,9 @@ void* QS60PixmapData::toNativeType(NativeType type)
if(displayMode == EGray2) {
//Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
//So invert mono bitmaps so that masks work correctly.
+ beginDataAccess();
image.invertPixels();
+ endDataAccess();
needsCopy = true;
}
@@ -828,7 +809,9 @@ void* QS60PixmapData::toNativeType(NativeType type)
QImage source;
if (convertToArgb32) {
+ beginDataAccess();
source = image.convertToFormat(QImage::Format_ARGB32);
+ endDataAccess();
displayMode = EColor16MA;
} else {
source = image;
@@ -858,7 +841,9 @@ void* QS60PixmapData::toNativeType(NativeType type)
if(displayMode == EGray2) {
// restore pixels
+ beginDataAccess();
image.invertPixels();
+ endDataAccess();
}
return reinterpret_cast<void*>(bitmap);
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h
index 8631ebd..2d93622 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_s60_p.h
@@ -109,14 +109,12 @@ public:
private:
void release();
- void fromSymbianBitmap(CFbsBitmap* bitmap);
- bool initSymbianBitmapContext();
+ void fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat=false);
+ QImage toImage(const QRect &r) const;
QSymbianBitmapDataAccess *symbianBitmapDataAccess;
CFbsBitmap *cfbsBitmap;
- CFbsBitmapDevice *bitmapDevice;
- CFbsBitGc *bitmapGc;
QPaintEngine *pengine;
uchar* bytes;
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index 3723500..caa0752 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -52,6 +52,10 @@
#include "private/qgraphicssystem_p.h"
#include "private/qpaintengineex_p.h"
#include "private/qpaintengine_raster_p.h"
+#include "qmath.h"
+#include "private/qmath_p.h"
+#include "private/qmemrotate_p.h"
+#include "private/qdrawhelper_p.h"
#ifndef QT_NO_GRAPHICSEFFECT
QT_BEGIN_NAMESPACE
@@ -585,106 +589,338 @@ QGraphicsBlurEffect::BlurHints QPixmapBlurFilter::blurHints() const
return d->hints;
}
+const qreal radiusScale = qreal(2.5);
+
/*!
\internal
*/
QRectF QPixmapBlurFilter::boundingRectFor(const QRectF &rect) const
{
Q_D(const QPixmapBlurFilter);
- const qreal delta = d->radius + 1;
+ const qreal delta = radiusScale * d->radius + 1;
return rect.adjusted(-delta, -delta, delta, delta);
}
-// Blur the image according to the blur radius
-// Based on exponential blur algorithm by Jani Huhtanen
-// (maximum radius is set to 16)
-static QImage blurred(const QImage& image, const QRect& rect, int radius, bool alphaOnly = false)
+template <int shift>
+static inline int static_shift(int value)
{
- int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 };
- int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1];
+ if (shift == 0)
+ return value;
+ else if (shift > 0)
+ return value << (uint(shift) & 0x1f);
+ else
+ return value >> (uint(-shift) & 0x1f);
+}
- QImage result = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
- int r1 = rect.top();
- int r2 = rect.bottom();
- int c1 = rect.left();
- int c2 = rect.right();
+template<int aprec, int zprec>
+static inline void blurinner(uchar *bptr, int &zR, int &zG, int &zB, int &zA, int alpha)
+{
+ QRgb *pixel = (QRgb *)bptr;
+
+#define Z_MASK (0xff << zprec)
+ const int A_zprec = static_shift<zprec - 24>(*pixel) & Z_MASK;
+ const int R_zprec = static_shift<zprec - 16>(*pixel) & Z_MASK;
+ const int G_zprec = static_shift<zprec - 8>(*pixel) & Z_MASK;
+ const int B_zprec = static_shift<zprec>(*pixel) & Z_MASK;
+#undef Z_MASK
+
+ const int zR_zprec = zR >> aprec;
+ const int zG_zprec = zG >> aprec;
+ const int zB_zprec = zB >> aprec;
+ const int zA_zprec = zA >> aprec;
+
+ zR += alpha * (R_zprec - zR_zprec);
+ zG += alpha * (G_zprec - zG_zprec);
+ zB += alpha * (B_zprec - zB_zprec);
+ zA += alpha * (A_zprec - zA_zprec);
+
+#define ZA_MASK (0xff << (zprec + aprec))
+ *pixel =
+ static_shift<24 - zprec - aprec>(zA & ZA_MASK)
+ | static_shift<16 - zprec - aprec>(zR & ZA_MASK)
+ | static_shift<8 - zprec - aprec>(zG & ZA_MASK)
+ | static_shift<-zprec - aprec>(zB & ZA_MASK);
+#undef ZA_MASK
+}
- int bpl = result.bytesPerLine();
- int rgba[4];
- unsigned char* p;
+const int alphaIndex = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3);
- int i1 = 0;
- int i2 = 3;
+template<int aprec, int zprec>
+static inline void blurinner_alphaOnly(uchar *bptr, int &z, int alpha)
+{
+ const int A_zprec = int(*(bptr)) << zprec;
+ const int z_zprec = z >> aprec;
+ z += alpha * (A_zprec - z_zprec);
+ *(bptr) = z >> (zprec + aprec);
+}
- if (alphaOnly)
- i1 = i2 = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3);
+template<int aprec, int zprec, bool alphaOnly>
+static inline void blurrow(QImage & im, int line, int alpha)
+{
+ uchar *bptr = im.scanLine(line);
+
+ int zR = 0, zG = 0, zB = 0, zA = 0;
+
+ if (alphaOnly && im.format() != QImage::Format_Indexed8)
+ bptr += alphaIndex;
+
+ const int stride = im.depth() >> 3;
+ const int im_width = im.width();
+ for (int index = 0; index < im_width; ++index) {
+ if (alphaOnly)
+ blurinner_alphaOnly<aprec, zprec>(bptr, zA, alpha);
+ else
+ blurinner<aprec, zprec>(bptr, zR, zG, zB, zA, alpha);
+ bptr += stride;
+ }
+
+ bptr -= stride;
+
+ for (int index = im_width - 2; index >= 0; --index) {
+ bptr -= stride;
+ if (alphaOnly)
+ blurinner_alphaOnly<aprec, zprec>(bptr, zA, alpha);
+ else
+ blurinner<aprec, zprec>(bptr, zR, zG, zB, zA, alpha);
+ }
+}
+
+/*
+* expblur(QImage &img, int radius)
+*
+* Based on exponential blur algorithm by Jani Huhtanen
+*
+* In-place blur of image 'img' with kernel
+* of approximate radius 'radius'.
+*
+* Blurs with two sided exponential impulse
+* response.
+*
+* aprec = precision of alpha parameter
+* in fixed-point format 0.aprec
+*
+* zprec = precision of state parameters
+* zR,zG,zB and zA in fp format 8.zprec
+*/
+template <int aprec, int zprec, bool alphaOnly>
+void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transposed = 0)
+{
+ // halve the radius if we're using two passes
+ if (improvedQuality)
+ radius *= qreal(0.5);
+
+ Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied
+ || img.format() == QImage::Format_RGB32);
+
+ // choose the alpha such that pixels at radius distance from a fully
+ // saturated pixel will have an alpha component of no greater than
+ // the cutOffIntensity
+ const qreal cutOffIntensity = 2;
+ int alpha = radius <= qreal(1e-5)
+ ? ((1 << aprec)-1)
+ : qRound((1<<aprec)*(1 - qPow(cutOffIntensity * (1 / qreal(255)), 1 / radius)));
+
+ int img_height = img.height();
+ for (int row = 0; row < img_height; ++row) {
+ for (int i = 0; i <= improvedQuality; ++i)
+ blurrow<aprec, zprec, alphaOnly>(img, row, alpha);
+ }
+
+ QImage temp(img.height(), img.width(), img.format());
+ if (transposed >= 0) {
+ if (img.depth() == 8) {
+ qt_memrotate270(reinterpret_cast<const quint8*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint8*>(temp.bits()),
+ temp.bytesPerLine());
+ } else {
+ qt_memrotate270(reinterpret_cast<const quint32*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint32*>(temp.bits()),
+ temp.bytesPerLine());
+ }
+ } else {
+ if (img.depth() == 8) {
+ qt_memrotate90(reinterpret_cast<const quint8*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint8*>(temp.bits()),
+ temp.bytesPerLine());
+ } else {
+ qt_memrotate90(reinterpret_cast<const quint32*>(img.bits()),
+ img.width(), img.height(), img.bytesPerLine(),
+ reinterpret_cast<quint32*>(temp.bits()),
+ temp.bytesPerLine());
+ }
+ }
- for (int col = c1; col <= c2; col++) {
- p = result.scanLine(r1) + col * 4;
- for (int i = i1; i <= i2; i++)
- rgba[i] = p[i] << 4;
+ img_height = temp.height();
+ for (int row = 0; row < img_height; ++row) {
+ for (int i = 0; i <= improvedQuality; ++i)
+ blurrow<aprec, zprec, alphaOnly>(temp, row, alpha);
+ }
- p += bpl;
- for (int j = r1; j < r2; j++, p += bpl)
- for (int i = i1; i <= i2; i++)
- p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
+ if (transposed == 0) {
+ qt_memrotate90(reinterpret_cast<const quint32*>(temp.bits()),
+ temp.width(), temp.height(), temp.bytesPerLine(),
+ reinterpret_cast<quint32*>(img.bits()),
+ img.bytesPerLine());
+ } else {
+ img = temp;
}
+}
+#define AVG(a,b) ( ((((a)^(b)) & 0xfefefefeUL) >> 1) + ((a)&(b)) )
+#define AVG16(a,b) ( ((((a)^(b)) & 0xf7deUL) >> 1) + ((a)&(b)) )
- for (int row = r1; row <= r2; row++) {
- p = result.scanLine(row) + c1 * 4;
- for (int i = i1; i <= i2; i++)
- rgba[i] = p[i] << 4;
+Q_GUI_EXPORT QImage qt_halfScaled(const QImage &source)
+{
+ QImage srcImage = source;
+
+ if (source.format() == QImage::Format_Indexed8) {
+ // assumes grayscale
+ QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+
+ const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits());
+ int sx = srcImage.bytesPerLine();
+ int sx2 = sx << 1;
+
+ uchar *dst = reinterpret_cast<uchar*>(dest.bits());
+ int dx = dest.bytesPerLine();
+ int ww = dest.width();
+ int hh = dest.height();
+
+ for (int y = hh; y; --y, dst += dx, src += sx2) {
+ const uchar *p1 = src;
+ const uchar *p2 = src + sx;
+ uchar *q = dst;
+ for (int x = ww; x; --x, ++q, p1 += 2, p2 += 2)
+ *q = ((int(p1[0]) + int(p1[1]) + int(p2[0]) + int(p2[1])) + 2) >> 2;
+ }
+
+ return dest;
+ } else if (source.format() == QImage::Format_ARGB8565_Premultiplied) {
+ QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+
+ const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits());
+ int sx = srcImage.bytesPerLine();
+ int sx2 = sx << 1;
+
+ uchar *dst = reinterpret_cast<uchar*>(dest.bits());
+ int dx = dest.bytesPerLine();
+ int ww = dest.width();
+ int hh = dest.height();
+
+ for (int y = hh; y; --y, dst += dx, src += sx2) {
+ const uchar *p1 = src;
+ const uchar *p2 = src + sx;
+ uchar *q = dst;
+ for (int x = ww; x; --x, q += 3, p1 += 6, p2 += 6) {
+ // alpha
+ q[0] = AVG(AVG(p1[0], p1[3]), AVG(p2[0], p2[3]));
+ // rgb
+ const quint16 p16_1 = (p1[2] << 8) | p1[1];
+ const quint16 p16_2 = (p1[5] << 8) | p1[4];
+ const quint16 p16_3 = (p2[2] << 8) | p2[1];
+ const quint16 p16_4 = (p2[5] << 8) | p2[4];
+ const quint16 result = AVG16(AVG16(p16_1, p16_2), AVG16(p16_3, p16_4));
+ q[1] = result & 0xff;
+ q[2] = result >> 8;
+ }
+ }
- p += 4;
- for (int j = c1; j < c2; j++, p += 4)
- for (int i = i1; i <= i2; i++)
- p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
+ return dest;
+ } else if (source.format() != QImage::Format_ARGB32_Premultiplied
+ && source.format() != QImage::Format_RGB32)
+ {
+ srcImage = source.convertToFormat(QImage::Format_ARGB32_Premultiplied);
}
- for (int col = c1; col <= c2; col++) {
- p = result.scanLine(r2) + col * 4;
- for (int i = i1; i <= i2; i++)
- rgba[i] = p[i] << 4;
+ QImage dest(source.width() / 2, source.height() / 2, srcImage.format());
+
+ const quint32 *src = reinterpret_cast<const quint32*>(const_cast<const QImage &>(srcImage).bits());
+ int sx = srcImage.bytesPerLine() >> 2;
+ int sx2 = sx << 1;
+
+ quint32 *dst = reinterpret_cast<quint32*>(dest.bits());
+ int dx = dest.bytesPerLine() >> 2;
+ int ww = dest.width();
+ int hh = dest.height();
- p -= bpl;
- for (int j = r1; j < r2; j++, p -= bpl)
- for (int i = i1; i <= i2; i++)
- p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
+ for (int y = hh; y; --y, dst += dx, src += sx2) {
+ const quint32 *p1 = src;
+ const quint32 *p2 = src + sx;
+ quint32 *q = dst;
+ for (int x = ww; x; --x, q++, p1 += 2, p2 += 2)
+ *q = AVG(AVG(p1[0], p1[1]), AVG(p2[0], p2[1]));
}
- for (int row = r1; row <= r2; row++) {
- p = result.scanLine(row) + c2 * 4;
- for (int i = i1; i <= i2; i++)
- rgba[i] = p[i] << 4;
+ return dest;
+}
- p -= 4;
- for (int j = c1; j < c2; j++, p -= 4)
- for (int i = i1; i <= i2; i++)
- p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
+Q_GUI_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0)
+{
+ if (blurImage.format() != QImage::Format_ARGB32_Premultiplied
+ && blurImage.format() != QImage::Format_RGB32)
+ {
+ blurImage = blurImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
}
- return result;
+ qreal scale = 1;
+ if (radius >= 4) {
+ blurImage = qt_halfScaled(blurImage);
+ scale = 2;
+ radius *= qreal(0.5);
+ }
+
+ if (alphaOnly)
+ expblur<12, 10, true>(blurImage, radius, quality, transposed);
+ else
+ expblur<12, 10, false>(blurImage, radius, quality, transposed);
+
+ if (p) {
+ p->scale(scale, scale);
+ p->setRenderHint(QPainter::SmoothPixmapTransform);
+ p->drawImage(QRect(0, 0, blurImage.width(), blurImage.height()), blurImage);
+ }
+}
+
+Q_GUI_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0)
+{
+ if (blurImage.format() == QImage::Format_Indexed8)
+ expblur<12, 10, true>(blurImage, radius, quality, transposed);
+ else
+ expblur<12, 10, false>(blurImage, radius, quality, transposed);
}
+bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
+
/*!
\internal
*/
-void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap &src, const QRectF &srcRect) const
+void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap &src, const QRectF &rect) const
{
Q_D(const QPixmapBlurFilter);
if (!painter->isActive())
return;
- if (d->radius <= 0) {
+ QRectF srcRect = rect;
+ if (srcRect.isNull())
+ srcRect = src.rect();
+
+ if (d->radius <= 1) {
painter->drawPixmap(srcRect.translated(p), src, srcRect);
return;
}
+ qreal scaledRadius = radiusScale * d->radius;
+ qreal scale;
+ if (qt_scaleForTransform(painter->transform(), &scale))
+ scaledRadius /= scale;
+
QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ?
static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0;
QPixmapBlurFilter *blurFilter = static_cast<QPixmapBlurFilter*>(filter);
if (blurFilter) {
- blurFilter->setRadius(d->radius);
+ blurFilter->setRadius(scaledRadius);
blurFilter->setBlurHints(d->hints);
blurFilter->draw(painter, p, src, srcRect);
return;
@@ -693,17 +929,17 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap
QImage srcImage;
QImage destImage;
- if (srcRect.isNull()) {
+ if (srcRect == src.rect()) {
srcImage = src.toImage();
- destImage = blurred(srcImage, srcImage.rect(), qRound(d->radius));
} else {
QRect rect = srcRect.toAlignedRect().intersected(src.rect());
-
srcImage = src.copy(rect).toImage();
- destImage = blurred(srcImage, srcImage.rect(), qRound(d->radius));
}
- painter->drawImage(p, destImage);
+ QTransform transform = painter->worldTransform();
+ painter->translate(p);
+ qt_blurImage(painter, srcImage, scaledRadius, (d->hints & QGraphicsBlurEffect::QualityHint), false);
+ painter->setWorldTransform(transform);
}
// grayscales the image to dest (could be same). If rect isn't defined
@@ -1095,7 +1331,13 @@ void QPixmapDropShadowFilter::draw(QPainter *p,
tmpPainter.end();
// blur the alpha channel
- tmp = blurred(tmp, tmp.rect(), qRound(d->radius), true);
+ QImage blurred(tmp.size(), QImage::Format_ARGB32_Premultiplied);
+ blurred.fill(0);
+ QPainter blurPainter(&blurred);
+ qt_blurImage(&blurPainter, tmp, d->radius, false, true);
+ blurPainter.end();
+
+ tmp = blurred;
// blacken the image...
tmpPainter.begin(&tmp);
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 4a450b7..f447989 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -70,6 +70,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
itemDelegate(0),
selectionModel(0),
ctrlDragSelectionFlag(QItemSelectionModel::NoUpdate),
+ noSelectionOnMousePress(false),
selectionMode(QAbstractItemView::ExtendedSelection),
selectionBehavior(QAbstractItemView::SelectItems),
currentlyCommittingEditor(0),
@@ -1622,6 +1623,7 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event)
d->pressedIndex = index;
d->pressedModifiers = event->modifiers();
QItemSelectionModel::SelectionFlags command = selectionCommand(index, event);
+ d->noSelectionOnMousePress = command == QItemSelectionModel::NoUpdate || !index.isValid();
QPoint offset = d->offset();
if ((command & QItemSelectionModel::Current) == 0)
d->pressedPosition = pos + offset;
@@ -1760,9 +1762,10 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate;
- //in the case the user presses on no item we might decide to clear the selection
- if (d->selectionModel && !index.isValid())
- d->selectionModel->select(QModelIndex(), selectionCommand(index, event));
+ if (d->selectionModel && d->noSelectionOnMousePress) {
+ d->noSelectionOnMousePress = false;
+ d->selectionModel->select(index, selectionCommand(index, event));
+ }
setState(NoState);
@@ -2065,9 +2068,13 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event)
{
Q_D(QAbstractItemView);
QAbstractScrollArea::focusInEvent(event);
- if (selectionModel()
+
+ const QItemSelectionModel* model = selectionModel();
+ const bool currentIndexValid = currentIndex().isValid();
+
+ if (model
&& !d->currentIndexSet
- && !currentIndex().isValid()) {
+ && !currentIndexValid) {
bool autoScroll = d->autoScroll;
d->autoScroll = false;
QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); // first visible index
@@ -2075,6 +2082,17 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event)
selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
d->autoScroll = autoScroll;
}
+
+ if (model && currentIndexValid) {
+ if (currentIndex().flags() != Qt::ItemIsEditable)
+ setAttribute(Qt::WA_InputMethodEnabled, false);
+ else
+ setAttribute(Qt::WA_InputMethodEnabled);
+ }
+
+ if (!currentIndexValid)
+ setAttribute(Qt::WA_InputMethodEnabled, false);
+
d->viewport->update();
}
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 0b5cfbe..7fc6780 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -347,6 +347,7 @@ public:
QMap<int, QPointer<QAbstractItemDelegate> > columnDelegates;
QPointer<QItemSelectionModel> selectionModel;
QItemSelectionModel::SelectionFlag ctrlDragSelectionFlag;
+ bool noSelectionOnMousePress;
QAbstractItemView::SelectionMode selectionMode;
QAbstractItemView::SelectionBehavior selectionBehavior;
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 8c63968..bd13423 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -3629,12 +3629,46 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
// walk through parents and check for gestures
if (qt_gestureManager) {
- if (receiver->isWidgetType()) {
- if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
- return true;
- } else if (QGesture *gesture = qobject_cast<QGesture *>(receiver)) {
- if (qt_gestureManager->filterEvent(gesture, e))
- return true;
+ switch (e->type()) {
+ case QEvent::Paint:
+ case QEvent::MetaCall:
+ case QEvent::DeferredDelete:
+ case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave:
+ case QEvent::Drop: case QEvent::DragResponse:
+ case QEvent::ChildAdded: case QEvent::ChildPolished:
+#ifdef QT3_SUPPORT
+ case QEvent::ChildInsertedRequest:
+ case QEvent::ChildInserted:
+ case QEvent::LayoutHint:
+#endif
+ case QEvent::ChildRemoved:
+ case QEvent::UpdateRequest:
+ case QEvent::UpdateLater:
+ case QEvent::AccessibilityPrepare:
+ case QEvent::LocaleChange:
+ case QEvent::Style:
+ case QEvent::IconDrag:
+ case QEvent::StyleChange:
+ case QEvent::AccessibilityHelp:
+ case QEvent::AccessibilityDescription:
+ case QEvent::GraphicsSceneDragEnter:
+ case QEvent::GraphicsSceneDragMove:
+ case QEvent::GraphicsSceneDragLeave:
+ case QEvent::GraphicsSceneDrop:
+ case QEvent::DynamicPropertyChange:
+ case QEvent::NetworkReplyUpdated:
+ break;
+ default:
+ if (receiver->isWidgetType()) {
+ if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
+ return true;
+ } else {
+ // a special case for events that go to QGesture objects.
+ // We pass the object to the gesture manager and it'll figure
+ // out if it's QGesture or not.
+ if (qt_gestureManager->filterEvent(receiver, e))
+ return true;
+ }
}
}
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index ab57c32..27f2644 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -361,6 +361,8 @@ void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop)
SetFocusing(true);
m_longTapDetector = QLongTapTimer::NewL(this);
+
+ DrawableWindow()->SetPointerGrab(ETrue);
}
}
@@ -472,41 +474,6 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent)
QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent));
}
-typedef QPair<QWidget*,QMouseEvent> Event;
-
-/*
- * Helper function called by HandlePointerEvent - separated to keep that function readable
- */
-static void generateEnterLeaveEvents(QList<Event> &events, QWidget *widgetUnderPointer,
- QPoint globalPos, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
-{
- //moved to another widget, create enter and leave events
- if (S60->lastPointerEventTarget) {
- QMouseEvent mEventLeave(QEvent::Leave, S60->lastPointerEventTarget->mapFromGlobal(
- S60->lastCursorPos), S60->lastCursorPos, button, QApplicationPrivate::mouse_buttons,
- modifiers);
- events.append(Event(S60->lastPointerEventTarget, mEventLeave));
- }
- if (widgetUnderPointer) {
- QMouseEvent mEventEnter(QEvent::Enter, widgetUnderPointer->mapFromGlobal(globalPos),
- globalPos, button, QApplicationPrivate::mouse_buttons, modifiers);
-
- events.append(Event(widgetUnderPointer, mEventEnter));
-#ifndef QT_NO_CURSOR
- S60->curWin = widgetUnderPointer->effectiveWinId();
- if (!QApplication::overrideCursor()) {
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors)
- qt_symbian_set_pointer_sprite(widgetUnderPointer->cursor());
- else
-#endif
- qt_symbian_setWindowCursor(widgetUnderPointer->cursor(), S60->curWin);
- }
-#endif
- }
-}
-
-
void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
{
QMouseEvent::Type type;
@@ -514,85 +481,77 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
mapS60MouseEventTypeToQt(&type, &button, &pEvent);
Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers);
- if (type == QMouseEvent::None)
- return;
-
- // store events for later sending/saving
- QList<Event > events;
-
QPoint widgetPos = QPoint(pEvent.iPosition.iX, pEvent.iPosition.iY);
TPoint controlScreenPos = PositionRelativeToScreen();
QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos;
+ S60->lastCursorPos = globalPos;
+ S60->lastPointerEventPos = widgetPos;
- // widgets interested in the event
- QWidget *widgetUnderPointer = qwidget->childAt(widgetPos);
- if (!widgetUnderPointer)
- widgetUnderPointer = qwidget; //i.e. this container widget
+ QWidget *mouseGrabber = QWidget::mouseGrabber();
- QWidget *widgetWithMouseGrab = QWidget::mouseGrabber();
+ QWidget *popupWidget = qApp->activePopupWidget();
+ QWidget *popupReceiver = 0;
+ if (popupWidget) {
+ QWidget *popupChild = popupWidget->childAt(popupWidget->mapFromGlobal(globalPos));
+ popupReceiver = popupChild ? popupChild : popupWidget;
+ }
- // handle auto grab of pointer when pressing / releasing
- if (!widgetWithMouseGrab && type == QEvent::MouseButtonPress) {
- //if previously auto-grabbed, generate a fake mouse release (platform bug: mouse release event was lost)
- if (S60->mousePressTarget) {
- QMouseEvent mEvent(QEvent::MouseButtonRelease, S60->mousePressTarget->mapFromGlobal(globalPos), globalPos,
- button, QApplicationPrivate::mouse_buttons, modifiers);
- events.append(Event(S60->mousePressTarget,mEvent));
+ if (mouseGrabber) {
+ if (popupReceiver) {
+ sendMouseEvent(popupReceiver, type, globalPos, button, modifiers);
+ } else {
+ sendMouseEvent(mouseGrabber, type, globalPos, button, modifiers);
}
- //auto grab the mouse
- widgetWithMouseGrab = S60->mousePressTarget = widgetUnderPointer;
- widgetWithMouseGrab->grabMouse();
- }
- if (widgetWithMouseGrab && widgetWithMouseGrab == S60->mousePressTarget && type == QEvent::MouseButtonRelease) {
- //release the auto grab - note this release event still goes to the autograb widget
- S60->mousePressTarget = 0;
- widgetWithMouseGrab->releaseMouse();
+ // No Enter/Leave events in grabbing mode.
+ return;
}
- QWidget *widgetToReceiveMouseEvent;
- if (widgetWithMouseGrab)
- widgetToReceiveMouseEvent = widgetWithMouseGrab;
- else
- widgetToReceiveMouseEvent = widgetUnderPointer;
-
- //queue QEvent::Enter and QEvent::Leave, if the pointer has moved
- if (widgetUnderPointer != S60->lastPointerEventTarget && (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove))
- generateEnterLeaveEvents(events, widgetUnderPointer, globalPos, button, modifiers);
+ QWidget *widgetUnderPointer = qwidget->childAt(widgetPos);
+ if (!widgetUnderPointer)
+ widgetUnderPointer = qwidget;
- //save global state
- S60->lastCursorPos = globalPos;
- S60->lastPointerEventPos = widgetPos;
+ QApplicationPrivate::dispatchEnterLeave(widgetUnderPointer, S60->lastPointerEventTarget);
S60->lastPointerEventTarget = widgetUnderPointer;
+ QWidget *receiver;
+ if (!popupReceiver && S60->mousePressTarget && type != QEvent::MouseButtonPress) {
+ receiver = S60->mousePressTarget;
+ if (type == QEvent::MouseButtonRelease)
+ S60->mousePressTarget = 0;
+ } else {
+ receiver = popupReceiver ? popupReceiver : widgetUnderPointer;
+ if (type == QEvent::MouseButtonPress)
+ S60->mousePressTarget = receiver;
+ }
+
#if !defined(QT_NO_CURSOR) && !defined(Q_SYMBIAN_FIXED_POINTER_CURSORS)
if (S60->brokenPointerCursors)
qt_symbian_move_cursor_sprite();
#endif
- //queue this event.
- Q_ASSERT(widgetToReceiveMouseEvent);
- QMouseEvent mEvent(type, widgetToReceiveMouseEvent->mapFromGlobal(globalPos), globalPos,
+ sendMouseEvent(receiver, type, globalPos, button, modifiers);
+}
+
+void QSymbianControl::sendMouseEvent(
+ QWidget *receiver,
+ QEvent::Type type,
+ const QPoint &globalPos,
+ Qt::MouseButton button,
+ Qt::KeyboardModifiers modifiers)
+{
+ Q_ASSERT(receiver);
+ QMouseEvent mEvent(type, receiver->mapFromGlobal(globalPos), globalPos,
button, QApplicationPrivate::mouse_buttons, modifiers);
- events.append(Event(widgetToReceiveMouseEvent,mEvent));
QEventDispatcherS60 *dispatcher;
// It is theoretically possible for someone to install a different event dispatcher.
- if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(widgetToReceiveMouseEvent->d_func()->threadData->eventDispatcher)) != 0) {
+ if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(receiver->d_func()->threadData->eventDispatcher)) != 0) {
if (dispatcher->excludeUserInputEvents()) {
- for (int i=0;i < events.count();++i)
- {
- Event next = events[i];
- dispatcher->saveInputEvent(this, next.first, new QMouseEvent(next.second));
- }
+ dispatcher->saveInputEvent(this, receiver, new QMouseEvent(mEvent));
return;
}
}
- //send events in the queue
- for (int i=0;i < events.count();++i)
- {
- Event next = events[i];
- sendMouseEvent(next.first, &(next.second));
- }
+ sendMouseEvent(receiver, &mEvent);
}
bool QSymbianControl::sendMouseEvent(QWidget *widget, QMouseEvent *mEvent)
@@ -672,27 +631,58 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod
fakeEvent.iType = TPointerEvent::EButton1Up;
S60->virtualMouseAccel = 1;
S60->virtualMouseLastKey = 0;
+ switch (keyCode) {
+ case Qt::Key_Left:
+ S60->virtualMousePressedKeys &= ~QS60Data::Left;
+ break;
+ case Qt::Key_Right:
+ S60->virtualMousePressedKeys &= ~QS60Data::Right;
+ break;
+ case Qt::Key_Up:
+ S60->virtualMousePressedKeys &= ~QS60Data::Up;
+ break;
+ case Qt::Key_Down:
+ S60->virtualMousePressedKeys &= ~QS60Data::Down;
+ break;
+ case Qt::Key_Select:
+ S60->virtualMousePressedKeys &= ~QS60Data::Select;
+ break;
+ }
}
else if (type == EEventKey) {
switch (keyCode) {
case Qt::Key_Left:
+ S60->virtualMousePressedKeys |= QS60Data::Left;
x -= S60->virtualMouseAccel;
fakeEvent.iType = TPointerEvent::EMove;
break;
case Qt::Key_Right:
+ S60->virtualMousePressedKeys |= QS60Data::Right;
x += S60->virtualMouseAccel;
fakeEvent.iType = TPointerEvent::EMove;
break;
case Qt::Key_Up:
+ S60->virtualMousePressedKeys |= QS60Data::Up;
y -= S60->virtualMouseAccel;
fakeEvent.iType = TPointerEvent::EMove;
break;
case Qt::Key_Down:
+ S60->virtualMousePressedKeys |= QS60Data::Down;
y += S60->virtualMouseAccel;
fakeEvent.iType = TPointerEvent::EMove;
break;
case Qt::Key_Select:
- fakeEvent.iType = TPointerEvent::EButton1Down;
+ // Platform bug. If you start pressing several keys simultaneously (for
+ // example for drag'n'drop), Symbian starts producing spurious up and
+ // down messages for some keys. Therefore, make sure we have a clean slate
+ // of pressed keys before starting a new button press.
+ if (S60->virtualMousePressedKeys != 0) {
+ S60->virtualMousePressedKeys |= QS60Data::Select;
+ return EKeyWasConsumed;
+ } else {
+ S60->virtualMousePressedKeys |= QS60Data::Select;
+ fakeEvent.iType = TPointerEvent::EButton1Down;
+ }
break;
}
}
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index ddd8ca6..6c06746 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -777,7 +777,7 @@ extern "C" {
NSPoint windowPoint = [theEvent locationInWindow];
NSPoint globalPoint = [[theEvent window] convertBaseToScreen:windowPoint];
NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
- QPoint qlocal = QPoint(localPoint.x, flipYCoordinate(localPoint.y));
+ QPoint qlocal = QPoint(localPoint.x, localPoint.y);
QPoint qglobal = QPoint(globalPoint.x, flipYCoordinate(globalPoint.y));
Qt::MouseButtons buttons = QApplication::mouseButtons();
bool wheelOK = false;
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index c4a25e1..eedf0a7 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -409,7 +409,7 @@ QMouseEventEx::~QMouseEventEx()
consider a top-level window A containing a child B which in turn contains a
child C (all with mouse tracking enabled):
- \image hoverEvents.png
+ \image hoverevents.png
Now, if you move the cursor from the top to the bottom in the middle of A,
you will get the following QEvent::MouseMove events:
@@ -432,7 +432,7 @@ QMouseEventEx::~QMouseEventEx()
\o A::HoverMove, B::HoverMove
\o A::HoverMove, B::HoverMove, C::HoverMove
\endlist
-
+
*/
/*!
@@ -3023,7 +3023,7 @@ QShowEvent::~QShowEvent()
This event is only used to notify the application of a request.
It may be safely ignored.
- \note This class is currently supported for Mac Os X only.
+ \note This class is currently supported for Mac OS X only.
*/
/*!
@@ -3066,6 +3066,8 @@ QFileOpenEvent::~QFileOpenEvent()
\fn QUrl QFileOpenEvent::url() const
Returns the url that is being opened.
+
+ \since 4.6
*/
QUrl QFileOpenEvent::url() const
{
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 192f9ac..d7cbebd 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -187,10 +187,8 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
#endif
}
- QList<QGesture *> states =
- m_objectGestures.value(QGestureManager::ObjectGesture(object, type));
// check if the QGesture for this recognizer has already been created
- foreach (QGesture *state, states) {
+ foreach (QGesture *state, m_objectGestures.value(QGestureManager::ObjectGesture(object, type))) {
if (m_gestureToRecognizer.value(state) == recognizer)
return state;
}
@@ -215,14 +213,13 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
return state;
}
-bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
+bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
Qt::GestureType> &contexts,
QEvent *event)
{
QSet<QGesture *> triggeredGestures;
QSet<QGesture *> finishedGestures;
QSet<QGesture *> newMaybeGestures;
- QSet<QGesture *> canceledGestures;
QSet<QGesture *> notGestures;
// TODO: sort contexts by the gesture type and check if one of the contexts
@@ -231,7 +228,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
bool ret = false;
// filter the event through recognizers
- typedef QHash<QObject *, Qt::GestureType>::const_iterator ContextIterator;
+ typedef QMultiMap<QObject *, Qt::GestureType>::const_iterator ContextIterator;
for (ContextIterator cit = contexts.begin(), ce = contexts.end(); cit != ce; ++cit) {
Qt::GestureType gestureType = cit.value();
QMap<Qt::GestureType, QGestureRecognizer *>::const_iterator
@@ -271,6 +268,9 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
}
}
}
+ if (triggeredGestures.isEmpty() && finishedGestures.isEmpty()
+ && newMaybeGestures.isEmpty() && notGestures.isEmpty())
+ return ret;
QSet<QGesture *> startedGestures = triggeredGestures - m_activeGestures;
triggeredGestures &= m_activeGestures;
@@ -280,8 +280,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiHash<QObject *,
// check if a running gesture switched back to not gesture state,
// i.e. were canceled
- QSet<QGesture *> activeToCancelGestures = m_activeGestures & notGestures;
- canceledGestures += activeToCancelGestures;
+ QSet<QGesture *> canceledGestures = m_activeGestures & notGestures;
// start timers for new gestures in maybe state
foreach (QGesture *state, newMaybeGestures) {
@@ -449,14 +448,14 @@ void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture)
// return true if accepted (consumed)
bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
{
- QSet<Qt::GestureType> types;
- QMultiHash<QObject *, Qt::GestureType> contexts;
+ QMap<Qt::GestureType, int> types;
+ QMultiMap<QObject *, Qt::GestureType> contexts;
QWidget *w = receiver;
typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
if (!w->d_func()->gestureContext.isEmpty()) {
for(ContextIterator it = w->d_func()->gestureContext.begin(),
e = w->d_func()->gestureContext.end(); it != e; ++it) {
- types.insert(it.key());
+ types.insert(it.key(), 0);
contexts.insertMulti(w, it.key());
}
}
@@ -468,7 +467,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
e = w->d_func()->gestureContext.end(); it != e; ++it) {
if (!(it.value() & Qt::DontStartGestureOnChildren)) {
if (!types.contains(it.key())) {
- types.insert(it.key());
+ types.insert(it.key(), 0);
contexts.insertMulti(w, it.key());
}
}
@@ -477,20 +476,20 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
break;
w = w->parentWidget();
}
- return filterEventThroughContexts(contexts, event);
+ return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
}
#ifndef QT_NO_GRAPHICSVIEW
bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
{
- QSet<Qt::GestureType> types;
- QMultiHash<QObject *, Qt::GestureType> contexts;
+ QMap<Qt::GestureType, int> types;
+ QMultiMap<QObject *, Qt::GestureType> contexts;
QGraphicsObject *item = receiver;
if (!item->QGraphicsItem::d_func()->gestureContext.isEmpty()) {
typedef QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator ContextIterator;
for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.begin(),
e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
- types.insert(it.key());
+ types.insert(it.key(), 0);
contexts.insertMulti(item, it.key());
}
}
@@ -503,20 +502,23 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
e = item->QGraphicsItem::d_func()->gestureContext.end(); it != e; ++it) {
if (!(it.value() & Qt::DontStartGestureOnChildren)) {
if (!types.contains(it.key())) {
- types.insert(it.key());
+ types.insert(it.key(), 0);
contexts.insertMulti(item, it.key());
}
}
}
item = item->parentObject();
}
- return filterEventThroughContexts(contexts, event);
+ return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
}
#endif
-bool QGestureManager::filterEvent(QGesture *state, QEvent *event)
+bool QGestureManager::filterEvent(QObject *receiver, QEvent *event)
{
- QMultiHash<QObject *, Qt::GestureType> contexts;
+ if (!m_gestureToRecognizer.contains(static_cast<QGesture *>(receiver)))
+ return false;
+ QGesture *state = static_cast<QGesture *>(receiver);
+ QMultiMap<QObject *, Qt::GestureType> contexts;
contexts.insert(state, state->gestureType());
return filterEventThroughContexts(contexts, event);
}
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
index 4efa10b..5329d1d 100644
--- a/src/gui/kernel/qgesturemanager_p.h
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -73,7 +73,7 @@ public:
void unregisterGestureRecognizer(Qt::GestureType type);
bool filterEvent(QWidget *receiver, QEvent *event);
- bool filterEvent(QGesture *receiver, QEvent *event);
+ bool filterEvent(QObject *receiver, QEvent *event);
#ifndef QT_NO_GRAPHICSVIEW
bool filterEvent(QGraphicsObject *receiver, QEvent *event);
#endif //QT_NO_GRAPHICSVIEW
@@ -86,7 +86,7 @@ public:
protected:
void timerEvent(QTimerEvent *event);
- bool filterEventThroughContexts(const QMultiHash<QObject *, Qt::GestureType> &contexts,
+ bool filterEventThroughContexts(const QMultiMap<QObject *, Qt::GestureType> &contexts,
QEvent *event);
private:
diff --git a/src/gui/kernel/qguieventdispatcher_glib.cpp b/src/gui/kernel/qguieventdispatcher_glib.cpp
index f8a638c..a252499 100644
--- a/src/gui/kernel/qguieventdispatcher_glib.cpp
+++ b/src/gui/kernel/qguieventdispatcher_glib.cpp
@@ -152,6 +152,8 @@ static gboolean x11EventSourceDispatch(GSource *s, GSourceFunc callback, gpointe
out:
+ source->d->runTimersOnceWithNormalPriority();
+
if (callback)
callback(user_data);
return true;
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 08f8bb5..737e9d7 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -103,6 +103,14 @@ public:
int defaultDpiY;
WId curWin;
int virtualMouseLastKey;
+ enum PressedKeys {
+ Select = 0x1,
+ Right = 0x2,
+ Down = 0x4,
+ Left = 0x8,
+ Up = 0x10
+ };
+ int virtualMousePressedKeys; // of the above type, but avoids casting problems
int virtualMouseAccel;
int virtualMouseMaxAccel;
#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
@@ -192,6 +200,12 @@ private:
TKeyResponse OfferKeyEvent(const TKeyEvent& aKeyEvent,TEventCode aType);
TKeyResponse sendKeyEvent(QWidget *widget, QKeyEvent *keyEvent);
bool sendMouseEvent(QWidget *widget, QMouseEvent *mEvent);
+ void sendMouseEvent(
+ QWidget *receiver,
+ QEvent::Type type,
+ const QPoint &globalPos,
+ Qt::MouseButton button,
+ Qt::KeyboardModifiers modifiers);
void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event);
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index a6b4cef..f626494 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -497,7 +497,7 @@ static bool addCircle(const QBezier *b, qreal offset, QBezier *o)
cos_a = 1.;
if (cos_a < -1.)
cos_a = -1;
- angles[i] = acos(cos_a)/Q_PI;
+ angles[i] = qAcos(cos_a)/Q_PI;
}
if (angles[0] + angles[1] > 1.) {
@@ -816,17 +816,17 @@ bool QBezier::findIntersections(const QBezier &a, const QBezier &b,
QVector<QPair<qreal, qreal> > *t)
{
if (IntersectBB(a, b)) {
- QPointF la1(fabs((a.x3 - a.x2) - (a.x2 - a.x1)),
- fabs((a.y3 - a.y2) - (a.y2 - a.y1)));
- QPointF la2(fabs((a.x4 - a.x3) - (a.x3 - a.x2)),
- fabs((a.y4 - a.y3) - (a.y3 - a.y2)));
+ QPointF la1(qFabs((a.x3 - a.x2) - (a.x2 - a.x1)),
+ qFabs((a.y3 - a.y2) - (a.y2 - a.y1)));
+ QPointF la2(qFabs((a.x4 - a.x3) - (a.x3 - a.x2)),
+ qFabs((a.y4 - a.y3) - (a.y3 - a.y2)));
QPointF la;
if (la1.x() > la2.x()) la.setX(la1.x()); else la.setX(la2.x());
if (la1.y() > la2.y()) la.setY(la1.y()); else la.setY(la2.y());
- QPointF lb1(fabs((b.x3 - b.x2) - (b.x2 - b.x1)),
- fabs((b.y3 - b.y2) - (b.y2 - b.y1)));
- QPointF lb2(fabs((b.x4 - b.x3) - (b.x3 - b.x2)),
- fabs((b.y4 - b.y3) - (b.y3 - b.y2)));
+ QPointF lb1(qFabs((b.x3 - b.x2) - (b.x2 - b.x1)),
+ qFabs((b.y3 - b.y2) - (b.y2 - b.y1)));
+ QPointF lb2(qFabs((b.x4 - b.x3) - (b.x3 - b.x2)),
+ qFabs((b.y4 - b.y3) - (b.y3 - b.y2)));
QPointF lb;
if (lb1.x() > lb2.x()) lb.setX(lb1.x()); else lb.setX(lb2.x());
if (lb1.y() > lb2.y()) lb.setY(lb1.y()); else lb.setY(lb2.y());
@@ -1120,7 +1120,7 @@ static inline void bindInflectionPoint(const QBezier &bez, const qreal t,
qreal ey = 3 * (right.y2 - right.y3);
qreal s4 = qAbs(6 * (ey * ax - ex * ay) / qSqrt(ex * ex + ey * ey)) + 0.00001f;
- qreal tf = pow(qreal(9 * flatness / s4), qreal(1./3.));
+ qreal tf = qPow(qreal(9 * flatness / s4), qreal(1./3.));
*tMinus = t - (1 - t) * tf;
*tPlus = t + (1 - t) * tf;
}
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 4df7f8a..23236ec 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -1182,7 +1182,7 @@ static const uint * QT_FASTCALL fetchConicalGradient(uint *buffer, const Operato
rx -= data->gradient.conical.center.x;
ry -= data->gradient.conical.center.y;
while (buffer < end) {
- qreal angle = atan2(ry, rx) + data->gradient.conical.angle;
+ qreal angle = qAtan2(ry, rx) + data->gradient.conical.angle;
*buffer = qt_gradient_pixel(&data->gradient, 1 - angle / (2*Q_PI));
@@ -1196,7 +1196,7 @@ static const uint * QT_FASTCALL fetchConicalGradient(uint *buffer, const Operato
if (!rw)
rw = 1;
while (buffer < end) {
- qreal angle = atan2(ry/rw - data->gradient.conical.center.x,
+ qreal angle = qAtan2(ry/rw - data->gradient.conical.center.x,
rx/rw - data->gradient.conical.center.y)
+ data->gradient.conical.angle;
@@ -7140,17 +7140,17 @@ void qt_build_pow_tables() {
}
#else
for (int i=0; i<256; ++i) {
- qt_pow_rgb_gamma[i] = uchar(qRound(pow(i / qreal(255.0), smoothing) * 255));
- qt_pow_rgb_invgamma[i] = uchar(qRound(pow(i / qreal(255.), 1 / smoothing) * 255));
+ qt_pow_rgb_gamma[i] = uchar(qRound(qPow(i / qreal(255.0), smoothing) * 255));
+ qt_pow_rgb_invgamma[i] = uchar(qRound(qPow(i / qreal(255.), 1 / smoothing) * 255));
}
#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
const qreal gray_gamma = 2.31;
for (int i=0; i<256; ++i)
- qt_pow_gamma[i] = uint(qRound(pow(i / qreal(255.), gray_gamma) * 2047));
+ qt_pow_gamma[i] = uint(qRound(qPow(i / qreal(255.), gray_gamma) * 2047));
for (int i=0; i<2048; ++i)
- qt_pow_invgamma[i] = uchar(qRound(pow(i / 2047.0, 1 / gray_gamma) * 255));
+ qt_pow_invgamma[i] = uchar(qRound(qPow(i / 2047.0, 1 / gray_gamma) * 255));
#endif
}
diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp
index 67dc2c7..e3a6f78 100644
--- a/src/gui/painting/qmemrotate.cpp
+++ b/src/gui/painting/qmemrotate.cpp
@@ -572,5 +572,26 @@ QT_IMPL_MEMROTATE(quint32, qrgb_generic16)
QT_IMPL_MEMROTATE(quint16, qrgb_generic16)
#endif
+struct qrgb_gl_rgba
+{
+public:
+ inline qrgb_gl_rgba(quint32 v) {
+ if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
+ data = ((v << 16) & 0xff0000) | ((v >> 16) & 0xff) | (v & 0xff00ff00);
+ else
+ data = (v << 8) | ((v >> 24) & 0xff);
+ }
+
+ inline operator quint32() const { return data; }
+
+private:
+ quint32 data;
+} Q_PACKED;
+
+void Q_GUI_EXPORT qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride,
+ quint32 *dest, int dstStride)
+{
+ qt_memrotate90_template(src, srcWidth, srcHeight, srcStride, reinterpret_cast<qrgb_gl_rgba *>(dest), dstStride);
+}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h
index 676a880..8aee575 100644
--- a/src/gui/painting/qmemrotate_p.h
+++ b/src/gui/painting/qmemrotate_p.h
@@ -81,6 +81,8 @@ QT_BEGIN_NAMESPACE
void Q_GUI_QWS_EXPORT qt_memrotate180(const srctype*, int, int, int, desttype*, int); \
void Q_GUI_QWS_EXPORT qt_memrotate270(const srctype*, int, int, int, desttype*, int)
+void Q_GUI_EXPORT qt_memrotate90(const quint32*, int, int, int, quint32*, int);
+
QT_DECL_MEMROTATE(quint32, quint32);
QT_DECL_MEMROTATE(quint32, quint16);
QT_DECL_MEMROTATE(quint16, quint32);
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 51d6195..a41ab6d 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1209,7 +1209,7 @@ static qreal computeAngle(const QPointF &v)
}
#else
// doesn't seem to be robust enough
- return atan2(v.x(), v.y()) + Q_PI;
+ return qAtan2(v.x(), v.y()) + Q_PI;
#endif
}
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index 228a6b1..8bb4728 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -910,8 +910,8 @@ QPointF qt_curves_for_arc(const QRectF &rect, qreal startAngle, qreal sweepLengt
}
}
- int startSegment = int(floor(startAngle / 90));
- int endSegment = int(floor((startAngle + sweepLength) / 90));
+ int startSegment = int(qFloor(startAngle / 90));
+ int endSegment = int(qFloor((startAngle + sweepLength) / 90));
qreal startT = (startAngle - startSegment * 90) / 90;
qreal endT = (startAngle + sweepLength - endSegment * 90) / 90;
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
index c66da71..15427c6 100644
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -68,12 +68,14 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget)
mode = EColor16MA; // Try for transparency anyway
// We create empty CFbsBitmap here -> it will be resized in setGeometry
- CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new
+ CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new
qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) );
QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType);
- data->fromSymbianBitmap(bitmap);
- d_ptr->device = QPixmap(data);
+ if (data) {
+ data->fromSymbianBitmap(bitmap, true);
+ d_ptr->device = QPixmap(data);
+ }
setStaticContentsSupport(true);
}
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 5028e5f..c1beb6a 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -2775,7 +2775,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
QSize size = (sr == SE_TabBarTabLeftButton) ? tab->leftButtonSize : tab->rightButtonSize;
int w = size.width();
int h = size.height();
- int midHeight = static_cast<int>(ceil(float(tr.height() - h) / 2));
+ int midHeight = static_cast<int>(qCeil(float(tr.height() - h) / 2));
int midWidth = ((tr.width() - w) / 2);
bool atTheTop = true;
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 93b517f..ed86f5a 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -88,16 +88,11 @@ static const qreal goldenRatio = 1.618;
const layoutHeader QS60StylePrivate::m_layoutHeaders[] = {
// *** generated layout data ***
-{240,320,1,15,true,"QVGA Landscape Mirrored"},
-{240,320,1,15,false,"QVGA Landscape"},
-{320,240,1,15,true,"QVGA Portrait Mirrored"},
-{320,240,1,15,false,"QVGA Portrait"},
-{360,640,1,15,true,"NHD Landscape Mirrored"},
-{360,640,1,15,false,"NHD Landscape"},
-{640,360,1,15,true,"NHD Portrait Mirrored"},
-{640,360,1,15,false,"NHD Portrait"},
-{352,800,1,12,true,"E90 Landscape Mirrored"},
-{352,800,1,12,false,"E90 Landscape"}
+{240,320,1,15,"QVGA Landscape"},
+{320,240,1,15,"QVGA Portrait"},
+{360,640,1,15,"NHD Landscape"},
+{640,360,1,15,"NHD Portrait"},
+{352,800,1,12,"E90 Landscape"}
// *** End of generated data ***
};
const int QS60StylePrivate::m_numberOfLayouts =
@@ -105,15 +100,10 @@ const int QS60StylePrivate::m_numberOfLayouts =
const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = {
// *** generated pixel metrics ***
-{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,6,3,3,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1},
{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1},
-{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,7,4,4,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1},
{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1},
-{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,8,5,5,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
-{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,8,5,5,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1},
-{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,5,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,8,6,5,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1},
{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1}
// *** End of generated data ***
};
@@ -200,10 +190,24 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter,
QS60StyleEnums::SP_QsnCpScrollHandleBottom, Qt::Vertical, painter, rect, flags | SF_PointNorth);
break;
case SE_SliderHandleHorizontal:
- drawPart(QS60StyleEnums::SP_QgnIndiSliderEdit, painter, rect, flags | SF_PointNorth);
+ drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarker, painter, rect, flags | SF_PointNorth);
break;
case SE_SliderHandleVertical:
- drawPart(QS60StyleEnums::SP_QgnIndiSliderEdit, painter, rect, flags | SF_PointEast);
+ drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarker, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_SliderHandleSelectedHorizontal:
+ drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_SliderHandleSelectedVertical:
+ drawPart(QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_SliderGrooveVertical:
+ drawRow(QS60StyleEnums::SP_QgnGrafNsliderEndLeft, QS60StyleEnums::SP_QgnGrafNsliderMiddle,
+ QS60StyleEnums::SP_QgnGrafNsliderEndRight, Qt::Vertical, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_SliderGrooveHorizontal:
+ drawRow(QS60StyleEnums::SP_QgnGrafNsliderEndLeft, QS60StyleEnums::SP_QgnGrafNsliderMiddle,
+ QS60StyleEnums::SP_QgnGrafNsliderEndRight, Qt::Horizontal, painter, rect, flags | SF_PointNorth);
break;
case SE_TabBarTabEastActive:
drawRow(QS60StyleEnums::SP_QgnGrafTabActiveL, QS60StyleEnums::SP_QgnGrafTabActiveM,
@@ -807,7 +811,15 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
//ratio of 1:2 for horizontal tab bars (and 2:1 for vertical ones).
result.setWidth(result.height()>>1);
break;
- case QS60StyleEnums::SP_QgnIndiSliderEdit:
+
+ case QS60StyleEnums::SP_QgnGrafNsliderEndLeft:
+ case QS60StyleEnums::SP_QgnGrafNsliderEndRight:
+ case QS60StyleEnums::SP_QgnGrafNsliderMiddle:
+ result.setWidth(result.height()>>1);
+ break;
+
+ case QS60StyleEnums::SP_QgnGrafNsliderMarker:
+ case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected:
result.scale(pixelMetric(QStyle::PM_SliderLength),
pixelMetric(QStyle::PM_SliderControlThickness), Qt::IgnoreAspectRatio);
break;
@@ -928,22 +940,42 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
case CC_Slider:
if (const QStyleOptionSlider *optionSlider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- // The groove is just a centered line. Maybe a qgn_graf_line_* at some point
const QRect sliderGroove = subControlRect(control, optionSlider, SC_SliderGroove, widget);
- const QPoint sliderGrooveCenter = sliderGroove.center();
const bool horizontal = optionSlider->orientation == Qt::Horizontal;
- painter->save();
- if (widget)
- painter->setPen(widget->palette().windowText().color());
- if (horizontal)
- painter->drawLine(0, sliderGrooveCenter.y(), sliderGroove.right(), sliderGrooveCenter.y());
- else
- painter->drawLine(sliderGrooveCenter.x(), 0, sliderGrooveCenter.x(), sliderGroove.bottom());
- painter->restore();
+ //Highlight
+/* if (optionSlider->state & QStyle::State_HasFocus)
+ drawPrimitive(PE_FrameFocusRect, optionSlider, painter, widget);*/
+
+ //Groove graphics
+ if (QS60StylePrivate::hasSliderGrooveGraphic()) {
+ const QS60StylePrivate::SkinElements grooveElement = horizontal ?
+ QS60StylePrivate::SE_SliderGrooveHorizontal :
+ QS60StylePrivate::SE_SliderGrooveVertical;
+ QS60StylePrivate::drawSkinElement(grooveElement, painter, sliderGroove, flags);
+ } else {
+ const QRect sliderGroove = subControlRect(control, optionSlider, SC_SliderGroove, widget);
+ const QPoint sliderGrooveCenter = sliderGroove.center();
+ const bool horizontal = optionSlider->orientation == Qt::Horizontal;
+ painter->save();
+ if (widget)
+ painter->setPen(widget->palette().windowText().color());
+ if (horizontal)
+ painter->drawLine(0, sliderGrooveCenter.y(), sliderGroove.right(), sliderGrooveCenter.y());
+ else
+ painter->drawLine(sliderGrooveCenter.x(), 0, sliderGrooveCenter.x(), sliderGroove.bottom());
+ painter->restore();
+ }
+
+ //Handle graphics
const QRect sliderHandle = subControlRect(control, optionSlider, SC_SliderHandle, widget);
- const QS60StylePrivate::SkinElements handleElement =
- horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical;
+ QS60StylePrivate::SkinElements handleElement;
+ if (optionSlider->state & QStyle::State_Sunken)
+ handleElement =
+ horizontal ? QS60StylePrivate::SE_SliderHandleSelectedHorizontal : QS60StylePrivate::SE_SliderHandleSelectedVertical;
+ else
+ handleElement =
+ horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical;
QS60StylePrivate::drawSkinElement(handleElement, painter, sliderHandle, flags);
}
break;
@@ -1317,6 +1349,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
painter->setClipRect(voptAdj.rect);
const bool isSelected = (vopt->state & QStyle::State_Selected);
+ const bool hasFocus = (vopt->state & QStyle::State_HasFocus);
bool isScrollBarVisible = false;
int scrollBarWidth = 0;
@@ -1359,7 +1392,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
} else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);}
// draw the focus rect
- if (isSelected) {
+ if (isSelected | hasFocus) {
QRect highlightRect = option->rect.adjusted(1,1,-1,-1);
QAbstractItemView::SelectionBehavior selectionBehavior =
itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems;
@@ -2238,11 +2271,13 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
}
break;
+ case PE_PanelScrollAreaCorner:
+ break;
+
// todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases
case PE_FrameLineEdit:
case PE_IndicatorDockWidgetResizeHandle:
case PE_PanelTipLabel:
- case PE_PanelScrollAreaCorner:
#ifndef QT_NO_TABBAR
case PE_IndicatorTabTear: // No tab tear in S60
@@ -2284,6 +2319,13 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const
metricValue = -menuWidth;
}
}
+ //if layout direction is mirrored, switch left and right border margins
+ if (option && option->direction == Qt::RightToLeft) {
+ if (metric == PM_LayoutLeftMargin)
+ metricValue = QS60StylePrivate::pixelMetric(PM_LayoutRightMargin);
+ else if (metric == PM_LayoutRightMargin)
+ metricValue = QS60StylePrivate::pixelMetric(PM_LayoutLeftMargin);
+ }
return metricValue;
}
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index eed66dc..65d7574 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -119,6 +119,9 @@ public:
SP_QgnGrafTabPassiveL,
SP_QgnGrafTabPassiveM,
SP_QgnGrafTabPassiveR,
+ SP_QgnGrafNsliderEndLeft,
+ SP_QgnGrafNsliderEndRight,
+ SP_QgnGrafNsliderMiddle,
SP_QgnIndiCheckboxOff,
SP_QgnIndiCheckboxOn,
SP_QgnIndiHlColSuper, // Available in S60 release 3.2 and later.
@@ -131,7 +134,8 @@ public:
SP_QgnIndiNaviArrowRight,
SP_QgnIndiRadiobuttOff,
SP_QgnIndiRadiobuttOn,
- SP_QgnIndiSliderEdit,
+ SP_QgnGrafNsliderMarker,
+ SP_QgnGrafNsliderMarkerSelected,
SP_QgnIndiSubMenu,
SP_QgnNoteErased,
SP_QgnNoteError,
@@ -313,6 +317,10 @@ public:
SE_ScrollBarHandleVertical,
SE_SliderHandleHorizontal,
SE_SliderHandleVertical,
+ SE_SliderHandleSelectedHorizontal,
+ SE_SliderHandleSelectedVertical,
+ SE_SliderGrooveVertical,
+ SE_SliderGrooveHorizontal,
SE_TabBarTabEastActive,
SE_TabBarTabEastInactive,
SE_TabBarTabNorthActive,
@@ -403,6 +411,7 @@ public:
static bool isTouchSupported();
static bool isToolBarBackground();
+ static bool hasSliderGrooveGraphic();
// calculates average color based on button skin graphics (minus borders).
QColor colorFromFrameGraphics(SkinFrameElements frame) const;
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index fbea644..13ac301 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -128,48 +128,57 @@ private:
};
const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
- /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawGulIcon, ES60_All, -1,-1},
- /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1},
- /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawGulIcon, ES60_All, -1,-1},
- /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawGulIcon, ES60_All, -1,-1},
- /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawGulIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawGulIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawGulIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_All, -1,-1},
+
+ // In 3.1 there is no slider groove.
+ /* SP_QgnGrafNsliderEndLeft */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19cf /* KAknsIIDQgnGrafNsliderEndLeft */},
+ /* SP_QgnGrafNsliderEndRight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d0 /* KAknsIIDQgnGrafNsliderEndRight */},
+ /* SP_QgnGrafNsliderMiddle */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d2 /* KAknsIIDQgnGrafNsliderMiddle */},
+ /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_All, -1,-1},
+
// Following 5 items (SP_QgnIndiHlColSuper - SP_QgnIndiHlLineStraight) are available starting from S60 release 3.2.
// In 3.1 CommonStyle drawing is used for these QTreeView elements, since no similar icons in AVKON UI.
- /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */},
- /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */},
- /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */},
- /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */},
- /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */},
- /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnIndiNaviArrowLeft, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnIndiNaviArrowRight, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiSliderEdit */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_All, -1,-1},
- /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */},
+ /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */},
+ /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */},
+ /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */},
+ /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */},
+ /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnIndiNaviArrowLeft, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnIndiNaviArrowRight, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_All, -1,-1},
+
+ // In 3.1 there different slider graphic and no pressed state.
+ /* SP_QgnGrafNsliderMarker */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d1 /* KAknsIIDQgnGrafNsliderMarker */},
+ /* SP_QgnGrafNsliderMarkerSelected */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x1a4a /* KAknsIIDQgnGrafNsliderMarkerSelected */},
+ /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_All, -1,-1},
// 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead.
/* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/
@@ -431,8 +440,11 @@ void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &style
case QS60StyleEnums::SP_QgnIndiRadiobuttOn:
fallbackIndex = EMbmAvkonQgn_indi_radiobutt_on;
break;
- case QS60StyleEnums::SP_QgnIndiSliderEdit:
- fallbackIndex = EMbmAvkonQgn_indi_slider_edit;
+ case QS60StyleEnums::SP_QgnGrafNsliderMarker:
+ fallbackIndex = 17572; /* EMbmAvkonQgn_graf_nslider_marker */
+ break;
+ case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected:
+ fallbackIndex = 17574; /* EMbmAvkonQgn_graf_nslider_marker_selected */
break;
case QS60StyleEnums::SP_QgnIndiSubMenu:
fallbackIndex = EMbmAvkonQgn_indi_submenu;
@@ -587,6 +599,11 @@ bool QS60StylePrivate::isToolBarBackground()
return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
}
+bool QS60StylePrivate::hasSliderGrooveGraphic()
+{
+ return QSysInfo::s60Version() != QSysInfo::SV_S60_3_1;
+}
+
QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
{
CCoeControl *control = targetWidget->effectiveWinId();
@@ -943,37 +960,23 @@ void QS60StylePrivate::setActiveLayout()
{
const QSize activeScreenSize(screenSize());
int activeLayoutIndex = -1;
- const bool mirrored = !QApplication::isLeftToRight();
const short screenHeight = (short)activeScreenSize.height();
const short screenWidth = (short)activeScreenSize.width();
for (int i=0; i<m_numberOfLayouts; i++) {
if (screenHeight==m_layoutHeaders[i].height &&
- screenWidth==m_layoutHeaders[i].width &&
- mirrored==m_layoutHeaders[i].mirroring) {
+ screenWidth==m_layoutHeaders[i].width) {
activeLayoutIndex = i;
break;
}
}
- //not found, lets try without mirroring info
- if (activeLayoutIndex==-1){
- for (int i=0; i<m_numberOfLayouts; i++) {
- if (screenHeight==m_layoutHeaders[i].height &&
- screenWidth==m_layoutHeaders[i].width) {
- activeLayoutIndex = i;
- break;
- }
- }
- }
-
//not found, lets try with either of dimensions
if (activeLayoutIndex==-1){
const QSysInfo::S60Version currentRelease = QSysInfo::s60Version();
const bool landscape = screenHeight < screenWidth;
- activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 4;
- activeLayoutIndex += (!landscape) ? 2 : 0;
- activeLayoutIndex += (!mirrored) ? 1 : 0;
+ activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 2;
+ activeLayoutIndex += (!landscape) ? 1 : 0;
}
m_pmPointer = data[activeLayoutIndex];
diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp
index 55d5771..e49854f 100644
--- a/src/gui/styles/qs60style_simulated.cpp
+++ b/src/gui/styles/qs60style_simulated.cpp
@@ -337,6 +337,11 @@ bool QS60StylePrivate::isToolBarBackground()
return true;
}
+bool QS60StylePrivate::hasSliderGrooveGraphic()
+{
+ return false;
+}
+
QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize)
{
QFont result;
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index af30f15..f5af960 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -154,7 +154,7 @@ qreal angle(const QPointF &p1, const QPointF &p2)
}
qreal m = -(y2 - y1) / (x2 - x1);
- _angle = atan(m) * rad_factor;
+ _angle = qAtan(m) * rad_factor;
if (p1.x() < p2.x())
_angle = 180 - _angle;
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 7e93aa0..e9c7b89 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1482,13 +1482,13 @@ QString QFontDatabase::styleString(const QFontInfo &fontInfo)
and style will look attractive.
If the font family is available from two or more foundries the
- foundry name is included in the family name, e.g. "Helvetica
- [Adobe]" and "Helvetica [Cronyx]". When you specify a family you
- can either use the old hyphenated Qt 2.x "foundry-family" format,
- e.g. "Cronyx-Helvetica", or the new bracketed Qt 3.x "family
- [foundry]" format e.g. "Helvetica [Cronyx]". If the family has a
- foundry it is always returned, e.g. by families(), using the
- bracketed format.
+ foundry name is included in the family name; for example:
+ "Helvetica [Adobe]" and "Helvetica [Cronyx]". When you specify a
+ family, you can either use the old hyphenated "foundry-family"
+ format or the bracketed "family [foundry]" format; for example:
+ "Cronyx-Helvetica" or "Helvetica [Cronyx]". If the family has a
+ foundry it is always returned using the bracketed format, as is
+ the case with the value returned by families().
The font() function returns a QFont given a family, style and
point size.
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index a4e7c04..a75d70f 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -404,7 +404,9 @@ QFixed QCoreTextFontEngine::ascent() const
}
QFixed QCoreTextFontEngine::descent() const
{
- return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil();
+ // subtract a pixel to even out the historical +1 in QFontMetrics::height().
+ // Fix in Qt 5.
+ return QFixed::fromReal(CTFontGetDescent(ctfont)).ceil() - 1;
}
QFixed QCoreTextFontEngine::leading() const
{
@@ -1406,7 +1408,9 @@ QFixed QFontEngineMac::ascent() const
QFixed QFontEngineMac::descent() const
{
- return m_descent;
+ // subtract a pixel to even out the historical +1 in QFontMetrics::height().
+ // Fix in Qt 5.
+ return m_descent - 1;
}
QFixed QFontEngineMac::leading() const
diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp
index 362be5b..474555b 100644
--- a/src/gui/util/qsystemtrayicon_win.cpp
+++ b/src/gui/util/qsystemtrayicon_win.cpp
@@ -83,7 +83,11 @@ struct Q_NOTIFYICONIDENTIFIER {
GUID guidItem;
};
+#define Q_MSGFLT_ALLOW 1
+
typedef HRESULT (WINAPI *PtrShell_NotifyIconGetRect)(const Q_NOTIFYICONIDENTIFIER* identifier, RECT* iconLocation);
+typedef BOOL (WINAPI *PtrChangeWindowMessageFilter)(UINT message, DWORD dwFlag);
+typedef BOOL (WINAPI *PtrChangeWindowMessageFilterEx)(HWND hWnd, UINT message, DWORD action, void* pChangeFilterStruct);
class QSystemTrayIconSys : QWidget
{
@@ -143,6 +147,23 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object)
if (!MYWM_TASKBARCREATED) {
MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated");
}
+
+ // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher
+ static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx =
+ (PtrChangeWindowMessageFilterEx)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx");
+
+ if (pChangeWindowMessageFilterEx) {
+ // Call the safer ChangeWindowMessageFilterEx API if available
+ pChangeWindowMessageFilterEx(winId(), MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0);
+ } else {
+ static PtrChangeWindowMessageFilter pChangeWindowMessageFilter =
+ (PtrChangeWindowMessageFilter)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter");
+
+ if (pChangeWindowMessageFilter) {
+ // Call the deprecated ChangeWindowMessageFilter API otherwise
+ pChangeWindowMessageFilter(MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW);
+ }
+ }
}
QSystemTrayIconSys::~QSystemTrayIconSys()
diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp
index c015589..c036c32 100644
--- a/src/gui/widgets/qabstractspinbox.cpp
+++ b/src/gui/widgets/qabstractspinbox.cpp
@@ -65,6 +65,11 @@
#include <limits.h>
#endif
+#if defined(Q_OS_SYMBIAN)
+#include <W32STD.H>
+#include <private/qt_s60_p.h>
+#endif
+
//#define QABSTRACTSPINBOX_QSBDEBUG
#ifdef QABSTRACTSPINBOX_QSBDEBUG
# define QASBDEBUG qDebug
@@ -939,10 +944,12 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
d->edit->setCursorPosition(d->prefix.size());
int steps = 1;
+ bool isPgUpOrDown = false;
switch (event->key()) {
case Qt::Key_PageUp:
case Qt::Key_PageDown:
steps *= 10;
+ isPgUpOrDown = true;
case Qt::Key_Up:
case Qt::Key_Down: {
#ifdef QT_KEYPAD_NAVIGATION
@@ -964,7 +971,13 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
if (style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)) {
d->buttonState = (Keyboard | (up ? Up : Down));
}
- stepBy(steps);
+ if (d->spinClickTimerId == -1)
+ stepBy(steps);
+ if(event->isAutoRepeat() && !isPgUpOrDown) {
+ if(d->spinClickThresholdTimerId == -1 && d->spinClickTimerId == -1) {
+ d->updateState(up, true);
+ }
+ }
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(this, 0, QAccessible::ValueChanged);
#endif
@@ -1061,8 +1074,7 @@ void QAbstractSpinBox::keyReleaseEvent(QKeyEvent *event)
{
Q_D(QAbstractSpinBox);
- if (d->buttonState & Keyboard && !event->isAutoRepeat()
- && style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)) {
+ if (d->buttonState & Keyboard && !event->isAutoRepeat()) {
d->reset();
} else {
d->edit->event(event);
@@ -1148,6 +1160,36 @@ void QAbstractSpinBox::hideEvent(QHideEvent *event)
QWidget::hideEvent(event);
}
+
+/*!
+ \internal
+
+ Used when acceleration is turned on. We need to get the
+ keyboard auto repeat rate from OS. This value is used as
+ argument when starting acceleration related timers.
+
+ Every platform should, either, use native calls to obtain
+ the value or hard code some reasonable rate.
+
+ Remember that time value should be given in msecs.
+*/
+static int getKeyboardAutoRepeatRate() {
+ int ret = 30;
+#if defined(Q_OS_SYMBIAN)
+ TTimeIntervalMicroSeconds32 initialTime;
+ TTimeIntervalMicroSeconds32 time;
+ S60->wsSession().GetKeyboardRepeatRate(initialTime, time);
+ ret = time.Int() / 1000; // msecs
+#elif defined(Q_OS_WIN)
+ DWORD time;
+ if (SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &time, 0) != FALSE)
+ ret = static_cast<int>(1000 / static_cast<int>(time)); // msecs
+#else
+#pragma message("Using default guesstimated value for keyboard repeat rate")
+#endif
+ return ret; // msecs
+}
+
/*!
\reimp
*/
@@ -1160,14 +1202,17 @@ void QAbstractSpinBox::timerEvent(QTimerEvent *event)
if (event->timerId() == d->spinClickThresholdTimerId) {
killTimer(d->spinClickThresholdTimerId);
d->spinClickThresholdTimerId = -1;
- d->spinClickTimerId = startTimer(d->spinClickTimerInterval);
+ d->effectiveSpinRepeatRate = d->buttonState & Keyboard
+ ? getKeyboardAutoRepeatRate()
+ : d->spinClickTimerInterval;
+ d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate);
doStep = true;
} else if (event->timerId() == d->spinClickTimerId) {
if (d->accelerate) {
- d->acceleration = d->acceleration + (int)(d->spinClickTimerInterval * 0.05);
- if (d->spinClickTimerInterval - d->acceleration >= 10) {
+ d->acceleration = d->acceleration + (int)(d->effectiveSpinRepeatRate * 0.05);
+ if (d->effectiveSpinRepeatRate - d->acceleration >= 10) {
killTimer(d->spinClickTimerId);
- d->spinClickTimerId = startTimer(d->spinClickTimerInterval - d->acceleration);
+ d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate - d->acceleration);
}
}
doStep = true;
@@ -1308,8 +1353,8 @@ void QAbstractSpinBox::mouseReleaseEvent(QMouseEvent *event)
QAbstractSpinBoxPrivate::QAbstractSpinBoxPrivate()
: edit(0), type(QVariant::Invalid), spinClickTimerId(-1),
spinClickTimerInterval(100), spinClickThresholdTimerId(-1), spinClickThresholdTimerInterval(-1),
- buttonState(None), cachedText(QLatin1String("\x01")), cachedState(QValidator::Invalid),
- pendingEmit(false), readOnly(false), wrapping(false),
+ effectiveSpinRepeatRate(1), buttonState(None), cachedText(QLatin1String("\x01")),
+ cachedState(QValidator::Invalid), pendingEmit(false), readOnly(false), wrapping(false),
ignoreCursorPositionChanged(false), frame(true), accelerate(false), keyboardTracking(true),
cleared(false), ignoreUpdateEdit(false), correctionMode(QAbstractSpinBox::CorrectToPreviousValue),
acceleration(0), hoverControl(QStyle::SC_None), buttonSymbols(QAbstractSpinBox::UpDownArrows), validator(0)
@@ -1554,7 +1599,7 @@ void QAbstractSpinBoxPrivate::reset()
Updates the state of the spinbox.
*/
-void QAbstractSpinBoxPrivate::updateState(bool up)
+void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard /* = false */)
{
Q_Q(QAbstractSpinBox);
if ((up && (buttonState & Up)) || (!up && (buttonState & Down)))
@@ -1563,7 +1608,7 @@ void QAbstractSpinBoxPrivate::updateState(bool up)
if (q && (q->stepEnabled() & (up ? QAbstractSpinBox::StepUpEnabled
: QAbstractSpinBox::StepDownEnabled))) {
spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval);
- buttonState = (up ? (Mouse | Up) : (Mouse | Down));
+ buttonState = (up ? Up : Down) | (fromKeyboard ? Keyboard : Mouse);
q->stepBy(up ? 1 : -1);
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(q, 0, QAccessible::ValueChanged);
diff --git a/src/gui/widgets/qabstractspinbox_p.h b/src/gui/widgets/qabstractspinbox_p.h
index 3020cbc..55f94d7 100644
--- a/src/gui/widgets/qabstractspinbox_p.h
+++ b/src/gui/widgets/qabstractspinbox_p.h
@@ -98,7 +98,7 @@ public:
void init();
void reset();
- void updateState(bool up);
+ void updateState(bool up, bool fromKeyboard = false);
QString stripped(const QString &text, int *pos = 0) const;
bool specialValue() const;
virtual QVariant getZeroVariant() const;
@@ -129,6 +129,7 @@ public:
QVariant value, minimum, maximum, singleStep;
QVariant::Type type;
int spinClickTimerId, spinClickTimerInterval, spinClickThresholdTimerId, spinClickThresholdTimerInterval;
+ int effectiveSpinRepeatRate;
uint buttonState;
mutable QString cachedText;
mutable QVariant cachedValue;
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index bd1d8ba..b7dd20c 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -931,7 +931,10 @@ void QComboBoxPrivate::init()
QSizePolicy::ComboBox));
setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem);
q->setModel(new QStandardItemModel(0, 1, q));
- q->setAttribute(Qt::WA_InputMethodEnabled);
+ if (!q->isEditable())
+ q->setAttribute(Qt::WA_InputMethodEnabled, false);
+ else
+ q->setAttribute(Qt::WA_InputMethodEnabled);
}
QComboBoxPrivateContainer* QComboBoxPrivate::viewContainer()
diff --git a/src/gui/widgets/qdial.cpp b/src/gui/widgets/qdial.cpp
index 95e6ed5..dc02c02 100644
--- a/src/gui/widgets/qdial.cpp
+++ b/src/gui/widgets/qdial.cpp
@@ -59,6 +59,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
+#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -135,7 +136,7 @@ int QDialPrivate::valueFromPoint(const QPoint &p) const
Q_Q(const QDial);
double yy = (double)q->height()/2.0 - p.y();
double xx = (double)p.x() - q->width()/2.0;
- double a = (xx || yy) ? atan2(yy, xx) : 0;
+ double a = (xx || yy) ? qAtan2(yy, xx) : 0;
if (a < Q_PI / -2)
a = a + Q_PI * 2;
diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h
index 594e488..3f159f6 100644
--- a/src/gui/widgets/qlineedit.h
+++ b/src/gui/widgets/qlineedit.h
@@ -288,6 +288,7 @@ private:
#ifdef QT_KEYPAD_NAVIGATION
Q_PRIVATE_SLOT(d_func(), void _q_editFocusChange(bool))
#endif
+ Q_PRIVATE_SLOT(d_func(), void _q_selectionChanged())
};
#endif // QT_NO_LINEEDIT
diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp
index 4437fef..c18ca25 100644
--- a/src/gui/widgets/qlineedit_p.cpp
+++ b/src/gui/widgets/qlineedit_p.cpp
@@ -126,6 +126,21 @@ void QLineEditPrivate::_q_editFocusChange(bool e)
}
#endif
+void QLineEditPrivate::_q_selectionChanged()
+{
+ Q_Q(QLineEdit);
+ if (control->preeditAreaText().isEmpty()) {
+ QStyleOptionFrameV2 opt;
+ q->initStyleOption(&opt);
+ bool showCursor = control->hasSelectedText() ?
+ q->style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, q):
+ true;
+ setCursorVisible(showCursor);
+ }
+
+ emit q->selectionChanged();
+}
+
void QLineEditPrivate::init(const QString& txt)
{
Q_Q(QLineEdit);
@@ -138,7 +153,7 @@ void QLineEditPrivate::init(const QString& txt)
QObject::connect(control, SIGNAL(cursorPositionChanged(int,int)),
q, SLOT(_q_cursorPositionChanged(int,int)));
QObject::connect(control, SIGNAL(selectionChanged()),
- q, SIGNAL(selectionChanged()));
+ q, SLOT(_q_selectionChanged()));
QObject::connect(control, SIGNAL(accepted()),
q, SIGNAL(returnPressed()));
QObject::connect(control, SIGNAL(editingFinished()),
@@ -149,6 +164,9 @@ void QLineEditPrivate::init(const QString& txt)
#endif
QObject::connect(control, SIGNAL(cursorPositionChanged(int,int)),
q, SLOT(updateMicroFocus()));
+
+ QObject::connect(control, SIGNAL(textChanged(const QString &)),
+ q, SLOT(updateMicroFocus()));
// for now, going completely overboard with updates.
QObject::connect(control, SIGNAL(selectionChanged()),
diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h
index dc648e8..f13dce2 100644
--- a/src/gui/widgets/qlineedit_p.h
+++ b/src/gui/widgets/qlineedit_p.h
@@ -128,7 +128,7 @@ public:
#ifdef QT_KEYPAD_NAVIGATION
void _q_editFocusChange(bool);
#endif
-
+ void _q_selectionChanged();
#ifndef QT_NO_COMPLETER
void _q_completionHighlighted(QString);
#endif
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index 8d8ffa7..6d50678 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -463,9 +463,6 @@ void QMainWindowLayout::removeFromMacToolbar(QToolBar *toolbar)
NSToolbarItem *item = static_cast<NSToolbarItem *>(it.key());
[[qt_mac_window_for(layoutState.mainWindow->window()) toolbar]
removeItemAtIndex:toolbarItemsCopy.indexOf(item)];
- // In Carbon this hash and list gets emptied via events. In Cocoa, we have to do it ourselves here.
- it = unifiedToolbarHash.erase(it);
- qtoolbarsInUnifiedToolbarList.removeAll(toolbar);
#endif
break;
}
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index 028ffe8..5e7d06e 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -765,6 +765,7 @@ void QPlainTextEditPrivate::init(const QString &txt)
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(_q_cursorPositionChanged()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
+ QObject::connect(control, SIGNAL(textChanged(const QString &)), q, SLOT(updateMicroFocus()));
// set a null page size initially to avoid any relayouting until the textedit
// is shown. relayoutDocument() will take care of setting the page size to the
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index 1bc0bf1..63fac2a 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -158,6 +158,8 @@ void QTextEditPrivate::init(const QString &html)
QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
+ QObject::connect(control, SIGNAL(textChanged(const QString &)), q, SLOT(updateMicroFocus()));
+
QTextDocument *doc = control->document();
// set a null page size initially to avoid any relayouting until the textedit
// is shown. relayoutDocument() will take care of setting the page size to the
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index c20812e..1667c10 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -273,7 +273,7 @@ void QNetworkReplyImplPrivate::handleNotifications()
if (state != Working)
return;
- while (!current.isEmpty()) {
+ while (state == Working && !current.isEmpty()) {
InternalNotifications notification = current.dequeue();
switch (notification) {
case NotifyDownstreamReadyWrite:
@@ -580,7 +580,7 @@ QNetworkReplyImpl::~QNetworkReplyImpl()
void QNetworkReplyImpl::abort()
{
Q_D(QNetworkReplyImpl);
- if (d->state == QNetworkReplyImplPrivate::Aborted)
+ if (d->state == QNetworkReplyImplPrivate::Finished || d->state == QNetworkReplyImplPrivate::Aborted)
return;
// stop both upload and download
diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h
index e319389..e0033be 100644
--- a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h
+++ b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h
@@ -68,7 +68,7 @@ class Q_OPENGL_EXPORT QGLCustomShaderStage
public:
QGLCustomShaderStage();
virtual ~QGLCustomShaderStage();
- virtual void setUniforms(QGLShaderProgram*) = 0;
+ virtual void setUniforms(QGLShaderProgram*) {}
void setUniformsDirty();
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 0084476..77ca3a8 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -291,10 +291,7 @@ public:
QScopedPointer<QPixmapFilter> convolutionFilter;
QScopedPointer<QPixmapFilter> colorizeFilter;
QScopedPointer<QPixmapFilter> blurFilter;
- QScopedPointer<QPixmapFilter> animationBlurFilter;
- QScopedPointer<QPixmapFilter> fastBlurFilter;
QScopedPointer<QPixmapFilter> dropShadowFilter;
- QScopedPointer<QPixmapFilter> fastDropShadowFilter;
QSet<QVectorPath::CacheEntry *> pathCaches;
QVector<GLuint> unusedVBOSToClean;
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index b6f8919..466e851 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2063,6 +2063,29 @@ QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
// #define QGL_BIND_TEXTURE_DEBUG
+// map from Qt's ARGB endianness-dependent format to GL's big-endian RGBA layout
+static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type)
+{
+ const int width = img.width();
+ const int height = img.height();
+
+ if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV
+ || (pixel_type == GL_UNSIGNED_BYTE && QSysInfo::ByteOrder == QSysInfo::LittleEndian))
+ {
+ for (int i = 0; i < height; ++i) {
+ uint *p = (uint *) img.scanLine(i);
+ for (int x = 0; x < width; ++x)
+ p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
+ }
+ } else {
+ for (int i = 0; i < height; ++i) {
+ uint *p = (uint *) img.scanLine(i);
+ for (int x = 0; x < width; ++x)
+ p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff);
+ }
+ }
+}
+
QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint internalFormat,
const qint64 key, QGLContext::BindOptions options)
{
@@ -2215,23 +2238,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
// 32 in the switch above is for the RGB16 case, where we set
// the format to GL_RGB
Q_ASSERT(img.depth() == 32);
- const int width = img.width();
- const int height = img.height();
-
- if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV
- || (pixel_type == GL_UNSIGNED_BYTE && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) {
- for (int i=0; i < height; ++i) {
- uint *p = (uint *) img.scanLine(i);
- for (int x=0; x<width; ++x)
- p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
- }
- } else {
- for (int i=0; i < height; ++i) {
- uint *p = (uint *) img.scanLine(i);
- for (int x=0; x<width; ++x)
- p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff);
- }
- }
+ qgl_byteSwapImage(img, pixel_type);
}
#ifdef QT_OPENGL_ES
// OpenGL/ES requires that the internal and external formats be identical.
@@ -3803,6 +3810,11 @@ bool QGLWidget::event(QEvent *e)
}
#if defined(QT_OPENGL_ES)
+ // A re-parent is likely to destroy the X11 window and re-create it. It is important
+ // that we free the EGL surface _before_ the winID changes - otherwise we can leak.
+ if (e->type() == QEvent::ParentAboutToChange)
+ d->glcx->d_func()->destroyEglSurfaceForDevice();
+
if ((e->type() == QEvent::ParentChange) || (e->type() == QEvent::WindowStateChange)) {
// The window may have been re-created during re-parent or state change - if so, the EGL
// surface will need to be re-created.
@@ -4290,6 +4302,7 @@ static void qt_save_gl_state()
glDisable(GL_CULL_FACE);
glDisable(GL_LIGHTING);
glDisable(GL_STENCIL_TEST);
+ glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}
@@ -4343,6 +4356,10 @@ static void qt_gl_draw_text(QPainter *p, int x, int y, const QString &str,
\note This function clears the stencil buffer.
\note This function is not supported on OpenGL/ES systems.
+
+ \note This function temporarily disables depth-testing when the
+ text is drawn.
+
\l{Overpainting Example}{Overpaint} with QPainter::drawText() instead.
*/
@@ -4433,6 +4450,13 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font,
have the labels move with the model as it is rotated etc.
\note This function is not supported on OpenGL/ES systems.
+
+ \note If depth testing is enabled before this function is called,
+ then the drawn text will be depth-tested against the models that
+ have already been drawn in the scene. Use \c{glDisable(GL_DEPTH_TEST)}
+ before calling this function to annotate the models without
+ depth-testing the text.
+
\l{Overpainting Example}{Overpaint} with QPainter::drawText() instead.
*/
void QGLWidget::renderText(double x, double y, double z, const QString &str, const QFont &font, int)
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index 079953f..2076c46 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -546,6 +546,7 @@ private:
friend class QGLPixelBuffer;
friend class QGLPixelBufferPrivate;
friend class QGLContext;
+ friend class QGLContextPrivate;
friend class QGLOverlayWidget;
friend class QOpenGLPaintEngine;
friend class QGLPaintDevice;
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index fbf0349..839e8eb 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -142,19 +142,7 @@ void QGLContext::reset()
d->cleanup();
doneCurrent();
if (d->eglContext) {
- if (d->eglSurface != EGL_NO_SURFACE) {
-#ifdef Q_WS_X11
- // Make sure we don't call eglDestroySurface on a surface which
- // was created for a different winId:
- if (d->paintDevice->devType() == QInternal::Widget) {
- QGLWidget* w = static_cast<QGLWidget*>(d->paintDevice);
-
- if (w->d_func()->eglSurfaceWindowId == w->winId())
- eglDestroySurface(d->eglContext->display(), d->eglSurface);
- } else
-#endif
- eglDestroySurface(d->eglContext->display(), d->eglSurface);
- }
+ d->destroyEglSurfaceForDevice();
delete d->eglContext;
}
d->eglContext = 0;
@@ -198,6 +186,26 @@ void QGLContext::swapBuffers() const
d->eglContext->swapBuffers(d->eglSurface);
}
+void QGLContextPrivate::destroyEglSurfaceForDevice()
+{
+ if (eglSurface != EGL_NO_SURFACE) {
+#ifdef Q_WS_X11
+ // Make sure we don't call eglDestroySurface on a surface which
+ // was created for a different winId:
+ if (paintDevice->devType() == QInternal::Widget) {
+ QGLWidget* w = static_cast<QGLWidget*>(paintDevice);
+
+ if (w->d_func()->eglSurfaceWindowId == w->winId())
+ eglDestroySurface(eglContext->display(), eglSurface);
+ else
+ qWarning("WARNING: Potential EGL surface leak!");
+ } else
+#endif
+ eglDestroySurface(eglContext->display(), eglSurface);
+ eglSurface = EGL_NO_SURFACE;
+ }
+}
+
void QGLWidget::setMouseTracking(bool enable)
{
QWidget::setMouseTracking(enable);
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 11770d3..99c0f33 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -288,6 +288,7 @@ public:
#if defined(QT_OPENGL_ES)
QEglContext *eglContext;
EGLSurface eglSurface;
+ void destroyEglSurfaceForDevice();
#elif defined(Q_WS_X11) || defined(Q_WS_MAC)
void* cx;
#endif
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index a868e83..19026b3 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -173,10 +173,16 @@ void QGLWidget::updateOverlayGL()
//handle overlay
}
+//#define QT_DEBUG_X11_VISUAL_SELECTION 1
+
bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig config, const QX11Info &x11Info, bool useArgbVisual)
{
bool foundVisualIsArgb = useArgbVisual;
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ qDebug("qt_egl_setup_x11_visual() - useArgbVisual=%d", useArgbVisual);
+#endif
+
memset(&vi, 0, sizeof(XVisualInfo));
EGLint eglConfigColorSize;
@@ -199,7 +205,9 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf
XRenderPictFormat *format;
format = XRenderFindVisualFormat(x11Info.display(), chosenVisualInfo->visual);
if (format->type == PictTypeDirect && format->direct.alphaMask) {
-// qDebug("Using ARGB X Visual ID (%d) provided by EGL", (int)vi.visualid);
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ qDebug("Using ARGB X Visual ID (%d) provided by EGL", (int)vi.visualid);
+#endif
foundVisualIsArgb = true;
vi = *chosenVisualInfo;
}
@@ -212,7 +220,9 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf
#endif
{
if (eglConfigColorSize == chosenVisualInfo->depth) {
-// qDebug("Using opaque X Visual ID (%d) provided by EGL", (int)vi.visualid);
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ qDebug("Using opaque X Visual ID (%d) provided by EGL", (int)vi.visualid);
+#endif
vi = *chosenVisualInfo;
} else
qWarning("Warning: EGL suggested using X visual ID %d (%d bpp) for config %d (%d bpp), but the depths do not match!",
@@ -248,7 +258,9 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf
if (format->type == PictTypeDirect && format->direct.alphaMask) {
vi = matchingVisuals[i];
foundVisualIsArgb = true;
-// qDebug("Using X Visual ID (%d) for ARGB visual as provided by XRender", (int)vi.visualid);
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ qDebug("Using X Visual ID (%d) for ARGB visual as provided by XRender", (int)vi.visualid);
+#endif
break;
}
}
@@ -272,24 +284,28 @@ bool qt_egl_setup_x11_visual(XVisualInfo &vi, EGLDisplay display, EGLConfig conf
} else
qWarning(" - Falling back to X11 suggested depth (%d)", depth);
}
-// else
-// qDebug("Using X Visual ID (%d) for EGL provided depth (%d)", (int)vi.visualid, depth);
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ else
+ qDebug("Using X Visual ID (%d) for EGL provided depth (%d)", (int)vi.visualid, depth);
+#endif
// Don't try to use ARGB now unless the visual is 32-bit - even then it might stil fail :-(
if (useArgbVisual)
foundVisualIsArgb = vi.depth == 32; //### We might at some point (soon) get ARGB4444
}
-// qDebug("Visual Info:");
-// qDebug(" bits_per_rgb=%d", vi.bits_per_rgb);
-// qDebug(" red_mask=0x%x", vi.red_mask);
-// qDebug(" green_mask=0x%x", vi.green_mask);
-// qDebug(" blue_mask=0x%x", vi.blue_mask);
-// qDebug(" colormap_size=%d", vi.colormap_size);
-// qDebug(" c_class=%d", vi.c_class);
-// qDebug(" depth=%d", vi.depth);
-// qDebug(" screen=%d", vi.screen);
-// qDebug(" visualid=%d", vi.visualid);
+#ifdef QT_DEBUG_X11_VISUAL_SELECTION
+ qDebug("Visual Info:");
+ qDebug(" bits_per_rgb=%d", vi.bits_per_rgb);
+ qDebug(" red_mask=0x%x", vi.red_mask);
+ qDebug(" green_mask=0x%x", vi.green_mask);
+ qDebug(" blue_mask=0x%x", vi.blue_mask);
+ qDebug(" colormap_size=%d", vi.colormap_size);
+ qDebug(" c_class=%d", vi.c_class);
+ qDebug(" depth=%d", vi.depth);
+ qDebug(" screen=%d", vi.screen);
+ qDebug(" visualid=%d", vi.visualid);
+#endif
return foundVisualIsArgb;
}
@@ -320,7 +336,7 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext,
// If the application has set WA_TranslucentBackground and not explicitly set
// the alpha buffer size to zero, modify the format so it have an alpha channel
QGLFormat& fmt = d->glcx->d_func()->glFormat;
- const bool tryArgbVisual = testAttribute(Qt::WA_TranslucentBackground);
+ const bool tryArgbVisual = testAttribute(Qt::WA_TranslucentBackground) || fmt.alpha();
if (tryArgbVisual && fmt.alphaBufferSize() == -1)
fmt.setAlphaBufferSize(1);
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index d0297c9..4b5c30a 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -597,6 +597,12 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
the constructors that take a QGLFramebufferObject parameter, and set the
QGLFramebufferObject::samples() property to a non-zero value.
+ When painting to a QGLFramebufferObject using QPainter, the state of
+ the current GL context will be altered by the paint engine to reflect
+ its needs. Applications should not rely upon the GL state being reset
+ to its original conditions, particularly the current shader program,
+ GL viewport, texture units, and drawing modes.
+
For multisample framebuffer objects a color render buffer is created,
otherwise a texture with the specified texture target is created.
The color render buffer or texture will have the specified internal
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index c478630..d4bcbe9 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -55,11 +55,17 @@
#include "qgl_p.h"
#include "private/qapplication_p.h"
+#include "private/qdrawhelper_p.h"
+#include "private/qmemrotate_p.h"
#include "private/qmath_p.h"
#include "qmath.h"
QT_BEGIN_NAMESPACE
+// qpixmapfilter.cpp
+void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0);
+QImage qt_halfScaled(const QImage &source);
+
void QGLPixmapFilterBase::bindTexture(const QPixmap &src) const
{
const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, QGLContext::BindOptions(QGLContext::DefaultBindOption | QGLContext::MemoryManagedBindOption));
@@ -102,48 +108,21 @@ private:
class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapBlurFilter>
{
public:
- QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHints hints);
-
- void setUniforms(QGLShaderProgram *program);
-
- static QByteArray generateGaussianShader(int radius, bool singlePass = false, bool dropShadow = false);
+ QGLPixmapBlurFilter();
protected:
bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const;
-
-private:
-
- mutable QSize m_textureSize;
- mutable bool m_horizontalBlur;
- mutable bool m_singlePass;
- mutable bool m_animatedBlur;
-
- mutable qreal m_t;
- mutable QSize m_targetSize;
-
- mutable bool m_haveCached;
- mutable int m_cachedRadius;
- mutable QGraphicsBlurEffect::BlurHints m_hints;
};
class QGLPixmapDropShadowFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapDropShadowFilter>
{
public:
- QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHints hints);
+ QGLPixmapDropShadowFilter();
void setUniforms(QGLShaderProgram *program);
protected:
bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const;
-
-private:
- mutable QSize m_textureSize;
- mutable bool m_horizontalBlur;
- mutable bool m_singlePass;
-
- mutable bool m_haveCached;
- mutable int m_cachedRadius;
- mutable QGraphicsBlurEffect::BlurHints m_hints;
};
extern QGLWidget *qt_gl_share_widget();
@@ -158,31 +137,14 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr
return d->colorizeFilter.data();
case QPixmapFilter::BlurFilter: {
- const QPixmapBlurFilter *proto = static_cast<const QPixmapBlurFilter *>(prototype);
- if (proto->blurHints() & QGraphicsBlurEffect::AnimationHint) {
- if (!d->animationBlurFilter)
- d->animationBlurFilter.reset(new QGLPixmapBlurFilter(proto->blurHints()));
- return d->animationBlurFilter.data();
- }
- if ((proto->blurHints() & QGraphicsBlurEffect::QualityHint) && proto->radius() > 5) {
- if (!d->blurFilter)
- d->blurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::QualityHint));
- return d->blurFilter.data();
- }
- if (!d->fastBlurFilter)
- d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint));
- return d->fastBlurFilter.data();
+ if (!d->blurFilter)
+ d->blurFilter.reset(new QGLPixmapBlurFilter());
+ return d->blurFilter.data();
}
case QPixmapFilter::DropShadowFilter: {
- const QPixmapDropShadowFilter *proto = static_cast<const QPixmapDropShadowFilter *>(prototype);
- if (proto->blurRadius() <= 5) {
- if (!d->fastDropShadowFilter)
- d->fastDropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::PerformanceHint));
- return d->fastDropShadowFilter.data();
- }
if (!d->dropShadowFilter)
- d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter(QGraphicsBlurEffect::QualityHint));
+ d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter());
return d->dropShadowFilter.data();
}
@@ -311,59 +273,43 @@ bool QGLPixmapConvolutionFilter::processGL(QPainter *painter, const QPointF &pos
return true;
}
-static const char *qt_gl_texture_sampling_helper =
- "lowp float texture2DAlpha(lowp sampler2D src, highp vec2 srcCoords) {\n"
- " return texture2D(src, srcCoords).a;\n"
- "}\n";
-
-QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHints hints)
- : m_animatedBlur(false)
- , m_haveCached(false)
- , m_cachedRadius(0)
- , m_hints(hints)
-{
-}
-
-// should be even numbers as they will be divided by two
-static const int qCachedBlurLevels[] = { 6, 14, 30 };
-static const int qNumCachedBlurTextures = sizeof(qCachedBlurLevels) / sizeof(*qCachedBlurLevels);
-static const int qMaxCachedBlurLevel = qCachedBlurLevels[qNumCachedBlurTextures - 1];
-
-static qreal qLogBlurLevel(int level)
+QGLPixmapBlurFilter::QGLPixmapBlurFilter()
{
- static bool initialized = false;
- static qreal logBlurLevelCache[qNumCachedBlurTextures];
- if (!initialized) {
- for (int i = 0; i < qNumCachedBlurTextures; ++i)
- logBlurLevelCache[i] = qLn(qCachedBlurLevels[i]);
- initialized = true;
- }
- return logBlurLevelCache[level];
}
class QGLBlurTextureInfo
{
public:
- QGLBlurTextureInfo(QSize size, GLuint textureIds[])
- : m_size(size)
+ QGLBlurTextureInfo(const QImage &image, GLuint tex, qreal r)
+ : m_texture(tex)
+ , m_radius(r)
{
- for (int i = 0; i < qNumCachedBlurTextures; ++i)
- m_textureIds[i] = textureIds[i];
+ m_paddedImage << image;
}
~QGLBlurTextureInfo()
{
- glDeleteTextures(qNumCachedBlurTextures, m_textureIds);
+ glDeleteTextures(1, &m_texture);
}
- QSize size() const { return m_size; }
- GLuint textureId(int i) const { return m_textureIds[i]; }
+ QImage paddedImage(int scaleLevel = 0) const;
+ GLuint texture() const { return m_texture; }
+ qreal radius() const { return m_radius; }
private:
- GLuint m_textureIds[qNumCachedBlurTextures];
- QSize m_size;
+ mutable QList<QImage> m_paddedImage;
+ GLuint m_texture;
+ qreal m_radius;
};
+QImage QGLBlurTextureInfo::paddedImage(int scaleLevel) const
+{
+ for (int i = m_paddedImage.size() - 1; i <= scaleLevel; ++i)
+ m_paddedImage << qt_halfScaled(m_paddedImage.at(i));
+
+ return m_paddedImage.at(scaleLevel);
+}
+
class QGLBlurTextureCache : public QObject
{
public:
@@ -373,7 +319,6 @@ public:
~QGLBlurTextureCache();
QGLBlurTextureInfo *takeBlurTextureInfo(const QPixmap &pixmap);
- bool fitsInCache(const QPixmap &pixmap) const;
bool hasBlurTextureInfo(const QPixmap &pixmap) const;
void insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTextureInfo *info);
void clearBlurTextureInfo(const QPixmap &pixmap);
@@ -458,12 +403,7 @@ void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTe
if (timerId)
killTimer(timerId);
- timerId = startTimer(1000);
-}
-
-bool QGLBlurTextureCache::fitsInCache(const QPixmap &pixmap) const
-{
- return pixmap.width() * pixmap.height() <= cache.maxCost();
+ timerId = startTimer(8000);
}
void QGLBlurTextureCache::pixmapDestroyed(QPixmap *pixmap)
@@ -474,567 +414,217 @@ void QGLBlurTextureCache::pixmapDestroyed(QPixmap *pixmap)
}
}
-static const char *qt_gl_interpolate_filter =
- "uniform lowp float interpolationValue;"
- "uniform lowp sampler2D interpolateTarget;"
- "uniform highp vec4 interpolateMapping;"
- "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)"
- "{"
- " return mix(texture2D(interpolateTarget, interpolateMapping.xy + interpolateMapping.zw * srcCoords),"
- " texture2D(src, srcCoords), interpolationValue);"
- "}";
+static const int qAnimatedBlurLevelIncrement = 16;
+static const int qMaxBlurHalfScaleLevel = 1;
-static void initializeTexture(GLuint id, int width, int height)
+static GLuint generateBlurTexture(const QSize &size, GLenum format = GL_RGBA)
{
- glBindTexture(GL_TEXTURE_2D, id);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glBindTexture(GL_TEXTURE_2D, 0);
+ GLuint texture;
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexImage2D(GL_TEXTURE_2D, 0, format, size.width(), size.height(), 0, format,
+ GL_UNSIGNED_BYTE, 0);
+ return texture;
}
-bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const
+static inline uint nextMultiple(uint x, uint multiplier)
{
- QGLPixmapBlurFilter *filter = const_cast<QGLPixmapBlurFilter *>(this);
-
- QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
- QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx);
-
- if ((m_hints & QGraphicsBlurEffect::AnimationHint) && blurTextureCache->fitsInCache(src)) {
- QRect targetRect = src.rect().adjusted(-qMaxCachedBlurLevel, -qMaxCachedBlurLevel, qMaxCachedBlurLevel, qMaxCachedBlurLevel);
- // ensure even dimensions (going to divide by two)
- targetRect.setWidth((targetRect.width() + 1) & ~1);
- targetRect.setHeight((targetRect.height() + 1) & ~1);
-
- QGLBlurTextureInfo *info = 0;
- if (blurTextureCache->hasBlurTextureInfo(src)) {
- info = blurTextureCache->takeBlurTextureInfo(src);
- } else {
- m_animatedBlur = false;
- m_hints = QGraphicsBlurEffect::QualityHint;
- m_singlePass = false;
-
- QGLFramebufferObjectFormat format;
- format.setInternalTextureFormat(GLenum(GL_RGBA));
- QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size() / 2, format, true);
-
- if (!fbo)
- return false;
-
- QPainter fboPainter(fbo);
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(fboPainter.paintEngine());
-
- glClearColor(0, 0, 0, 0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- // ensure GL_LINEAR filtering is used for scaling down to half the size
- fboPainter.setRenderHint(QPainter::SmoothPixmapTransform);
- fboPainter.setCompositionMode(QPainter::CompositionMode_Source);
- fboPainter.drawPixmap(qMaxCachedBlurLevel / 2, qMaxCachedBlurLevel / 2,
- targetRect.width() / 2 - qMaxCachedBlurLevel, targetRect.height() / 2 - qMaxCachedBlurLevel, src);
-
- GLuint textures[qNumCachedBlurTextures]; // blur textures
- glGenTextures(qNumCachedBlurTextures, textures);
- GLuint temp; // temp texture
- glGenTextures(1, &temp);
-
- initializeTexture(temp, fbo->width(), fbo->height());
- m_textureSize = fbo->size();
-
- int currentBlur = 0;
-
- QRect fboRect(0, 0, fbo->width(), fbo->height());
- GLuint sourceTexture = fbo->texture();
- for (int i = 0; i < qNumCachedBlurTextures; ++i) {
- int targetBlur = qCachedBlurLevels[i] / 2;
-
- int blurDelta = qRound(qSqrt(targetBlur * targetBlur - currentBlur * currentBlur));
- QByteArray source = generateGaussianShader(blurDelta);
- filter->setSource(source);
-
- currentBlur = targetBlur;
-
- // now we're going to be nasty and keep using the same FBO with different textures
- glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, temp, 0);
-
- m_horizontalBlur = true;
- filter->setOnPainter(&fboPainter);
- engine->drawTexture(fboRect, sourceTexture, fbo->size(), fboRect);
- filter->removeFromPainter(&fboPainter);
-
- sourceTexture = textures[i];
- initializeTexture(sourceTexture, fbo->width(), fbo->height());
-
- glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, textures[i], 0);
-
- m_horizontalBlur = false;
- filter->setOnPainter(&fboPainter);
- engine->drawTexture(fboRect, temp, fbo->size(), fboRect);
- filter->removeFromPainter(&fboPainter);
- }
-
- glDeleteTextures(1, &temp);
+ uint mod = x % multiplier;
+ if (mod == 0)
+ return x;
+ return x + multiplier - mod;
+}
- // reattach the original FBO texture
- glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, fbo->texture(), 0);
+void qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride,
+ quint32 *dest, int dstStride);
- fboPainter.end();
+bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const
+{
+ if (radius() < 1) {
+ painter->drawPixmap(pos, src);
+ return true;
+ }
- qgl_fbo_pool()->release(fbo);
+ qreal actualRadius = radius();
- info = new QGLBlurTextureInfo(fboRect.size(), textures);
- }
+ QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
- if (!m_haveCached || !m_animatedBlur) {
- m_haveCached = true;
- m_animatedBlur = true;
- m_hints = QGraphicsBlurEffect::AnimationHint;
- filter->setSource(qt_gl_interpolate_filter);
- }
+ QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx);
+ QGLBlurTextureInfo *info = 0;
+ int padding = nextMultiple(qCeil(actualRadius), qAnimatedBlurLevelIncrement);
+ QRect targetRect = src.rect().adjusted(-padding, -padding, padding, padding);
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
- filter->setOnPainter(painter);
+ // pad so that we'll be able to half-scale qMaxBlurHalfScaleLevel times
+ targetRect.setWidth((targetRect.width() + (qMaxBlurHalfScaleLevel-1)) & ~(qMaxBlurHalfScaleLevel-1));
+ targetRect.setHeight((targetRect.height() + (qMaxBlurHalfScaleLevel-1)) & ~(qMaxBlurHalfScaleLevel-1));
- qreal logRadius = qLn(radius());
+ QSize textureSize;
- int t;
- for (t = -1; t < qNumCachedBlurTextures - 2; ++t) {
- if (logRadius < qLogBlurLevel(t+1))
- break;
- }
+ info = blurTextureCache->takeBlurTextureInfo(src);
+ if (!info || info->radius() < actualRadius) {
+ QSize paddedSize = targetRect.size() / 2;
- qreal logBase = t >= 0 ? qLogBlurLevel(t) : 0;
- m_t = qBound(qreal(0), (logRadius - logBase) / (qLogBlurLevel(t+1) - logBase), qreal(1));
+ QImage padded(paddedSize.height(), paddedSize.width(), QImage::Format_ARGB32_Premultiplied);
+ padded.fill(0);
- m_textureSize = info->size();
+ if (info) {
+ int oldPadding = qRound(info->radius());
- glActiveTexture(GL_TEXTURE0 + 3);
- if (t >= 0) {
- glBindTexture(GL_TEXTURE_2D, info->textureId(t));
- m_targetSize = info->size();
+ QPainter p(&padded);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ p.drawImage((padding - oldPadding) / 2, (padding - oldPadding) / 2, info->paddedImage());
+ p.end();
} else {
- QGLTexture *texture =
- ctx->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA,
- QGLContext::InternalBindOption
- | QGLContext::CanFlipNativePixmapBindOption);
- m_targetSize = src.size();
- if (!(texture->options & QGLContext::InvertedYBindOption))
- m_targetSize.setHeight(-m_targetSize.height());
+ // TODO: combine byteswapping and memrotating into one by declaring
+ // custom GL_RGBA pixel type and qt_colorConvert template for it
+ QImage prepadded = qt_halfScaled(src.toImage()).convertToFormat(QImage::Format_ARGB32_Premultiplied);
+
+ // byte-swap and memrotates in one go
+ qt_memrotate90_gl(reinterpret_cast<const quint32*>(prepadded.bits()),
+ prepadded.width(), prepadded.height(), prepadded.bytesPerLine(),
+ reinterpret_cast<quint32*>(padded.scanLine(padding / 2)) + padding / 2,
+ padded.bytesPerLine());
}
- // restrict the target rect to the max of the radii we are interpolating between
- int radiusDelta = qMaxCachedBlurLevel - qCachedBlurLevels[t+1];
- targetRect = targetRect.translated(pos.toPoint()).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta);
-
- radiusDelta /= 2;
- QRect sourceRect = QRect(QPoint(), m_textureSize).adjusted(radiusDelta, radiusDelta, -radiusDelta, -radiusDelta);
-
- engine->drawTexture(targetRect, info->textureId(t+1), m_textureSize, sourceRect);
-
- glActiveTexture(GL_TEXTURE0 + 3);
- glBindTexture(GL_TEXTURE_2D, 0);
-
- filter->removeFromPainter(painter);
- blurTextureCache->insertBlurTextureInfo(src, info);
-
- return true;
- }
+ delete info;
+ info = new QGLBlurTextureInfo(padded, generateBlurTexture(paddedSize), padding);
- if (blurTextureCache->hasBlurTextureInfo(src))
- blurTextureCache->clearBlurTextureInfo(src);
-
- int actualRadius = qRound(radius());
- int filterRadius = actualRadius;
- int fastRadii[] = { 1, 2, 3, 5, 8, 15, 25 };
- if (!(m_hints & QGraphicsBlurEffect::QualityHint)) {
- uint i = 0;
- for (; i < (sizeof(fastRadii)/sizeof(*fastRadii))-1; ++i) {
- if (fastRadii[i+1] > filterRadius)
- break;
- }
- filterRadius = fastRadii[i];
+ textureSize = paddedSize;
+ } else {
+ textureSize = QSize(info->paddedImage().height(), info->paddedImage().width());
}
- m_singlePass = filterRadius <= 3;
-
- if (!m_haveCached || m_animatedBlur || filterRadius != m_cachedRadius) {
- // Only regenerate the shader from source if parameters have changed.
- m_haveCached = true;
- m_animatedBlur = false;
- m_cachedRadius = filterRadius;
- QByteArray source = generateGaussianShader(filterRadius, m_singlePass);
- filter->setSource(source);
+ actualRadius *= qreal(0.5);
+ int level = 1;
+ for (; level < qMaxBlurHalfScaleLevel; ++level) {
+ if (actualRadius <= 16)
+ break;
+ actualRadius *= qreal(0.5);
}
- QRect targetRect = QRectF(src.rect()).translated(pos).adjusted(-actualRadius, -actualRadius, actualRadius, actualRadius).toAlignedRect();
+ const int s = (1 << level);
- if (m_singlePass) {
- // prepare for updateUniforms
- m_textureSize = src.size();
+ int prepadding = qRound(info->radius());
+ padding = qMin(prepadding, qCeil(actualRadius) << level);
+ targetRect = src.rect().adjusted(-padding, -padding, padding, padding);
- // ensure GL_LINEAR filtering is used
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
- filter->setOnPainter(painter);
- QBrush pixmapBrush = src;
- pixmapBrush.setTransform(QTransform::fromTranslate(pos.x(), pos.y()));
- painter->fillRect(targetRect, pixmapBrush);
- filter->removeFromPainter(painter);
- } else {
- QGLFramebufferObjectFormat format;
- format.setInternalTextureFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB));
- QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size(), format);
+ targetRect.setWidth(targetRect.width() & ~(s-1));
+ targetRect.setHeight(targetRect.height() & ~(s-1));
- if (!fbo)
- return false;
+ int paddingDelta = (prepadding - padding) >> level;
- // prepare for updateUniforms
- m_textureSize = src.size();
+ QRect subRect(paddingDelta, paddingDelta, targetRect.width() >> level, targetRect.height() >> level);
+ QImage sourceImage = info->paddedImage(level-1);
- // horizontal pass, to pixmap
- m_horizontalBlur = true;
+ QImage subImage(subRect.height(), subRect.width(), QImage::Format_ARGB32_Premultiplied);
+ qt_rectcopy((QRgb *)subImage.bits(), ((QRgb *)sourceImage.scanLine(paddingDelta)) + paddingDelta,
+ 0, 0, subRect.height(), subRect.width(), subImage.bytesPerLine(), sourceImage.bytesPerLine());
- QPainter fboPainter(fbo);
+ GLuint texture = info->texture();
- glClearColor(0, 0, 0, 0);
- glClear(GL_COLOR_BUFFER_BIT);
+ qt_blurImage(subImage, actualRadius, blurHints() & QGraphicsBlurEffect::QualityHint, 1);
- // ensure GL_LINEAR filtering is used
- fboPainter.setRenderHint(QPainter::SmoothPixmapTransform);
- fboPainter.setCompositionMode(QPainter::CompositionMode_Source);
- filter->setOnPainter(&fboPainter);
- QBrush pixmapBrush = src;
- pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius));
- fboPainter.fillRect(QRect(0, 0, targetRect.width(), targetRect.height()), pixmapBrush);
- filter->removeFromPainter(&fboPainter);
- fboPainter.end();
+ // subtract one pixel off the end to prevent the bilinear sampling from sampling uninitialized data
+ QRect textureSubRect = subImage.rect().adjusted(0, 0, -1, -1);
+ QRectF targetRectF = QRectF(targetRect).adjusted(0, 0, -targetRect.width() / qreal(textureSize.width()), -targetRect.height() / qreal(textureSize.height()));
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subImage.width(), subImage.height(), GL_RGBA,
+ GL_UNSIGNED_BYTE, const_cast<const QImage &>(subImage).bits());
- // vertical pass, to painter
- m_horizontalBlur = false;
- m_textureSize = fbo->size();
+ QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
+ painter->setRenderHint(QPainter::SmoothPixmapTransform);
- painter->save();
- // ensure GL_LINEAR filtering is used
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
- filter->setOnPainter(painter);
- engine->drawTexture(targetRect, fbo->texture(), fbo->size(), QRect(QPoint(), targetRect.size()).translated(0, fbo->height() - targetRect.height()));
- filter->removeFromPainter(painter);
- painter->restore();
+ // texture is flipped on the y-axis
+ targetRectF = QRectF(targetRectF.x(), targetRectF.bottom(), targetRectF.width(), -targetRectF.height());
+ engine->drawTexture(targetRectF.translated(pos), texture, textureSize, textureSubRect);
- qgl_fbo_pool()->release(fbo);
- }
+ blurTextureCache->insertBlurTextureInfo(src, info);
return true;
}
-void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program)
-{
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- if (m_animatedBlur) {
- program->setUniformValue("interpolateTarget", 3);
- program->setUniformValue("interpolationValue", GLfloat(m_t));
-
- if (m_textureSize == m_targetSize) {
- program->setUniformValue("interpolateMapping", 0.0f, 0.0f, 1.0f, 1.0f);
- } else {
- float offsetX = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.width());
- float offsetY = (-qMaxCachedBlurLevel - 0.5) / qreal(m_targetSize.height());
-
- if (m_targetSize.height() < 0)
- offsetY = 1 + offsetY;
-
- float scaleX = 2.0f * qreal(m_textureSize.width()) / qreal(m_targetSize.width());
- float scaleY = 2.0f * qreal(m_textureSize.height()) / qreal(m_targetSize.height());
-
- program->setUniformValue("interpolateMapping", offsetX, offsetY, scaleX, scaleY);
- }
-
- return;
- }
+static const char *qt_gl_drop_shadow_filter =
+ "uniform lowp vec4 shadowColor;"
+ "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)"
+ "{"
+ " return shadowColor * texture2D(src, srcCoords.yx).a;"
+ "}";
- if (m_hints & QGraphicsBlurEffect::QualityHint) {
- if (m_singlePass)
- program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height());
- else if (m_horizontalBlur)
- program->setUniformValue("delta", 1.0 / m_textureSize.width(), 0.0);
- else
- program->setUniformValue("delta", 0.0, 1.0 / m_textureSize.height());
- } else {
- qreal blur = radius() / qreal(m_cachedRadius);
-
- if (m_singlePass)
- program->setUniformValue("delta", blur / m_textureSize.width(), blur / m_textureSize.height());
- else if (m_horizontalBlur)
- program->setUniformValue("delta", blur / m_textureSize.width(), 0.0);
- else
- program->setUniformValue("delta", 0.0, blur / m_textureSize.height());
- }
-}
-static inline qreal gaussian(qreal dx, qreal sigma)
+QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter()
{
- return exp(-dx * dx / (2 * sigma * sigma)) / (Q_2PI * sigma * sigma);
+ setSource(qt_gl_drop_shadow_filter);
}
-QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius, bool singlePass, bool dropShadow)
+bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const
{
- Q_ASSERT(radius >= 1);
-
- radius = qMin(127, radius);
-
- static QCache<uint, QByteArray> shaderSourceCache;
- uint key = radius | (int(singlePass) << 7) | (int(dropShadow) << 8);
- QByteArray *cached = shaderSourceCache.object(key);
- if (cached)
- return *cached;
-
- QByteArray source;
- source.reserve(1000);
- source.append(qt_gl_texture_sampling_helper);
-
- source.append("uniform highp vec2 delta;\n");
- if (dropShadow)
- source.append("uniform mediump vec4 shadowColor;\n");
- source.append("lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {\n");
-
- QVector<qreal> sampleOffsets;
- QVector<qreal> weights;
-
- QVector<qreal> gaussianComponents;
-
- qreal sigma = radius / 1.65;
-
- qreal sum = 0;
- for (int i = -radius; i < radius; ++i) {
- float value = gaussian(i, sigma);
- gaussianComponents << value;
- sum += value;
- }
-
- // normalize
- for (int i = 0; i < gaussianComponents.size(); ++i)
- gaussianComponents[i] /= sum;
-
- for (int i = 0; i < gaussianComponents.size() - 1; i += 2) {
- qreal weight = gaussianComponents.at(i) + gaussianComponents.at(i + 1);
- qreal offset = i - radius + gaussianComponents.at(i + 1) / weight;
-
- sampleOffsets << offset;
- weights << weight;
- }
-
- int limit = sampleOffsets.size();
- if (singlePass)
- limit *= limit;
-
- QByteArray baseCoordinate = "srcCoords";
-
- for (int i = 0; i < limit; ++i) {
- QByteArray coordinate = baseCoordinate;
-
- qreal weight;
- if (singlePass) {
- const int xIndex = i % sampleOffsets.size();
- const int yIndex = i / sampleOffsets.size();
-
- const qreal deltaX = sampleOffsets.at(xIndex);
- const qreal deltaY = sampleOffsets.at(yIndex);
- weight = weights.at(xIndex) * weights.at(yIndex);
-
- if (!qFuzzyCompare(deltaX, deltaY)) {
- coordinate.append(" + vec2(delta.x * float(");
- coordinate.append(QByteArray::number(deltaX));
- coordinate.append("), delta.y * float(");
- coordinate.append(QByteArray::number(deltaY));
- coordinate.append("))");
- } else if (!qFuzzyIsNull(deltaX)) {
- coordinate.append(" + delta * float(");
- coordinate.append(QByteArray::number(deltaX));
- coordinate.append(")");
- }
- } else {
- const qreal delta = sampleOffsets.at(i);
- weight = weights.at(i);
- if (!qFuzzyIsNull(delta)) {
- coordinate.append(" + delta * float(");
- coordinate.append(QByteArray::number(delta));
- coordinate.append(")");
- }
- }
-
- if (i == 0) {
- if (dropShadow)
- source.append(" mediump float sample = ");
- else
- source.append(" mediump vec4 sample = ");
- } else {
- if (dropShadow)
- source.append(" sample += ");
- else
- source.append(" sample += ");
- }
+ QGLPixmapDropShadowFilter *filter = const_cast<QGLPixmapDropShadowFilter *>(this);
- source.append("texture2D(src, ");
- source.append(coordinate);
- source.append(")");
+ qreal r = blurRadius();
+ QRectF targetRectUnaligned = QRectF(src.rect()).translated(pos + offset()).adjusted(-r, -r, r, r);
+ QRect targetRect = targetRectUnaligned.toAlignedRect();
- if (dropShadow)
- source.append(".a");
+ // ensure even dimensions (going to divide by two)
+ targetRect.setWidth((targetRect.width() + 1) & ~1);
+ targetRect.setHeight((targetRect.height() + 1) & ~1);
- if (!qFuzzyCompare(weight, qreal(1))) {
- source.append(" * float(");
- source.append(QByteArray::number(weight));
- source.append(");\n");
- } else {
- source.append(";\n");
- }
- }
+ QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
+ QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx);
- source.append(" return ");
- if (dropShadow)
- source.append("shadowColor * ");
- source.append("sample;\n");
- source.append("}\n");
+ QGLBlurTextureInfo *info = blurTextureCache->takeBlurTextureInfo(src);
+ if (!info || info->radius() != r) {
+ QImage half = qt_halfScaled(src.toImage().alphaChannel());
- cached = new QByteArray(source);
- shaderSourceCache.insert(key, cached);
+ qreal rx = r + targetRect.left() - targetRectUnaligned.left();
+ qreal ry = r + targetRect.top() - targetRectUnaligned.top();
- return source;
-}
+ QImage image = QImage(targetRect.size() / 2, QImage::Format_Indexed8);
+ image.setColorTable(half.colorTable());
+ image.fill(0);
+ int dx = qRound(rx * qreal(0.5));
+ int dy = qRound(ry * qreal(0.5));
+ qt_rectcopy(image.bits(), half.bits(), dx, dy,
+ half.width(), half.height(),
+ image.bytesPerLine(), half.bytesPerLine());
-QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHints hints)
- : m_haveCached(false)
- , m_cachedRadius(0)
- , m_hints(hints)
-{
-}
+ qt_blurImage(image, r * qreal(0.5), false, 1);
-bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const
-{
- QGLPixmapDropShadowFilter *filter = const_cast<QGLPixmapDropShadowFilter *>(this);
+ GLuint texture = generateBlurTexture(image.size(), GL_ALPHA);
- int actualRadius = qRound(blurRadius());
- int filterRadius = actualRadius;
- m_singlePass = filterRadius <= 3;
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image.width(), image.height(), GL_ALPHA,
+ GL_UNSIGNED_BYTE, image.bits());
- if (!m_haveCached || filterRadius != m_cachedRadius) {
- // Only regenerate the shader from source if parameters have changed.
- m_haveCached = true;
- m_cachedRadius = filterRadius;
- QByteArray source = QGLPixmapBlurFilter::generateGaussianShader(filterRadius, m_singlePass, true);
- filter->setSource(source);
+ info = new QGLBlurTextureInfo(image, texture, r);
}
- QRect targetRect = QRectF(src.rect()).translated(pos + offset()).adjusted(-actualRadius, -actualRadius, actualRadius, actualRadius).toAlignedRect();
-
- if (m_singlePass) {
- // prepare for updateUniforms
- m_textureSize = src.size();
-
- painter->save();
- // ensure GL_LINEAR filtering is used
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
- filter->setOnPainter(painter);
- QBrush pixmapBrush = src;
- pixmapBrush.setTransform(QTransform::fromTranslate(pos.x() + offset().x(), pos.y() + offset().y()));
- painter->fillRect(targetRect, pixmapBrush);
- filter->removeFromPainter(painter);
- painter->restore();
- } else {
- QGLFramebufferObjectFormat format;
- format.setInternalTextureFormat(GLenum(src.hasAlphaChannel() ? GL_RGBA : GL_RGB));
- QGLFramebufferObject *fbo = qgl_fbo_pool()->acquire(targetRect.size(), format);
-
- if (!fbo)
- return false;
-
- // prepare for updateUniforms
- m_textureSize = src.size();
-
- // horizontal pass, to pixmap
- m_horizontalBlur = true;
-
- QPainter fboPainter(fbo);
+ GLuint texture = info->texture();
- glClearColor(0, 0, 0, 0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- // ensure GL_LINEAR filtering is used
- fboPainter.setRenderHint(QPainter::SmoothPixmapTransform);
- fboPainter.setCompositionMode(QPainter::CompositionMode_Source);
- filter->setOnPainter(&fboPainter);
- QBrush pixmapBrush = src;
- pixmapBrush.setTransform(QTransform::fromTranslate(actualRadius, actualRadius));
- fboPainter.fillRect(QRect(0, 0, targetRect.width(), targetRect.height()), pixmapBrush);
- filter->removeFromPainter(&fboPainter);
- fboPainter.end();
-
- QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
+ filter->setOnPainter(painter);
- // vertical pass, to painter
- m_horizontalBlur = false;
- m_textureSize = fbo->size();
+ QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine());
+ painter->setRenderHint(QPainter::SmoothPixmapTransform);
- painter->save();
- // ensure GL_LINEAR filtering is used
- painter->setRenderHint(QPainter::SmoothPixmapTransform);
- filter->setOnPainter(painter);
- engine->drawTexture(targetRect, fbo->texture(), fbo->size(), QRectF(0, fbo->height() - targetRect.height(), targetRect.width(), targetRect.height()));
- filter->removeFromPainter(painter);
- painter->restore();
+ engine->drawTexture(targetRect, texture, info->paddedImage().size(), info->paddedImage().rect());
- qgl_fbo_pool()->release(fbo);
- }
+ filter->removeFromPainter(painter);
// Now draw the actual pixmap over the top.
painter->drawPixmap(pos, src, srcRect);
+ blurTextureCache->insertBlurTextureInfo(src, info);
+
return true;
}
void QGLPixmapDropShadowFilter::setUniforms(QGLShaderProgram *program)
{
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
QColor col = color();
- if (m_horizontalBlur && !m_singlePass) {
- program->setUniformValue("shadowColor", 1.0f, 1.0f, 1.0f, 1.0f);
- } else {
- qreal alpha = col.alphaF();
- program->setUniformValue("shadowColor", col.redF() * alpha,
- col.greenF() * alpha,
- col.blueF() * alpha,
- alpha);
- }
-
- if (m_hints & QGraphicsBlurEffect::QualityHint) {
- if (m_singlePass)
- program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height());
- else if (m_horizontalBlur)
- program->setUniformValue("delta", 1.0 / m_textureSize.width(), 0.0);
- else
- program->setUniformValue("delta", 0.0, 1.0 / m_textureSize.height());
- } else {
- qreal blur = blurRadius() / qreal(m_cachedRadius);
-
- if (m_singlePass)
- program->setUniformValue("delta", blur / m_textureSize.width(), blur / m_textureSize.height());
- else if (m_horizontalBlur)
- program->setUniformValue("delta", blur / m_textureSize.width(), 0.0);
- else
- program->setUniformValue("delta", 0.0, blur / m_textureSize.height());
- }
+ qreal alpha = col.alphaF();
+ program->setUniformValue("shadowColor", col.redF() * alpha,
+ col.greenF() * alpha,
+ col.blueF() * alpha,
+ alpha);
}
QT_END_NAMESPACE
diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro
index 8927c4c..c8c9917 100644
--- a/src/openvg/openvg.pro
+++ b/src/openvg/openvg.pro
@@ -16,11 +16,13 @@ HEADERS += \
qpaintengine_vg_p.h \
qpixmapdata_vg_p.h \
qpixmapfilter_vg_p.h \
- qvgcompositionhelper_p.h
+ qvgcompositionhelper_p.h \
+ qvgimagepool_p.h
SOURCES += \
qpaintengine_vg.cpp \
qpixmapdata_vg.cpp \
- qpixmapfilter_vg.cpp
+ qpixmapfilter_vg.cpp \
+ qvgimagepool.cpp
contains(QT_CONFIG, egl) {
HEADERS += \
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 6b829dd..04fee08 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -43,6 +43,7 @@
#include "qpixmapdata_vg_p.h"
#include "qpixmapfilter_vg_p.h"
#include "qvgcompositionhelper_p.h"
+#include "qvgimagepool_p.h"
#if !defined(QT_NO_EGL)
#include <QtGui/private/qegl_p.h>
#include "qwindowsurface_vgegl_p.h"
@@ -1018,7 +1019,7 @@ static VGImage toVGImage
const uchar *pixels = img.bits();
- VGImage vgImg = vgCreateImage
+ VGImage vgImg = QVGImagePool::instance()->createPermanentImage
(format, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
vgImageSubData
(vgImg, pixels, img.bytesPerLine(), format, 0, 0,
@@ -1063,7 +1064,7 @@ static VGImage toVGImageSubRect
const uchar *pixels = img.bits() + bpp * sr.x() +
img.bytesPerLine() * sr.y();
- VGImage vgImg = vgCreateImage
+ VGImage vgImg = QVGImagePool::instance()->createPermanentImage
(format, sr.width(), sr.height(), VG_IMAGE_QUALITY_FASTER);
vgImageSubData
(vgImg, pixels, img.bytesPerLine(), format, 0, 0,
@@ -1084,7 +1085,7 @@ static VGImage toVGImageWithOpacity(const QImage & image, qreal opacity)
const uchar *pixels = img.bits();
- VGImage vgImg = vgCreateImage
+ VGImage vgImg = QVGImagePool::instance()->createPermanentImage
(VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
vgImageSubData
(vgImg, pixels, img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0,
@@ -1106,7 +1107,7 @@ static VGImage toVGImageWithOpacitySubRect
const uchar *pixels = img.bits();
- VGImage vgImg = vgCreateImage
+ VGImage vgImg = QVGImagePool::instance()->createPermanentImage
(VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER);
vgImageSubData
(vgImg, pixels, img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0,
@@ -1194,6 +1195,12 @@ VGPaintType QVGPaintEnginePrivate::setBrush
if (pd->classId() == QPixmapData::OpenVGClass) {
QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd);
vgImg = vgpd->toVGImage();
+
+ // We don't want the pool to reclaim this image
+ // because we cannot predict when the paint object
+ // will stop using it. Replacing the image with
+ // new data will make the paint object invalid.
+ vgpd->detachImageFromPool();
} else {
vgImg = toVGImage(*(pd->buffer()));
deref = true;
@@ -1201,6 +1208,7 @@ VGPaintType QVGPaintEnginePrivate::setBrush
} else if (pd->classId() == QPixmapData::OpenVGClass) {
QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd);
vgImg = vgpd->toVGImage(opacity);
+ vgpd->detachImageFromPool();
} else {
vgImg = toVGImageWithOpacity(*(pd->buffer()), opacity);
deref = true;
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index af6f0f0..358ec4d 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -43,6 +43,7 @@
#include "qpaintengine_vg_p.h"
#include <QtGui/private/qdrawhelper_p.h>
#include "qvg_p.h"
+#include "qvgimagepool_p.h"
#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
#include <graphics/sgimage.h>
@@ -63,6 +64,8 @@ QVGPixmapData::QVGPixmapData(PixelType type)
vgImageOpacity = VG_INVALID_HANDLE;
cachedOpacity = 1.0f;
recreate = true;
+ inImagePool = false;
+ inLRU = false;
#if !defined(QT_NO_EGL)
context = 0;
qt_vg_register_pixmap(this);
@@ -78,32 +81,43 @@ QVGPixmapData::~QVGPixmapData()
#endif
}
+void QVGPixmapData::destroyImages()
+{
+ if (inImagePool) {
+ QVGImagePool *pool = QVGImagePool::instance();
+ if (vgImage != VG_INVALID_HANDLE)
+ pool->releaseImage(this, vgImage);
+ if (vgImageOpacity != VG_INVALID_HANDLE)
+ pool->releaseImage(this, vgImageOpacity);
+ } else {
+ if (vgImage != VG_INVALID_HANDLE)
+ vgDestroyImage(vgImage);
+ if (vgImageOpacity != VG_INVALID_HANDLE)
+ vgDestroyImage(vgImageOpacity);
+ }
+ vgImage = VG_INVALID_HANDLE;
+ vgImageOpacity = VG_INVALID_HANDLE;
+ inImagePool = false;
+}
+
void QVGPixmapData::destroyImageAndContext()
{
if (vgImage != VG_INVALID_HANDLE) {
// We need to have a context current to destroy the image.
#if !defined(QT_NO_EGL)
if (context->isCurrent()) {
- vgDestroyImage(vgImage);
- if (vgImageOpacity != VG_INVALID_HANDLE)
- vgDestroyImage(vgImageOpacity);
+ destroyImages();
} else {
// We don't currently have a widget surface active, but we
// need a surface to make the context current. So use the
// shared pbuffer surface instead.
context->makeCurrent(qt_vg_shared_surface());
- vgDestroyImage(vgImage);
- if (vgImageOpacity != VG_INVALID_HANDLE)
- vgDestroyImage(vgImageOpacity);
+ destroyImages();
context->lazyDoneCurrent();
}
#else
- vgDestroyImage(vgImage);
- if (vgImageOpacity != VG_INVALID_HANDLE)
- vgDestroyImage(vgImageOpacity);
+ destroyImages();
#endif
- vgImage = VG_INVALID_HANDLE;
- vgImageOpacity = VG_INVALID_HANDLE;
}
#if !defined(QT_NO_EGL)
if (context) {
@@ -234,26 +248,22 @@ VGImage QVGPixmapData::toVGImage()
context = qt_vg_create_context(0, QInternal::Pixmap);
#endif
- if (recreate && prevSize != QSize(w, h)) {
- if (vgImage != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImage);
- vgImage = VG_INVALID_HANDLE;
- }
- if (vgImageOpacity != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImageOpacity);
- vgImageOpacity = VG_INVALID_HANDLE;
- }
- } else if (recreate) {
+ if (recreate && prevSize != QSize(w, h))
+ destroyImages();
+ else if (recreate)
cachedOpacity = -1.0f; // Force opacity image to be refreshed later.
- }
if (vgImage == VG_INVALID_HANDLE) {
- vgImage = vgCreateImage
- (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER);
+ vgImage = QVGImagePool::instance()->createImageForPixmap
+ (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER, this);
// Bail out if we run out of GPU memory - try again next time.
if (vgImage == VG_INVALID_HANDLE)
return VG_INVALID_HANDLE;
+
+ inImagePool = true;
+ } else if (inImagePool) {
+ QVGImagePool::instance()->useImage(this);
}
if (!source.isNull() && recreate) {
@@ -282,8 +292,13 @@ VGImage QVGPixmapData::toVGImage(qreal opacity)
// Create an alternative image for the selected opacity.
if (vgImageOpacity == VG_INVALID_HANDLE || cachedOpacity != opacity) {
if (vgImageOpacity == VG_INVALID_HANDLE) {
- vgImageOpacity = vgCreateImage
- (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER);
+ if (inImagePool) {
+ vgImageOpacity = QVGImagePool::instance()->createImageForPixmap
+ (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER, this);
+ } else {
+ vgImageOpacity = vgCreateImage
+ (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER);
+ }
// Bail out if we run out of GPU memory - try again next time.
if (vgImageOpacity == VG_INVALID_HANDLE)
@@ -308,6 +323,14 @@ VGImage QVGPixmapData::toVGImage(qreal opacity)
#endif
}
+void QVGPixmapData::detachImageFromPool()
+{
+ if (inImagePool) {
+ QVGImagePool::instance()->detachImage(this);
+ inImagePool = false;
+ }
+}
+
void QVGPixmapData::hibernate()
{
// If the image was imported (e.g, from an SgImage under Symbian),
@@ -319,6 +342,14 @@ void QVGPixmapData::hibernate()
destroyImageAndContext();
}
+void QVGPixmapData::reclaimImages()
+{
+ if (!inImagePool)
+ return;
+ forceToImage();
+ destroyImages();
+}
+
extern int qt_defaultDpiX();
extern int qt_defaultDpiY();
@@ -411,14 +442,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type)
if (!context)
context = qt_vg_create_context(0, QInternal::Pixmap);
- if (vgImage != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImage);
- vgImage = VG_INVALID_HANDLE;
- }
- if (vgImageOpacity != VG_INVALID_HANDLE) {
- vgDestroyImage(vgImageOpacity);
- vgImageOpacity = VG_INVALID_HANDLE;
- }
+ destroyImages();
prevSize = QSize();
TInt err = 0;
diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h
index c0bb098..4ff95c1 100644
--- a/src/openvg/qpixmapdata_vg_p.h
+++ b/src/openvg/qpixmapdata_vg_p.h
@@ -63,6 +63,7 @@ class RSGImage;
QT_BEGIN_NAMESPACE
class QEglContext;
+class QVGImagePool;
#if !defined(QT_NO_EGL)
class QVGPixmapData;
@@ -101,6 +102,9 @@ public:
// Return the VGImage form for a specific opacity setting.
virtual VGImage toVGImage(qreal opacity);
+ // Detach this image from the image pool.
+ virtual void detachImageFromPool();
+
// Release the VG resources associated with this pixmap and copy
// the pixmap's contents out of the GPU back into main memory.
// The VG resource will be automatically recreated the next time
@@ -109,6 +113,10 @@ public:
// process via a SgImage).
virtual void hibernate();
+ // Called when the QVGImagePool wants to reclaim this pixmap's
+ // VGImage objects to reuse storage.
+ virtual void reclaimImages();
+
QSize size() const { return QSize(w, h); }
#if defined(Q_OS_SYMBIAN)
@@ -123,8 +131,13 @@ protected:
void cleanup();
#endif
-#if !defined(QT_NO_EGL)
private:
+ QVGPixmapData *nextLRU;
+ QVGPixmapData *prevLRU;
+ bool inLRU;
+ friend class QVGImagePool;
+
+#if !defined(QT_NO_EGL)
QVGPixmapData *next;
QVGPixmapData *prev;
@@ -140,6 +153,7 @@ protected:
qreal cachedOpacity;
mutable QImage source;
mutable bool recreate;
+ bool inImagePool;
#if !defined(QT_NO_EGL)
mutable QEglContext *context;
#endif
@@ -148,6 +162,7 @@ protected:
QImage::Format sourceFormat() const;
void destroyImageAndContext();
+ void destroyImages();
};
QT_END_NAMESPACE
diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp
index e17c728..aa526ed 100644
--- a/src/openvg/qpixmapfilter_vg.cpp
+++ b/src/openvg/qpixmapfilter_vg.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qpixmapfilter_vg_p.h"
+#include "qvgimagepool_p.h"
#include <QtCore/qvarlengtharray.h>
#include <QtGui/qpainter.h>
@@ -82,9 +83,9 @@ void QVGPixmapConvolutionFilter::draw
return;
QSize size = pd->size();
- VGImage dstImage = vgCreateImage
+ VGImage dstImage = QVGImagePool::instance()->createTemporaryImage
(VG_sARGB_8888_PRE, size.width(), size.height(),
- VG_IMAGE_QUALITY_FASTER);
+ VG_IMAGE_QUALITY_FASTER, pd);
if (dstImage == VG_INVALID_HANDLE)
return;
@@ -124,7 +125,7 @@ void QVGPixmapConvolutionFilter::draw
if(child != dstImage)
vgDestroyImage(child);
- vgDestroyImage(dstImage);
+ QVGImagePool::instance()->releaseImage(0, dstImage);
}
QVGPixmapColorizeFilter::QVGPixmapColorizeFilter()
@@ -155,9 +156,9 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const
return;
QSize size = pd->size();
- VGImage dstImage = vgCreateImage
+ VGImage dstImage = QVGImagePool::instance()->createTemporaryImage
(VG_sARGB_8888_PRE, size.width(), size.height(),
- VG_IMAGE_QUALITY_FASTER);
+ VG_IMAGE_QUALITY_FASTER, pd);
if (dstImage == VG_INVALID_HANDLE)
return;
@@ -217,7 +218,7 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const
if(child != dstImage)
vgDestroyImage(child);
- vgDestroyImage(dstImage);
+ QVGImagePool::instance()->releaseImage(0, dstImage);
}
QVGPixmapDropShadowFilter::QVGPixmapDropShadowFilter()
@@ -248,9 +249,9 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con
return;
QSize size = pd->size();
- VGImage dstImage = vgCreateImage
+ VGImage dstImage = QVGImagePool::instance()->createTemporaryImage
(VG_A_8, size.width(), size.height(),
- VG_IMAGE_QUALITY_FASTER);
+ VG_IMAGE_QUALITY_FASTER, pd);
if (dstImage == VG_INVALID_HANDLE)
return;
@@ -282,7 +283,7 @@ void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, con
if(child != dstImage)
vgDestroyImage(child);
- vgDestroyImage(dstImage);
+ QVGImagePool::instance()->releaseImage(0, dstImage);
// Now draw the actual pixmap over the top.
painter->drawPixmap(dest, src, srect);
@@ -316,9 +317,9 @@ void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPi
return;
QSize size = pd->size();
- VGImage dstImage = vgCreateImage
+ VGImage dstImage = QVGImagePool::instance()->createTemporaryImage
(VG_sARGB_8888_PRE, size.width(), size.height(),
- VG_IMAGE_QUALITY_FASTER);
+ VG_IMAGE_QUALITY_FASTER, pd);
if (dstImage == VG_INVALID_HANDLE)
return;
@@ -347,7 +348,7 @@ void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPi
if(child != dstImage)
vgDestroyImage(child);
- vgDestroyImage(dstImage);
+ QVGImagePool::instance()->releaseImage(0, dstImage);
}
#endif
diff --git a/src/openvg/qvgimagepool.cpp b/src/openvg/qvgimagepool.cpp
new file mode 100644
index 0000000..93e6e03
--- /dev/null
+++ b/src/openvg/qvgimagepool.cpp
@@ -0,0 +1,215 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenVG module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvgimagepool_p.h"
+#include "qpixmapdata_vg_p.h"
+
+QT_BEGIN_NAMESPACE
+
+static QVGImagePool *qt_vg_image_pool = 0;
+
+class QVGImagePoolPrivate
+{
+public:
+ QVGImagePoolPrivate() : lruFirst(0), lruLast(0) {}
+
+ QVGPixmapData *lruFirst;
+ QVGPixmapData *lruLast;
+};
+
+QVGImagePool::QVGImagePool()
+ : d_ptr(new QVGImagePoolPrivate())
+{
+}
+
+QVGImagePool::~QVGImagePool()
+{
+}
+
+QVGImagePool *QVGImagePool::instance()
+{
+ if (!qt_vg_image_pool)
+ qt_vg_image_pool = new QVGImagePool();
+ return qt_vg_image_pool;
+}
+
+void QVGImagePool::setImagePool(QVGImagePool *pool)
+{
+ if (qt_vg_image_pool != pool)
+ delete qt_vg_image_pool;
+ qt_vg_image_pool = pool;
+}
+
+VGImage QVGImagePool::createTemporaryImage(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality,
+ QVGPixmapData *keepData)
+{
+ VGImage image;
+ do {
+ image = vgCreateImage(format, width, height, allowedQuality);
+ if (image != VG_INVALID_HANDLE)
+ return image;
+ } while (reclaimSpace(format, width, height, keepData));
+ qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d temporary image",
+ width, height);
+ return VG_INVALID_HANDLE;
+}
+
+VGImage QVGImagePool::createImageForPixmap(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality,
+ QVGPixmapData *data)
+{
+ VGImage image;
+ do {
+ image = vgCreateImage(format, width, height, allowedQuality);
+ if (image != VG_INVALID_HANDLE) {
+ if (data)
+ moveToHeadOfLRU(data);
+ return image;
+ }
+ } while (reclaimSpace(format, width, height, data));
+ qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d pixmap",
+ width, height);
+ return VG_INVALID_HANDLE;
+}
+
+VGImage QVGImagePool::createPermanentImage(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality)
+{
+ VGImage image;
+ do {
+ image = vgCreateImage(format, width, height, allowedQuality);
+ if (image != VG_INVALID_HANDLE)
+ return image;
+ } while (reclaimSpace(format, width, height, 0));
+ qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d image",
+ width, height);
+ return VG_INVALID_HANDLE;
+}
+
+void QVGImagePool::releaseImage(QVGPixmapData *data, VGImage image)
+{
+ // Very simple strategy at the moment: just destroy the image.
+ if (data)
+ removeFromLRU(data);
+ vgDestroyImage(image);
+}
+
+void QVGImagePool::useImage(QVGPixmapData *data)
+{
+ moveToHeadOfLRU(data);
+}
+
+void QVGImagePool::detachImage(QVGPixmapData *data)
+{
+ removeFromLRU(data);
+}
+
+bool QVGImagePool::reclaimSpace(VGImageFormat format,
+ VGint width, VGint height,
+ QVGPixmapData *data)
+{
+ Q_UNUSED(format); // For future use in picking the best image to eject.
+ Q_UNUSED(width);
+ Q_UNUSED(height);
+
+ if (data)
+ moveToHeadOfLRU(data);
+
+ QVGPixmapData *lrudata = pixmapLRU();
+ if (lrudata && lrudata != data) {
+ lrudata->reclaimImages();
+ return true;
+ }
+
+ return false;
+}
+
+void QVGImagePool::hibernate()
+{
+ // Nothing to do here at the moment since the pool does not
+ // retain VGImage's after they have been released.
+}
+
+void QVGImagePool::moveToHeadOfLRU(QVGPixmapData *data)
+{
+ Q_D(QVGImagePool);
+ if (data->inLRU) {
+ if (!data->prevLRU)
+ return; // Already at the head of the list.
+ removeFromLRU(data);
+ }
+ data->inLRU = true;
+ data->nextLRU = d->lruFirst;
+ data->prevLRU = 0;
+ if (d->lruFirst)
+ d->lruFirst->prevLRU = data;
+ else
+ d->lruLast = data;
+ d->lruFirst = data;
+}
+
+void QVGImagePool::removeFromLRU(QVGPixmapData *data)
+{
+ Q_D(QVGImagePool);
+ if (!data->inLRU)
+ return;
+ if (data->nextLRU)
+ data->nextLRU->prevLRU = data->prevLRU;
+ else
+ d->lruLast = data->prevLRU;
+ if (data->prevLRU)
+ data->prevLRU->nextLRU = data->nextLRU;
+ else
+ d->lruFirst = data->nextLRU;
+ data->inLRU = false;
+}
+
+QVGPixmapData *QVGImagePool::pixmapLRU()
+{
+ Q_D(QVGImagePool);
+ return d->lruLast;
+}
+
+QT_END_NAMESPACE
diff --git a/src/openvg/qvgimagepool_p.h b/src/openvg/qvgimagepool_p.h
new file mode 100644
index 0000000..66a4998
--- /dev/null
+++ b/src/openvg/qvgimagepool_p.h
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenVG module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVGIMAGEPOOL_P_H
+#define QVGIMAGEPOOL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qvg.h"
+#include <QtCore/qscopedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+class QVGPixmapData;
+class QVGImagePoolPrivate;
+
+class Q_OPENVG_EXPORT QVGImagePool
+{
+public:
+ QVGImagePool();
+ virtual ~QVGImagePool();
+
+ static QVGImagePool *instance();
+
+ // This function can be used from system-specific graphics system
+ // plugins to alter the image allocation strategy.
+ static void setImagePool(QVGImagePool *pool);
+
+ // Create a new VGImage from the pool with the specified parameters
+ // that is not associated with a pixmap. The VGImage is returned to
+ // the pool when releaseImage() is called.
+ //
+ // This function will call reclaimSpace() when vgCreateImage() fails.
+ //
+ // This function is typically called when allocating temporary
+ // VGImage's for pixmap filters. The "keepData" object will not
+ // be reclaimed if reclaimSpace() needs to be called.
+ virtual VGImage createTemporaryImage(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality,
+ QVGPixmapData *keepData = 0);
+
+ // Create a new VGImage with the specified parameters and associate
+ // it with "data". The QVGPixmapData will be notified when the
+ // VGImage needs to be reclaimed by the pool.
+ //
+ // This function will call reclaimSpace() when vgCreateImage() fails.
+ virtual VGImage createImageForPixmap(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality,
+ QVGPixmapData *data);
+
+ // Create a permanent VGImage with the specified parameters.
+ // If there is insufficient space for the vgCreateImage call,
+ // then this function will call reclaimSpace() and try again.
+ //
+ // The caller is responsible for calling vgDestroyImage()
+ // when it no longer needs the VGImage, as the image is not
+ // recorded in the image pool.
+ //
+ // This function is typically used for pattern brushes where
+ // the OpenVG engine is responsible for managing the lifetime
+ // of the VGImage, destroying it automatically when the brush
+ // is no longer in use.
+ virtual VGImage createPermanentImage(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality);
+
+ // Release a VGImage that is no longer required.
+ virtual void releaseImage(QVGPixmapData *data, VGImage image);
+
+ // Notify the pool that a QVGPixmapData object is using
+ // an image again. This allows the pool to move the image
+ // within a least-recently-used list of QVGPixmapData objects.
+ virtual void useImage(QVGPixmapData *data);
+
+ // Notify the pool that the VGImage's associated with a
+ // QVGPixmapData are being detached from the pool. The caller
+ // will become responsible for calling vgDestroyImage().
+ virtual void detachImage(QVGPixmapData *data);
+
+ // Reclaim space for an image allocation with the specified parameters.
+ // Returns true if space was reclaimed, or false if there is no
+ // further space that can be reclaimed. The "data" parameter
+ // indicates the pixmap that is trying to obtain space which should
+ // not itself be reclaimed.
+ virtual bool reclaimSpace(VGImageFormat format,
+ VGint width, VGint height,
+ QVGPixmapData *data);
+
+ // Hibernate the image pool because the context is about to be
+ // destroyed. All VGImage's left in the pool should be released.
+ virtual void hibernate();
+
+protected:
+ // Helper functions for managing the LRU list of QVGPixmapData objects.
+ void moveToHeadOfLRU(QVGPixmapData *data);
+ void removeFromLRU(QVGPixmapData *data);
+ QVGPixmapData *pixmapLRU();
+
+private:
+ QScopedPointer<QVGImagePoolPrivate> d_ptr;
+
+ Q_DECLARE_PRIVATE(QVGImagePool)
+ Q_DISABLE_COPY(QVGImagePool)
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index 1571083..bda6096 100644
--- a/src/openvg/qwindowsurface_vgegl.cpp
+++ b/src/openvg/qwindowsurface_vgegl.cpp
@@ -42,6 +42,7 @@
#include "qwindowsurface_vgegl_p.h"
#include "qpaintengine_vg_p.h"
#include "qpixmapdata_vg_p.h"
+#include "qvgimagepool_p.h"
#include "qvg_p.h"
#if !defined(QT_NO_EGL)
@@ -360,6 +361,9 @@ void qt_vg_hibernate_pixmaps(QVGSharedContext *shared)
pd = pd->next;
}
+ // Hibernate any remaining VGImage's in the image pool.
+ QVGImagePool::instance()->hibernate();
+
// Don't need the current context any more.
shared->context->lazyDoneCurrent();
diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def
index 303c463..d50e85f 100644
--- a/src/s60installs/bwins/QtGuiu.def
+++ b/src/s60installs/bwins/QtGuiu.def
@@ -2503,7 +2503,7 @@ EXPORTS
?cacheMode@QMovie@@QAE?AW4CacheMode@1@XZ @ 2502 NONAME ; enum QMovie::CacheMode QMovie::cacheMode(void)
?cacheMode@QMovie@@QBE?AW4CacheMode@1@XZ @ 2503 NONAME ; enum QMovie::CacheMode QMovie::cacheMode(void) const
?cacheStatistics@QFont@@SAXXZ @ 2504 NONAME ; void QFont::cacheStatistics(void)
- ?cacheType@QTextureGlyphCache@@QBE?AW4Type@QFontEngineGlyphCache@@XZ @ 2505 NONAME ABSENT ; enum QFontEngineGlyphCache::Type QTextureGlyphCache::cacheType(void) const
+ ?cacheType@QTextureGlyphCache@@QBE?AW4Type@QFontEngineGlyphCache@@XZ @ 2505 NONAME ; enum QFontEngineGlyphCache::Type QTextureGlyphCache::cacheType(void) const
?calcEffectiveOpacity@QGraphicsItemPrivate@@QBEMXZ @ 2506 NONAME ; float QGraphicsItemPrivate::calcEffectiveOpacity(void) const
?calculateTabWidth@QTextEngine@@QBE?AUQFixed@@HU2@@Z @ 2507 NONAME ; struct QFixed QTextEngine::calculateTabWidth(int, struct QFixed) const
?calendarPopup@QDateTimeEdit@@QBE_NXZ @ 2508 NONAME ; bool QDateTimeEdit::calendarPopup(void) const
@@ -4299,7 +4299,7 @@ EXPORTS
?expandingDirections@QSpacerItem@@UBE?AV?$QFlags@W4Orientation@Qt@@@@XZ @ 4298 NONAME ; class QFlags<enum Qt::Orientation> QSpacerItem::expandingDirections(void) const
?expandingDirections@QWidgetItem@@UBE?AV?$QFlags@W4Orientation@Qt@@@@XZ @ 4299 NONAME ; class QFlags<enum Qt::Orientation> QWidgetItem::expandingDirections(void) const
?expandsOnDoubleClick@QTreeView@@QBE_NXZ @ 4300 NONAME ; bool QTreeView::expandsOnDoubleClick(void) const
- ?expireGlyphCache@QFontEngine@@AAEXXZ @ 4301 NONAME ABSENT ; void QFontEngine::expireGlyphCache(void)
+ ?expireGlyphCache@QFontEngine@@AAEXXZ @ 4301 NONAME ; void QFontEngine::expireGlyphCache(void)
?extension@QDialog@@QBEPAVQWidget@@XZ @ 4302 NONAME ; class QWidget * QDialog::extension(void) const
?extension@QGraphicsEllipseItem@@MBE?AVQVariant@@ABV2@@Z @ 4303 NONAME ; class QVariant QGraphicsEllipseItem::extension(class QVariant const &) const
?extension@QGraphicsItem@@MBE?AVQVariant@@ABV2@@Z @ 4304 NONAME ; class QVariant QGraphicsItem::extension(class QVariant const &) const
@@ -4933,8 +4933,8 @@ EXPORTS
?globalY@QMouseEvent@@QBEHXZ @ 4932 NONAME ; int QMouseEvent::globalY(void) const
?globalY@QTabletEvent@@QBEHXZ @ 4933 NONAME ; int QTabletEvent::globalY(void) const
?globalY@QWheelEvent@@QBEHXZ @ 4934 NONAME ; int QWheelEvent::globalY(void) const
- ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@PAXABVQTransform@@@Z @ 4935 NONAME ABSENT ; class QFontEngineGlyphCache * QFontEngine::glyphCache(void *, class QTransform const &) const
- ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@W4Type@2@ABVQTransform@@@Z @ 4936 NONAME ABSENT ; class QFontEngineGlyphCache * QFontEngine::glyphCache(enum QFontEngineGlyphCache::Type, class QTransform const &) const
+ ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@PAXABVQTransform@@@Z @ 4935 NONAME ; class QFontEngineGlyphCache * QFontEngine::glyphCache(void *, class QTransform const &) const
+ ?glyphCache@QFontEngine@@QBEPAVQFontEngineGlyphCache@@W4Type@2@ABVQTransform@@@Z @ 4936 NONAME ; class QFontEngineGlyphCache * QFontEngine::glyphCache(enum QFontEngineGlyphCache::Type, class QTransform const &) const
?glyphCount@QFontEngine@@UBEHXZ @ 4937 NONAME ; int QFontEngine::glyphCount(void) const
?glyphMargin@QTextureGlyphCache@@UBEHXZ @ 4938 NONAME ; int QTextureGlyphCache::glyphMargin(void) const
?gotFocus@QFocusEvent@@QBE_NXZ @ 4939 NONAME ; bool QFocusEvent::gotFocus(void) const
@@ -9103,7 +9103,7 @@ EXPORTS
?setGestureCancelPolicy@QGesture@@QAEXW4GestureCancelPolicy@1@@Z @ 9102 NONAME ; void QGesture::setGestureCancelPolicy(enum QGesture::GestureCancelPolicy)
?setGlobalStrut@QApplication@@SAXABVQSize@@@Z @ 9103 NONAME ; void QApplication::setGlobalStrut(class QSize const &)
?setGlyphCache@QFontEngine@@QAEXPAXPAVQFontEngineGlyphCache@@@Z @ 9104 NONAME ; void QFontEngine::setGlyphCache(void *, class QFontEngineGlyphCache *)
- ?setGlyphCache@QFontEngine@@QAEXW4Type@QFontEngineGlyphCache@@PAV3@@Z @ 9105 NONAME ABSENT ; void QFontEngine::setGlyphCache(enum QFontEngineGlyphCache::Type, class QFontEngineGlyphCache *)
+ ?setGlyphCache@QFontEngine@@QAEXW4Type@QFontEngineGlyphCache@@PAV3@@Z @ 9105 NONAME ; void QFontEngine::setGlyphCache(enum QFontEngineGlyphCache::Type, class QFontEngineGlyphCache *)
?setGraphicsEffect@QGraphicsItem@@QAEXPAVQGraphicsEffect@@@Z @ 9106 NONAME ; void QGraphicsItem::setGraphicsEffect(class QGraphicsEffect *)
?setGraphicsEffect@QWidget@@QAEXPAVQGraphicsEffect@@@Z @ 9107 NONAME ; void QWidget::setGraphicsEffect(class QGraphicsEffect *)
?setGraphicsEffectSource@QGraphicsEffectPrivate@@QAEXPAVQGraphicsEffectSource@@@Z @ 9108 NONAME ; void QGraphicsEffectPrivate::setGraphicsEffectSource(class QGraphicsEffectSource *)
@@ -12517,8 +12517,9 @@ EXPORTS
?effectiveFocusWidget@QWidgetPrivate@@QAEPAVQWidget@@XZ @ 12516 NONAME ; class QWidget * QWidgetPrivate::effectiveFocusWidget(void)
?ignoreUnusedNavigationEvents@QTextControl@@QBE_NXZ @ 12517 NONAME ; bool QTextControl::ignoreUnusedNavigationEvents(void) const
?setIgnoreUnusedNavigationEvents@QTextControl@@QAEX_N@Z @ 12518 NONAME ; void QTextControl::setIgnoreUnusedNavigationEvents(bool)
- ?discardUpdateRequest@QGraphicsItemPrivate@@QBE_N_N00@Z @ 12519 NONAME ; bool QGraphicsItemPrivate::discardUpdateRequest(bool, bool, bool) const
- ??1QImagePixmapCleanupHooks@@QAE@XZ @ 12520 NONAME ; QImagePixmapCleanupHooks::~QImagePixmapCleanupHooks(void)
+ ??1QImagePixmapCleanupHooks@@QAE@XZ @ 12519 NONAME ; QImagePixmapCleanupHooks::~QImagePixmapCleanupHooks(void)
+ ??1QVectorPath@@QAE@XZ @ 12520 NONAME ; QVectorPath::~QVectorPath(void)
?addCacheData@QVectorPath@@QBEPAUCacheEntry@1@PAVQPaintEngineEx@@PAXP6AX01@Z@Z @ 12521 NONAME ; struct QVectorPath::CacheEntry * QVectorPath::addCacheData(class QPaintEngineEx *, void *, void (*)(class QPaintEngineEx *, void *)) const
- ?makeCacheable@QVectorPath@@QBEXXZ @ 12522 NONAME ; void QVectorPath::makeCacheable(void) const
- ??1QVectorPath@@QAE@XZ @ 12523 NONAME ; QVectorPath::~QVectorPath(void)
+ ?discardUpdateRequest@QGraphicsItemPrivate@@QBE_N_N00@Z @ 12522 NONAME ; bool QGraphicsItemPrivate::discardUpdateRequest(bool, bool, bool) const
+ ?makeCacheable@QVectorPath@@QBEXXZ @ 12523 NONAME ; void QVectorPath::makeCacheable(void) const
+
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index f130087..a384ba0 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -517,7 +517,7 @@ QVariant::Type qDecodeOCIType(const QString& ocitype, QSql::NumericalPrecisionPo
}
else if (ocitype == QLatin1String("LONG") || ocitype == QLatin1String("NCLOB")
|| ocitype == QLatin1String("CLOB"))
- type = QVariant::ByteArray;
+ type = QVariant::String;
else if (ocitype == QLatin1String("RAW") || ocitype == QLatin1String("LONG RAW")
|| ocitype == QLatin1String("ROWID") || ocitype == QLatin1String("BLOB")
|| ocitype == QLatin1String("CFILE") || ocitype == QLatin1String("BFILE"))
@@ -543,6 +543,7 @@ QVariant::Type qDecodeOCIType(int ocitype, QSql::NumericalPrecisionPolicy precis
case SQLT_AVC:
case SQLT_RDD:
case SQLT_LNG:
+ case SQLT_CLOB:
#ifdef SQLT_INTERVAL_YM
case SQLT_INTERVAL_YM:
#endif
@@ -584,7 +585,6 @@ QVariant::Type qDecodeOCIType(int ocitype, QSql::NumericalPrecisionPolicy precis
case SQLT_NTY:
case SQLT_REF:
case SQLT_RID:
- case SQLT_CLOB:
type = QVariant::ByteArray;
break;
case SQLT_DAT:
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index e686873..fdf0c2c 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -172,28 +172,39 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode
SQLSMALLINT msgLen = 0;
SQLRETURN r = SQL_NO_DATA;
SQLTCHAR state_[SQL_SQLSTATE_SIZE+1];
- SQLTCHAR description_[SQL_MAX_MESSAGE_LENGTH];
+ QVarLengthArray<SQLTCHAR> description_(SQL_MAX_MESSAGE_LENGTH);
QString result;
int i = 1;
description_[0] = 0;
+ r = SQLGetDiagRec(handleType,
+ handle,
+ i,
+ state_,
+ &nativeCode_,
+ 0,
+ NULL,
+ &msgLen);
+ if(r == SQL_NO_DATA)
+ return QString();
+ description_.resize(msgLen+1);
do {
r = SQLGetDiagRec(handleType,
handle,
i,
- (SQLTCHAR*)state_,
+ state_,
&nativeCode_,
- (SQLTCHAR*)description_,
- SQL_MAX_MESSAGE_LENGTH, /* in bytes, not in characters */
+ description_.data(),
+ description_.size(),
&msgLen);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
if (nativeCode)
*nativeCode = nativeCode_;
QString tmpstore;
#ifdef UNICODE
- tmpstore = QString((const QChar*)description_, msgLen);
+ tmpstore = QString((const QChar*)description_.data(), msgLen);
#else
- tmpstore = QString::fromLocal8Bit((const char*)description_, msgLen);
+ tmpstore = QString::fromLocal8Bit((const char*)description_.data(), msgLen);
#endif
if(result != tmpstore) {
if(!result.isEmpty())
diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
index 3ed918e..ac220bd 100644
--- a/src/svg/qsvghandler.cpp
+++ b/src/svg/qsvghandler.cpp
@@ -1147,12 +1147,12 @@ static QMatrix parseTransformationMatrix(const QStringRef &value)
if (points.count() != 1)
goto error;
const qreal deg2rad = qreal(0.017453292519943295769);
- matrix.shear(tan(points[0]*deg2rad), 0);
+ matrix.shear(qTan(points[0]*deg2rad), 0);
} else if (state == SkewY) {
if (points.count() != 1)
goto error;
const qreal deg2rad = qreal(0.017453292519943295769);
- matrix.shear(0, tan(points[0]*deg2rad));
+ matrix.shear(0, qTan(points[0]*deg2rad));
}
}
error:
@@ -1481,8 +1481,8 @@ static void pathArc(QPainterPath &path,
yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0);
/* (xc, yc) is center of the circle. */
- th0 = atan2(y0 - yc, x0 - xc);
- th1 = atan2(y1 - yc, x1 - xc);
+ th0 = qAtan2(y0 - yc, x0 - xc);
+ th1 = qAtan2(y1 - yc, x1 - xc);
th_arc = th1 - th0;
if (th_arc < 0 && sweep_flag)
@@ -1578,8 +1578,8 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
count--;
break;
}
- x = x0 = num[0] + offsetX;
- y = y0 = num[1] + offsetY;
+ x = num[0] + offsetX;
+ y = num[1] + offsetY;
num += 2;
count -= 2;
path.lineTo(x, y);
@@ -1592,8 +1592,8 @@ static bool parsePathDataFast(const QStringRef &dataStr, QPainterPath &path)
count--;
break;
}
- x = x0 = num[0];
- y = y0 = num[1];
+ x = num[0];
+ y = num[1];
num += 2;
count -= 2;
path.lineTo(x, y);
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp
index 57927fd..c67f7d2 100644
--- a/src/svg/qsvgstyle.cpp
+++ b/src/svg/qsvgstyle.cpp
@@ -771,7 +771,7 @@ void QSvgAnimateTransform::resolveMatrix(QSvgNode *node)
qreal transXDiff = (to1-from1) * percentOfAnimation;
qreal transX = from1 + transXDiff;
m_transform = QTransform();
- m_transform.shear(tan(transX * deg2rad), 0);
+ m_transform.shear(qTan(transX * deg2rad), 0);
break;
}
case SkewY: {
@@ -786,7 +786,7 @@ void QSvgAnimateTransform::resolveMatrix(QSvgNode *node)
qreal transYDiff = (to1 - from1) * percentOfAnimation;
qreal transY = from1 + transYDiff;
m_transform = QTransform();
- m_transform.shear(0, tan(transY * deg2rad));
+ m_transform.shear(0, qTan(transY * deg2rad));
break;
}
default:
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 8fcc0df..1a75cf6 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -725,16 +725,6 @@ void Generator::generateMetacall()
needEditable |= p.editable.endsWith(')');
needUser |= p.user.endsWith(')');
}
- bool needAnything = needGet
- | needSet
- | needReset
- | needDesignable
- | needScriptable
- | needStored
- | needEditable
- | needUser;
- if (!needAnything)
- goto skip_properties;
fprintf(out, "\n#ifndef QT_NO_PROPERTIES\n ");
if (needElse)
@@ -904,7 +894,6 @@ void Generator::generateMetacall()
fprintf(out, "\n#endif // QT_NO_PROPERTIES");
}
- skip_properties:
if (methodList.size() || cdef->signalList.size() || cdef->propertyList.size())
fprintf(out, "\n ");
fprintf(out,"return _id;\n}\n");
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index 2316ba2..1ca2b3a 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -489,6 +489,7 @@ private slots:
void constructors();
void typenameWithUnsigned();
void warnOnVirtualSignal();
+ void QTBUG5590_dummyProperty();
signals:
void sigWithUnsignedArg(unsigned foo);
void sigWithSignedArg(signed foo);
@@ -1216,6 +1217,40 @@ void tst_Moc::warnOnVirtualSignal()
#endif
}
+
+class QTBUG5590_DummyObject: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool dummy)
+};
+
+class QTBUG5590_PropertyObject: public QTBUG5590_DummyObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int value2 READ value2 WRITE setValue2)
+
+ public:
+ QTBUG5590_PropertyObject() : m_value(85), m_value2(40) { }
+ int value() const { return m_value; }
+ void setValue(int value) { m_value = value; }
+ int value2() const { return m_value2; }
+ void setValue2(int value) { m_value2 = value; }
+ private:
+ int m_value, m_value2;
+};
+
+void tst_Moc::QTBUG5590_dummyProperty()
+{
+ QTBUG5590_PropertyObject o;
+ QCOMPARE(o.property("value").toInt(), 85);
+ QCOMPARE(o.property("value2").toInt(), 40);
+ o.setProperty("value", 32);
+ QCOMPARE(o.value(), 32);
+ o.setProperty("value2", 82);
+ QCOMPARE(o.value2(), 82);
+}
+
QTEST_APPLESS_MAIN(tst_Moc)
#include "tst_moc.moc"
diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
index 6479829..bf3af63 100644
--- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
@@ -48,6 +48,7 @@
#include <qlistview.h>
#include <qlistwidget.h>
#include <qtableview.h>
+#include <qtablewidget.h>
#include <qtreeview.h>
#include <qtreewidget.h>
#include <qheaderview.h>
@@ -226,6 +227,7 @@ private slots:
void shiftSelectionAfterRubberbandSelection();
void ctrlRubberbandSelection();
void QTBUG6407_extendedSelection();
+ void QTBUG6753_selectOnSelection();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -1475,5 +1477,26 @@ void tst_QAbstractItemView::QTBUG6407_extendedSelection()
}
+void tst_QAbstractItemView::QTBUG6753_selectOnSelection()
+{
+ QTableWidget table(5, 5);
+ for (int i = 0; i < table.rowCount(); ++i)
+ for (int j = 0; j < table.columnCount(); ++j)
+ table.setItem(i, j, new QTableWidgetItem("choo-be-doo-wah"));
+
+ table.show();
+ table.setSelectionMode(QAbstractItemView::ExtendedSelection);
+ table.selectAll();
+ QTest::qWaitForWindowShown(&table);
+ QModelIndex item = table.model()->index(1,1);
+ QRect itemRect = table.visualRect(item);
+ QTest::mouseMove(table.viewport(), itemRect.center());
+ QTest::mouseClick(table.viewport(), Qt::LeftButton, Qt::NoModifier, itemRect.center());
+ QTest::qWait(20);
+
+ QCOMPARE(table.selectedItems().count(), 1);
+ QCOMPARE(table.selectedItems().first(), table.item(item.row(), item.column()));
+}
+
QTEST_MAIN(tst_QAbstractItemView)
#include "tst_qabstractitemview.moc"
diff --git a/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp b/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp
index 6398d9c..82e6389 100644
--- a/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp
+++ b/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp
@@ -93,6 +93,7 @@ private slots:
}
void init();
+ void unconnected();
void simpleTypes();
void complexTypes();
void wrongTypes();
@@ -252,6 +253,30 @@ void tst_QDBusPendingReply::init()
QVERIFY(iface->isValid());
}
+void tst_QDBusPendingReply::unconnected()
+{
+ QDBusConnection con("invalid stored connection");
+ QVERIFY(!con.isConnected());
+ QDBusInterface iface("doesnt.matter", "/", "doesnt.matter", con);
+ QVERIFY(!iface.isValid());
+
+ QDBusPendingReply<> rvoid = iface.asyncCall("ReloadConfig");
+ QVERIFY(rvoid.isFinished());
+ QVERIFY(!rvoid.isValid());
+ QVERIFY(rvoid.isError());
+ rvoid.waitForFinished();
+ QVERIFY(!rvoid.isValid());
+ QVERIFY(rvoid.isError());
+
+ QDBusPendingReply<QString> rstring = iface.asyncCall("GetId");
+ QVERIFY(rstring.isFinished());
+ QVERIFY(!rstring.isValid());
+ QVERIFY(rstring.isError());
+ rstring.waitForFinished();
+ QVERIFY(!rstring.isValid());
+ QVERIFY(rstring.isError());
+}
+
void tst_QDBusPendingReply::simpleTypes()
{
QDBusPendingReply<> rvoid = iface->asyncCall("retrieveVoid");
diff --git a/tests/auto/qdbusreply/tst_qdbusreply.cpp b/tests/auto/qdbusreply/tst_qdbusreply.cpp
index 9866302..e36d288 100644
--- a/tests/auto/qdbusreply/tst_qdbusreply.cpp
+++ b/tests/auto/qdbusreply/tst_qdbusreply.cpp
@@ -93,6 +93,7 @@ private slots:
}
void init();
+ void unconnected();
void simpleTypes();
void complexTypes();
void wrongTypes();
@@ -236,6 +237,21 @@ void tst_QDBusReply::init()
QVERIFY(iface->isValid());
}
+void tst_QDBusReply::unconnected()
+{
+ QDBusConnection con("invalid stored connection");
+ QVERIFY(!con.isConnected());
+ QDBusInterface iface("doesnt.matter", "/", "doesnt.matter", con);
+ QVERIFY(!iface.isValid());
+
+ QDBusReply<void> rvoid = iface.asyncCall("ReloadConfig");
+ QVERIFY(!rvoid.isValid());
+
+ QDBusReply<QString> rstring = iface.asyncCall("GetId");
+ QVERIFY(!rstring.isValid());
+ QVERIFY(rstring.value().isEmpty());
+}
+
void tst_QDBusReply::simpleTypes()
{
QDBusReply<bool> rbool = iface->call(QDBus::BlockWithGui, "retrieveBool");
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp
index 7ee5665..2b2f431 100644
--- a/tests/auto/qfile/tst_qfile.cpp
+++ b/tests/auto/qfile/tst_qfile.cpp
@@ -220,6 +220,9 @@ public:
private:
enum FileType { OpenQFile, OpenFd, OpenStream };
+ void openStandardStreamsFileDescriptors();
+ void openStandardStreamsBufferedStreams();
+
bool openFd(QFile &file, QIODevice::OpenMode mode)
{
int fdMode = QT_OPEN_LARGEFILE | QT_OPEN_BINARY;
@@ -554,6 +557,10 @@ void tst_QFile::size()
QFETCH( QString, filename );
QFETCH( qint64, size );
+#ifdef Q_WS_WINCE
+ filename = QFileInfo(filename).absoluteFilePath();
+#endif
+
{
QFile f( filename );
QCOMPARE( f.size(), size );
@@ -564,24 +571,29 @@ void tst_QFile::size()
{
QFile f;
- int fd = QT_OPEN(filename.toLocal8Bit().constData(), QT_OPEN_RDONLY);
- QVERIFY( fd != -1 );
- QVERIFY( f.open(fd, QIODevice::ReadOnly) );
+ FILE* stream = QT_FOPEN(filename.toLocal8Bit().constData(), "rb");
+ QVERIFY( stream );
+ QVERIFY( f.open(stream, QIODevice::ReadOnly) );
QCOMPARE( f.size(), size );
f.close();
- QT_CLOSE(fd);
+ fclose(stream);
}
{
+#ifdef Q_WS_WINCE
+ QSKIP("Currently low level file I/O not well supported on Windows CE", SkipSingle);
+#endif
QFile f;
- FILE* stream = QT_FOPEN(filename.toLocal8Bit().constData(), "rb");
- QVERIFY( stream );
- QVERIFY( f.open(stream, QIODevice::ReadOnly) );
+
+ int fd = QT_OPEN(filename.toLocal8Bit().constData(), QT_OPEN_RDONLY);
+
+ QVERIFY( fd != -1 );
+ QVERIFY( f.open(fd, QIODevice::ReadOnly) );
QCOMPARE( f.size(), size );
f.close();
- fclose(stream);
+ QT_CLOSE(fd);
}
}
@@ -603,6 +615,7 @@ void tst_QFile::seek()
QVERIFY(file.seek(10));
QCOMPARE(file.pos(), qint64(10));
QCOMPARE(file.size(), qint64(0));
+ file.close();
QFile::remove("newfile.txt");
}
@@ -1128,9 +1141,15 @@ void tst_QFile::copyFallback()
QVERIFY(QFile::exists("file-copy-destination.txt"));
QVERIFY(!file.isOpen());
+#ifdef Q_WS_WINCE
// Need to reset permissions on Windows to be able to delete
QVERIFY(QFile::setPermissions("file-copy-destination.txt",
- QFile::ReadOwner | QFile::WriteOwner));
+ QFile::WriteOther));
+#else
+ // Need to reset permissions on Windows to be able to delete
+ QVERIFY(QFile::setPermissions("file-copy-destination.txt",
+ QFile::ReadOwner | QFile::WriteOwner));
+#endif
QVERIFY(QFile::remove("file-copy-destination.txt"));
// Fallback copy of open file.
@@ -1139,6 +1158,7 @@ void tst_QFile::copyFallback()
QVERIFY(QFile::exists("file-copy-destination.txt"));
QVERIFY(!file.isOpen());
+ file.close();
QFile::remove("file-copy-destination.txt");
}
@@ -2239,6 +2259,7 @@ void tst_QFile::rename()
QFile file(source);
QCOMPARE(file.rename(destination), result);
+
if (result)
QCOMPARE(file.error(), QFile::NoError);
else
@@ -2367,6 +2388,7 @@ void tst_QFile::appendAndRead()
QCOMPARE(readFile.read(1 << j).size(), 1 << j);
}
+ readFile.close();
QFile::remove(QLatin1String("appendfile.txt"));
}
@@ -2608,10 +2630,15 @@ void tst_QFile::map()
QFETCH(QFile::FileError, error);
QString fileName = QDir::currentPath() + '/' + "qfile_map_testfile";
+
+#ifdef Q_WS_WINCE
+ fileName = QFileInfo(fileName).absoluteFilePath();
+#endif
+
if (QFile::exists(fileName)) {
QVERIFY(QFile::setPermissions(fileName,
QFile::WriteOwner | QFile::ReadOwner | QFile::WriteUser | QFile::ReadUser));
- QFile::remove(fileName);
+ QFile::remove(fileName);
}
QFile file(fileName);
@@ -2650,8 +2677,13 @@ void tst_QFile::map()
QCOMPARE(file.error(), QFile::NoError);
// hpux wont let you map multiple times.
-#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API)
+#if !defined(Q_OS_HPUX) && !defined(Q_USE_DEPRECATED_MAP_API) && !defined(Q_OS_WINCE)
// exotic test to make sure that multiple maps work
+
+ // note: windows ce does not reference count mutliple maps
+ // it's essentially just the same reference but it
+ // cause a resource lock on the file which prevents it
+ // from being removed uchar *memory1 = file.map(0, file.size());
uchar *memory1 = file.map(0, file.size());
QCOMPARE(file.error(), QFile::NoError);
uchar *memory2 = file.map(0, file.size());
@@ -2687,7 +2719,6 @@ void tst_QFile::map()
QVERIFY(!memory);
QVERIFY(file.setPermissions(originalPermissions));
}
-
QVERIFY(file.remove());
}
@@ -2800,8 +2831,14 @@ void tst_QFile::openDirectory()
f1.close();
}
-void tst_QFile::openStandardStreams()
+void tst_QFile::openStandardStreamsFileDescriptors()
{
+#ifdef Q_WS_WINCE
+ //allthough Windows CE (not mobile!) has functions that allow redirecting
+ //the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW)
+ //it does not have functions to simply open them like below .
+ QSKIP("Opening standard streams on Windows CE via descriptor not implemented", SkipAll);
+#endif
// Using file descriptors
{
QFile in;
@@ -2826,7 +2863,13 @@ void tst_QFile::openStandardStreams()
QCOMPARE( err.size(), (qint64)0 );
QVERIFY( err.isSequential() );
}
+}
+void tst_QFile::openStandardStreamsBufferedStreams()
+{
+#if defined (Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QSKIP("Unix only test.", SkipAll);
+#endif
// Using streams
{
QFile in;
@@ -2853,6 +2896,12 @@ void tst_QFile::openStandardStreams()
}
}
+void tst_QFile::openStandardStreams()
+{
+ openStandardStreamsFileDescriptors();
+ openStandardStreamsBufferedStreams();
+}
+
void tst_QFile::writeNothing()
{
for (int i = 0; i < 3; ++i) {
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index 5dc072d..532e550 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -75,6 +75,7 @@ private slots:
void graphicsViewClipping();
void partialGLWidgetUpdates_data();
void partialGLWidgetUpdates();
+ void glWidgetWithAlpha();
void glWidgetRendering();
void glFBOSimpleRendering();
void glFBORendering();
@@ -251,15 +252,10 @@ void tst_QGL::getSetCheck()
// bool QGLFormat::sampleBuffers()
// void QGLFormat::setSampleBuffers(bool)
-#if !defined(QT_OPENGL_ES_2)
QCOMPARE(false, obj1.sampleBuffers());
QVERIFY(!obj1.testOption(QGL::SampleBuffers));
QVERIFY(obj1.testOption(QGL::NoSampleBuffers));
-#else
- QCOMPARE(true, obj1.sampleBuffers());
- QVERIFY(obj1.testOption(QGL::SampleBuffers));
- QVERIFY(!obj1.testOption(QGL::NoSampleBuffers));
-#endif
+
obj1.setSampleBuffers(false);
QCOMPARE(false, obj1.sampleBuffers());
QVERIFY(obj1.testOption(QGL::NoSampleBuffers));
@@ -927,6 +923,17 @@ void tst_QGL::glPBufferRendering()
QFUZZY_COMPARE_IMAGES(fb, reference);
}
+void tst_QGL::glWidgetWithAlpha()
+{
+ QGLWidget* w = new QGLWidget(QGLFormat(QGL::AlphaChannel));
+ w->show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(w);
+#endif
+
+ delete w;
+}
+
class GLWidget : public QGLWidget
{
public:
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
index 259df4d..69fc118 100644
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -69,6 +69,7 @@ private slots:
void opacity();
void grayscale();
void colorize();
+ void drawPixmapItem();
};
void tst_QGraphicsEffect::initTestCase()
@@ -465,6 +466,54 @@ void tst_QGraphicsEffect::colorize()
QCOMPARE(image.pixel(10, 10), qRgb(122, 193, 66));
}
+class PixmapItemEffect : public QGraphicsEffect
+{
+public:
+ PixmapItemEffect(const QPixmap &source)
+ : QGraphicsEffect()
+ , pixmap(source)
+ , repaints(0)
+ {}
+
+ QRectF boundingRectFor(const QRectF &rect) const
+ { return rect; }
+
+ void draw(QPainter *painter)
+ {
+ QVERIFY(sourcePixmap(Qt::LogicalCoordinates).pixmapData() == pixmap.pixmapData());
+ QVERIFY((painter->worldTransform().type() <= QTransform::TxTranslate) == (sourcePixmap(Qt::DeviceCoordinates).pixmapData() == pixmap.pixmapData()));
+
+ ++repaints;
+ }
+ QPixmap pixmap;
+ int repaints;
+};
+
+void tst_QGraphicsEffect::drawPixmapItem()
+{
+ QImage image(32, 32, QImage::Format_RGB32);
+ QPainter p(&image);
+ p.fillRect(0, 0, 32, 16, Qt::blue);
+ p.fillRect(0, 16, 32, 16, Qt::red);
+ p.end();
+
+ QGraphicsScene scene;
+ QGraphicsPixmapItem *item = new QGraphicsPixmapItem(QPixmap::fromImage(image));
+ scene.addItem(item);
+
+ PixmapItemEffect *effect = new PixmapItemEffect(item->pixmap());
+ item->setGraphicsEffect(effect);
+
+ QGraphicsView view(&scene);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ item->rotate(180);
+ QTest::qWait(50);
+
+ QTRY_VERIFY(effect->repaints >= 2);
+}
+
QTEST_MAIN(tst_QGraphicsEffect)
#include "tst_qgraphicseffect.moc"
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 797e1fb..69df39b 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -3601,7 +3601,7 @@ void tst_QGraphicsView::inputMethodSensitivity()
item->setFlag(QGraphicsItem::ItemIsFocusable);
scene.addItem(item);
scene.setFocusItem(item);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
item->setFlag(QGraphicsItem::ItemAcceptsInputMethod, false);
@@ -3616,35 +3616,35 @@ void tst_QGraphicsView::inputMethodSensitivity()
scene.addItem(item2);
scene.setFocusItem(item2);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item2);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2));
scene.setFocusItem(item);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
view.setScene(0);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
view.setScene(&scene);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
scene.setFocusItem(item2);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item2);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2));
view.setScene(0);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item2);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2));
scene.setFocusItem(item);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
view.setScene(&scene);
QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true);
- QCOMPARE(scene.focusItem(), item);
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
}
class InputContextTester : public QInputContext
@@ -3878,7 +3878,7 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect()
{ lastBackgroundExposedRect = rect; }
QRectF lastBackgroundExposedRect;
};
-
+
class CustomRectItem : public QGraphicsRectItem
{
public:
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index a2524aa..75d7a0a 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -126,6 +126,7 @@ private slots:
void deleteQObjectWhenDeletingEvent();
void overloads();
void isSignalConnected();
+ void qMetaObjectConnect();
protected:
};
@@ -3125,5 +3126,148 @@ void tst_QObject::isSignalConnected()
QCOMPARE(o.rec, 2);
}
+void tst_QObject::qMetaObjectConnect()
+{
+ SenderObject *s = new SenderObject;
+ ReceiverObject *r1 = new ReceiverObject;
+ ReceiverObject *r2 = new ReceiverObject;
+ r1->reset();
+ r2->reset();
+ ReceiverObject::sequence = 0;
+
+ int signal1Index = s->metaObject()->indexOfSignal("signal1()");
+ int signal3Index = s->metaObject()->indexOfSignal("signal3()");
+ int slot1Index = r1->metaObject()->indexOfSlot("slot1()");
+ int slot2Index = r1->metaObject()->indexOfSlot("slot2()");
+ int slot3Index = r1->metaObject()->indexOfSlot("slot3()");
+
+ QVERIFY(slot1Index > 0);
+ QVERIFY(slot2Index > 0);
+ QVERIFY(slot3Index > 0);
+
+ QVERIFY( QMetaObject::connect( s, signal1Index, r1, slot1Index) );
+ QVERIFY( QMetaObject::connect( s, signal3Index, r2, slot3Index) );
+ QVERIFY( QMetaObject::connect( s, -1, r2, slot2Index) );
+
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ s->emitSignal1();
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 1 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ s->emitSignal2();
+ s->emitSignal3();
+ s->emitSignal4();
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 4 );
+ QCOMPARE( r2->count_slot3, 1 );
+
+ QVERIFY( QMetaObject::disconnect( s, signal1Index, r1, slot1Index) );
+ QVERIFY( QMetaObject::disconnect( s, signal3Index, r2, slot3Index) );
+ QVERIFY( QMetaObject::disconnect( s, -1, r2, slot2Index) );
+
+ s->emitSignal1();
+ s->emitSignal2();
+ s->emitSignal3();
+ s->emitSignal4();
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 4 );
+ QCOMPARE( r2->count_slot3, 1 );
+
+ //some "dynamic" signal
+ QVERIFY( QMetaObject::connect( s, s->metaObject()->methodOffset() + 20, r1, slot3Index) );
+ QVERIFY( QMetaObject::connect( s, s->metaObject()->methodOffset() + 35, r2, slot1Index) );
+ QVERIFY( QMetaObject::connect( s, -1, r1, slot2Index) );
+
+ r1->reset();
+ r2->reset();
+
+ void *args[] = { 0 , 0 };
+ QMetaObject::activate(s, s->metaObject()->methodOffset() + 20, args);
+ QMetaObject::activate(s, s->metaObject()->methodOffset() + 48, args);
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 2 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ QMetaObject::activate(s, s->metaObject()->methodOffset() + 35, args);
+ s->emitSignal1();
+ s->emitSignal2();
+
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 5 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 1 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ delete s;
+ r1->reset();
+ r2->reset();
+
+#define SIGNAL_INDEX(S) obj1.metaObject()->indexOfSignal(QMetaObject::normalizedSignature(#S))
+ OverloadObject obj1;
+ QObject obj2, obj3;
+
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int)) , r1, slot1Index);
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *)) , r2, slot1Index);
+
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *, QObject *, QObject *, QObject *)) , r1, slot2Index);
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(QObject *)) , r2, slot2Index);
+ QMetaObject::connect(&obj1, SIGNAL_INDEX(sig(int, int)) , r1, slot3Index);
+
+ emit obj1.sig(0.5); //connected to nothing
+ emit obj1.sig(1, 'a'); //connected to nothing
+ QCOMPARE( r1->count_slot1, 0 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 0 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 0 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ emit obj1.sig(1); //this signal is connected
+ emit obj1.sig(&obj2);
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 0 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 0 );
+ QCOMPARE( r2->count_slot2, 1 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ emit obj1.sig(&obj2, &obj3); //this signal is connected
+
+ QCOMPARE( r1->count_slot1, 1 );
+ QCOMPARE( r1->count_slot2, 1 );
+ QCOMPARE( r1->count_slot3, 1 );
+ QCOMPARE( r2->count_slot1, 1 );
+ QCOMPARE( r2->count_slot2, 1 );
+ QCOMPARE( r2->count_slot3, 0 );
+
+ delete r1;
+ delete r2;
+
+}
+
QTEST_MAIN(tst_QObject)
#include "tst_qobject.moc"
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 0effd01..0164c9d 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -1289,6 +1289,12 @@ void tst_QPixmap::copy()
QPixmap expected(10, 10);
expected.fill(Qt::blue);
QVERIFY(lenientCompare(dest, expected));
+
+ QPixmap trans;
+ trans.fill(Qt::transparent);
+
+ QPixmap transCopy = trans.copy();
+ QVERIFY(pixmapsAreEqual(&trans, &transCopy));
}
#ifdef QT3_SUPPORT
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index cb4e103..4f89708 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -942,9 +942,9 @@ void tst_QSqlDatabase::recordOCI()
FieldDef("raw(2000)", QVariant::ByteArray, QByteArray(Q3CString("blah6")), false),
FieldDef("blob", QVariant::ByteArray, QByteArray(Q3CString("blah7"))),
#endif
-//FIXME FieldDef("clob", QVariant::CString, Q3CString("blah8")),
-//FIXME FieldDef("nclob", QVariant::CString, Q3CString("blah9")),
-//X FieldDef("bfile", QVariant::ByteArray, QByteArray(Q3CString("blah10"))),
+ FieldDef("clob", QVariant::String, QString("blah8")),
+ FieldDef("nclob", QVariant::String, QString("blah9")),
+ FieldDef("bfile", QVariant::ByteArray, QByteArray("blah10")),
intytm,
intdts,
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index a8908fd..2a55c32 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -201,6 +201,8 @@ private slots:
void QTBUG_5251();
void QTBUG_6421_data() { generic_data("QOCI"); }
void QTBUG_6421();
+ void QTBUG_6618_data() { generic_data("QODBC"); }
+ void QTBUG_6618();
private:
// returns all database connections
@@ -2961,5 +2963,27 @@ void tst_QSqlQuery::QTBUG_6421()
QCOMPARE(q.value(0).toString(), QLatin1String("\"COL3\""));
}
+void tst_QSqlQuery::QTBUG_6618()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ if (!tst_Databases::isSqlServer( db ))
+ QSKIP("SQL Server specific test", SkipSingle);
+
+ QSqlQuery q(db);
+ q.exec( "drop procedure " + qTableName( "tst_raiseError" ) ); //non-fatal
+ QString errorString;
+ for (int i=0;i<110;i++)
+ errorString+="reallylong";
+ errorString+=" error";
+ QVERIFY_SQL( q, exec("create procedure " + qTableName( "tst_raiseError" ) + " as\n"
+ "begin\n"
+ " raiserror('" + errorString + "', 16, 1)\n"
+ "end\n" ));
+ q.exec( "{call " + qTableName( "tst_raiseError" ) + "}" );
+ QVERIFY(q.lastError().text().contains(errorString));
+}
+
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 579f4eb..ed3b08e 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -182,12 +182,12 @@ void tst_Selftests::runSubTest_data()
#endif
QTest::newRow("benchlibeventcounter") << "benchlibeventcounter" << QStringList("-eventcounter");
QTest::newRow("benchliboptions") << "benchliboptions" << QStringList("-eventcounter");
- QTest::newRow("benchlibwalltime") << "benchlibwalltime" << QStringList();
- //### This test is affected by the speed of the CPU and whether the tick counter is
- //### monotonically increasing. It won't work on some machines so leave it off by default.
+ //### These tests are affected by timing and whether the CPU tick counter is
+ //### monotonically increasing. They won't work on some machines so leave them off by default.
//### Feel free to uncomment for your own testing.
#if 0
+ QTest::newRow("benchlibwalltime") << "benchlibwalltime" << QStringList();
QTest::newRow("benchlibtickcounter") << "benchlibtickcounter" << QStringList("-tickcounter");
#endif
diff --git a/tests/benchmarks/containers-sequential/main.cpp b/tests/benchmarks/containers-sequential/main.cpp
index 76643ca..885db3e 100644
--- a/tests/benchmarks/containers-sequential/main.cpp
+++ b/tests/benchmarks/containers-sequential/main.cpp
@@ -59,7 +59,7 @@ public:
};
template <typename T>
-static T * f(T *ts) // dummy function to prevent code from being optimized away by the compiler
+T * f(T *ts) // dummy function to prevent code from being optimized away by the compiler
{
return ts;
}
@@ -81,7 +81,7 @@ class UseCases_QVector : public UseCases<T>
void lookup(int size)
{
QVector<T> v;
-
+
T t;
for (int i = 0; i < size; ++i)
v.append(t);
@@ -113,7 +113,7 @@ class UseCases_stdvector : public UseCases<T>
void lookup(int size)
{
std::vector<T> v;
-
+
T t;
for (int i = 0; i < size; ++i)
v.push_back(t);
@@ -132,6 +132,13 @@ struct Large { // A "large" item type
int x[1000];
};
+// Symbian devices typically have limited memory
+#ifdef Q_OS_SYMBIAN
+# define LARGE_MAX_SIZE 2000
+#else
+# define LARGE_MAX_SIZE 20000
+#endif
+
class tst_vector_vs_std : public QObject
{
Q_OBJECT
@@ -190,7 +197,7 @@ void tst_vector_vs_std::insert_Large_data()
QTest::addColumn<bool>("useStd");
QTest::addColumn<int>("size");
- for (int size = 10; size < 20000; size += 100) {
+ for (int size = 10; size < LARGE_MAX_SIZE; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size;
QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size;
@@ -236,7 +243,7 @@ void tst_vector_vs_std::lookup_Large_data()
QTest::addColumn<bool>("useStd");
QTest::addColumn<int>("size");
- for (int size = 10; size < 20000; size += 100) {
+ for (int size = 10; size < LARGE_MAX_SIZE; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size;
QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size;
diff --git a/tests/benchmarks/events/main.cpp b/tests/benchmarks/events/main.cpp
index 7c9de8f..09d6c53 100644
--- a/tests/benchmarks/events/main.cpp
+++ b/tests/benchmarks/events/main.cpp
@@ -47,6 +47,7 @@ class PingPong : public QObject
{
public:
void setPeer(QObject *peer);
+ void resetCounter() {m_counter = 100;}
protected:
bool event(QEvent *e);
@@ -69,7 +70,7 @@ bool PingPong::event(QEvent *)
QEvent *e = new QEvent(QEvent::User);
QCoreApplication::postEvent(m_peer, e);
} else {
- QCoreApplication::quit();
+ QTestEventLoop::instance().exitLoop();
}
return true;
}
@@ -149,6 +150,10 @@ void EventsBench::sendEvent()
void EventsBench::postEvent_data()
{
QTest::addColumn<bool>("filterEvents");
+ // The first time an eventloop is executed, the case runs radically slower at least
+ // on some platforms, so test the "no eventfilter" case to get a comparable results
+ // with the "eventfilter" case.
+ QTest::newRow("first time, no eventfilter") << false;
QTest::newRow("no eventfilter") << false;
QTest::newRow("eventfilter") << true;
}
@@ -164,8 +169,14 @@ void EventsBench::postEvent()
ping.installEventFilter(this);
pong.installEventFilter(this);
}
- QEvent *e = new QEvent(QEvent::User);
+
QBENCHMARK {
+ // In case multiple iterations are done, event needs to be created inside the QBENCHMARK,
+ // or it gets deleted once first iteration exits and can cause a crash. Similarly,
+ // ping and pong need their counters reset.
+ QEvent *e = new QEvent(QEvent::User);
+ ping.resetCounter();
+ pong.resetCounter();
QCoreApplication::postEvent(&ping, e);
QTestEventLoop::instance().enterLoop( 61 );
}
diff --git a/tests/benchmarks/qbytearray/main.cpp b/tests/benchmarks/qbytearray/main.cpp
index 6a481f1..78c5b16 100644
--- a/tests/benchmarks/qbytearray/main.cpp
+++ b/tests/benchmarks/qbytearray/main.cpp
@@ -73,6 +73,11 @@ void tst_qbytearray::append()
{
QFETCH(int, size);
+#ifdef Q_OS_SYMBIAN
+ if (size > 1000000)
+ QSKIP("Skipped due to limited memory in many Symbian devices.", SkipSingle);
+#endif
+
QByteArray ba;
QBENCHMARK {
QByteArray ba2(size, 'x');
diff --git a/tests/benchmarks/qdiriterator/main.cpp b/tests/benchmarks/qdiriterator/main.cpp
index 2a400e3..9e4e53e 100644
--- a/tests/benchmarks/qdiriterator/main.cpp
+++ b/tests/benchmarks/qdiriterator/main.cpp
@@ -73,7 +73,7 @@ private slots:
void tst_qdiriterator::data()
{
-#ifdef Q_OS_WINCE
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QByteArray qtdir = qPrintable(QCoreApplication::applicationDirPath());
qtdir += "/depot";
#else
@@ -148,9 +148,9 @@ static int posix_helper(const char *dirpath)
int count = 0;
while ((entry = ::readdir(dir))) {
- if (qstrcmp(entry->d_name, ".") == 0)
+ if (qstrcmp(entry->d_name, ".") == 0)
continue;
- if (qstrcmp(entry->d_name, "..") == 0)
+ if (qstrcmp(entry->d_name, "..") == 0)
continue;
++count;
QByteArray ba = dirpath;
@@ -198,7 +198,7 @@ void tst_qdiriterator::diriterator()
//QDir::AllEntries | QDir::Hidden,
QDir::Files,
QDirIterator::Subdirectories);
-
+
while (dir.hasNext()) {
dir.next();
//printf("%s\n", qPrintable(dir.fileName()));
@@ -231,7 +231,7 @@ void tst_qdiriterator::fsiterator()
//QDir::Files | QDir::NoDotAndDotDot,
QDir::Files,
QFileSystemIterator::Subdirectories);
-
+
for (; !dir.atEnd(); dir.next()) {
dump && printf("%d %s\n",
dir.fileInfo().isDir(),
diff --git a/tests/benchmarks/qdiriterator/qdiriterator.pro b/tests/benchmarks/qdiriterator/qdiriterator.pro
index fb4b753..e06d746 100755
--- a/tests/benchmarks/qdiriterator/qdiriterator.pro
+++ b/tests/benchmarks/qdiriterator/qdiriterator.pro
@@ -15,7 +15,7 @@ SOURCES += main.cpp
SOURCES += qfilesystemiterator.cpp
HEADERS += qfilesystemiterator.h
-wince*: {
+wince*|symbian: {
corelibdir.sources = $$QT_SOURCE_TREE/src/corelib
corelibdir.path = ./depot/src
DEPLOYMENT += corelibdir
diff --git a/tests/benchmarks/qfile/main.cpp b/tests/benchmarks/qfile/main.cpp
index d3f6ab5..4217077 100644
--- a/tests/benchmarks/qfile/main.cpp
+++ b/tests/benchmarks/qfile/main.cpp
@@ -128,12 +128,18 @@ private:
QString tmpDirName;
};
+Q_DECLARE_METATYPE(tst_qfile::BenchmarkType)
+Q_DECLARE_METATYPE(QIODevice::OpenMode)
+Q_DECLARE_METATYPE(QIODevice::OpenModeFlag)
+
void tst_qfile::createFile()
{
+ removeFile(); // Cleanup in case previous test case aborted before cleaning up
+
QTemporaryFile tmpFile;
tmpFile.setAutoRemove(false);
if (!tmpFile.open())
- ::_exit(1);
+ ::exit(1);
filename = tmpFile.fileName();
tmpFile.close();
}
@@ -217,7 +223,6 @@ void tst_qfile::readBigFile_data(BenchmarkType type, QIODevice::OpenModeFlag t,
for (int i=0; i<bs_entries; ++i)
QTest::newRow((QString("BS: %1, Flags: %2" )).arg(bs[i]).arg(flagstring).toLatin1().constData()) << type << bs[i] << t << b;
-
}
void tst_qfile::readBigFile()
@@ -227,8 +232,12 @@ void tst_qfile::readBigFile()
QFETCH(QFile::OpenModeFlag, textMode);
QFETCH(QFile::OpenModeFlag, bufferedMode);
- char buffer[BUFSIZE]; // we can't allocate buffers nice and dynamically in c++
- removeFile();
+#ifndef Q_OS_WIN
+ if (testType == Win32Benchmark)
+ QSKIP("This is Windows only benchmark.", SkipSingle);
+#endif
+
+ char *buffer = new char[BUFSIZE];
createFile();
fillFile();
@@ -297,6 +306,9 @@ void tst_qfile::readBigFile()
}
break;
}
+
+ removeFile();
+ delete[] buffer;
}
void tst_qfile::seek_data()
@@ -374,6 +386,8 @@ void tst_qfile::seek()
}
break;
}
+
+ removeFile();
}
void tst_qfile::open_data()
@@ -392,7 +406,6 @@ void tst_qfile::open()
{
QFETCH(tst_qfile::BenchmarkType, testType);
- removeFile();
createFile();
switch (testType) {
@@ -435,6 +448,7 @@ void tst_qfile::open()
file.open(cfile, QIODevice::ReadOnly);
file.close();
}
+ ::fclose(cfile);
}
break;
case(Win32Benchmark): {
@@ -456,6 +470,7 @@ void tst_qfile::open()
break;
}
+ removeFile();
}
@@ -515,15 +530,20 @@ void tst_qfile::readSmallFiles_data(BenchmarkType type, QIODevice::OpenModeFlag
void tst_qfile::createSmallFiles()
{
QDir dir = QDir::temp();
- Q_ASSERT(dir.mkdir("tst"));
+ dir.mkdir("tst");
dir.cd("tst");
tmpDirName = dir.absolutePath();
+#ifdef Q_OS_SYMBIAN
+ for (int i = 0; i < 100; ++i)
+#else
for (int i = 0; i < 1000; ++i)
+#endif
{
QFile f(tmpDirName+"/"+QString::number(i));
f.open(QIODevice::WriteOnly);
- f.seek(512);
+ f.seek(511);
+ f.putChar('\n');
f.close();
}
}
@@ -544,17 +564,22 @@ void tst_qfile::readSmallFiles()
QFETCH(QFile::OpenModeFlag, textMode);
QFETCH(QFile::OpenModeFlag, bufferedMode);
- removeSmallFiles();
+#ifndef Q_OS_WIN
+ if (testType == Win32Benchmark)
+ QSKIP("This is Windows only benchmark.", SkipSingle);
+#endif
+
createSmallFiles();
+
QDir dir(tmpDirName);
- const QStringList files = dir.entryList(QDir::NoDotAndDotDot|QDir::NoSymLinks);
- char buffer[BUFSIZE]; // we can't allocate buffers nice and dynamically in c++
+ const QStringList files = dir.entryList(QDir::NoDotAndDotDot|QDir::NoSymLinks|QDir::Files);
+ char *buffer = new char[BUFSIZE];
switch (testType) {
case(QFileBenchmark): {
QList<QFile*> fileList;
Q_FOREACH(QString file, files) {
- QFile *f = new QFile(file);
+ QFile *f = new QFile(tmpDirName+ "/" + file);
f->open(QIODevice::ReadOnly|textMode|bufferedMode);
fileList.append(f);
}
@@ -576,7 +601,7 @@ void tst_qfile::readSmallFiles()
case(QFSFileEngineBenchmark): {
QList<QFSFileEngine*> fileList;
Q_FOREACH(QString file, files) {
- QFSFileEngine *fse = new QFSFileEngine(file);
+ QFSFileEngine *fse = new QFSFileEngine(tmpDirName+ "/" + file);
fse->open(QIODevice::ReadOnly|textMode|bufferedMode);
fileList.append(fse);
}
@@ -596,7 +621,7 @@ void tst_qfile::readSmallFiles()
case(PosixBenchmark): {
QList<FILE*> fileList;
Q_FOREACH(QString file, files) {
- fileList.append(::fopen(QFile::encodeName(file).constData(), "rb"));
+ fileList.append(::fopen(QFile::encodeName(tmpDirName+ "/" + file).constData(), "rb"));
}
QBENCHMARK {
@@ -640,11 +665,10 @@ void tst_qfile::readSmallFiles()
}
break;
}
-}
-Q_DECLARE_METATYPE(tst_qfile::BenchmarkType)
-Q_DECLARE_METATYPE(QIODevice::OpenMode)
-Q_DECLARE_METATYPE(QIODevice::OpenModeFlag)
+ removeSmallFiles();
+ delete[] buffer;
+}
QTEST_MAIN(tst_qfile)
diff --git a/tests/benchmarks/qgraphicsview/qgraphicsview.pro b/tests/benchmarks/qgraphicsview/qgraphicsview.pro
index d9db8c9..927d731 100644
--- a/tests/benchmarks/qgraphicsview/qgraphicsview.pro
+++ b/tests/benchmarks/qgraphicsview/qgraphicsview.pro
@@ -6,3 +6,11 @@ SOURCES += tst_qgraphicsview.cpp
RESOURCES += qgraphicsview.qrc
include(chiptester/chiptester.pri)
+
+symbian {
+ qt_not_deployed {
+ plugins.sources = qjpeg.dll
+ plugins.path = imageformats
+ DEPLOYMENT += plugins
+ }
+}
diff --git a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
index aadd56c..cf65e5d 100644
--- a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp
@@ -62,25 +62,25 @@ class QEventWaiter : public QEventLoop
{
public:
QEventWaiter(QObject *receiver, QEvent::Type type)
- : waiting(false), t(type)
+ : waiting(false), t(type)
{
- receiver->installEventFilter(this);
+ receiver->installEventFilter(this);
}
void wait()
{
- waiting = true;
- exec();
+ waiting = true;
+ exec();
}
bool eventFilter(QObject *receiver, QEvent *event)
{
- Q_UNUSED(receiver);
- if (waiting && event->type() == t) {
- waiting = false;
- exit();
- }
- return false;
+ Q_UNUSED(receiver);
+ if (waiting && event->type() == t) {
+ waiting = false;
+ exit();
+ }
+ return false;
}
private:
@@ -166,20 +166,26 @@ void tst_QGraphicsView::paintSingleItem()
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ view.viewport()->render(&painter);
}
}
+#ifdef Q_OS_SYMBIAN
+# define DEEP_STACKING_COUNT 200
+#else
+# define DEEP_STACKING_COUNT 1000
+#endif
+
void tst_QGraphicsView::paintDeepStackingItems()
{
QGraphicsScene scene(0, 0, 100, 100);
QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10);
QGraphicsRectItem *lastRect = item;
- for (int i = 0; i < 1000; ++i) {
- QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
- rect->setPos(1, 1);
- rect->setParentItem(lastRect);
- lastRect = rect;
+ for (int i = 0; i < DEEP_STACKING_COUNT; ++i) {
+ QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
+ rect->setPos(1, 1);
+ rect->setParentItem(lastRect);
+ lastRect = rect;
}
QGraphicsView view(&scene);
@@ -192,7 +198,7 @@ void tst_QGraphicsView::paintDeepStackingItems()
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ view.viewport()->render(&painter);
}
}
@@ -202,11 +208,11 @@ void tst_QGraphicsView::paintDeepStackingItems_clipped()
QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10);
item->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
QGraphicsRectItem *lastRect = item;
- for (int i = 0; i < 1000; ++i) {
- QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
- rect->setPos(1, 1);
- rect->setParentItem(lastRect);
- lastRect = rect;
+ for (int i = 0; i < DEEP_STACKING_COUNT; ++i) {
+ QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10);
+ rect->setPos(1, 1);
+ rect->setParentItem(lastRect);
+ lastRect = rect;
}
QGraphicsView view(&scene);
@@ -219,7 +225,7 @@ void tst_QGraphicsView::paintDeepStackingItems_clipped()
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&image);
QBENCHMARK {
- view.viewport()->render(&painter);
+ view.viewport()->render(&painter);
}
}
@@ -239,8 +245,8 @@ void tst_QGraphicsView::moveSingleItem()
int n = 1;
QBENCHMARK {
item->setPos(25 * n, 25 * n);
- waiter.wait();
- n = n ? 0 : 1;
+ waiter.wait();
+ n = n ? 0 : 1;
}
}
@@ -382,18 +388,18 @@ void tst_QGraphicsView::chipTester()
tester.setOpenGL(opengl);
tester.setOperation(ChipTester::Operation(operation));
QBENCHMARK {
- tester.runBenchmark();
+ tester.runBenchmark();
}
}
static void addChildHelper(QGraphicsItem *parent, int n, bool rotate)
{
if (!n)
- return;
+ return;
QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0, 0, 50, 50), parent);
item->setPos(10, 10);
if (rotate)
- item->rotate(10);
+ item->rotate(10);
addChildHelper(item, n - 1, rotate);
}
@@ -421,12 +427,12 @@ void tst_QGraphicsView::deepNesting()
QGraphicsScene scene;
for (int y = 0; y < 15; ++y) {
- for (int x = 0; x < 15; ++x) {
- QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50));
- if (rotate) item1->rotate(10);
- item1->setPos(x * 25, y * 25);
- addChildHelper(item1, 30, rotate);
- }
+ for (int x = 0; x < 15; ++x) {
+ QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50));
+ if (rotate) item1->rotate(10);
+ item1->setPos(x * 25, y * 25);
+ addChildHelper(item1, 30, rotate);
+ }
}
scene.setItemIndexMethod(bsp ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex);
scene.setSortCacheEnabled(sortCache);
@@ -441,11 +447,11 @@ void tst_QGraphicsView::deepNesting()
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
- CALLGRIND_START_INSTRUMENTATION
+ CALLGRIND_START_INSTRUMENTATION
#endif
- view.viewport()->repaint();
+ view.viewport()->repaint();
#ifdef CALLGRIND_DEBUG
- CALLGRIND_STOP_INSTRUMENTATION
+ CALLGRIND_STOP_INSTRUMENTATION
#endif
}
}
@@ -456,36 +462,36 @@ public:
AnimatedPixmapItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0)
: QGraphicsPixmapItem(parent), rotateFactor(0), scaleFactor(0)
{
- rotate = rot;
- scale = scal;
- xspeed = x;
- yspeed = y;
+ rotate = rot;
+ scale = scal;
+ xspeed = x;
+ yspeed = y;
}
protected:
void advance(int i)
- {
- if (!i)
- return;
- int x = int(pos().x()) + pixmap().width();
- x += xspeed;
- x = (x % (300 + pixmap().width() * 2)) - pixmap().width();
- int y = int(pos().y()) + pixmap().width();
- y += yspeed;
- y = (y % (300 + pixmap().width() * 2)) - pixmap().width();
- setPos(x, y);
-
- int rot = rotateFactor;
- int sca = scaleFactor;
+ {
+ if (!i)
+ return;
+ int x = int(pos().x()) + pixmap().width();
+ x += xspeed;
+ x = (x % (300 + pixmap().width() * 2)) - pixmap().width();
+ int y = int(pos().y()) + pixmap().width();
+ y += yspeed;
+ y = (y % (300 + pixmap().width() * 2)) - pixmap().width();
+ setPos(x, y);
+
+ int rot = rotateFactor;
+ int sca = scaleFactor;
if (rotate)
- rotateFactor = 1 + (rot + xspeed) % 360;
+ rotateFactor = 1 + (rot + xspeed) % 360;
if (scale)
- scaleFactor = 1 + (sca + yspeed) % 50;
+ scaleFactor = 1 + (sca + yspeed) % 50;
- if (rotate || scale) {
- qreal s = 0.5 + scaleFactor / 50.0;
- setTransform(QTransform().rotate(rotateFactor).scale(s, s));
- }
+ if (rotate || scale) {
+ qreal s = 0.5 + scaleFactor / 50.0;
+ setTransform(QTransform().rotate(rotateFactor).scale(s, s));
+ }
}
private:
@@ -543,38 +549,38 @@ void tst_QGraphicsView::imageRiver()
view.show();
QPixmap pix(":/images/designer.png");
- QVERIFY(!pix.isNull());
+ QVERIFY(!pix.isNull());
QList<QGraphicsItem *> items;
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
for (int i = 0; i < 100; ++i) {
- AnimatedPixmapItem *item;
- if (direction == 0) item = new AnimatedPixmapItem((i % 4) + 1, 0, rotation, scale);
- if (direction == 1) item = new AnimatedPixmapItem(0, (i % 4) + 1, rotation, scale);
- if (direction == 2) item = new AnimatedPixmapItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
- item->setPixmap(pix);
+ AnimatedPixmapItem *item;
+ if (direction == 0) item = new AnimatedPixmapItem((i % 4) + 1, 0, rotation, scale);
+ if (direction == 1) item = new AnimatedPixmapItem(0, (i % 4) + 1, rotation, scale);
+ if (direction == 2) item = new AnimatedPixmapItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
+ item->setPixmap(pix);
int rnd1, rnd2;
str >> rnd1 >> rnd2;
- item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
- -pix.height() + rnd2 % (view.height() + pix.height()));
- scene.addItem(item);
+ item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
+ -pix.height() + rnd2 % (view.height() + pix.height()));
+ scene.addItem(item);
}
view.count = 0;
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
- CALLGRIND_START_INSTRUMENTATION
+ CALLGRIND_START_INSTRUMENTATION
#endif
- for (int i = 0; i < 100; ++i) {
- scene.advance();
- while (view.count < (i+1))
- qApp->processEvents();
- }
+ for (int i = 0; i < 100; ++i) {
+ scene.advance();
+ while (view.count < (i+1))
+ qApp->processEvents();
+ }
#ifdef CALLGRIND_DEBUG
- CALLGRIND_STOP_INSTRUMENTATION
+ CALLGRIND_STOP_INSTRUMENTATION
#endif
}
}
@@ -585,38 +591,38 @@ public:
AnimatedTextItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0)
: QGraphicsSimpleTextItem(parent), rotateFactor(0), scaleFactor(25)
{
- setText("River of text");
- rotate = rot;
- scale = scal;
- xspeed = x;
- yspeed = y;
+ setText("River of text");
+ rotate = rot;
+ scale = scal;
+ xspeed = x;
+ yspeed = y;
}
protected:
void advance(int i)
- {
- if (!i)
- return;
- QRect r = boundingRect().toRect();
- int x = int(pos().x()) + r.width();
- x += xspeed;
- x = (x % (300 + r.width() * 2)) - r.width();
- int y = int(pos().y()) + r.width();
- y += yspeed;
- y = (y % (300 + r.width() * 2)) - r.width();
- setPos(x, y);
-
- int rot = rotateFactor;
- int sca = scaleFactor;
+ {
+ if (!i)
+ return;
+ QRect r = boundingRect().toRect();
+ int x = int(pos().x()) + r.width();
+ x += xspeed;
+ x = (x % (300 + r.width() * 2)) - r.width();
+ int y = int(pos().y()) + r.width();
+ y += yspeed;
+ y = (y % (300 + r.width() * 2)) - r.width();
+ setPos(x, y);
+
+ int rot = rotateFactor;
+ int sca = scaleFactor;
if (rotate)
- rotateFactor = 1 + (rot + xspeed) % 360;
+ rotateFactor = 1 + (rot + xspeed) % 360;
if (scale)
- scaleFactor = 1 + (sca + yspeed) % 50;
+ scaleFactor = 1 + (sca + yspeed) % 50;
- if (rotate || scale) {
- qreal s = 0.5 + scaleFactor / 50.0;
- setTransform(QTransform().rotate(rotateFactor).scale(s, s));
- }
+ if (rotate || scale) {
+ qreal s = 0.5 + scaleFactor / 50.0;
+ setTransform(QTransform().rotate(rotateFactor).scale(s, s));
+ }
}
private:
@@ -657,37 +663,37 @@ void tst_QGraphicsView::textRiver()
view.show();
QPixmap pix(":/images/designer.png");
- QVERIFY(!pix.isNull());
+ QVERIFY(!pix.isNull());
QList<QGraphicsItem *> items;
QFile file(":/random.data");
QVERIFY(file.open(QIODevice::ReadOnly));
QDataStream str(&file);
for (int i = 0; i < 100; ++i) {
- AnimatedTextItem *item;
- if (direction == 0) item = new AnimatedTextItem((i % 4) + 1, 0, rotation, scale);
- if (direction == 1) item = new AnimatedTextItem(0, (i % 4) + 1, rotation, scale);
- if (direction == 2) item = new AnimatedTextItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
+ AnimatedTextItem *item;
+ if (direction == 0) item = new AnimatedTextItem((i % 4) + 1, 0, rotation, scale);
+ if (direction == 1) item = new AnimatedTextItem(0, (i % 4) + 1, rotation, scale);
+ if (direction == 2) item = new AnimatedTextItem((i % 4) + 1, (i % 4) + 1, rotation, scale);
int rnd1, rnd2;
str >> rnd1 >> rnd2;
- item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
- -pix.height() + rnd2 % (view.height() + pix.height()));
- scene.addItem(item);
+ item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()),
+ -pix.height() + rnd2 % (view.height() + pix.height()));
+ scene.addItem(item);
}
view.count = 0;
QBENCHMARK {
#ifdef CALLGRIND_DEBUG
- CALLGRIND_START_INSTRUMENTATION
+ CALLGRIND_START_INSTRUMENTATION
#endif
- for (int i = 0; i < 100; ++i) {
- scene.advance();
- while (view.count < (i+1))
- qApp->processEvents();
- }
+ for (int i = 0; i < 100; ++i) {
+ scene.advance();
+ while (view.count < (i+1))
+ qApp->processEvents();
+ }
#ifdef CALLGRIND_DEBUG
- CALLGRIND_STOP_INSTRUMENTATION
+ CALLGRIND_STOP_INSTRUMENTATION
#endif
}
}
diff --git a/tests/benchmarks/qstringlist/qstringlist.pro b/tests/benchmarks/qstringlist/qstringlist.pro
index f9ebd59..11cceb0 100644
--- a/tests/benchmarks/qstringlist/qstringlist.pro
+++ b/tests/benchmarks/qstringlist/qstringlist.pro
@@ -2,3 +2,5 @@ load(qttest_p4)
TARGET = tst_qstringlist
QT -= gui
SOURCES += main.cpp
+
+symbian: LIBS += -llibpthread
diff --git a/tests/benchmarks/qstylesheetstyle/main.cpp b/tests/benchmarks/qstylesheetstyle/main.cpp
index 19efcab..d6fa48c 100644
--- a/tests/benchmarks/qstylesheetstyle/main.cpp
+++ b/tests/benchmarks/qstylesheetstyle/main.cpp
@@ -49,16 +49,16 @@ class tst_qstylesheetstyle : public QObject
private slots:
void empty();
void empty_events();
-
+
void simple();
void simple_events();
-
+
void grid_data();
void grid();
-
+
private:
QWidget *buildSimpleWidgets();
-
+
};
@@ -103,7 +103,7 @@ void tst_qstylesheetstyle::empty_events()
delete w;
}
-static const char *simple_css =
+static const char *simple_css =
" QLineEdit { background: red; } QPushButton { border: 1px solid yellow; color: pink; } \n"
" QCheckBox { margin: 3px 5px; background-color:red; } QAbstractButton { background-color: #456; } \n"
" QFrame { padding: 3px; } QLabel { color: black } QSpinBox:hover { background-color:blue; } ";
@@ -138,7 +138,7 @@ void tst_qstylesheetstyle::grid_data()
QTest::addColumn<bool>("events");
QTest::addColumn<bool>("show");
QTest::addColumn<int>("N");
- for (int n = 5; n <= 25; n += 5) {
+ for (int n = 5; n <= 25; n += 5) {
const QByteArray nString = QByteArray::number(n*n);
QTest::newRow(("simple--" + nString).constData()) << false << false << n;
QTest::newRow(("events--" + nString).constData()) << true << false << n;
@@ -153,6 +153,13 @@ void tst_qstylesheetstyle::grid()
QFETCH(bool, show);
QFETCH(int, N);
+#ifdef Q_OS_SYMBIAN
+ // Symbian has limited stack (max 80k), which will run out when N >= 20 due to
+ // QWidget::show() using recursion among grid labels somewhere down the line.
+ if (show && N >= 20)
+ QSKIP("Grid too big for device to show", SkipSingle);
+#endif
+
QWidget *w = new QWidget();
QGridLayout *layout = new QGridLayout(w);
w->setLayout(layout);
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp
index 9389268..56fca06 100644
--- a/tools/qdoc3/generator.cpp
+++ b/tools/qdoc3/generator.cpp
@@ -65,6 +65,8 @@ QMap<QString, QStringList> Generator::imgFileExts;
QSet<QString> Generator::outputFormats;
QStringList Generator::imageFiles;
QStringList Generator::imageDirs;
+QStringList Generator::exampleDirs;
+QStringList Generator::exampleImgExts;
QString Generator::outDir;
QString Generator::project;
@@ -120,12 +122,19 @@ void Generator::initialize(const Config &config)
if (!dirInfo.mkdir(outDir + "/images"))
config.lastLocation().fatal(tr("Cannot create output directory '%1'")
.arg(outDir + "/images"));
+ if (!dirInfo.mkdir(outDir + "/images/used-in-examples"))
+ config.lastLocation().fatal(tr("Cannot create output directory '%1'")
+ .arg(outDir + "/images/used-in-examples"));
}
imageFiles = config.getStringList(CONFIG_IMAGES);
imageDirs = config.getStringList(CONFIG_IMAGEDIRS);
+ exampleDirs = config.getStringList(CONFIG_EXAMPLEDIRS);
+ exampleImgExts = config.getStringList(CONFIG_EXAMPLES + Config::dot +
+ CONFIG_IMAGEEXTENSIONS);
- QString imagesDotFileExtensions = CONFIG_IMAGES + Config::dot + CONFIG_FILEEXTENSIONS;
+ QString imagesDotFileExtensions =
+ CONFIG_IMAGES + Config::dot + CONFIG_FILEEXTENSIONS;
QSet<QString> formats = config.subVars(imagesDotFileExtensions);
QSet<QString>::ConstIterator f = formats.begin();
while (f != formats.end()) {
@@ -323,7 +332,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
const FakeNode *fake = static_cast<const FakeNode *>(node);
if (fake->subType() == Node::Example)
generateExampleFiles(fake, marker);
- else if (fake->subType() == Node::File)
+ else if ((fake->subType() == Node::File) || (fake->subType() == Node::Image))
quiet = true;
}
@@ -530,6 +539,13 @@ void Generator::generateInheritedBy(const ClassNode *classe,
}
}
+/*!
+ This function is called when the documentation for an
+ example is being formatted. It outputs the list of source
+ files comprising the example, and the list of images used
+ by the example. The images are copied into a subtree of
+ \c{...doc/html/images/used-in-examples/...}
+ */
void Generator::generateFileList(const FakeNode* fake,
CodeMarker* marker,
Node::SubType subtype,
@@ -546,9 +562,30 @@ void Generator::generateFileList(const FakeNode* fake,
if (child->subType() == subtype) {
++count;
QString file = child->name();
+ if (subtype == Node::Image) {
+ if (!file.isEmpty()) {
+ QDir dirInfo;
+ QString userFriendlyFilePath;
+ QString srcPath = Config::findFile(fake->location(),
+ QStringList(),
+ exampleDirs,
+ file,
+ exampleImgExts,
+ userFriendlyFilePath);
+ userFriendlyFilePath.truncate(userFriendlyFilePath.lastIndexOf('/'));
+
+ QString imgOutDir = outDir + "/images/used-in-examples/" + userFriendlyFilePath;
+ if (!dirInfo.mkpath(imgOutDir))
+ fake->location().fatal(tr("Cannot create output directory '%1'")
+ .arg(imgOutDir));
+
+ QString imgOutName = Config::copyFile(fake->location(),
+ srcPath,
+ file,
+ imgOutDir);
+ }
- if (file == "network/qftp/images/dir.png")
- qDebug() << "FILE:" << file;
+ }
openedList.next();
text << Atom(Atom::ListItemNumber, openedList.numberString())
diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h
index 7667789..cc1ea25 100644
--- a/tools/qdoc3/generator.h
+++ b/tools/qdoc3/generator.h
@@ -183,6 +183,8 @@ class Generator
static QSet<QString> outputFormats;
static QStringList imageFiles;
static QStringList imageDirs;
+ static QStringList exampleDirs;
+ static QStringList exampleImgExts;
static QString outDir;
static QString project;
};
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 8711c6b..ae7bd81 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -3429,6 +3429,8 @@ QString HtmlGenerator::fileName(const Node *node)
if (node->type() == Node::Fake) {
if (static_cast<const FakeNode *>(node)->subType() == Node::ExternalPage)
return node->name();
+ if (static_cast<const FakeNode *>(node)->subType() == Node::Image)
+ return node->name();
}
return PageGenerator::fileName(node);
}
@@ -4000,6 +4002,8 @@ QString HtmlGenerator::getLink(const Atom *atom,
if (path.isEmpty()) {
link = linkForNode(*node, relative);
+ if (*node && (*node)->subType() == Node::Image)
+ link = "images/used-in-examples/" + link;
if (targetAtom)
link += "#" + refForAtom(targetAtom, *node);
}
diff --git a/util/s60pixelmetrics/pm_mapper.hrh b/util/s60pixelmetrics/pm_mapper.hrh
index 4822654..f46a963 100644
--- a/util/s60pixelmetrics/pm_mapper.hrh
+++ b/util/s60pixelmetrics/pm_mapper.hrh
@@ -55,16 +55,9 @@ enum
{
ECmdStartCalculations = 8500,
ECmdSwitchOrientation,
- ECmdSwitchMirroring,
ECmdStatus,
ECmdSwitchOutput,
- ECmdCreateHeaderFile,
- ECmdSetAutoMode
- };
-
-enum
- {
- EWaitNote = 9000
+ ECmdCreateHeaderFile
};
#endif // PMMAPPER_HRH
diff --git a/util/s60pixelmetrics/pm_mapper.rss b/util/s60pixelmetrics/pm_mapper.rss
index 22817ad..8071b44 100644
--- a/util/s60pixelmetrics/pm_mapper.rss
+++ b/util/s60pixelmetrics/pm_mapper.rss
@@ -150,11 +150,9 @@ RESOURCE MENU_PANE r_pmmapper_system_menu
{
MENU_ITEM { command = ECmdStartCalculations; txt = "Start calculations"; },
MENU_ITEM { command = ECmdSwitchOrientation; txt = "Switch orientation"; },
- MENU_ITEM { command = ECmdSwitchMirroring; txt = "Switch mirroring";},
MENU_ITEM { command = ECmdStatus; txt = "Status"; },
MENU_ITEM { command = ECmdSwitchOutput; txt = "Switch output (file/screen)"; },
- MENU_ITEM { command = ECmdCreateHeaderFile; txt = "Create header file"; },
- MENU_ITEM { command = ECmdSetAutoMode; txt = "Switch autoMode";}
+ MENU_ITEM { command = ECmdCreateHeaderFile; txt = "Create header file"; }
};
}
diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp
index de6af0d..19d3b36 100644
--- a/util/s60pixelmetrics/pm_mapperapp.cpp
+++ b/util/s60pixelmetrics/pm_mapperapp.cpp
@@ -65,7 +65,6 @@
#include <aknglobalnote.h>
#include <CentralRepository.h>
-#include <AvkonInternalCRKeys.h> // KAknLayoutId
#include <Aknsutils.h>
#include <AknUtils.h>
@@ -89,7 +88,7 @@ _LIT(KEndBraceWithCommaAndCRLF, "},\n");
_LIT(KCRLF, "\n");
// Number of header lines in layout data.
-const TInt KHeaderValues = 5;
+const TInt KHeaderValues = 4;
// ============================ MEMBER FUNCTIONS ===============================
@@ -156,37 +155,27 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
Exit();
break;
case ECmdSwitchOutput:
+ {
+ HBufC* buffer = HBufC::NewLC( 100 );
+ TPtr bufferPtr = buffer->Des();
+ TBool last = ETrue;
+ bufferPtr.Append(_L("Output switched to "));
iFileOutputOn = !iFileOutputOn;
+ if (iFileOutputOn)
+ bufferPtr.Append(_L("file."));
+ else
+ bufferPtr.Append(_L("screen."));
+ ShowL( *buffer, last );
+ }
break;
case ECmdStatus:
{
ClearL();
// layout
- CRepository* repository = NULL;
- TInt value = KErrNotFound;
- TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon));
- if (ret == KErrNone)
- {
- ret = repository->Get(KAknLayoutId, value);
- }
- delete repository;
- ret= 0;
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
- bufferPtr.Append(_L("Layout: "));
- if (ret==KErrNone)
- {
- bufferPtr.AppendNum(value);
- }
- else
- {
- bufferPtr.Append(_L("(error) "));
- bufferPtr.AppendNum(ret);
- }
TBool last = ETrue;
- ShowL( *buffer, last );
- bufferPtr.Zero();
// Orientation
bufferPtr.Append(_L("Orientation: "));
@@ -201,12 +190,6 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
ShowL( *buffer, last );
bufferPtr.Zero();
- // Automode
- bufferPtr.Append(_L("AutoMode: "));
- bufferPtr.AppendNum((TInt)iAutoMode);
- ShowL( *buffer, last );
- bufferPtr.Zero();
-
CAknLayoutConfig::TScreenMode localAppScreenMode = CAknSgcClient::ScreenMode();
TInt hashValue = localAppScreenMode.ScreenStyleHash();
TPixelsTwipsAndRotation pixels = CAknSgcClient::PixelsAndRotation();
@@ -261,47 +244,24 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
CleanupStack::PopAndDestroy( buffer );
}
break;
- case ECmdSwitchMirroring:
- {
- // set the shared data value
- CRepository* repository = NULL;
- TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon));
- if (ret == KErrNone)
- {
- TInt value = KErrNotFound;
- repository->Get(KAknLayoutId, value);
- if ( value == EAknLayoutIdELAF)
- {
- value = EAknLayoutIdABRW;
- }
- else if (value ==EAknLayoutIdABRW)
- {
- value = EAknLayoutIdELAF;
- }
- ret = repository->Set(KAknLayoutId, value);
- }
- delete repository;
- // now inform all open apps of the switch
- TWsEvent event;
- event.SetType(KEikDynamicLayoutVariantSwitch);
- iEikonEnv->WsSession().SendEventToAllWindowGroups(event);
- }
- break;
case ECmdSwitchOrientation:
{
ClearL();
+ HBufC* buffer = HBufC::NewLC( 100 );
+ TPtr bufferPtr = buffer->Des();
+ TBool last = ETrue;
+
#ifndef __SERIES60_31__
if (!iAvkonAppUi->OrientationCanBeChanged())
{
- HBufC* buffer = HBufC::NewLC( 100 );
- TPtr bufferPtr = buffer->Des();
bufferPtr.Append(_L("Orientation cannot be changed."));
- TBool last = EFalse;
ShowL( *buffer, last );
bufferPtr.Zero();
delete buffer;
+ break;
}
#endif //__SERIES60_31__
+
if ( iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationPortrait)
{
iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
@@ -314,15 +274,11 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
{
// unspecified
iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
- /*User::After(100000);
- HBufC* buffer = HBufC::NewLC( 100 );
- TPtr bufferPtr = buffer->Des();
- bufferPtr.Append(_L("Orientation unspecified."));
- TBool last = EFalse;
- ShowL( *buffer, last );
- bufferPtr.Zero();
- delete buffer;*/
}
+ bufferPtr.Append(_L("Orientation changed."));
+ ShowL( *buffer, last );
+ bufferPtr.Zero();
+ delete buffer;
break;
}
case ECmdStartCalculations:
@@ -362,12 +318,6 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
tgt.AppendNum(version.minorVersion, EDecimal); // put minor version into text file
ShowL( tgt, last );
tgt.Zero();
- // MIRRORED
- TBool mirrored = AknLayoutUtils::LayoutMirrored();
- tgt.Append(_L("mirrored: \t"));
- tgt.AppendNum(mirrored, EDecimal); // put mirrored state into text file
- ShowL( tgt, last );
- tgt.Zero();
}
TInt myValue = KErrNotFound;
@@ -385,33 +335,15 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
if (index==QStyle::PM_SubMenuOverlap) index = QStyle::PM_CustomBase;
index++;
}
- if (iAutoMode && !iMode)
- {
- HandleCommandL(ECmdSwitchMirroring);
- iMode = ETrue;
- }
}
break;
case ECmdCreateHeaderFile:
CreateHeaderFileL();
break;
- case ECmdSetAutoMode:
- iAutoMode = !iAutoMode;
default:
break;
}
}
-void CPixelMetricsMapperAppUi::DoAutoOperationL()
- {
- HandleCommandL(ECmdStartCalculations);
- iMode = EFalse;
- HandleCommandL(ECmdSwitchMirroring);
- }
-
-TBool CPixelMetricsMapperAppUi::ReadyForAutoOp() const
- {
- return (iAutoMode && iMode);
- }
// -----------------------------------------------------------------------------
//
@@ -834,21 +766,7 @@ void CPixelMetricsMapperAppUi::CreateHeaderFileL() const
User::LeaveIfError( lex.Val(nextValue) );
if ( loop <= KHeaderValues-1)
{
- if (loop == KHeaderValues -1 ) // true / false values
- {
- if (nextValue == 1)
- {
- bufferLayoutHdr.Append(_L("true"));
- }
- else
- {
- bufferLayoutHdr.Append(_L("false"));
- }
- }
- else
- {
- bufferLayoutHdr.AppendNum(nextValue);
- }
+ bufferLayoutHdr.AppendNum(nextValue);
}
else
{
@@ -882,13 +800,11 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co
// Layout data is deployed like this:
// first line - height
// second line - width
- // fifth line mirror info
TFileName lines;
TFileName layoutName;
TInt height = -666;
TInt width = -666;
- TInt mirroring = -666;
// Collect name information.
for (TInt i=0; i<6; i++)
{
@@ -907,10 +823,6 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co
{
error = myLexer.Val(width);
}
- if (i==4) //mirror info is fourth
- {
- error = myLexer.Val(mirroring);
- }
User::LeaveIfError(error);
}
@@ -966,10 +878,6 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co
{
layoutName.Append(_L("Portrait"));
}
- if (mirroring)
- {
- layoutName.Append(_L(" Mirrored"));
- }
return layoutName;
}
diff --git a/util/s60pixelmetrics/pm_mapperapp.h b/util/s60pixelmetrics/pm_mapperapp.h
index cd119bc..aa6a63b 100644
--- a/util/s60pixelmetrics/pm_mapperapp.h
+++ b/util/s60pixelmetrics/pm_mapperapp.h
@@ -111,7 +111,7 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi
/**
* Constructor.
*/
- CPixelMetricsMapperAppUi();
+ CPixelMetricsMapperAppUi();
/**
* Symbian 2nd phase constructor.
@@ -123,12 +123,6 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi
*/
~CPixelMetricsMapperAppUi();
- public:
- void DoAutoOperationL();
-
- TBool ReadyForAutoOp() const;
-
-
private: // Functions from base classes
/**
@@ -158,18 +152,16 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi
private: // Data
// Test view.
- CPixelMetricsMapperView* iView;
+ CPixelMetricsMapperView* iView;
CEikDialog* iDialog;
TBool iFileOutputOn;
+ TBool iMode;
CFbsBitmap* icon;
CFbsBitmap* iconMask;
- TBool iAutoMode;
- TBool iMode;
-
};
diff --git a/util/s60pixelmetrics/pm_mapperview.cpp b/util/s60pixelmetrics/pm_mapperview.cpp
index 82b825d..04bc3e8 100644
--- a/util/s60pixelmetrics/pm_mapperview.cpp
+++ b/util/s60pixelmetrics/pm_mapperview.cpp
@@ -129,8 +129,6 @@ void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast
fileName.Append('_');
fileName.AppendNum(width);
- if (AknLayoutUtils::LayoutMirrored())
- fileName.Append(_L("_mirrored"));
fileName.Append(_L(".txt"));
TInt err=file.Open(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
@@ -263,11 +261,9 @@ void CPixelMetricsMapperViewContainer::HandleResourceChange(TInt aType)
mainPaneRect );
SetRect( mainPaneRect );
- CPixelMetricsMapperAppUi* myApp = static_cast<CPixelMetricsMapperAppUi*> (ControlEnv()->AppUi());
- if (myApp->ReadyForAutoOp())
- myApp->DoAutoOperationL();
}
- if (iListbox) iListbox->HandleResourceChange(aType);
+ if (iListbox)
+ iListbox->HandleResourceChange(aType);
}
@@ -329,6 +325,7 @@ void CPixelMetricsMapperView::HandleCommandL( TInt aCommand )
AppUi()->HandleCommandL( aCommand );
}
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -342,6 +339,7 @@ void CPixelMetricsMapperView::HandleStatusPaneSizeChange()
}
}
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -358,6 +356,7 @@ void CPixelMetricsMapperView::DoActivateL(
AppUi()->AddToViewStackL( *this, iView );
}
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -372,4 +371,5 @@ void CPixelMetricsMapperView::DoDeactivate()
iView = NULL;
}
+
// End of File
diff --git a/util/s60pixelmetrics/pm_mapperview.h b/util/s60pixelmetrics/pm_mapperview.h
index be40a15..36376cd 100644
--- a/util/s60pixelmetrics/pm_mapperview.h
+++ b/util/s60pixelmetrics/pm_mapperview.h
@@ -219,7 +219,7 @@ class CPixelMetricsMapperView : public CAknView
private: // Data
// The view container.
- CPixelMetricsMapperViewContainer* iView;
+ CPixelMetricsMapperViewContainer* iView;
};